Thanks Charles i go to try this... thanks... Regards...<br><br><div><span class="gmail_quote">2007/5/22, Charles Seman <<a href="mailto:Charles.Seman@noaa.gov">Charles.Seman@noaa.gov</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Rafael,<br><br>Please find attached a short GrADS script called "test_xy2w.gs" (and the<br>resulting output file "test_xy2w.txt") with code to plot some "i", "j",<br>"lonval", and "latval" values into an output file "test_xy2w.txt" with a
<br>specified format...<br><br>see also:<br><a href="http://grads.iges.org/grads/gadoc/mathfunctions.html">http://grads.iges.org/grads/gadoc/mathfunctions.html</a><br>for info on formatting numbers for output (I couldn't get the "prnopts"
<br>command to do this)...<br><br>I hope this helps,<br>Chuck<br><br>Rafael Mundaray wrote:<br>> hi GrADS Users, Anybody here know how i write a file with the<br>> coordinates of my grid...<br>> example:<br>> x y lon lat
<br>> 1 1 -67.3 3.1<br>> . . . .<br>> . . . .<br>> . . . .<br>> . . . .<br>> n n n n<br>><br>> Can you help me with this???<br>> I know that 'q xy2w x y' corvets the x and y dimension to reals
<br>> coordinates (Lon,Lat), but i want that save this in one file with all<br>> my points of my grids... I was trying this ( bold type) but didn't<br>> function...<br>><br>> 'set gxout print'<br>
> 'set prnopts %1.3f 1 1 u'<br>><br>> 'q dims'<br>><br>> rec=sublin(result,2)<br>> Imin=subwrd(rec,11)<br>> Imax=subwrd(rec,13)<br>> say 'Imin 'Imin 'Imax ' Imax<br>
> rec=sublin(result,3)<br>> Jmin=subwrd(rec,11)<br>> Jmax=subwrd(rec,13)<br>> say 'Jmin 'Jmin 'Jmax ' Jmax<br>><br>> I = 1<br>> while (I =< Imax)<br>> 'q xy2w 'I ' ' J
<br>> rec=sublin(result,1)<br>> I=subwrd(rec,3)<br>> J=subwrd(rec,6)<br>> endwhile<br>> while (J =< Jmax)<br>> 'q xy2w 'I ' ' J<br>> rec=sublin(result,1)<br>> I=subwrd(rec,3)
<br>> J=subwrd(rec,6)<br>> rc = write ('/root/Desktop/LatLon.txt',result)<br>> rc = close ('/root/Desktop/LatLon.txt')<br>> endwhile<br>> --<br>> Ing. Rafael E. Mundaray M.<br><br>--<br>
<br>Please note that <a href="mailto:Charles.Seman@noaa.gov">Charles.Seman@noaa.gov</a> should be considered my NOAA<br>email address, not <a href="mailto:cjs@gfdl.noaa.gov">cjs@gfdl.noaa.gov</a>.<br><br>********************************************************************
<br> Charles Seman <a href="mailto:Charles.Seman@noaa.gov">Charles.Seman@noaa.gov</a><br> U.S. Department of Commerce / NOAA / OAR<br> Geophysical Fluid Dynamics Laboratory voice: (609) 452-6547
<br> 201 Forrestal Road fax: (609) 987-5063<br> Princeton, NJ 08540-6649 <a href="http://www.gfdl.noaa.gov/~cjs/">http://www.gfdl.noaa.gov/~cjs/</a><br>********************************************************************
<br><br>"The contents of this message are mine personally and do not reflect<br>any position of the Government or NOAA."<br><br><br>'reinit'<br>'sdfopen /net/stg/netcdf/isabel_ras.nc'<br>*<br>* define scaling environment by displaying any variable (otherwise an error
<br>* results...)<br>*<br>'set gxout shaded'<br>'d ps'<br>*<br>* open output file and print header...<br>*<br>rc = write('test_xy2w.txt','i j lonval latval')<br>i=1<br>while ( i <= 2 )
<br> j=1<br> while ( j <= 2 )<br> 'q xy2w 'i' 'j<br> rec = sublin(result,1)<br> lonv = subwrd(rec,3)<br> latv = subwrd(rec,6)<br> say ''i' 'j' 'lonv' 'latv
<br> lonval = math_format('%6.3f',lonv)<br> latval = math_format('%6.3f',latv)<br> rc = write('test_xy2w.txt',''i' 'j' 'lonval' 'latval'')<br> j=j+1
<br> endwhile<br> i=i+1<br>endwhile<br>rc = close('test_xy2w.txt')<br><br>i j lonval latval<br>1 1 279.617 13.130<br>1 2 279.617 17.090<br>2 1 284.369 13.130<br>2 2 284.369 17.090<br><br></blockquote></div><br>
<br clear="all"><br>-- <br>Ing. Rafael E. Mundaray M.