Re: Reading NCAR/NCEP reanalysis grib files

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 8 Jul 2009 14:35:14 -0600 (MDT)

Hi Chris,

It's possible that the variable is not called exactly "UGRD" on the
file.

What does the following report:

   ncl_filedump 10m_Winds/2008-12_10m-wind.grb

or

   ncl_filedump 10m_Winds/2008-12_10m-wind.grb | grep -i ugrd

Do you see a variation of "UGRD"?

As for your other questions:

> 2) If anyone could offer some code examples that would fill an array of
> values (over all [or some] times) from the horizontal grid that are
> valid for a given lat/lon that would be really helpful.

Can you elaborate here? I'm not sure what you mean by "from the horizontal
grid that are valid"...

> 3) Are there any built-in functions (or contributed ones) that will
> convert my U and V components into Speed and Direction?

This was asked once before on ncl-talk. See:

    http://www.ncl.ucar.edu/Support/talk_archives/2009/0381.html

--Mary

On Wed, 8 Jul 2009, Christopher G. Herbster wrote:

> Hi all,
>
> I have downloaded 10m winds (U and V) in grib format and I am having
> trouble reading the files.
>
> I have cat'ed both components into a single file. An ultimate goal is
> to extract wind information for an arbitrary location and use that
> information to build a wind rose.
>
> 1) When I try to read in the variables from the file I get an error that
> says they don't exist or there is a problem with the file.
>
> ;***************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/wind_rose.ncl"
> ;
> ; Need the next one for the read functions
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> ;***************************************
> begin
> ;
> fname = "10m_Winds/2008-12_10m-wind.grb"
> ;
> ;
> ; Open file to read
> infile = addfile(fname,"r") ; Open GRIB file to read
> ;
> ; Fill the U and V arrays
> ugrd = infile->UGRD
> vgrd = infile->VGRD
>
> usize = dimsizes(ugrd)
> print ("usize is " + usize)
>
>
> end
>
> -----------
>
> This yields:
>
> $ ncl read_reanalysis_windrose.ncl
> Copyright (C) 1995-2007 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 4.3.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> fatal:Either file (infile) isn't defined or variable (UGRD) is not a
> variable in the file
> fatal:Execute: Error occurred at or near line 26 in file
> read_reanalysis_windrose.ncl
>
> ----------
>
> wgrib says this is what is in the file:
>
> $ wgrib 10m_Winds/2008-12_10m-wind.grb -v
> 1:0:D=2008120100:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u wind [m/s]
> 2:20388:D=2008120106:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u wind
> [m/s]
> 3:40776:D=2008120112:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u wind
> [m/s]
> 4:61164:D=2008120118:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u wind
> [m/s]
> 5:81552:D=2008120200:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u wind
> [m/s]
> 6:101940:D=2008120206:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u
> wind [m/s]
> 7:122328:D=2008120212:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u
> wind [m/s]
> 8:142716:D=2008120218:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u
> wind [m/s]
> 9:163104:D=2008120300:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u
> wind [m/s]
> 10:183492:D=2008120306:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u
> wind [m/s]
> <... snip ...>
> 120:2428428:D=2008123018:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u
> wind [m/s]
> 121:2448816:D=2008123100:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u
> wind [m/s]
> 122:2469204:D=2008123106:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u
> wind [m/s]
> 123:2489592:D=2008123112:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u
> wind [m/s]
> 124:2509980:D=2008123118:UGRD:10 m above gnd:kpds=33,105,10:6hr fcst:"u
> wind [m/s]
> 125:2530368:D=2008120100:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 126:2550756:D=2008120106:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 127:2571144:D=2008120112:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 128:2591532:D=2008120118:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 129:2611920:D=2008120200:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 130:2632308:D=2008120206:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 131:2652696:D=2008120212:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 132:2673084:D=2008120218:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 133:2693472:D=2008120300:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 134:2713860:D=2008120306:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> <... snip ...>
> 244:4958796:D=2008123018:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 245:4979184:D=2008123100:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 246:4999572:D=2008123106:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 247:5019960:D=2008123112:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
> 248:5040348:D=2008123118:VGRD:10 m above gnd:kpds=34,105,10:6hr fcst:"v
> wind [m/s]
>
>
> ------------
>
> Any help in getting past this fundamental point is greatly appreciated.
>
>
> 2) If anyone could offer some code examples that would fill an array of
> values (over all [or some] times) from the horizontal grid that are
> valid for a given lat/lon that would be really helpful.
>
>
> 3) Are there any built-in functions (or contributed ones) that will
> convert my U and V components into Speed and Direction?
>
>
> Thanks in advance for any help!
>
> Cheers,
> Chris Herbster
>
> --
>
> Dr. Christopher G. Herbster
> Associate Professor
> Director of Science and Technology
> for the ERAU Weather Center
> Applied Aviation Sciences
> Embry-Riddle Aeronautical Univ.
> 600 S. Clyde Morris Blvd.
> Daytona Beach, FL 32114-3900
>
> 386.226.6444 Office
> 386.226.6446 Weather Center
> http://wx.erau.edu/
>
> Schedule at: http://wx.erau.edu/faculty/herbster/Schedules/
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 08 2009 - 14:35:14 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 08 2009 - 14:48:16 MDT