Lat and Lon
Rafael Mundaray
remm69 at GMAIL.COM
Wed May 23 07:55:28 EDT 2007
Thanks Charles i go to try this... thanks... Regards...
2007/5/22, Charles Seman <Charles.Seman at noaa.gov>:
>
> 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."
>
>
> 'reinit'
> 'sdfopen /net/stg/netcdf/isabel_ras.nc'
> *
> * define scaling environment by displaying any variable (otherwise an
> error
> * results...)
> *
> 'set gxout shaded'
> 'd ps'
> *
> * open output file and print header...
> *
> rc = write('test_xy2w.txt','i j lonval latval')
> i=1
> while ( i <= 2 )
> j=1
> while ( j <= 2 )
> 'q xy2w 'i' 'j
> rec = sublin(result,1)
> lonv = subwrd(rec,3)
> latv = subwrd(rec,6)
> say ''i' 'j' 'lonv' 'latv
> lonval = math_format('%6.3f',lonv)
> latval = math_format('%6.3f',latv)
> rc = write('test_xy2w.txt',''i' 'j' 'lonval' 'latval'')
> j=j+1
> endwhile
> i=i+1
> endwhile
> rc = close('test_xy2w.txt')
>
> i j lonval latval
> 1 1 279.617 13.130
> 1 2 279.617 17.090
> 2 1 284.369 13.130
> 2 2 284.369 17.090
>
>
--
Ing. Rafael E. Mundaray M.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20070523/61891c5c/attachment.html
More information about the gradsusr
mailing list