I'm not following this thread real closely, so I might not be answering it properly... but:<div><br></div><div><b style="font-family: 'Times New Roman'; font-size: medium; ">wgrib2</b><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "> shows help</span><br style="font-family: 'Times New Roman'; font-size: medium; ">
<b style="font-family: 'Times New Roman'; font-size: medium; ">wgrib2 gfs12Z090411_00hr.grib -s -lon -93 43</b><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "> Shows everything for this point (43,-93)</span><br style="font-family: 'Times New Roman'; font-size: medium; ">
<b style="font-family: 'Times New Roman'; font-size: medium; ">wgrib2 infile.grib -s -lon -93 43 | egrep '(:TMP:2 m|:DPT:2 m:)'</b><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "> shows exact values for specific records at a specific coordinate.</span><br style="font-family: 'Times New Roman'; font-size: medium; ">
<b style="font-family: 'Times New Roman'; font-size: medium; ">wgrib2 infile.grib -ctl_inv</b><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "> shows inventory with units</span><br style="font-family: 'Times New Roman'; font-size: medium; ">
<b style="font-family: 'Times New Roman'; font-size: medium; ">wgrib2 infile.grib -match_inv</b><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "> shows inventory for use with egrep</span><br style="font-family: 'Times New Roman'; font-size: medium; ">
<span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; ">adding a </span><b style="font-family: 'Times New Roman'; font-size: medium; ">> output.txt</b><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "> to the end will print out the output to a file.</span></div>
<div><font class="Apple-style-span" face="'Times New Roman'" size="3"><br></font></div><div><font class="Apple-style-span" face="'Times New Roman'" size="3"><br clear="all"></font>Andrew Revering<br>Convective Development, Inc.<br>
<a href="http://www.convectivedevelopment.com/">http://www.convectivedevelopment.com/</a><br>
<br><br><div class="gmail_quote">On Thu, Nov 24, 2011 at 3:02 PM, Eric Altshuler <span dir="ltr"><<a href="mailto:ela@cola.iges.org">ela@cola.iges.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Mason,<br>
<br>
Just typing 'wgrib' will show all available options. I may be wrong, but it appears that wgrib lacks the capability to extract a data value at a specific point on the horizontal grid. wgrib can extract a single GRIB record (which is usually one single-level field or one multi-level field on a specified vertical level) and output the data in several formats, including text, but you still get the entire horizontal grid. In order to get the value at a single point, you need to identify the proper location of the value at that point in the output text file. Alternatively, you could obtain the output data in binary format and read the binary data using a Fortran or C program which prints out the value for a given input location (I,J). You would need to figure out the correct I and J for the point you are interested in. If the horizontal grid is on a projection (e.g. polar stereographic, Lambert), you would need to use the transformation formulas that relate (lon,lat) to (I,J) for!<br>
that projection and its parameters. It's somewhat complicated, but it can be done. However, using grads is probably much easier in this situation, since grads will automatically interpolate preprojected data onto the lat-lon grid specified in the XDEF and YDEF lines in the control file. You can use grib2ctl to generate a control file from the original GRIB file. grib2ctl recognizes most common map projections (it reads the projection information from the GRIB header) and usually generates a correct PDEF statement, if one is necessary. After running grib2ctl, run gribmap on the control file to make the index file, and you'll be all set.<br>
<br>
Eric<br>
<br>
----- Original Message -----<br>
From: "Mason D. Rowell" <<a href="mailto:Mason.D.Rowell-1@ou.edu">Mason.D.Rowell-1@ou.edu</a>><br>
To: "GrADS Users Forum" <<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a>><br>
Sent: Thursday, November 24, 2011 12:28:30 AM<br>
Subject: Re: [gradsusr] writing results & variables to a text file<br>
<br>
If you looked, you would see the 'comprehensive' documentation provided here (<a href="ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/grib2ieee.txt" target="_blank">ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/grib2ieee.txt</a>) given in this link you give me (which I am aware of already) has some examples, but not about how to extract for a specific location in space. Even these 'tricks' also provided here (<a href="ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/tricks.wgrib" target="_blank">ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib/tricks.wgrib</a>) within your link only mention how to extract at a specific height. Perhaps I am just not digging into this page enough, as I have tried in the past. My original inquiry alluded to needing this specific functionality, or least this was what was most paramount. These pages do mention more details in the readme files, but I am using the wgrib made available in the grads utility bin, so readme files are not present (at least in the build made available to me). I didn't want to unnecessarily download and compile wgrib just to get the readme files when I already have the utility itself through grads. My question was!<br>
a simple yes or no, can this exact syntax provided below be used with wgrib, not just wgrib2? I apologize if it seems I am not trying. If you do not know then thank you anyways, but the answer is simple.<br>
<br>
Mason<br>
________________________________________<br>
From: <a href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a> [<a href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a>] on behalf of Jeff Lake [<a href="mailto:admin@michiganwxsystem.com">admin@michiganwxsystem.com</a>]<br>
Sent: Wednesday, November 23, 2011 10:13 PM<br>
To: <a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
Subject: Re: [gradsusr] writing results & variables to a text file<br>
<br>
<a href="http://www.cpc.ncep.noaa.gov/products/wesley/wgrib.html" target="_blank">http://www.cpc.ncep.noaa.gov/products/wesley/wgrib.html</a><br>
hmm look and see<br>
<br>
-Jeff Lake<br>
MichiganWxSystem.com<br>
WeatherMichigan.net<br>
TheWeatherCenter.net<br>
GRLevelXStuff.com<br>
<br>
<br>
On 11/23/2011 10:33 PM, Rowell, Mason D. wrote:<br>
> The question was, if that syntax, and thus specific type of extraction, was possible with wgrib, rather than wgrib2. Yes there is a wgrib, but it is just called wgrib, not wgrib1.<br>
><br>
> Mason<br>
> ________________________________________<br>
> From: <a href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a> [<a href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a>] on behalf of Jeff Lake [<a href="mailto:admin@michiganwxsystem.com">admin@michiganwxsystem.com</a>]<br>
> Sent: Wednesday, November 23, 2011 4:56 PM<br>
> To: <a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
> Subject: Re: [gradsusr] writing results& variables to a text file<br>
><br>
> wgrib is for GRIB1<br>
> wgrib2 is for GRIB2<br>
> I don't think there is many GRIB1 around is there ?<br>
><br>
> -Jeff Lake<br>
> MichiganWxSystem.com<br>
> WeatherMichigan.net<br>
> TheWeatherCenter.net<br>
> GRLevelXStuff.com<br>
><br>
><br>
> On 11/23/2011 5:36 PM, Rowell, Mason D. wrote:<br>
>> Wesley,<br>
>><br>
>> Will command syntax like this work for wgrib as well (not wgrib2)? I have had instances of just wanting to extract one variable at one exact location but the wgrib documentation didn't have examples of how to do this (what options to use after wgrib) for a specific location.<br>
>><br>
>> Mason<br>
>> ________________________________________<br>
>> From: <a href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a> [<a href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a>] on behalf of Wesley Ebisuzaki [<a href="mailto:Wesley.Ebisuzaki@noaa.gov">Wesley.Ebisuzaki@noaa.gov</a>]<br>
>> Sent: Wednesday, November 23, 2011 12:43 PM<br>
>> To: GrADS Users Forum<br>
>> Subject: Re: [gradsusr] writing results& variables to a text file<br>
>><br>
>> Alireza,<br>
>><br>
>> "If all you have is a hammer, everything looks like a nail."<br>
>><br>
>> Before trying to find a GrADS solution, consider whether GrADS is<br>
>> the right tool.<br>
>><br>
>><br>
>> (A) To find Washington DCs T2m for a single file, 1.grb2<br>
>><br>
>> wgrib2 1.txt -match ":TMP:" -match ":2 m above ground:" -s -lon -53<br>
>> 38>1.txt<br>
>><br>
>><br>
>> (B) Do the same for *.grb2 (only works for v0.1.9.3 5/2011 or later)<br>
>><br>
>> cat *.grb2 | wgrib2 - -match ":TMP:" -match ":2 m above ground:"<br>
>> -s -lon -53 38>all.txt<br>
>><br>
>><br>
>> for older wgrib2: cat *.grb2>tmp.grb2<br>
>> wgrib2 tmp.grb2 -match ":TMP:" -match<br>
>> ":2 m above ground:" -s -lon -53 38>all.txt<br>
>><br>
>><br>
>> Wesley Ebisuzaki<br>
>><br>
>><br>
>><br>
>> Alireza Azargoun wrote:<br>
>>> Dear GrADS users<br>
>>> Hi everybody<br>
>>><br>
>>> I have about 200 grib2 files ( 1.grb2 ~ 200.grb ) . i need to read a<br>
>>> temperature of a city (lat, lon, lev, time are constant in all files)<br>
>>> . how i can read this files using a while loop!? ( I receive this<br>
>>> error when i write a while. Unknown Command: while )<br>
>>> and how can i write these data to a text file!? I've searched all<br>
>>> grads option for a command that writes variables in a text file! but i<br>
>>> couldn't find it!<br>
>>><br>
>>> Thanks in advance,<br>
>>> Alireza<br>
>>> Sharif University of Technology<br>
>>><br>
>>><br>
>>> --<br>
>>> Alireza Azargoun<br>
>>> ------------------------------------------------------------------------<br>
>>><br>
>>> _______________________________________________<br>
>>> gradsusr mailing list<br>
>>> <a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
>>> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
>>><br>
>> _______________________________________________<br>
>> gradsusr mailing list<br>
>> <a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
>> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
>><br>
>> _______________________________________________<br>
>> gradsusr mailing list<br>
>> <a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
>> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
>><br>
> _______________________________________________<br>
> gradsusr mailing list<br>
> <a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
><br>
> _______________________________________________<br>
> gradsusr mailing list<br>
> <a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
><br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br></div>