Re: [netcdf-java] Bug/fix for processing grib v1 with proper earth radius.

  • To: "Mittler, Nathan" <nathan.mittler@xxxxxxxxxx>
  • Subject: Re: [netcdf-java] Bug/fix for processing grib v1 with proper earth radius.
  • From: Tom Kunicki <tkunicki@xxxxxxxx>
  • Date: Fri, 10 Jun 2011 16:27:34 -0500
Hi Nate,

Have you looked at using the values returned from 
Projection.getProjectionParameters?  Here's some snippets from our code base...


====
   Projection projection = ...

    // put in form that's a little easier to interrogate...
    Map<String, Parameter> parameterMap = new HashMap<String, Parameter>();
    for (Parameter p : projection.getProjectionParameters()) {
        parameterMap.put(p.getName(), p);
    }

    // check projection type
    Parameter p = parameterMap.get("grid_mapping_name");
    String gridMappingName = p == null ?
                                "LatLon" :  // or "latitude_longitude" 
                                p.getStringValue();
   
    if ("lambert_conformal_conic".equals(gridMappingName)) {
 
        Parameter p = parameterMap.get("earth_radius");
        double earthRadius = p == null ? Double.NaN : p.getNumericValue();
    
        // repeat for desired parameters:  
http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.5/apf.html#id2731485

    }
===

Tom Kunicki
Center for Integrated Data Analytics
U.S. Geological Survey
8505 Research Way
Middleton, WI  53562
  
On Jun 10, 2011, at 1:01 PM, Mittler, Nathan wrote:

> Strike that John, I need access to N in order to do the rotation … so I’ll 
> need a getN() added to LambertConformal instead.  Honestly, we might as well 
> add accessors for all the goodies J
>  
> From: Mittler, Nathan 
> Sent: Friday, June 10, 2011 10:39 AM
> To: 'John Caron'
> Cc: netcdf-java@xxxxxxxxxxxxxxxx
> Subject: RE: [netcdf-java] Bug/fix for processing grib v1 with proper earth 
> radius.
>  
> Hi John,
> Next week would be great!  Also would we be able to add that getEarthRadius() 
> method to LambertConformal?  I can send you an updated file if that will be 
> easier.  The reason is that we need this value to help us properly rotate the 
> wind vectors in our RUC files.
>  
> As far as a data set goes … I’m reading a GRIB1 file (so it assumes a radius 
> of 6367.47km).  We have some legacy code that uses JGrib with this radius.  
> I’ve been writing a new version of our library using NetCDF and was comparing 
> projections at various points to get a warm fuzzy that the new code is 
> working.  When NetCDF was incorrectly using a radius of 6371.229km, the 
> projections differed in some cases by 3 km.  After making my fixes, the 
> projections were within 4-5 decimal places of our JGrib version.  
>  
> Does that answer your question?
>  
> Thanks again,
> Nate
>  
> From: John Caron [mailto:caron@xxxxxxxxxxxxxxxx] 
> Sent: Friday, June 10, 2011 10:08 AM
> To: Mittler, Nathan
> Cc: netcdf-java@xxxxxxxxxxxxxxxx
> Subject: Re: [netcdf-java] Bug/fix for processing grib v1 with proper earth 
> radius.
>  
> Hi Nathan:
> 
> Sorry, ive been hoping I could just tell you it was done, but we have a delay 
> for another reason, so 4.2.28 will probably be out next week and will have 
> your fixes in it. 
> 
> the question I have is whether you have a dataset where theres any noticeable 
> difference between earth radius 6371.229km and 6367.47km ?
> 
> thanks for contributing your fix.
> 
> John
> 
> On 6/10/2011 10:56 AM, Mittler, Nathan wrote:
> Hi John,
> It’s been a couple of days, so I figured I should repost …. Any idea when the 
> next release of netcdf-java will be? And whether or not my changes can make 
> it in?
>  
> Also, I was wondering if we could add a getEarthRadius() method to the 
> LambertConformal projection?
>  
> Thanks,
> Nate
>  
> From: Mittler, Nathan 
> Sent: Wednesday, June 08, 2011 8:06 AM
> To: 'John Caron'; netcdf-java@xxxxxxxxxxxxxxxx
> Subject: RE: [netcdf-java] Bug/fix for processing grib v1 with proper earth 
> radius.
>  
> Hi John,
> Glad I could help!  I’m not quite sure I understand your question … are you 
> asking whether these changes would somehow affect projections that use the 
> standard Earth radius?  I don’t have a test dataset that uses the standard 
> radius at the moment, but I would assume there would be no issue.
>  
> Also, do you have a feel for when the next release of netcdf-java will be?  
> And whether or not these changes could make it in?
>  
> Thanks,
> Nate
>  
>  
> From: netcdf-java-bounces@xxxxxxxxxxxxxxxx 
> [mailto:netcdf-java-bounces@xxxxxxxxxxxxxxxx] On Behalf OfJohn Caron
> Sent: Wednesday, June 08, 2011 6:39 AM
> To: netcdf-java@xxxxxxxxxxxxxxxx
> Subject: Re: [netcdf-java] Bug/fix for processing grib v1 with proper earth 
> radius.
>  
> Hi Nathan:
> 
> These changes look good, thanks very much. It looks like the two bugs 
> cancelled each other out in use.
> 
> BTW, are there any noticeable effects of the change of standard radius?
> 
> John
> 
>  
> 
> 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.
>  
> 
> 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._______________________________________________
> netcdf-java mailing list
> netcdf-java@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe, visit: 
> http://www.unidata.ucar.edu/mailing_lists/





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