[gradsusr] GrADS convert longitude west to east

Tracey tdorian10 at gmail.com
Fri Jul 13 10:20:10 EDT 2018


Hi Colleen,

Taking out the quotations worked, thank you!

'set lat 'latmin' 'latmax
'set lon 'lonmin' 'lonmax
lonmine = 360 - (-lonmin)
lonmaxe = 360 - (-lonmax)
say lonmine
say lonmaxe

Greatly appreciate the help,
Tracey


On Fri, Jul 13, 2018 at 10:11 AM, Mikovitz, Colleen (LARC-E302)[Science
Systems & Applications, Inc.] <j.c.mikovitz at nasa.gov> wrote:

> Hi Tracey,
>
> That’s getting into the difference in a grads script variable and
> variables used on command line and such.  Anything you put in quotes would
> be something you could type into a Grads command line session.
>
> If you modify your script like:
>
> lonmine = 360 - lonmin
> lonmaxe = 360 - lonmax
> say lonmine
> say lonmaxe
>
> It should work.
>
> Colleen
>
> On Jul 12, 2018, at 1:08 PM, Tracey <tdorian10 at gmail.com> wrote:
>
> Hi Bill,
>
> Thanks for your response!  I'm still a little bit confused though.  I am
> passing into the script a grid, for example:
>
> grads -lc "script.gs 25 50 -130 -60"
>
> Where 25 and 50 are latmin and latmax, and -130 and -60 are lonmin and
> lonmax.  It is necesary in my GrADS script to use both degrees east and
> degrees west longitude.
>
> So in my GrADS script, is there a way to just do something like the
> following in the bold red color?
>
> function main(arg)
> latmin=subwrd(arg,1)
> latmax=subwrd(arg,2)
> lonmin=subwrd(arg,3)
> lonmax=subwrd(arg,4)
> ....
> 'set lat 'latmin' 'latmax
> 'set lon 'lonmin' 'lonmax
> *'define lonmine = 360 - 'lonmin*
> *'define lonmaxe = 360 - 'lonmax*
> *say lonmine*
> *say lonmaxe*
>
> The above in red doesn't seem to work and I'm not sure why.  Maybe I have
> quotations in the wrong places?
>
> Thanks,
> Tracey
>
> On Thu, Jul 12, 2018 at 7:39 AM, Bill Bua - NOAA Affiliate <
> bill.bua at noaa.gov> wrote:
>
>> Hi Tracey --
>>
>> There's a difference between a script variable and what I believe is
>> called an *intrinsic* variable, in GrADS. With script variables, you
>> would indeed use "define".  But for intrinsic variables (and this from my
>> experience needs to be in a script), I believe you'd have to pull the
>> values from a string of display-ed data.  That is:
>>
>> "d lon"
>> lonw = subwrd(result,<leftmost character position>, <rightmost character
>> position>)
>>
>> where leftmost and rightmost refer to the left and right position in the
>> line that includes the variable lonw.
>> If there are multiple lines in the display, you'll have to first choose
>> the line that contains the longitude. If it were the 2nd line, you'd have
>> the command
>>
>> lonline=sublin(result, 2)
>> then do subwrd(lonline, <leftmost>,<rightmost>) as above.
>>
>> Finally, you'd define your lone = 360 - lonw ("define lone = 360 -
>> lonw").
>>
>> I'm doing this from memory ... it's been awhile since I wrote a script.
>> I'll check it out once I'm where I can write a test script and see if this
>> works.
>>
>> Bill
>>
>>
>>
>> Dr. William R. (Bill) Bua
>> UCAR/COMET/NCEP/EMC
>> 5830 University Research Court #2784
>> College Park, MD 20740
>>
>>
>> On Wed, Jul 11, 2018 at 6:49 PM, Tracey <tdorian10 at gmail.com> wrote:
>>
>>> ​Hi Bill,
>>>
>>> Thanks, how would I use this arithmetic in the GrADS script with
>>> 'lonmax' and 'lonmin' arguments?  This is what I'm having trouble with.
>>>  Would I use "define"?
>>>
>>> Sincerely,
>>> Tracey
>>>
>>> On Wed, Jul 11, 2018 at 6:31 PM, Bill Reilly <bill_reilly at compuserve.com
>>> > wrote:
>>>
>>>> 360 - degW = degE
>>>>
>>>> --
>>>>
>>>> Bill Reilly
>>>>
>>>> (+34) 686-110-748
>>>> bill at passageweather.comwww.passageweather.com
>>>> bill at brwebworks.comwww.brwebworks.com
>>>>
>>>> On 12/07/2018 00:14, Tracey wrote:
>>>>
>>>> ​Hi GrADS users,
>>>>
>>>> Is there a GrADS function or script that converts degrees west
>>>> longitude into degrees east?  For example, if I input "lonmin" and "lonmax"
>>>> arguments into a GrADS script and I wanted to convert those longitudes from
>>>> degrees west to degrees east within the script by defining new "lonmin" and
>>>> "lonmax" variables?
>>>>
>>>> Thanks in advance for any help,
>>>> Tracey​
>>>>
>>>>
>>>> _______________________________________________
>>>> gradsusr mailing listgradsusr at gradsusr.orghttp://gradsusr.org/mailman/listinfo/gradsusr
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>
>> _______________________________________________
>> 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
>
>
>
> _______________________________________________
> 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/20180713/299313c5/attachment.html>


More information about the gradsusr mailing list