[gradsusr] (no subject)

James Potemra jimp at hawaii.edu
Sun May 9 20:57:44 EDT 2021


Evgeny,

You have a lot of curiosities in your script.  First, it's never a good 
to mix GrADS variables (e.g., "t") with your own:

'set t 1 20'
'define t=tmpprs(lev=850)'

instead of 'define t=' maybe make this 'define temp=' or something like 
that.  Second, you have

'define a = thetae'

but thetae is not defined anywhere.  Third, no need set time range every 
time you define the variables; set it once.  Finally, as Jeff suggested 
a while back, you'll need to add quotes to get the time index as a number:

'd a - a(t-1)' --> 'd a - a(t='i-1')

---------------------------

* set URL for data
'sdfopen 
https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210509/gfs_0p25_12z'

* define lat/lon/time ranges
'set lon 30 50'
'set lat 40 50'
'set t 1 81'

* define variables
'define temp=tmpprs(lev=850)'
'define rh=rhprs(lev=850)'
'define 
dewp850mb=(t-273.15)-((14.55+0.114*(t-273.15))*(1-0.01*rh)+pow((2.5+0.007*(t-273.15))*(1-0.01*rh),3)+(15.9+0.117*(t-273.15))*pow((1-0.01*rh),14))'
'define vapr850mb=6.112*exp((17.67*dewp850mb)/(dewp850mb+243.5))'
'define e850mb=vapr850mb*1.001+(850-100)/900*0.0034'
'define w850mb=0.62197*(e850mb/(850-e850mb))'
'define te850mb=(t+(2260000*w850mb/1004))'
'define epa=(te850mb*pow((1000/850),(287/1004)))-273.16'

* draw maps
maps = 20
'set display color white'
i = 1
while ( i<maps )
   'set t ' i
   'set gxout shaded'
* I have not idea what you want to do, but this will display the 
difference between the current timestep and the one prior
   'd temp - temp(t='i-1')'
   'cbarn'
   'clear'
   i=i+1
endwhile

-------------------------


On 5/9/21 9:02 AM, Evgeny Gavrilov wrote:
> All the same. The maps are not drawn
>
> You can run my script:
>
> 'reinit'
>
> 'sdfopen 
> https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210509/gfs_0p25_12z 
> <https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210509/gfs_0p25_12z>'
>
> 'set lon 30 50'
> 'set lat 40 50'
>
> 'set display color white'
>
> maps = 20
>   i = 1
>   while ( i<maps )
> 'set t ' i
>
> 'set t 1 20'
> 'define t=tmpprs(lev=850)'
> 'set t 1 20'
> 'define rh=rhprs(lev=850)'
> 'set t 1 20'
> 'define 
> dewp850mb=(t-273.15)-((14.55+0.114*(t-273.15))*(1-0.01*rh)+pow((2.5+0.007*(t-273.15))*(1-0.01*rh),3)+(15.9+0.117*(t-273.15))*pow((1-0.01*rh),14))'
> 'set t 1 20'
> 'define vapr850mb=6.112*exp((17.67*dewp850mb)/(dewp850mb+243.5))'
> 'set t 1 20'
> 'define e850mb=vapr850mb*1.001+(850-100)/900*0.0034'
> 'set t 1 20'
> 'define w850mb=0.62197*(e850mb/(850-e850mb))'
> 'set t 1 20'
> 'define te850mb=(t+(2260000*w850mb/1004))'
> 'set t 1 20'
> 'define epa=(te850mb*pow((1000/850),(287/1004)))-273.16'
>
> 'set gxout shaded'
> 'define a = thetae'
> 'd a - a(t-1)'
> 'cbarm'
>
> 'printim C:\Users\123\for\temp_'i'.png x800 y600'
>
> 'clear'
>
> i=i+1
> endwhile
>
> return
>
> On Sun, May 9, 2021 at 8:54 PM Jeff Duda <jeffduda319 at gmail.com 
> <mailto:jeffduda319 at gmail.com>> wrote:
>
>     Oh, yeah...I missed that. Good catch, James!
>
>     But the display command I suggested to him (d a - a(t-1))
>     certainly is valid for plotting the 1-time-step change in thetae,
>     which I presume is what he wanted originally. It depends on the
>     final graphic type he is trying to produce.
>
>     On Sun, May 9, 2021 at 10:41 AM James Potemra <jimp at hawaii.edu
>     <mailto:jimp at hawaii.edu>> wrote:
>
>         You are not defining the time correctly.  In this new script
>         you define "thetae", and this is still only defined for a
>         single time-step.  You need to put the "set t 1 81" before any
>         variable you want to be a function of time.  Also, your
>         statement "d a-a(t-1)" doesn't make sense since "a" (if
>         defined properly) will be a function of time/lat/lon.  If you
>         want to plot 81 contour plots, each one as a different between
>         current time and time before, you'll have to script that like
>         you did in your first example.
>
>         Jim
>
>         On 5/8/21 12:52 PM, Evgeny Gavrilov wrote:
>>         this command: 'set t 1 81' before 'define' does not solve
>>         this problem
>>
>>         On Sun, May 9, 2021 at 1:11 AM Jeff Duda
>>         <jeffduda319 at gmail.com <mailto:jeffduda319 at gmail.com>> wrote:
>>
>>             What do you mean by "doesn't help"? We need specifics to
>>             be able to fully help you.
>>
>>             Jeff Duda
>>
>>             On Sat, May 8, 2021 at 1:53 PM Evgeny Gavrilov
>>             <eugen420 at gmail.com <mailto:eugen420 at gmail.com>> wrote:
>>
>>                   still doesn't help 'set t 1 81'
>>
>>                 'reinit'
>>
>>                 'sdfopen
>>                 https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210508/gfs_0p25_12z
>>                 <https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210508/gfs_0p25_12z>'
>>
>>                 'set mpdset hires'
>>                 'set lon 10 30'
>>                 'set lat 40 50'
>>
>>                 'set display color white'
>>
>>                 'set gxout shaded'
>>                 'define tc = tmpprs(lev=850)'
>>                 'define rh = rhprs(lev=850)'
>>                 'define dewp850mb =
>>                 (tc-273.15)-((14.55+0.114*(tc-273.15))*(1-0.01*rh)+pow((2.5+0.007*(tc-273.15))*(1-0.01*rh),3)+(15.9+0.117*(tc-273.15))*pow((1-0.01*rh),14))'
>>                 'define vapr850mb =
>>                 6.112*exp((17.67*dewp850mb)/(dewp850mb+243.5))'
>>                 'define e850mb = vapr850mb*1.001+(850-100)/900*0.0034'
>>                 'define w850mb = 0.62197*(e850mb/(850-e850mb))'
>>                 'define te850mb = (tc+(2260000*w850mb/1004))'
>>                 'define thetae =
>>                 (te850mb*pow((1000/850),(287/1004)))-273.16'
>>
>>                 'set t 1 81'
>>                 'define a = thetae'
>>                 'd a-a(t-1)'
>>                 'cbarm'
>>
>>                 'printim C:\Users\for\temp.png x800 y600'
>>
>>                 'clear'
>>
>>                 return
>>
>>                 On Sat, May 8, 2021 at 11:15 PM Evgeny Gavrilov
>>                 <eugen420 at gmail.com <mailto:eugen420 at gmail.com>> wrote:
>>
>>                     still doesn't help 'set t 1 81'
>>
>>                     'reinit'
>>
>>                     'sdfopen
>>                     https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210508/gfs_0p25_12z
>>                     <https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210508/gfs_0p25_12z>'
>>
>>                     'set mpdset hires'
>>                     'set lon 10 30'
>>                     'set lat 40 50'
>>
>>                     'set display color white'
>>
>>                     'set gxout shaded'
>>                     'define tc = tmpprs(lev=850)'
>>                     'define rh = rhprs(lev=850)'
>>                     'define dewp850mb =
>>                     (tc-273.15)-((14.55+0.114*(tc-273.15))*(1-0.01*rh)+pow((2.5+0.007*(tc-273.15))*(1-0.01*rh),3)+(15.9+0.117*(tc-273.15))*pow((1-0.01*rh),14))'
>>                     'define vapr850mb =
>>                     6.112*exp((17.67*dewp850mb)/(dewp850mb+243.5))'
>>                     'define e850mb =
>>                     vapr850mb*1.001+(850-100)/900*0.0034'
>>                     'define w850mb = 0.62197*(e850mb/(850-e850mb))'
>>                     'define te850mb = (tc+(2260000*w850mb/1004))'
>>                     'define thetae =
>>                     (te850mb*pow((1000/850),(287/1004)))-273.16'
>>
>>                     'set t 1 81'
>>                     'define a = thetae'
>>                     'd a-a(t-1)'
>>                     'cbarm'
>>
>>                     'printim C:\Users\for\temp.png x800 y600'
>>
>>                     'clear'
>>
>>                     return
>>
>>                     On Sat, May 8, 2021 at 10:54 PM James T. Potemra
>>                     <jimp at hawaii.edu <mailto:jimp at hawaii.edu>> wrote:
>>
>>                         You will have to set the time range before
>>                         defining variable 'a', otherwise it will only
>>                         be defined for a single time step. Try add
>>                         'set t 1 81' before defining 'a'.
>>
>>                         Jim
>>
>>                         On 5/8/21 8:42 AM, Evgeny Gavrilov wrote:
>>>                         "i" from while.
>>>
>>>                         maps = 20
>>>                           i = 1
>>>                           while ( i<maps )
>>>                         'set t ' i
>>>
>>>                         2) a-a(t=1) also has a report about constant
>>>                         field (value=0)
>>>
>>>                         'reinit'
>>>
>>>                         'sdfopen
>>>                         https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210508/gfs_0p25_12z
>>>                         <https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210508/gfs_0p25_12z>'
>>>
>>>                         'set mpdset hires'
>>>                         'set lon 10 30'
>>>                         'set lat 40 50'
>>>
>>>                         'set display color white'
>>>
>>>                         'set gxout shaded'
>>>                         'define a = tmp2m'
>>>                         'd a-a(t-1)'
>>>                         'cbarm'
>>>
>>>                         'printim C:\Users\for\temp.png x800 y600'
>>>
>>>                         'clear'
>>>
>>>                         return
>>>
>>>                         On Sat, May 8, 2021 at 10:11 PM Jeff Duda
>>>                         <jeffduda319 at gmail.com
>>>                         <mailto:jeffduda319 at gmail.com>> wrote:
>>>
>>>                             1a) How is 'i' set?
>>>                             1b) I don't think the grads scripting
>>>                             language supports math in a command line
>>>                             command like that. You'd have to do
>>>                             something like
>>>                             i = 1
>>>                             i2 = i-1
>>>                             'd a(t='i') - a(t='i2')'
>>>
>>>                             2) This command is equivalent and does
>>>                             not require a script variable (provided
>>>                             your dimension environment is set
>>>                             appropriately): 'd a - a(t-1)'
>>>
>>>                             Jeff Duda
>>>
>>>                             On Sat, May 8, 2021 at 12:01 PM Evgeny
>>>                             Gavrilov <eugen420 at gmail.com
>>>                             <mailto:eugen420 at gmail.com>> wrote:
>>>
>>>                                 why this method does not working?
>>>
>>>                                 'set gxout shaded'
>>>                                 'define a=tmp2m'
>>>                                 'd a(t='i') - a(t='i-1')'
>>>
>>>                                 report: constant field. value = 0
>>>                                 _______________________________________________
>>>                                 gradsusr mailing list
>>>                                 gradsusr at gradsusr.org
>>>                                 <mailto:gradsusr at gradsusr.org>
>>>                                 http://gradsusr.org/mailman/listinfo/gradsusr
>>>                                 <http://gradsusr.org/mailman/listinfo/gradsusr>
>>>
>>>
>>>
>>>                             -- 
>>>                             Jeff Duda, Research Scientist
>>>                             University of Colorado Boulder
>>>                             Cooperative Institute for Research in
>>>                             Environmental Sciences
>>>                             NOAA/OAR/ESRL/Global Systems Laboratory
>>>                             Boulder, CO
>>>                             _______________________________________________
>>>                             gradsusr mailing list
>>>                             gradsusr at gradsusr.org
>>>                             <mailto:gradsusr at gradsusr.org>
>>>                             http://gradsusr.org/mailman/listinfo/gradsusr
>>>                             <http://gradsusr.org/mailman/listinfo/gradsusr>
>>>
>>>
>>>                         _______________________________________________
>>>                         gradsusr mailing list
>>>                         gradsusr at gradsusr.org  <mailto:gradsusr at gradsusr.org>
>>>                         http://gradsusr.org/mailman/listinfo/gradsusr  <http://gradsusr.org/mailman/listinfo/gradsusr>
>>
>>                 _______________________________________________
>>                 gradsusr mailing list
>>                 gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>>                 http://gradsusr.org/mailman/listinfo/gradsusr
>>                 <http://gradsusr.org/mailman/listinfo/gradsusr>
>>
>>
>>
>>             -- 
>>             Jeff Duda, Research Scientist
>>             University of Colorado Boulder
>>             Cooperative Institute for Research in Environmental Sciences
>>             NOAA/OAR/ESRL/Global Systems Laboratory
>>             Boulder, CO
>>             _______________________________________________
>>             gradsusr mailing list
>>             gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>>             http://gradsusr.org/mailman/listinfo/gradsusr
>>             <http://gradsusr.org/mailman/listinfo/gradsusr>
>>
>>
>>         _______________________________________________
>>         gradsusr mailing list
>>         gradsusr at gradsusr.org  <mailto:gradsusr at gradsusr.org>
>>         http://gradsusr.org/mailman/listinfo/gradsusr  <http://gradsusr.org/mailman/listinfo/gradsusr>
>         _______________________________________________
>         gradsusr mailing list
>         gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>         http://gradsusr.org/mailman/listinfo/gradsusr
>         <http://gradsusr.org/mailman/listinfo/gradsusr>
>
>
>
>     -- 
>     Jeff Duda, Research Scientist
>     University of Colorado Boulder
>     Cooperative Institute for Research in Environmental Sciences
>     NOAA/OAR/ESRL/Global Systems Laboratory
>     Boulder, CO
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20210509/0e55b32c/attachment-0001.html>


More information about the gradsusr mailing list