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

  • To: Tor Christian Bekkvik <torc@xxxxxx>
  • Subject: Re: [netcdf-java] Missing GRIB parameters in NetCDF?
  • From: Robb Kambic <rkambic@xxxxxxxxxxxxxxxx>
  • Date: Wed, 26 Aug 2009 15:13:34 -0600 (MDT)
On Wed, 26 Aug 2009, Tor Christian Bekkvik wrote:


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)


Tor,

Your are correct the COMPONENT FLAG is not available in the NetCDF API,
so I added it yesterday as the GRIB_VectorComponentFlag attribute. The values are either: easterlyNortherlyRelative or gridRelative. Example:

float Categorical_Freezing_Rain_Perturb_pos_surface(time1=64, lat=181,
lon=360);
     :units = "";
     :long_name = "Categorical_Freezing_Rain_Perturb_pos @ surface";
     :missing_value = NaNf; // float
     :GRIB_param_discipline = "Meteorological_products";
     :GRIB_param_category = "Moisture";
     :GRIB_param_name = "Categorical_Freezing_Rain";
     :GRIB_param_id = 2, 0, 1, 193; // int
     :GRIB_product_definition_type = "Individual ensemble forecast";
     :GRIB_level_type = 1; // int
     :GRIB_forecasts_in_ensemble = "10";
     :GRIB_VectorComponentFlag = "easterlyNortherlyRelative";
   float Categorical_Freezing_Rain_Cntrl_low_surface(time1=64, lat=181,
lon=360);

The netCDF-Java 4.1 snapshot release will include this change
in the next day or so. The current plan is for 4.1 to become
our stable release in mid-September.

Robb...

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/




===============================================================================
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: