[gradsusr] xy2gr bug?
Ryglicki, Dr. David
david.ryglicki at nrlmry.navy.mil
Wed Jul 5 14:22:35 EDT 2017
And I completely spaced on #2.
Here are the commands, with another script called in the middle that issues “set mproj off.” Here’s the code snippet:
'reinit'
rc=gsfallow('on')
ctl = 'cotc.Patricia.grid_1.ctl'
'open 'ctl
'set lon 2500 5500'
'set lat -2000 1000'
'q file'
rec = sublin(result,5)
nx = subwrd(rec,3)
ny = subwrd(rec,6)
nz = subwrd(rec,9)
nt = subwrd(rec,12)
ne = subwrd(rec,15)
fname = 'Patricia.grid_1.loc.txt'
tt = 1
while (tt <= nt)
'set t 'tt
'square 0.5'
'set xlint 500'
'set ylint 500'
'set z 1'
'd absvor'
say 'Click on the center of the TC'
'q pos'
say result
rec = sublin(result,1)
xpos = subwrd(rec,3) ; ypos = subwrd(rec,4)
'q xy2gr 'xpos' 'ypos
rec = sublin(result,1)
xdim.tt = subwrd(rec,3) ; ydim.tt = subwrd(rec,6)
xdim.tt = math_nint(xdim.tt)
ydim.tt = math_nint(ydim.tt)
'q xy2w 'xpos' 'ypos
rec = sublin(result,1)
xlon.tt = subwrd(rec,3) ; ylon.tt = subwrd(rec,6)
...<snip>...
…and square.gs:
function square(arg)
*
* set parea into square.
*
mgn = ''
mgn = subwrd(arg,1)
if (mgn = '')
mgn = 1.0
endif
if (mgn >= 4.25)
say 'Margin too large.'
return
endif
'q gxinfo'
rec = sublin(result,2)
psx = subwrd(rec,4)
psy = subwrd(rec,6)
'set mproj off'
if (psx > psy)
* Landscape
'set parea '1.25+mgn' '9.75-mgn' 'mgn' '8.5-mgn
else
* Portrait
'set parea 'mgn' '8.5-mgn' '1.25+mgn' '9.75-mgn
endif
return
~Dave
From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Ryglicki, Dr. David
Sent: Wednesday, July 5, 2017 10:32 AM
To: GrADS Users Forum
Subject: Re: [gradsusr] xy2gr bug?
Hi, Jennifer.
I've attached the control file. The XDEF and YDEF entries specifically are:
xdef 361 linear -6480.0 36.0
ydef 191 linear -3420.0 36.0
As an extra data point, I can replicate this in both the newest version of GrADS (2.1.1.b0) and OpenGrADS 2.1.0.oga.1. WordPad added the extra .txt extension. It’s a ctl file on the Linux side.
~Dave
-----Original Message-----
From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Jennifer M Adams
Sent: Wednesday, July 5, 2017 8:43 AM
To: GrADS Users Forum
Subject: Re: [gradsusr] xy2gr bug?
Hi, Dave —
1. What are the XDEF and YDEF entries in your descriptor file?
2. What were the commands you issued (including the dimension environment) when you drew a plot before issuing the ‘q xy2gr’ command? Did you set mprog off?
—Jennifer
> On Jun 19, 2017, at 12:35 PM, Ryglicki, Dr. David < <mailto:david.ryglicki at nrlmry.navy.mil> david.ryglicki at nrlmry.navy.mil> wrote:
>
> Hey, GrADS list.
>
> I’m getting an error with xy2gr – it’s duplicating the results of xy2w but only under specific circumstances. I’m using a Cartesian domain that’s not georeferenced (km from the origin as opposed to lat/lon on the planet). The two functions give similar results up to a point. To wit:
>
> Position = 5.15564 2.55131 1 0
>
> ga-> q xy2gr 5.15564 2.55131
> Xdim = 288.285 Ydim = -1179.48
>
> ga-> q xy2w 5.15564 2.55131
> Lon = 3862.26 Lat = -1179.48
>
> ga-> q xy2gr 5.15564 1.55131
> Xdim = 288.285 Ydim = -1579.48
>
> ga-> q xy2gr 5.15564 3.55131
> Xdim = 288.285 Ydim = 74.3479
>
> ga-> q xy2gr 5.15564 2.55131
> Xdim = 288.285 Ydim = -1179.48
>
> ga-> q xy2gr 5.15564 2.65131
> Xdim = 288.285 Ydim = -1139.48
>
> ga-> q xy2gr 5.15564 2.75131
> Xdim = 288.285 Ydim = -1099.48
>
> ga-> q xy2gr 5.15564 2.85131
> Xdim = 288.285 Ydim = -1059.48
>
> ga-> q xy2gr 5.15564 2.95131
> Xdim = 288.285 Ydim = -1019.48
>
> ga-> q xy2gr 5.15564 3.05131
> Xdim = 288.285 Ydim = 68.7923
>
> ga-> q xy2gr 5.15564 3
> Xdim = 288.285 Ydim = -1000
>
> ga-> q xy2gr 5.15564 3.01
> Xdim = 288.285 Ydim = 68.3333
>
> ga-> q xy2w 5.15564 3.01
> Lon = 3862.26 Lat = -996
>
> ga-> q xy2w 5.15564 3.00
> Lon = 3862.26 Lat = -1000
>
>
> The takeaway here is that when the position moves above -1000 “latitude,” then xy2gr is giving me the y-position grid index. Below that, then it’s the “world” coordinate. I don’t think the 3 means anything, here (just a guess).
>
> Operator-error goof or bug?
>
> ~Dave
> _______________________________________________
> gradsusr mailing list
> <mailto:gradsusr at gradsusr.org> gradsusr at gradsusr.org
> <http://gradsusr.org/mailman/listinfo/gradsusr> http://gradsusr.org/mailman/listinfo/gradsusr
--
Jennifer Miletta Adams
Center for Ocean-Land-Atmosphere Studies (COLA) George Mason University
_______________________________________________
gradsusr mailing list
<mailto:gradsusr at gradsusr.org> gradsusr at gradsusr.org
<http://gradsusr.org/mailman/listinfo/gradsusr> http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20170705/b24efbaf/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5386 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20170705/b24efbaf/attachment-0001.bin
More information about the gradsusr
mailing list