GRADS - meteogram with spatial vertical section

All other topics about postprocessing model data (GrADS and other software), about other numerical weather prediction software (including WRF-NMM and WRF-ARW discussion unrelated to UEMS/WRF EMS), and general meteorology talk go in this forum.
meteoadriatic
Posts: 1510
Joined: Wed Aug 19, 2009 10:05 am

Re: GRADS - meteogram with spatial vertical section

Post by meteoadriatic » Sat Oct 01, 2016 7:13 am

Didn't did it well. See line 114 of your script? It starts with drawings... isn't it? :)

Post here your script I will try to edit it best I can.

And color.gs still is missing from grads scripts folder, are you sure you put it into folder where grads can find it??? Not in folder where you store your own scripts probably, but where grads locates them! That is probably somewhere inside grads installation path...

nebojsa
Posts: 133
Joined: Sun Mar 21, 2010 3:40 pm

Re: GRADS - meteogram with spatial vertical section

Post by nebojsa » Sat Oct 01, 2016 7:30 am

I put the scripts in /uems/util/grads/scripts but it still doesn't work.
Here's the code:

Code: Select all

dan = 28
mjesec = 09
godina = 2016
termin = 12
domena = 1
tip = arw
folder = wrf_meteogrami

'open /home/nebojsa/grads_hr/'godina''mjesec''dan''termin'00_'tip'_wrfout_d0'domena'.ctl'

'set t 24'

'set grads off'
'set font 1'
'set rgb 180 180 180 180'
'set grid horizontal 5 180'
'set display color white'
'clear'
'set zlog on'
lon1 = 15.5
lon2 = 16.5
lat1 = 46.5
lat2 = 45.5
lon = lon1

terrain_arr=''

'set parea 0.5 10 0.5 8.0'
'set lat 'lat1
'set lon 'lon1' 'lon2
'set lev 1000 700'
'd rhprs'

'collect 1 free'
'collect 2 free'
'collect 3 free'
'collect 4 free'
'set x 1'
'set y 1'

say 'collecting station data'

'q gxinfo'
xline=sublin(result,3)
yline=sublin(result,4)
xs=subwrd(xline,4)' 'subwrd(xline,6)
ys=subwrd(yline,4)' 'subwrd(yline,6)


while (lon <= lon2)
  'set lev 1000 700'
  lat = lat1 + (lat2-lat1)*(lon-lon1) / (lon2-lon1)
  'collect 1 gr2stn(rhprs,'lon','lat')'
  'collect 2 gr2stn((tmpprs-273),'lon','lat')'
  'collect 3 gr2stn(ugrdprs,'lon','lat')'
  'collect 4 gr2stn(vgrdprs,'lon','lat')'

  'set gxout print'
  'set lat 'lat
  'set lon 'lon
  'set lev 1000'
  'd pressfc/100'

   press=sublin(result,3);press=subwrd(press,1)
   'q w2xy 'lon' 'press
   x=subwrd(result,3)
   y=subwrd(result,6)

   if(x<=subwrd(xs,1));x=subwrd(xs,1);endif
   if(x>=subwrd(xs,2));x=subwrd(xs,2);endif
   if(y<=subwrd(ys,1));y=subwrd(ys,1);endif
   if(y>=subwrd(ys,2));y=subwrd(ys,2);endif

   terrain_arr=terrain_arr''x' 'y' '
   terrain_arry=terrain_arry''x' 'subwrd(ys,1)' 'x' 'y

  lon = lon + 0.0015
endwhile

say 'plotting data'

'clear'
'set grads off'
'set lev 1000 700'
'set lon 'lon1' 'lon2
'set clab on'
'set gxout shaded'
'color 70 100 0.5 -kind white->lightgreen->darkgreen->darkblue'
'd coll2gr(1,-u)'
'set gxout contour'
'set clevs 0' ; 'set ccols 2'
'set clab %.0f`3.`1C'
'd coll2gr(2,-u)'
'set gxout barb'
'set ccolor 1' ; 'set cthick 1' ; 'set digsiz 0.05'
'd skip((1.94*coll2gr(3)),10,1);(1.94*coll2gr(4))'

'xcbar 10.1 10.3 0.7 7.74 -fs 10'

say 'drawing terrain'

x1=subwrd(terrain_arr,1)
y1=subwrd(terrain_arr,2)
terrain_arr=terrain_arr''subwrd(xs,2)' 'subwrd(ys,1)' 'subwrd(xs,1)' 'subwrd(ys,1)' 'x1' 'y1

'set line 15 1 1'
'draw polyf 'terrain_arr

'draw title Cross section: lat1 S/lon1 W - lat2 S/lon2 W'

'query time'
res = subwrd(result,3) ; res1 = subwrd(result,6) ; fcsthr = substr(res,1,3) ; fcsttime = substr(res,4,13) ; fcstday = substr(res1,1,3)
drawings(domnumber,init,step,fcsthr,fcstday,fcsttime,dateday,datemonth,dateyear)

'printim /home/nebojsa/wrfout/wrf_meteogrami/aatmp.png'
Didn't change it very much. It is almost the same as your code.

meteoadriatic
Posts: 1510
Joined: Wed Aug 19, 2009 10:05 am

Re: GRADS - meteogram with spatial vertical section

Post by meteoadriatic » Sat Oct 01, 2016 8:26 am

First, delete second line from bottom:

Code: Select all

drawings(domnumber,init,step,fcsthr,fcstday,fcsttime,dateday,datemonth,dateyear)
Second, download also this one: https://github.com/kodamail/gscript/blo ... /color.gsf and put in same directory ( uems/util/grads/scripts ). Not sure if that is needed for color.gs to work.

Then try again.

nebojsa
Posts: 133
Joined: Sun Mar 21, 2010 3:40 pm

Re: GRADS - meteogram with spatial vertical section

Post by nebojsa » Sun Oct 02, 2016 3:20 pm

Hi meteoadriatic,

Just did as you said. Downloaded this colors.gsf, comented line with drawings, but still it doesn't work.

But, there's one more thing.
When I start the script it returns errors:

Code: Select all

ga-> run spatial_meteogram.gs 
collecting station data
Query Error: Syntax is QUERY W2XY Lon Lev
Query Error: Syntax is QUERY W2XY Lon Lev
Query Error: Syntax is QUERY W2XY Lon Lev
Query Error: Syntax is QUERY W2XY Lon Lev
.....
And finaly produces this:

Image

If I break it and start again it produces this:

Image

Still have this warning:

Code: Select all

Unknown command: color

meteoadriatic
Posts: 1510
Joined: Wed Aug 19, 2009 10:05 am

Re: GRADS - meteogram with spatial vertical section

Post by meteoadriatic » Sun Oct 02, 2016 5:58 pm

OK this looks like a progress :mrgreen:

OK go directly into grads prompt and just run color command. The response should start with

Code: Select all

 Name:
   color 0.07r1 - set color
 
 Usage:
   color [-gxout (contour|shaded|grfill)]
         [-kind kind]
         [-sample]
         [-div div]
         (-var variable | min max [int] | -levs lev1 lev2 ...)
         [-xcbar xcba-args]
         
         ..............
If it doesn't and instead you get Unknown command, then your script is in wrong place obviously, or your environment does not know where to search for it!

When you run env command (in shell, not in grads), you should have among others this:

Code: Select all

GASCRP=/home/ems/wrfems/util/grads/scripts
You can easy grep response for it:

Code: Select all

[ems@delta102 ~]$ env | grep GASCRP
GASCRP=/home/ems/wrfems/util/grads/scripts
That is directory where your system search for included grads scripts and where you should put color.gs. Now if you don't get response for GASCRP variable then it is not properly set, it is fixable easy but let's go step by step.

nebojsa
Posts: 133
Joined: Sun Mar 21, 2010 3:40 pm

Re: GRADS - meteogram with spatial vertical section

Post by nebojsa » Wed Oct 12, 2016 8:17 am

Hi!

I've just modified those colors and bars, so, here's the code:

Code: Select all

dan = 10
mjesec = 10
godina = 2016
termin = 12
domena = 1
tip = arw
run = hrvatska
folder = wrf_meteogrami

'open /home/nebojsa/gribovi/'godina''mjesec''dan''termin'00_'tip'_wrfout_d0'domena'.ctl'

*ostale boje
'set rgb 99 0 0 0'
*crna
'set rgb 98 255 255 255'
*bijela
'set rgb 90 0 153 0'
*zelena

*boje naoblake
*plavo vedro
'set rgb 20 0 153 255' 
*plavo svjetlije
'set rgb 21 153 204 255' 
*plavo jos svjetlije
'set rgb 22 180 240 255' 
* skoro skroz svjetlo
'set rgb 23 244 244 255' 
* blijedo narandjasto
'set rgb 24 255 255 153' 
* narandjasto
'set rgb 25 255 255 78' 
* tamno narandjasto
'set rgb 26 255 203 63' 
*jako tamno narandjasto
'set rgb 27 255 179 47' 
* skoro crveno
'set rgb 28 255 158 25' 
* crveno
'set rgb 29 255 129 25' 
* tamno crveno
'set rgb 30 255 93 18' 


*boje oborine i vjetra
*zuta
'set rgb 31 255 230 51'
*svjetlo plava
'set rgb 32 165 220 255'
*manje svjetlo plava
'set rgb 33 30 144 255'
*plava
'set rgb 34 60 55 255'
*plavo ljubicasta
'set rgb 35 110 35 255'
*ljubicasta
'set rgb 36 155 35 255'
*svjetlo ljubicasta
'set rgb 37 205 35 255'
*lila
'set rgb 38 255 35 190'
*tamno lila
'set rgb 39 255 35 130'
*crvena
'set rgb 40 255 35 85'
*tamnije crvena
'set rgb 41 245 0 60'
*tamno crvena
'set rgb 42 215 5 55'
*tamno tamno crvena
'set rgb 43 185 5 50'
*tamno tamno crvena
'set rgb 44 155 5 35'
*tamno tamno tamno crvena
'set rgb 45 120 0 25'
*tamno tamno tamno crvena
'set rgb 46 100 0 20'
*tamno plava za malo oborine
'set rgb 120 39 64 139'


*spektar
*ljubicasta
'set rgb 150 153 0 153'
*tamno ljubicasta
'set rgb 151 204 0 204'
*ljubicastoplava
'set rgb 152 76 0 153'
*plavoljubičasta
'set rgb 153 127 0 255'
*plava
'set rgb 154 0 0 153'
*svjetlije plava
'set rgb 155 0 0 204'
*još svjetlije plava
'set rgb 156 0 0 255'
*svjetlo plava
'set rgb 157 51 51 255'
*blijedo plava
'set rgb 158 102 102 255'
*ljubicasta
'set rgb 159 153 153 255'
*ljubicasta
'set rgb 160 204 204 255'
*ljubicasta
'set rgb 161 204 229 255'
*bijela
'set rgb 162 255 255 255'
*bijela
'set rgb 163 255 255 204'
*bijela
'set rgb 164 255 255 51'
*bijela
'set rgb 165 255 178 102'
*bijela
'set rgb 166 255 128 0'
*bijela
'set rgb 167 245 0 0'
*bijela
'set rgb 168 229 18 18'
*bijela
'set rgb 169 209 26 26'
*bijela
'set rgb 170 204 0 0'
*bijela
'set rgb 171 174 28 28'
*bijela
'set rgb 172 151 35 35'
*bijela
'set rgb 173 134 36 36'
*bijela
'set rgb 174 108 27 27'


*radarska refleksija
'set rgb 70 0 255 255'
'set rgb 71 135 206 250' 
'set rgb 72 95 158 160' 
'set rgb 73 0 0 205' 
'set rgb 74 34 139 34' 
'set rgb 75 50 205 50' 
'set rgb 76 127 255 0' 
'set rgb 77 255 255 0'
'set rgb 78 255 215 0'
'set rgb 79 255 0 0'
'set rgb 80 238 130 238' 
'set rgb 81 148 0 211'

'set t 48'

'set grads off'
'set font 1'
'set rgb 180 180 180 180'
'set grid horizontal 5 180'
'set display color white'
'clear'
'set zlog on'
lon1 = 15.5
lon2 = 16.5
lat1 = 46.5
lat2 = 45.5
lon = lon1

terrain_arr=''

'set parea 0.5 10 0.5 8.0'
'set lat 'lat1
'set lon 'lon1' 'lon2
'set lev 1000 700'
'd rhprs'

'collect 1 free'
'collect 2 free'
'collect 3 free'
'collect 4 free'
'set x 1'
'set y 1'

say 'collecting station data'

'q gxinfo'
xline=sublin(result,3)
yline=sublin(result,4)
xs=subwrd(xline,4)' 'subwrd(xline,6)
ys=subwrd(yline,4)' 'subwrd(yline,6)


while (lon <= lon2)
  'set lev 1000 700'
  lat = lat1 + (lat2-lat1)*(lon-lon1) / (lon2-lon1)
  'collect 1 gr2stn(rhprs,'lon','lat')'
  'collect 2 gr2stn((tmpprs-273),'lon','lat')'
  'collect 3 gr2stn(ugrdprs,'lon','lat')'
  'collect 4 gr2stn(vgrdprs,'lon','lat')'

  'set gxout print'
  'set lat 'lat
  'set lon 'lon
  'set lev 1000'
  'd pressfc/100'

   press=sublin(result,3);press=subwrd(press,1)
   'q w2xy 'lon' 'press
   x=subwrd(result,3)
   y=subwrd(result,6)

   if(x<=subwrd(xs,1));x=subwrd(xs,1);endif
   if(x>=subwrd(xs,2));x=subwrd(xs,2);endif
   if(y<=subwrd(ys,1));y=subwrd(ys,1);endif
   if(y>=subwrd(ys,2));y=subwrd(ys,2);endif

   terrain_arr=terrain_arr''x' 'y' '
   terrain_arry=terrain_arry''x' 'subwrd(ys,1)' 'x' 'y

  lon = lon + 0.0015
endwhile

say 'plotting data'

'clear'
'set grads off'
'set lev 1000 700'
'set lon 'lon1' 'lon2
'set clab on'
'set gxout shaded'
*'color 70 100 0.5 -kind white->lightgreen->darkgreen->darkblue'
'set clevs  0 70 73 76 79 81 84 87 90 93 96  101'
'set ccols 20 20 21 22 23 24 25 26 27 28 29  30'
'd coll2gr(1,-u)'
'set gxout contour'
'set ccols 90'
'set clevs  0 46 49 52 55 58 61 64 67 70 73 76 79 81 84 87 90 93 96  101'
'd coll2gr(1,-u)'
'set gxout contour'
'set clevs 0' ; 'set ccols 2'
'set clab %.0f`3.`1C'
'd coll2gr(2,-u)'
'set gxout barb'
'set ccolor 1' ; 'set cthick 1' ; 'set digsiz 0.05'
'd skip((1.94*coll2gr(3)),10,1);(1.94*coll2gr(4))'

*'xcbar 10.1 10.3 0.7 7.74 -fs 10'
'run cbarn.gs'

say 'drawing terrain'

x1=subwrd(terrain_arr,1)
y1=subwrd(terrain_arr,2)
terrain_arr=terrain_arr''subwrd(xs,2)' 'subwrd(ys,1)' 'subwrd(xs,1)' 'subwrd(ys,1)' 'x1' 'y1

'set line 15 1 1'
'draw polyf 'terrain_arr

'draw title Cross section: lat1 S/lon1 W - lat2 S/lon2 W'

'query time'
res = subwrd(result,3) ; res1 = subwrd(result,6) ; fcsthr = substr(res,1,3) ; fcsttime = substr(res,4,13) ; fcstday = substr(res1,1,3)
*drawings(domnumber,init,step,fcsthr,fcstday,fcsttime,dateday,datemonth,dateyear)

say 'spremam sliku'
'printim /home/nebojsa/wrfout/wrf_meteogrami/aspatial_'t'.png x900 y700'
and here's the result:

Image

nebojsa
Posts: 133
Joined: Sun Mar 21, 2010 3:40 pm

Re: GRADS - meteogram with spatial vertical section

Post by nebojsa » Wed Oct 12, 2016 2:33 pm

Hi meteoadriatic,

Is your script for arw or nmm wrf? I have problem with drawing terrain, mean, seems that the script takes wrong numbers for it.

meteoadriatic
Posts: 1510
Joined: Wed Aug 19, 2009 10:05 am

Re: GRADS - meteogram with spatial vertical section

Post by meteoadriatic » Wed Oct 12, 2016 3:34 pm

I never tried it on NMM, only ARW. Once, got that, and never again :)

nebojsa
Posts: 133
Joined: Sun Mar 21, 2010 3:40 pm

Re: GRADS - meteogram with spatial vertical section

Post by nebojsa » Thu Oct 13, 2016 10:19 am

Huh! Pitty! It looks great. Sadly, can't reproduce it on my data.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests