Re: Extracting wind data from grib files



I was hoping that there was a way to use wgrib to get at wind speed and
direction directly. However, I'm learning that things are not as
simple as that.

I found that something like this sort of gets at what I want...
wgrib "GRIB file" -d all text

....yet the headers are...well there are none, really:

(grid 1) (nx) (ny) grid dimensions
(grid value)
(grid value)
...

Huh? So one has no clue as to whether the output is UGRD or VGRD (or
something else, like PRMSL, WVSP1, etc.), nor what the geographic
coordinates are - but then I suppose wgrib does an outstanding job
converting grib to ieee, or perform other manipulations and inventory
tasks (it's primary purpose according to the website
(http://www.cpc.ncep.noaa.gov/products/wesley/wgrib.html)).

I also looked at degrib, which seems like it might be useful...and
something like this sort of does what I want...

degrib "GRIB file" -C -msg all -nMet -Csv

....but this generates potentially hundreds of separate files (one for
each record in the grib file) and one still would need to convert the
wind components to speed and direction...yech.

Plato lives on (something about the mother of invention), and so...I've
started working on a tool that will do what I want. I thought about
modifying degrib for the purpose, but the code seems rather bloated in
comparison to the elegantly written wgrib (all packed neatly in one
file). What I decided to do is to modify wgrib to extract and analyze
ocean wind data, specifically the UGRD and VGRD wind components, and to
output that data, as well as the calculated wind speed and direction
with associated latitude and longitudes, as text (in a sort of report
form), and optionally as comma-delimited data.

I managed to get a prototype (of what i'll call "gribwind" for now)
working yesterday and so far it does a pretty good job. I'd appreciate
any comments about my direction, and if anyone is interested I'll post
the source to my website.
=
Garen






Scott L wrote:
garen.evans@xxxxxxxxx wrote:
I'm working on a simulation and would like to extract weather data from
grib files.
<snip>
I'm not sure I understand -- is it the conversion from (u,v)
to speed/direction that has you stumped? Speed is just
(u^2 + v^2)^0.5, and direction is atan2(-u,-v). You seem
to be extracting the 35 datapoints (small domain!) just
fine.

When I've used NCEP's grib2 decoding software, everything
seems to decode properly except the v grids, which come
out as -v. Has anyone else experienced that?

Scott

.