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