Re: [netcdf-java] FW: Adding a new projection to GRIB netcdf decoder

  • To: Tor Christian Bekkvik <torc@xxxxxx>
  • Subject: Re: [netcdf-java] FW: Adding a new projection to GRIB netcdf decoder
  • From: John Caron <caron@xxxxxxxxxxxxxxxx>
  • Date: Thu, 30 Oct 2008 09:30:22 -0600
Hi Tor:

1. We do have ucar.unidata.geoloc.projection.RotatedPole in 4.0. Is that the 
same projection?

2. If so, we can add to the GRIB IOSP. All we need is an example GRIB file that 
uses this, so we can test.

thanks,
John

Tor Christian Bekkvik wrote:
-----Original Message-----
From: Tor Christian Bekkvik Sent: 27. oktober 2008 14:48
To: 'support-netcdf-decoders@xxxxxxxxxxxxxxxx'
Cc: Kjell Røang
Subject: Adding a new projection to GRIB netcdf decoder

Hi,
We would like to add support for Rotated LatLon projection when reading GRIB 
files. (using netcdf decoders)


To open the gribfile, we have used class  NetcdfDataset:  
NetcdfDataset.openDataset(gribFile,...)
But this fails for with rotated latlong projection, as it is not supported:
  ucar.grib.NoValidGribException: GDS: Unknown Grid Type : 10) is not supported.
        at 
ucar.grib.grib1.Grib1GridDefinitionSection.<init>(Grib1GridDefinitionSection.java:401)
        at ucar.grib.grib1.Grib1Input.scan(Grib1Input.java:155)
        at ucar.grib.grib1.Grib1Indexer.writeFileIndex(Grib1Indexer.java:90)
        at 
ucar.nc2.iosp.grib.GribServiceProvider.writeIndex(GribServiceProvider.java:163)
        at 
ucar.nc2.iosp.grib.GribServiceProvider.getIndex(GribServiceProvider.java:139)
        at 
ucar.nc2.iosp.grib.GribServiceProvider.open(GribServiceProvider.java:75)
        at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1092)
        at ucar.nc2.NetcdfFile.open(NetcdfFile.java:485)
        at ucar.nc2.NetcdfFile.open(NetcdfFile.java:278)
        at ucar.nc2.dataset.NetcdfDataset.openFile(NetcdfDataset.java:341)
        at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:175)
        at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:161)



To add this new projection, it seems that at least the following code needs 
update:
1) ProjectionImpl  (I can implement RotLatLonProjection extends ProjectionImpl)
2) Grib1GridDefinitionSection (to fix NoValidGribException, listed above) 3) GribHorizCoordSys.makeProjection (read necessary parameters from Grib GDS section and return RotLatLonProjection):
  private void makeProjection(NetcdfFile ncfile) {
    switch (lookup.getProjectionType(gdsIndex)) {
      case TableLookup.PolarStereographic:
        makePS();
        break;
      case TableLookup.LambertConformal:
        makeLC();
        break;
      case TableLookup.Mercator:
        makeMercator();
        break;
      case TableLookup.Orthographic:
        makeSpaceViewOrOthographic();
        break;
      default:
        throw new UnsupportedOperationException("unknown projection = " + 
gdsIndex.grid_type);
    }





Currently, I don't have sufficient GRIB/NetCDF knowledge (or source code) to do 
this.
But I have already added Rotated LatLon projection for the JGRIB project 
(http://jgrib.sourceforge.net/), and we would like to do the same with 
NetCDF/GRIB.




- Any comments how to best do this ?



Thanks,
Tor Chr Bekkvik


_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/


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