NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdf-java] Missing GRIB parameters in NetCDF?

  • To: rkambic <rkambic@xxxxxxxxxxxxxxxx>
  • Subject: Re: [netcdf-java] Missing GRIB parameters in NetCDF?
  • From: "Tor Christian Bekkvik" <torc@xxxxxx>
  • Date: Wed, 26 Aug 2009 16:21:20 +0200
Thank You, It helps to know what to look for (GridIndex, GridDefRecord).
But It is still unclear how to get these, given a variable or its
Gridset:

   mNCdataset = NetcdfDataset.openDataset(this.mFilename, true, null);
   mNCgridDataset = new ucar.nc2.dt.grid.GridDataset(mNCdataset);
   for (ucar.nc2.dt.GridDataset.Gridset gs :
   mNCgridDataset.getGridsets())
   {       for (GridDatatype gg : gs.getGrids())
           {       VariableEnhanced variable = gg.getVariable(); //gets
   U and V variables here.
   ...
   (When interpreting and joining U&V variable components, info from
   GridDefRecord etc. only gives meaning when associated with these
   variables)


Regards,
Tor C


On Thu, 20 Aug 2009, Robb Kambic wrote:

> On Thu, 20 Aug 2009, Tor Christian Bekkvik wrote:
>
>>
>> Hi,
>> I am using NetCDF to read GRIB/GRIB2 files. Almost everything works
>> fine, but some GRIB parameters seems to be unavailable via the NetCDF
>> API. I this case, I could not find
>>        "RESOLUTION AND COMPONENT FLAGS (GDS OCTET 17)" from the GRIB
file.
>> , at least not in the NetCDF attributes..
>>
>> (Details: This GDS parameter from the GRIB file tells how to
>> interpret direction from combined U- and V- components. (In my case,
>> current vectors from weather data) Text from GRIB standards
>> documentation:
>>
>>       TABLE 7 - RESOLUTION AND COMPONENT FLAGS (GDS OCTET 17):
>>       Bit 5:
>>       0     u- and v-components of vector quantities resolved
relative
>>               to easterly and northerly directions
>>
>>       1     u and v components of vector quantities resolved relative
>>               to the defined grid in the direction of increasing x
and y
>>               (or i and j) coordinates respectively
>>
>> )
>>
>>  
>>
>> - How could we get this GRIB parameter ?
>>
>
>

Tor,

The information is available in the CDM stack, ie

GridIndex index;

List<GridDefRecord> hcsList = index.getHorizCoordSys(); for
(GridDefRecord gds : hcsList) {
   String windflag = gds.getParam(GridDefRecord.WIND_FLAG)
}


In my first response it was a mistake to move the discussion from the
netCDF-Java library to the lower level GRIB library without an
explanation. The purpose was to show you the code snipet of how the
value was obtained. Hopefully I didn't confuse you.


Robb...



>>  
>>
>> Thanks,
>>
>> Tor Chr Bekkvik
>>
>>  
>>
>>  
>>
>>  
>>
>>
>>
>
>
========================================================================
=======
> Robb Kambic                              Unidata Program Center
> Software Engineer III                    Univ. Corp for Atmospheric
> Research
> rkambic@xxxxxxxxxxxxxxxx                 WWW:
http://www.unidata.ucar.edu/



  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: