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.
Greetings, As part of the process of creating a GRIB1 file from subgridded netCDF data generated by the NetCDF-Java 4.0 API (long story), I had a difficult time figuring out how the X and Y values from the netCDF were calculated. Since there were negative X and Y values, it appeared that the projection used to calculate X and Y were not grid based. So, I obtained the Java netCDF source and proceeded to debug through the code. After some exploring, I found a class called GridHorizCoordSys in the package ucar.nc2.iosp.grid. In said class is a private method called makeLC and the first thing it does is create a projection for the GRIB record. Now here's where I'm confused. This is the code in question: proj = new LambertConformal( gds.getDouble(GridDefRecord.LATIN1), gds.getDouble(GridDefRecord.LOV), gds.getDouble(GridDefRecord.LATIN1), gds.getDouble(GridDefRecord.LATIN2)); Looking at the javadoc for the LambertConformal constructor, the first two parameters should be the latitude and longitude origin of the coordinate system. In my experience when dealing with Lambert Conformal grids, this is typically GridDefRecord.LA1 and GridDefRecord.LO1, respectively, from the GRIB GDS. The code above is using GridDefRecord.LATIN1 and GridDefRecord.LOV instead. Once I found out how the projection was being created, it was then possible to get the LA1 and LO1 from the X and Y within the netCDF to create a valid GDS for the GRIB data I'm generating. My questions are as follows: Why use the LATIN1 and LOV to set the lat and lon origin of the projection instead of LA1 and LO1? Is this documented someplace? I'm curious how someone such as myself would know to create a projection like this without debugging through the code. Bryan Rockwood
netcdf-java
archives: