Hey guys, Let me preface this by stating that I'm running with netcdf-4.2 because I wasn't able to find the latest 4.2.22 on the download page (if anyone could point me to the 4.2.22 download I'd appreciate it). I have tried with the 4.2.20 binaries (which I found on ibiblio) but had the same problem... I'm trying to use netcdf-java to process a GRIB v1 RUC file and was noticing that the returned GridDataset had a value for the Earth's radius of 6371.229km (i.e. Earth.getRadius() * .001 - the default value). This is incorrect for GRIB v1, which should have a radius of 6367.47km (i.e. Grib1Tables.getShapeRadius()). Inspecting the source I was able to make what I believe to be the proper fix, but I'll let you folks be the judge. The fix spans two files (attached). The first issue was that the during the process of creating the GridDataset, the LambertConformal projection is copied using the constructCopy() method. This method was not, however, copying the Earth's radius so it was getting the default value (incorrect for GRIB 1). The second issue was that LambertConformalConic relies on an attribute "earth_radius" to be in meters, since it does a conversion to km when creating the projection. In GridHorizCoordSys, however, the "earth_radius" attribute is set directly from the attribute "grid_radius_spherical_earth" or "radius_spherical_earth" (depending on GRIB1 or GRIB2). This value appears to be coming in as km for GRIB1. So it's already km, then LambertConformalConfic multiplies by 0.001 again (thinking it's meters) and we end up with a very small value for the radius of the Earth. I've run my local tests and things appear to be working properly with these changes. If you guys like these changes, would there be any way of getting this into the next release? Thanks in advance for all your help. Regards, Nathan Mittler - This message is intended only for the addressee and may contain information that is company confidential or privileged. Any technical data in this message may be exported only in accordance with the U.S. International Traffic in Arms Regulations (22 CFR Parts 120-130) or the Export Administration Regulations (15 CFR Parts 730-774). Unauthorized use is strictly prohibited and may be unlawful. If you are not the intended recipient, or the person responsible for delivering to the intended recipient, you should not read, copy, disclose or otherwise use this message. If you have received this email in error, please delete it, and advise the sender immediately. -
Attachment:
LambertConformal.java
Description: LambertConformal.java
Attachment:
GridHorizCoordSys.java
Description: GridHorizCoordSys.java
netcdf-java
archives: