Re: [thredds] RTOFS, Grib2 and THREDDS

Roy,

Good thing you asked because we spent some time last summer scratching our
heads over this one with the folks from NCEP!

The RTOFS GRIB files represent an interesting case indeed, and the solution
again shows the power of NcML.   It also shows that we need a version of the
THREDDS Data Server that uses NetCDF-Java 4.0.

The problem is that RTOFS is a general curvilinear orthogonal grid
(see http://coast-enviro.er.usgs.gov/models/share/2009-01-29_0717.png)
that is not uniformly spaced in any map projection that can be specified
analytically -- there is no GRIB code that can be used to determine the X,Y
locations of the curvilinear grid cells.   The RTOFS GRIB files specify
"204", which was unknown to the NetCDF-Java 2.2.22, so it just stopped with
an "unknown projection = 204" error.    But with NetCDF-Java 4.0, it
recognizes 204 as a "Curvilinear_Orthogonal_Grid".   If you check out the
NcML view of a RTOFS variable from the NetCDF tools app  (-java -Xmx512m
-jar toolsUI-4.0.jar), here's what you see:

<variable name="Sensible_heat_net_flux" shape="time y x" type="float">
    <attribute name="units" value="W m-2" />
    <attribute name="long_name" value="Sensible heat net flux @ surface" />
    <attribute name="missing_value" type="float" value="-9999.0" />
    <attribute name="grid_mapping" value="Curvilinear_Orthogonal_Grid" />
    <attribute name="GRIB_param_discipline" value="Meteorological_products"
/>
    <attribute name="GRIB_param_category" value="Temperature" />
    <attribute name="GRIB_param_name" value="Sensible_heat_net_flux" />
    <attribute name="GRIB_param_id" type="int" value="2 0 0 11" />
    <attribute name="GRIB_product_definition_type" value="Analysis/forecast
at horizontal level/layer" />
    <attribute name="GRIB_level_type" type="int" value="1" />
  </variable>

Of course, you still want to provide CF-compliant data via OpenDAP to your
users, and the magic of NcML allows you to just union in a file that
containst the lon and lat variables.    So Avichal Mehra at NCEP kindly
provided the lon/lat values and we made a NetCDF file that just contained
those variables called "rtofs_lonlat.nc".   So the NcML looks like:

<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2";>
  <aggregation type="union">
    <netcdf location="shtfl.grib2"/>
    <netcdf location="rtofs_lonlat.nc"/>
  </aggregation>
  <variable name="Sensible_heat_net_flux">
    <attribute name="coordinates" value="lon lat"/>
    <remove type="attribute" name="grid_mapping"/>
  </variable>
   <attribute name="Conventions" type="String" value="CF-1.0"/>
</netcdf>

If you want to try this out, you can grab these files (including grib and
NcML) from:
http://coast-enviro.er.usgs.gov/models/share/rtofs.zip

Unfortunately, while the NcML works with NetCDF-Java 4.0, the current
THREDDS Data Server does not yet use NetCDF-Java 4.0.     As a work around
for THREDDS using NetCDF-Java 2.22, you could modify ASCII .gbx file that
get created when NetCDF-Java reads a grib file, replacing the unknown 204
code with something like "30".    This will allow NetCDF-Java to continue
without error, and it doesn't matter because the grid_mapping is not being
used anyway.




-Rich

On Wed, Jan 28, 2009 at 4:09 PM, Roy Mendelssohn
<Roy.Mendelssohn@xxxxxxxx>wrote:

> Hi All:
>
> Can THREDDS serve the RTOFS  grib files?  We are getting an error of
> unsupported coordinate system, get similar error within toolsUI.  Is here
> something we need to ad to the setup to get it to work?
>
> Thanks,
>
> -Roy
>
> **********************
> "The contents of this message do not reflect any position of the U.S.
> Government or NOAA."
> **********************
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> NOAA/NMFS
> Environmental Research Division
> Southwest Fisheries Science Center
> 1352 Lighthouse Avenue
> Pacific Grove, CA 93950-2097
>
> e-mail: Roy.Mendelssohn@xxxxxxxx (Note new e-mail address)
> voice: (831)-648-9029
> fax: (831)-648-8440
> www: http://www.pfeg.noaa.gov/
>
> "Old age and treachery will overcome youth and skill."
> "From those who have been given much, much will be expected"
>
>



-- 
Dr. Richard P. Signell   (508) 457-2229
USGS, 384 Woods Hole Rd.
Woods Hole, MA 02543-1598
  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the thredds archives: