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

'reinit'
dir='/pesq/dados/bamc/paulo.bonatti/Modal_Energetics/Version_3.0/Horizontal_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'
if (md>0) ; 'set lat -60 30' ; endif
'set cthick 8'
if (md>=2) ; 'set black -1e-5 1e-5' ; endif
'display et'ca''cb''md'/1000'
pa=subwrd(result,2)
pb=subwrd(result,4)
dp=subwrd(result,6)
ct='Contours: 'pa' to 'pb' by 'dp' [kJ/kg]'
if (md=0)
  ha=9746.3
  hb=641.4
  za=00
  zb=04
endif
if (md=1)
  ha=434.5
  hb=125.1
  za=05
  zb=10
endif
if (md=2)
  ha=98.7
  hb=11.6
  za=11
  zc=18
endif
if (md=3)
  ha=9.53
  hb=1.23
  za=19
  zb=28
endif
if (md=4)
  ha=0.894
  hb=0.149
  za=29
  zb=36
endif
tr='Daily Mean 'dateg'  Case Study: 'casestudy'  RB0125L037'
'draw title `1'caso' Horizontal Energy Interaction 'ca'_'cb'_C'md'\`1C'md': H'za'='ha' to H'zb'='hb'\`1'tr
'draw xlab `1'ct

fig='../png/Energy_Interaction_Total_'ca'_'cb'_C'md'_'caso'_'casestudy'_'dateg'_HS_RB0125L037.png'
say ' '
say ' fig = 'fig
say ' '
'printim 'fig' png white'

return
