Kamodo Logo

Kamodo Python script for selected plot options of
  DTM Run Lars_Sprengelmeyer_041824_IT_9


#Python file for hash=ccfecdf29e7ea25eee32812d51706be7
file_dir='/PATH_TO_DATA/DTM/Lars_Sprengelmeyer_041824_IT_9/'
out_file='/PATH_TO_OUTPUT/plot'

# Load Python packages
from datetime import datetime
import pytz
from kamodo_ccmc.tools.plotfunctions import figMods
import kamodo_ccmc.flythrough.model_wrapper as MW

# Set values to build later pieces of this script
model='DTM'
Krun='Lars_Sprengelmeyer_041824_IT_9'
Kvar='T_exo'
Kvarunits='K'
Kvarijk=Kvar+'_ijk'
Kshore=True
Klog=False
Kcolorbar='Viridis'
Ksymcb=False
Kcmin=''
Kcmax=''

# Build plot title and set dimension slice values
Ktitle = ''
Ktime='1439.75'
tsPlot = 1672531200+(float(Ktime)*3600.)
Ktitle = Ktitle+'Time = 2023/03/01 23:45:00 UT'

# Load the requested variable data into a Kamodo object
variables_requested = [Kvar]
reader = MW.Model_Reader(model)
ko = reader(file_dir, variables_requested=variables_requested)

# Create figure object in Kamodo
fig=ko.plot(Kvarijk, plot_partial={Kvarijk: {'time': 1439.75, }})
plotCoord = 'GDZ'

# For contour plot, modify the figure
fig=figMods(fig,
    ncont=200, colorscale=Kcolorbar, enhanceHover=True, log10=Klog,
    newTitle=Ktitle, cText=Kvar+' ['+Kvarunits+']',
    coText=plotCoord+" Coordinates", 
    llText="CCMC Run: "+Krun, llText2="Model: "+model, xtic=90., ytic=45., )

# Add shorelines
from kamodo_ccmc.tools.shoreline import shoreline
tsPlotint = int(tsPlot)
if plotCoord == 'GDZ':
    # GDZ is really GEO-sph
    pos = shoreline(coord='GEO', coordT='sph', utcts=tsPlotint)
else:
    pos = shoreline(coord=plotCoord, coordT='sph', utcts=tsPlotint)
fig.add_scattergl(mode='lines', x=pos[:, 0], y=pos[:, 1],
    hoverinfo='skip', showlegend=False, line=dict(width=1, color='#EEEEEE'))

# Save interactive figure to html file
fig.write_html(out_file+'.html', full_html=False, include_mathjax='cdn')
print('SUCCESS, script exiting.')