<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.5848" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=174150116-10122009><FONT face=Arial color=#0000ff size=2>There
are a number of options ..</FONT></SPAN></DIV>
<DIV><SPAN class=174150116-10122009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=174150116-10122009><FONT face=Arial color=#0000ff size=2>the
simplest is to set gxout print ... display the data which will go into the
"result" variable .. and then use subwrd /sublin to grab and print
(say) the variable.</FONT></SPAN></DIV>
<DIV><SPAN class=174150116-10122009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=174150116-10122009><FONT face=Arial color=#0000ff
size=2>Attached is a script I use with my data which reads a file of lat/lon
points.. and prints out a bit of data for each point. This was just for
testing so you will have to modify. If you can't understand the program
flow -- you can contact me directly if you wish.</FONT></SPAN></DIV>
<DIV><SPAN class=174150116-10122009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=174150116-10122009><FONT face=Arial color=#0000ff
size=2>ron</FONT></SPAN></DIV>
<DIV><SPAN class=174150116-10122009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=174150116-10122009><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> GRADSUSR@LIST.CINECA.IT
[mailto:GRADSUSR@LIST.CINECA.IT] <B>On Behalf Of </B>Nathan Cool<BR><B>Sent:</B>
December 9, 2009 3:55 PM<BR><B>To:</B>
GRADSUSR@LIST.CINECA.IT<BR><B>Subject:</B> Re: Output data from grib for given
coordinates<BR></FONT><BR></DIV>
<DIV></DIV>Thanks everyone. <BR><BR>I was able to do this by manually entering
in each command, but I need to run this in batch mode, if possible.<BR><BR>A
simple script I have now is:<BR><BR>'open nww3.ctl'<BR>'set lon 206'<BR>'set lat
33'<BR>'set t 3'<BR>'d HTSGWsfc'<BR><BR>Grads is then executed using the
following arguments:<BR><BR> gradsc -lbxc <A
href="http://point.gs">point.gs</A><BR><BR>...where <A
href="http://point.gs">point.gs</A> is the script above.<BR><BR>In batch mode, I
don't see the result output. Is there a way to run this in batch mode, or
perhaps a GRADS command to output the result into a
file?<BR><BR>-Nathan<BR><BR><BR>On Wed, Dec 9, 2009 at 8:49 AM, Goodson,Ron
[Edm] <SPAN dir=ltr><<A
href="mailto:Ron.Goodson@ec.gc.ca">Ron.Goodson@ec.gc.ca</A>></SPAN>
wrote:<BR>
<DIV class=gmail_quote>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>I'm lazier
than that...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>I just set
lat lon to be the coordinates I want, then print out the result of displaying
the data.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>This is
only useful if you don't mind getting the nearest grid point to your
lat/lon. Otherwise - simply use the GrADS
"bilinear".</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>Hmmm ..
thought that was in the script library but don't see it .. so here is a copy I
have buried in one of my scripts. Haven't used this script in many
years, so no warrantly expressed or implied. You will probably have to
modify it as it looks like it was hardwired for a specific-sized grid.
And it looks like it would run pretty slow.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN lang=en-ca><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN lang=en-ca><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN lang=en-ca><FONT face=Arial color=#0000ff
size=2><SPAN>-------------------------------------------------------------------------------------------</SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN lang=en-ca><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV><SPAN lang=EN>
<DIV align=left><FONT face=Arial color=#0000ff size=2>*****bilinear
interpolation from 4 nearest gridpoints:</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>function bilinear(llat,
llon, myvar)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>**_llat =
subwrd(myposition, 1)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>**_llon =
subwrd(myposition, 2)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>************say 'q w2gr
'llon' 'llat</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'q w2gr 'llon'
'llat</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>*************say
result</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff
size=2>xdim=subwrd(result,3)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff
size=2>xdim=0.+xdim</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>if ( xdim <= 1.) ;
xdim=96.+xdim ; endif</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff
size=2>ydim=subwrd(result,6)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>* nearest x dimensions
:</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>x1=
math_int(xdim)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>x2 = x1 + 1</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>* the weights
are</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>xw1=
xdim-x1</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>xw2= 1.-xw1</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>* nearest y dimensions
:</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>y1=
math_int(ydim)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>y2 = y1 + 1</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>* the weights
are</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>yw1=
ydim-y1</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>yw2= 1.-yw1</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'set x ' x1</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'set y ' y1
</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'d ' myvar</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>line2 =
sublin(result,2)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>pointa =
subwrd(line2,4)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'set x ' x2</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'set y ' y1
</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'d ' myvar</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>line2 =
sublin(result,2)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>pointb =
subwrd(line2,4)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'set x ' x1</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'set y ' y2
</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'d ' myvar</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>line2 =
sublin(result,2)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>pointc =
subwrd(line2,4)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'set x ' x2</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'set y ' y2
</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>'d ' myvar</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>line2 =
sublin(result,2)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>pointd =
subwrd(line2,4)</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>newtemp = pointa*xw2*yw2
+ pointb*xw1*yw2 + pointc*xw2*yw1 + pointd*xw1*yw1</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>return
newtemp</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>* station =
f(x1,y1)*xw2*yw2+</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>*
f(x2,y1)*xw1*yw2+</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>*
f(x1,y2)*xw2*yw1+</FONT></DIV>
<DIV align=left><FONT face=Arial color=#0000ff size=2>*
f(x2,y2)*xw1*yw1</FONT></DIV></SPAN>
<DIV><FONT face=Arial color=#0000ff size=2><BR></FONT> </DIV>
<DIV lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> <A href="mailto:GRADSUSR@LIST.CINECA.IT"
target=_blank>GRADSUSR@LIST.CINECA.IT</A> [mailto:<A
href="mailto:GRADSUSR@LIST.CINECA.IT"
target=_blank>GRADSUSR@LIST.CINECA.IT</A>] <B>On Behalf Of </B>Guilherme
Martins<BR><B>Sent:</B> December 9, 2009 8:49 AM<BR><B>To:</B> <A
href="mailto:GRADSUSR@LIST.CINECA.IT"
target=_blank>GRADSUSR@LIST.CINECA.IT</A><BR><B>Subject:</B> Re: Output data
from grib for given coordinates<BR></FONT><BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=h5>
<DIV></DIV>Hi Nathan!<BR><BR>You can use the <A href="http://lats4d.gs"
target=_blank>lats4d.gs</A>. You can extract levels, variables, specific times
and coordinates. The output format can be, .nc, .bin,
.grb.<BR><BR>Guilherme.<BR><BR>
<DIV class=gmail_quote>2009/12/9 Nathan Cool <SPAN dir=ltr><<A
href="mailto:nathan@nathancool.com"
target=_blank>nathan@nathancool.com</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Good
morning everyone,<BR><BR>I'm working on a project where I need to extract
data from a grib file for specific coordinates only. Is there a way, using
GRADS, where I can specify a given coordinate (lon, lat), and retrieve data
just for that coordinate for each time series in a grib file? Or is GRADS
not the tool to do this; I was thinking of just dumping the grib using wgrib
and text parsing it, but thought GRADS might have an easier
way.<BR><BR>Thanks in advance,<BR><FONT color=#888888><BR
clear=all>-Nathan<BR></FONT></BLOCKQUOTE></DIV><BR><BR clear=all><BR>--
<BR>-----------------------------------------------------------<BR>José
Guilherme Martins dos Santos<BR>Grupo de Modelagem da Atmosfera e Interfaces -
GMAI<BR>Divisão de Modelagem e Desenvolvimento - DMD<BR>Centro de Previsão de
Tempo e Estudos Climáticos - INPE<BR>Rodovia Presidente Dutra, km 39 - CEP
12630-000<BR>Cachoeira Paulista, SP, Brasil<BR>Telefone(CP): +55 12 3186
8502<BR>Celular(SJC): +55 12 91678770 / +55 12 81528580<BR>E-mail: <A
href="mailto:guilherme.martins@cptec.inpe.br"
target=_blank>guilherme.martins@cptec.inpe.br</A><BR>E-mail alternativo: <A
href="mailto:jgmsantos@gmail.com"
target=_blank>jgmsantos@gmail.com</A><BR>Homepage: <A
href="http://guilhermemartins.hd1.com.br/"
target=_blank>http://guilhermemartins.hd1.com.br/</A><BR>-----------------------------------------------------------<BR>Sent
from Sao Jose Dos Campos, SP, Brazil
</DIV></DIV></DIV></BLOCKQUOTE></DIV><BR></BODY></HTML>