function plt(args)
ca=subwrd(args,1)
if (ca='') ; ca=0 ; endif
cb=subwrd(args,2)
if (cb='') ; cb=1 ; endif
atm=subwrd(args,3)
if (atm='') ; atm='ht' ; endif
caso=subwrd(args,4)
if (caso='') ; caso='ERA_5' ; endif
date=subwrd(args,5)
if (date='') ; date='2023021312' ; endif
casestudy='SaoSebastiao'

if (atm='ht') ; pfa=450 ; pfb=100 ; kfa=17 ; kfb=27 ; endif
if (atm='ct') ; pfa=700 ; pfb=300 ; kfa=12 ; kfb=20 ; endif
if (atm='bt') ; pfa=1000 ; pfb=550 ; kfa=1 ; kfb=15 ; endif

'reinit'
dir='/pesq/dados/bamc/paulo.bonatti/Modal_Energetics/Version_3.0/Vertical_Decomposition/dataout/'
filea='ENCL'caso''date''date'P.icn.RB0125L037.ctl'
'open 'dir''filea

'query time'
dg=subwrd(result,3)
dateg=substr(dg,4,9)

'set display color white'
'clear'

'set grads off'
'set mpdset brmap_mres'
'set map 1 1 3'
'set lev 200'
'set xlopts 1 8 0.15'
'set ylopts 1 8 0.15'
'set clopts 1 8 0.12'
'set lat -90 0'
'set cthick 8'
'define etca=sum(etc'ca''cb',z='kfa',z='kfb')/1000'
'display etca'
pa=subwrd(result,2)
pb=subwrd(result,4)
dp=subwrd(result,6)
ct='Contours: 'pa' to 'pb' by 'dp' [kJ/kg]'
if (ca=0 & cb=1)
  ha=9746.3
  hb=641.4
  za=00
  zb=04
  hc=434.5
  hd=125.1
  zc=05
  zd=10
endif
if (ca=1 & cb=2)
  ha=434.5
  hb=125.1
  za=05
  zb=10
  hc=98.7
  hd=11.6
  zc=11
  zd=18
endif
tr='Daily Mean 'dateg'  Case Study: 'casestudy'  RB0125L037'
'draw title `1'caso' Vertical Energy Interaction C'ca'_C'cb' - Levels: 'pfa'-'pfb' hPa  \`1C'ca': H'za'='ha' to H'zb'='hb' - C'cb': H'zc'='hc' to H'zd'='hd'\`1'tr
'draw xlab `1'ct

fig='../png/Energy_Interaction_Total_C'ca'_C'cb'_'pfa'_'pfb'_hPa_'caso'_'casestudy'_'dateg'_HS_RB0125L037.png'
say ' '
say ' fig = 'fig
say ' '
'printim 'fig' png white'

return
