Re: [netcdf-java] How to project/transform variables on the fly

Nikolas,

reprojection from rotated pole to lat/lon will give you two two-dimensional coordinate variables, traditionally called lat and lon. First create these.

- Create a ucar.unidata.geoloc.projection.RotatedPole with the projection parameters.

- For each point in the two-dimensional grid, create a ucar.unidata.geoloc.ProjectionPointImpl containing the rotated coordinates and an empty ucar.unidata.geoloc.LatLonPointImpl to store the results.

- Use Projection.projToLatLon (that is, RotatedPole.projToLatLon) to calculate the lat/lon coordinates, and store them in your new coordinate variables.

See testProjToLatLon in this unit test:
https://github.com/Unidata/thredds/blob/master/cdm/src/test/java/ucar/unidata/geoloc/projection/RotatedLatLonTest.java

Kind regards,
Ben.

On 21/07/16 02:25, Dahn, Nikolas wrote:
Hello!

I'm developing an application module which should import a GRIB(2) file, select 
a subset of the variables and save them to a NetCDF file.

My problem is that some of the variables use rotated lat/lon. They seem to be correctly encoded 
(i.e. the dimensions have the standard_name "grid_latitude"/"grid_longitude" 
set and there's a reference variable with grid_mapping_name, grid_north_pole_latitude and 
-longitude set correctly), but I have to convert them to regular lat/lon and I don't know how.

My question now is: given a Variable object with Dimension i,j in rotated 
lat/lon, what do I have to do to convert it to regular lat/lon? At this point 
in the program I don't care about the actual values.

Thanks in advance!
Nikolas



_______________________________________________
NOTE: All exchanges posted to Unidata maintained email lists are
recorded in the Unidata inquiry tracking system and made publicly
available through the web.  Users who post to any of the lists we
maintain are reminded to remove any personal information that they
do not want to be made public.


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


--
Ben Caradoc-Davies <ben@xxxxxxxxxxxx>
Director
Transient Software Limited <http://transient.nz/>
New Zealand



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