[gradsusr] Plot data text in a grid instead of random

Jeff Chabot jsc219 at gmail.com
Thu Dec 9 14:14:13 EST 2021


I figured out what is going wrong.  I haven't found a fix, but I do see the
problem and I think I am very close to fixing the issue.  GrADS is using
only the first variable I add into the ctl file; so if I use d landsfc
first, I see the expected 0 and 1s for both variables tmp2m and landsfc.
When I use tmp2m first, I get 250-300K values for both tmp2m and landsfc on
display. I am creating the ctl manually with this cutout of code:

Download the file with landsfc and tmp2m:
'set fwrite gfs_hd_temp.dat'
'set gxout fwrite'
'set x 1 '1440''
'set y 1 '721''
'set t 1 81''
'd landsfc'
'!sleep 60' (I get the same results with and without this line)
'd tmp2m'
'disable fwrite'
'clear'

*In the above example, when I display landsfc or tmp2m, all my values are
either 0 or 1.
*If I add 'd tmp2m' first, above in the write command, later when I display
landsfc and tmp2m both variables report values around 250-300K.

Write ctl file:
result = write (gfs_hd_temp.ctl, 'DSET gfs_hd_temp.dat')
result = write (gfs_hd_temp.ctl , 'UNDEF 9.999E+20', append)
result = write (gfs_hd_temp.ctl, 'GFS 0.25 deg', append)
result = write (gfs_hd_temp.ctl, 'XDEF 1440 linear 0.000000 0.25', append)
result = write (gfs_hd_temp.ctl, 'YDEF 721 linear -90.000000 0.25', append)
result = write (gfs_hd_temp.ctl, 'ZDEF 1 levels 1000', append)
result = write (gfs_hd_temp.ctl, 'TDEF 81 linear 12Z09DEC2021 3hr', append)
result = write (gfs_hd_temp.ctl, 'VARS 2', append)
result = write (gfs_hd_temp.ctl, 'landsfc 0 99  ** surface land cover
(0=sea, 1=land) [proportion]', append)
result = write (gfs_hd_temp.ctl, 'tmp2m 0 99  ** 2 m above ground
temperature [k]', append)
result = write (gfs_hd_temp.ctl, 'ENDVARS', append)
rc = close (gfs_hd_temp.ctl)

I think the code above looks good; the ctl file is probably fine. But, why
am I only able to see the first written variable and not both.

Thanks,

Jeff C



On Thu, Dec 9, 2021 at 11:56 AM Jeff Duda <jeffduda319 at gmail.com> wrote:

> How did you generate the control file? Manually? I suggest using g2ctl
> (freely available online). It should create all of that metadata for you.
>
> Jeff Duda
>
> On Wed, Dec 8, 2021 at 7:26 PM Jeff Chabot <jsc219 at gmail.com> wrote:
>
>> When I plot landseamask, all of my values are between 250-300 which I am
>> guessing is temperature in K.   So I think my ctl is at fault here:
>>
>> DSET gfs_hd_temp.dat
>> UNDEF 9.999E+20
>> TITLE GFS 0.25 deg
>> XDEF 1440 linear 0.000000 0.25
>> YDEF 721 linear -90.000000 0.25
>> ZDEF 1 levels 1000
>> TDEF 81 linear 12Z08DEC2021 3hr
>> VARS 2
>> tmp2m  0 99  ** 2 m above ground temperature [k]
>> landsfc  0 1 ** surface land cover (0=sea, 1=land) [proportion]
>> ENDVARS
>>
>>
>> I'm still new to ctl files so I am not sure what I should be using for
>> values after landsfc since in theory there is only one level.  0 99 maybe?
>>
>>
>>
>> On Wed, Dec 8, 2021 at 5:29 PM Jeff Duda <jeffduda319 at gmail.com> wrote:
>>
>>> Hmmm...nothing specific seems wrong with that command. Have you looked
>>> at the landsfc field to verify the contents? Perhaps the description is
>>> incorrect.
>>>
>>> Jeff Duda
>>>
>>> On Wed, Dec 8, 2021 at 3:04 PM Jeff Chabot <jsc219 at gmail.com> wrote:
>>>
>>>> The data that I am using is from NOMADS:
>>>> https://nomads.ncep.noaa.gov/dods/gfs_0p25/gfs20211208/gfs_0p25_12z.info
>>>>
>>>> Sure enough, it has this variable:
>>>>
>>>> *landsfc*
>>>> ** surface land cover (0=sea, 1=land) [proportion]
>>>> So, I am close.  I defined landseamask variable like so:
>>>>
>>>> 'define landseamask = landsfc'
>>>>
>>>> Then used it here:
>>>>
>>>> 'set gxout grid'
>>>> 'set gridln off'
>>>> 'set ccolor 254'
>>>> 'set digsiz 0.1'
>>>> 'display maskout(skip(t2m,12,12),landseamask-1)'
>>>>
>>>> I would think that would maskout any area that is negative (as sea is
>>>> 0).   But, it is not masking anything out.  I must be close here.
>>>>
>>>> Thanks again!
>>>>
>>>>
>>>> On Wed, Dec 8, 2021 at 7:26 AM Jeff Chabot <jsc219 at gmail.com> wrote:
>>>>
>>>>> I am using set mpdset hires.  That maskout line 'd
>>>>> maskout(t2m,landseamask)' looks like the best option, but is there any easy
>>>>> way to define landseamask?  I have been using basemap.gs because it
>>>>> was a prebuilt script to mask out the oceans.
>>>>>
>>>>> Jeff C
>>>>>
>>>>> On Tue, Dec 7, 2021 at 11:42 PM Jeff Duda <jeffduda319 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> I agree with setting up a mask using maskout or 'if' (depending on
>>>>>> grads version). The trick is how to define your land-sea mask. But once you
>>>>>> have decided what you want to use, it should be as simple as the display
>>>>>> command Davide suggested, i.e.,
>>>>>>
>>>>>> 'set gxout grid'
>>>>>> 'd maskout(t2m,landseamask)'
>>>>>>
>>>>>> I don't know what basemap.gs does, but the built-in geopolitical
>>>>>> boundaries look pretty good at that scale. You're using 'set mpdset hires'
>>>>>> right?
>>>>>>
>>>>>> Jeff Duda
>>>>>>
>>>>>> On Tue, Dec 7, 2021 at 8:51 PM Jeff Chabot <jsc219 at gmail.com> wrote:
>>>>>>
>>>>>>> Running basemap.gs before means I have grid plots over the entire
>>>>>>> ocean as seen here:
>>>>>>>
>>>>>>> https://jeffsweatherservice.com/grads/temp_US_2_before.png
>>>>>>>
>>>>>>> I prefer the look running basemap.gs after, I'm just trying to fix
>>>>>>> the cutoff plots by the oceans, for example near San Francisco and southern
>>>>>>> Louisiana as seen here:
>>>>>>>
>>>>>>> https://jeffsweatherservice.com/grads/temp_US_2_after.png
>>>>>>>
>>>>>>> Basically, I am trying to prevent the text cutoff without showing
>>>>>>> the entire grid over the ocean.  Maybe it's not possible in GrADS.
>>>>>>>
>>>>>>> As for the other issue, I'll just use set gxout contour without
>>>>>>> labels.
>>>>>>>
>>>>>>> Thanks again!  I was able to use your maskout example nicely with
>>>>>>> precip accum, btw!
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Dec 6, 2021 at 9:58 AM Davide Sacchetti <
>>>>>>> davide.sacchetti at arpal.liguria.it> wrote:
>>>>>>>
>>>>>>>> about second question: run basemap.gs before t2m (or display t2m
>>>>>>>> again after basemap)
>>>>>>>>
>>>>>>>> about first question use maskout, eg.:
>>>>>>>> d maskout(t2m,t2m-32) displays only t2m>32
>>>>>>>> d maskout(t2m,33-t2m) displays only t2m<33
>>>>>>>> you can combine both:
>>>>>>>> d maskout(maskout(t2m,33-t2m),t2m-32)
>>>>>>>> (I haven't tried this command ... but the idea could be this)
>>>>>>>>
>>>>>>>> Davide
>>>>>>>>
>>>>>>>> *Dott. Davide Sacchetti*
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> *Dipartimento Stato dell’Ambiente e Tutela dai Rischi NaturaliU.O.
>>>>>>>> Clima Meteo IdroViale Brigate Partigiane 2, 16129 Genova (I)tel: +39
>>>>>>>> 0106437535mail: davide.sacchetti at arpal.liguria.it
>>>>>>>> <mauro.damonte at arpal.liguria.it>
>>>>>>>> web: https://www.arpal.liguria.it/homepage/meteo.html
>>>>>>>> <http://www.meteoliguria.it/>*
>>>>>>>>
>>>>>>>>
>>>>>>>> * Da: * Jeff Chabot <jsc219 at gmail.com>
>>>>>>>> * A: * GrADS Users Forum <gradsusr at gradsusr.org>
>>>>>>>> * Inviato: * 06/12/2021 15:33
>>>>>>>> * Oggetto: * Re: [gradsusr] Plot data text in a grid instead of
>>>>>>>> random
>>>>>>>>
>>>>>>>> Duh!  That was a dumb question on my part, and I apologize.  I have
>>>>>>>> set ccolor working.  Two more better questions however.
>>>>>>>>
>>>>>>>> Is there any way to do a set gxout grid at just 32 degrees F?
>>>>>>>>
>>>>>>>> I tried the following with set gxout grid:
>>>>>>>> 'set gxout grid'
>>>>>>>> 'set gridln off'
>>>>>>>> 'set cint 1'
>>>>>>>> 'set cmin 32'
>>>>>>>> 'set cmax 32'
>>>>>>>> 'set ccolor 4'
>>>>>>>> 'set digsiz 0.1'
>>>>>>>> 'display skip(t2m,12,12)'
>>>>>>>>
>>>>>>>> *where t2m = ((tmp2m - 273.15) * 9 / 5) + 32
>>>>>>>>
>>>>>>>> The result is the full grid.
>>>>>>>>
>>>>>>>> My other question is probably much more complicated.  I am using
>>>>>>>> basemap.gs
>>>>>>>> <https://urlsand.esvalabs.com/?u=http%3A%2F%2Fbasemap.gs&e=7312d17f&h=398c37dd&f=y&p=n>
>>>>>>>> to mask out the oceans.  It is cropping the grid numbers by the oceans as
>>>>>>>> seen here: http://jeffsweatherservice.com/grads/temp_US_2.png
>>>>>>>> <https://urlsand.esvalabs.com/?u=http%3A%2F%2Fjeffsweatherservice.com%2Fgrads%2Ftemp_US_2.png&e=7312d17f&h=78ddcde1&f=y&p=n>
>>>>>>>> north of San Francisco and in southern Louisiana.  Is there a workaround
>>>>>>>> for that issue?
>>>>>>>>
>>>>>>>> 'run 'basemap.gs
>>>>>>>> <https://urlsand.esvalabs.com/?u=http%3A%2F%2Fbasemap.gs&e=7312d17f&h=398c37dd&f=y&p=n>
>>>>>>>> o 202 1 H' (run after the lines above).
>>>>>>>>
>>>>>>>> Thanks again!
>>>>>>>>
>>>>>>>> Jeff C
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Dec 6, 2021 at 4:50 AM Davide Sacchetti <
>>>>>>>> davide.sacchetti at arpal.liguria.it> wrote:
>>>>>>>>
>>>>>>>> great!
>>>>>>>> set ccolor color_number
>>>>>>>> bye bye
>>>>>>>> Davide
>>>>>>>>
>>>>>>>> *Dott. Davide Sacchetti*
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> *Dipartimento Stato dell’Ambiente e Tutela dai Rischi NaturaliU.O.
>>>>>>>> Clima Meteo IdroViale Brigate Partigiane 2, 16129 Genova (I)tel: +39
>>>>>>>> 0106437535mail: davide.sacchetti at arpal.liguria.it
>>>>>>>> <mauro.damonte at arpal.liguria.it>
>>>>>>>> web: https://www.arpal.liguria.it/homepage/meteo.html
>>>>>>>> <https://urlsand.esvalabs.com/?u=http%3A%2F%2Fwww.meteoliguria.it%2F&e=7312d17f&h=8b11d4a6&f=y&p=n>*
>>>>>>>>
>>>>>>>>
>>>>>>>> * Da: * Jeff Chabot <jsc219 at gmail.com>
>>>>>>>> * A: * GrADS Users Forum <gradsusr at gradsusr.org>
>>>>>>>> * Inviato: * 06/12/2021 6:52
>>>>>>>> * Oggetto: * Re: [gradsusr] Plot data text in a grid instead of
>>>>>>>> random
>>>>>>>>
>>>>>>>> The following worked very well:
>>>>>>>>
>>>>>>>> 'set gxout grid'
>>>>>>>> 'set gridln off'
>>>>>>>> 'display skip(t2m,10,10)'
>>>>>>>>
>>>>>>>> Thanks guys!
>>>>>>>>
>>>>>>>> Can you control the color of those numbers?  I can only get them in
>>>>>>>> white.
>>>>>>>>
>>>>>>>> Sincerely,
>>>>>>>>
>>>>>>>> Jeff C
>>>>>>>>
>>>>>>>> On Thu, Dec 2, 2021 at 12:23 PM Jeff Duda <jeffduda319 at gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> You can also use a loop with 'draw string' to achieve this.
>>>>>>>>
>>>>>>>> Jeff Duda
>>>>>>>>
>>>>>>>> On Thu, Dec 2, 2021 at 9:28 AM Stephen McMillan <
>>>>>>>> smcmillan at planalytics.com> wrote:
>>>>>>>>
>>>>>>>> In addition to Davide's suggestion, you can use:
>>>>>>>>
>>>>>>>> 'set gridln off' to hide the grid lines
>>>>>>>>
>>>>>>>> Use "skip" function to skip plotting every other, every third, etc.
>>>>>>>> grid value
>>>>>>>>
>>>>>>>> Stephen Mc
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, Dec 2, 2021 at 10:17 AM Jeff Chabot <jsc219 at gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi GrADS Users,
>>>>>>>>
>>>>>>>> Does anyone know if it is possible to plot data text in a grid
>>>>>>>> pattern instead of random plots in GrADS?
>>>>>>>>
>>>>>>>> For example, this is the grid pattern that I would like to use:
>>>>>>>>
>>>>>>>>
>>>>>>>> https://www.tropicaltidbits.com/analysis/models/gfs/2021120206/gfs_T2m_neus_1.png
>>>>>>>> <https://urlsand.esvalabs.com/?u=https%3A%2F%2Fwww.tropicaltidbits.com%2Fanalysis%2Fmodels%2Fgfs%2F2021120206%2Fgfs_T2m_neus_1.png&e=7312d17f&h=27bc95a0&f=y&p=n>
>>>>>>>>
>>>>>>>> Instead, I am currently showing numbers randomly attached to a
>>>>>>>> contour line:
>>>>>>>>
>>>>>>>> https://jeffsweatherservice.com/grads/hrrr/temp_NE_1.png
>>>>>>>> <https://urlsand.esvalabs.com/?u=https%3A%2F%2Fjeffsweatherservice.com%2Fgrads%2Fhrrr%2Ftemp_NE_1.png&e=7312d17f&h=f81a2820&f=y&p=n>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Jeff C
>>>>>>>> _______________________________________________
>>>>>>>> gradsusr mailing list
>>>>>>>> gradsusr at gradsusr.org
>>>>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>>>>> <https://urlsand.esvalabs.com/?u=http%3A%2F%2Fgradsusr.org%2Fmailman%2Flistinfo%2Fgradsusr&e=7312d17f&h=5ee7e1e3&f=y&p=n>
>>>>>>>>
>>>>>>>>
>>>>>>>> ***************************************************
>>>>>>>>
>>>>>>>> The information contained in this e-mail message
>>>>>>>>
>>>>>>>> is intended only for the use of the recipient(s)
>>>>>>>>
>>>>>>>> named above and may contain information that is
>>>>>>>>
>>>>>>>> privileged, confidential, and/or proprietary.
>>>>>>>>
>>>>>>>> If you are not the intended recipient, you may not
>>>>>>>>
>>>>>>>> review, copy or distribute this message. If you have
>>>>>>>>
>>>>>>>> received this communication in error, please notify
>>>>>>>>
>>>>>>>> the sender immediately by e-mail, and delete the original message.
>>>>>>>>
>>>>>>>> ***************************************************
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> gradsusr mailing list
>>>>>>>> gradsusr at gradsusr.org
>>>>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>>>>> <https://urlsand.esvalabs.com/?u=http%3A%2F%2Fgradsusr.org%2Fmailman%2Flistinfo%2Fgradsusr&e=7312d17f&h=5ee7e1e3&f=y&p=n>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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
>>>>>>>> <https://urlsand.esvalabs.com/?u=http%3A%2F%2Fgradsusr.org%2Fmailman%2Flistinfo%2Fgradsusr&e=7312d17f&h=5ee7e1e3&f=y&p=n>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> gradsusr mailing list
>>>>>>>> gradsusr at gradsusr.org
>>>>>>>>
>>>>>>>> https://urlsand.esvalabs.com/?u=http%3A%2F%2Fgradsusr.org%2Fmailman%2Flistinfo%2Fgradsusr&e=7312d17f&h=5ee7e1e3&f=y&p=n
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> gradsusr mailing list
>>>>>>>> gradsusr at gradsusr.org
>>>>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>>>>> <https://urlsand.esvalabs.com/?u=http%3A%2F%2Fgradsusr.org%2Fmailman%2Flistinfo%2Fgradsusr&e=7312d17f&h=5ee7e1e3&f=y&p=n>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> gradsusr mailing list
>>>>>>>> gradsusr at gradsusr.org
>>>>>>>>
>>>>>>>> https://urlsand.esvalabs.com/?u=http%3A%2F%2Fgradsusr.org%2Fmailman%2Flistinfo%2Fgradsusr&e=7312d17f&h=5ee7e1e3&f=y&p=n
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> gradsusr mailing list
>>>>>>>> gradsusr at gradsusr.org
>>>>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> gradsusr mailing list
>>>>>>> gradsusr at gradsusr.org
>>>>>>> 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
>>>>>>
>>>>> _______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org
>>>> 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
>>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> 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/20211209/a533430f/attachment-0001.html>


More information about the gradsusr mailing list