[gradsusr] (no subject)

James Potemra jimp at hawaii.edu
Mon May 10 14:22:04 EDT 2021


Evgeny,

Again you are changing your script in between questions.  Please just 
fix one thing at a time.  You have repeated the confusion of the 
variable "t" in this line:

'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))'

I presume by "t" you mean "temperature" and not "time".  This won't work 
since "t" at this point is not defined.

Second, you need to put all the code within the while loop.  For 
example, you have "printim" presumably to make images for each 
time-step, but since this is outside the while loop, you'll only get one.

Finally, there does not seem to be "rhprs" in this data set, or at least 
it's not being read reliably via OPeNDAP.

Comment out the lines defining rh and dewp850mb, move all the stuff 
below "endwhile" into the "while" loop, and it works, at least for me.

Jim

On 5/10/21 7:49 AM, Evgeny Gavrilov wrote:
> but why? can you explain the reasons?
>
> 'reinit'
>
> 'sdfopen 
> https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210510/gfs_0p25_12z 
> <https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20210510/gfs_0p25_12z>'
>
> 'set lon 30 50'
> 'set lat 40 50'
> 'set t 1 80'
>
> '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 te=(te850mb*pow((1000/850),(287/1004)))-273.15'
>
> maps = 20
> 'set display color white'
> i = 1
> while ( i<maps )
>   'set t ' i
>   'set gxout shaded'
>   'd te - te(t='i-1')'
>   'cbarn'
>   'clear'
>   i=i+1
> endwhile
>
> 'q dims'
> times = sublin(result,5)
> mse = subwrd(times,6)
>
> 'set strsiz 0.17'
> 'set string 1 r 6 0' ; 'draw string 4.85 7.98 GFS forecast: 'mse
> 'set string 1 r 6 0' ; 'draw string 10.1 7.98 Run: 'met
>
> 'printim C:\Users\123\for\te_'i'.png x800 y650'
>
> 'clear'
>
> return
>
> On Mon, May 10, 2021 at 8:14 PM Jeff Duda <jeffduda319 at gmail.com 
> <mailto:jeffduda319 at gmail.com>> wrote:
>
>     Do you see it? That very first error message points to the fact
>     that your data file either was not opened successfully or  you are
>     not able to access the data within it.
>
>     First thing you should do is confirm you can plot basic fields
>     from the data file.
>
>     Jeff
>
>     On Mon, May 10, 2021 at 10:05 AM Evgeny Gavrilov
>     <eugen420 at gmail.com <mailto:eugen420 at gmail.com>> wrote:
>
>         778.png
>
>         On Mon, May 10, 2021 at 6:31 PM Jeff Duda
>         <jeffduda319 at gmail.com <mailto:jeffduda319 at gmail.com>> wrote:
>
>             at least one of your variables or function calls above is
>             wrong based on the error messages. However, because GrADS
>             throws out more messages than the window you showed can
>             contain, I can't see the first error message, which is
>             likely the most important one. Show us that message.
>
>             Jeff Duda
>
>             On Mon, May 10, 2021 at 3:13 AM Evgeny Gavrilov
>             <eugen420 at gmail.com <mailto:eugen420 at gmail.com>> wrote:
>
>                   the map is not drawn again
>
>                 https://www.youtube.com/watch?v=s8JG6BUVh8c
>                 <https://www.youtube.com/watch?v=s8JG6BUVh8c>
>
>
>                 On Mon, May 10, 2021 at 4:57 AM James Potemra
>                 <jimp at hawaii.edu <mailto:jimp at hawaii.edu>> wrote:
>
>                     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
>                     <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  <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>
>
>
>
>     -- 
>     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/20210510/d6c58bdb/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 778.png
Type: image/png
Size: 27757 bytes
Desc: not available
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20210510/d6c58bdb/attachment-0001.png>


More information about the gradsusr mailing list