This notebook tracks development of a wrapper for the kameleon software suite to support legacy ccmc models until python 3 model readers become available.

This notebook should be executed from a python3 environment with kamodo installed.

!python --version
Python 3.7.3
from kamodo.readers._kameleon_kamodo import Kameleon
# may need to specify the full path to cdf, else file doesn't load correctly
fname = '/Users/apembrok/Work/Kameleon_Sample_Data/LFM/Nov2015.LFM.S1-OF_mhd_2002-09-30T03-16-00Z.cdf'

# python_path should point to a python2 executeable with kameleon installed
python_path = '/Users/apembrok/miniconda2/envs/klive/bin/python'
kameleon = Kameleon(fname, python_path, 'rho', 'p', 'bx','by','bz')
/Users/apembrok/Work/Kameleon_Sample_Data/LFM/Nov2015.LFM.S1-OF_mhd_2002-09-30T03-16-00Z.cdf opened

from kamodo import gridify
import numpy as np
points = np.arange(12*3).reshape((-1,3))
array([ 1.75048208e+00,  4.82881117e+00,  5.63864784e+01,  1.87258148e+01,
        1.88226109e+01,  1.85908566e+01,  1.87104950e+01,  1.86995926e+01,
        1.86710930e+01,  1.86786823e+01, -1.09951163e+12, -1.09951163e+12])
kameleon.bx([[-30, 0, 0], [-20, 0, 0]])
[-14.527422904968262, -11.133100509643555]

kameleon['bz_ijk'] = gridify(kameleon.bz, 
                             x = np.linspace(-25, -10, 30),
                             y = np.linspace(-10, 10, 40), z = 0)

fig = kameleon.plot('bz_ijk')
fig.layout.scene.aspectmode = 'data'
import plotly.io as pio

pio.write_image(fig, 'images/kameleon_sample_out.svg')