Lat and Lon

Charles Seman Charles.Seman at NOAA.GOV
Tue May 22 12:38:40 EDT 2007


Rafael,

Please find attached a short GrADS script called "test_xy2w.gs" (and the
resulting output file "test_xy2w.txt") with code to plot some "i", "j",
"lonval", and "latval" values into an output file "test_xy2w.txt" with a
specified format...

see also:
http://grads.iges.org/grads/gadoc/mathfunctions.html
for info on formatting numbers for output (I couldn't get the "prnopts"
command to do this)...

I hope this helps,
Chuck

Rafael Mundaray wrote:
> hi GrADS Users, Anybody here know how i write a file with the
> coordinates of my grid...
> example:
> x y lon      lat
> 1 1 -67.3   3.1
> .  .     .        .
> .  .     .        .
> .  .     .        .
> .  .     .        .
> n n     n       n
>
> Can you help me with this???
> I know that 'q xy2w x y' corvets the x and y dimension to reals
> coordinates (Lon,Lat), but i want that save this in one file with all
> my points of my grids... I was trying this ( bold type) but didn't
> function...
>
> 'set gxout print'
> 'set prnopts %1.3f 1 1 u'
>
> 'q dims'
>
> rec=sublin(result,2)
> Imin=subwrd(rec,11)
> Imax=subwrd(rec,13)
> say 'Imin 'Imin   'Imax ' Imax
> rec=sublin(result,3)
> Jmin=subwrd(rec,11)
> Jmax=subwrd(rec,13)
> say 'Jmin 'Jmin   'Jmax ' Jmax
>
> I = 1
> while (I =< Imax)
> 'q xy2w 'I ' ' J
> rec=sublin(result,1)
> I=subwrd(rec,3)
> J=subwrd(rec,6)
> endwhile
>   while (J =< Jmax)
>   'q xy2w 'I ' ' J
>    rec=sublin(result,1)
>    I=subwrd(rec,3)
>    J=subwrd(rec,6)
> rc = write ('/root/Desktop/LatLon.txt',result)
> rc = close ('/root/Desktop/LatLon.txt')
> endwhile
> --
> Ing. Rafael E. Mundaray M.

--

Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.

********************************************************************
 Charles Seman                                Charles.Seman at noaa.gov
 U.S. Department of Commerce / NOAA / OAR
 Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
 201 Forrestal Road                              fax: (609) 987-5063
 Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect
any position of the Government or NOAA."

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_xy2w.gs
Url: http://gradsusr.org/pipermail/gradsusr/attachments/20070522/2eefd98e/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_xy2w.txt
Url: http://gradsusr.org/pipermail/gradsusr/attachments/20070522/2eefd98e/attachment.txt 


More information about the gradsusr mailing list