Re: Resampling from lat/lon to projection


Kjell Røang wrote:
I want to resample a grid in lat/lon to a grid in a projection and do the
transformations myself. Both grids has a rectangular topology and the
projection grid has also has a rectangular geometry. Then, what will be most

Instead of doing the transformations yourself, why not just let
the CoordinateSystem do this?  If you want to display the lat/lon
grid on a different projection, you could use a Display side
CoordinateSystem. See visad/examples/ as
an example.

Transform all lat/long coordinates to the projection (forward transform) and
resample the data to the projection grid (in "projection space")

Transform the projection grid to lat/lon (inverse transform) and resample
the data to this transformed projection grid (in "lat/lon space")

If someone has some input to this and/or to how to resample most effective I
will be happy.

If this is for display purposes, I would suggest creating a
Display side CoordinateSystem like in MapProjectionDisplay.
The example uses the GRIBCoordinateSystem that Tom W mentioned in
his note.

As I am using GRIB data and have a Java GRIB reader (JGrib of course, look
at sourceforge), I would like to know how to make a "GRIB adapter". Does
anyone have input to this?

I know Richard Gonzales has been in touch with you about
mods to JGrib.  He was using this to get data into the
Integrated Data Viewer (IDV) which takes the GRIB data
and transforms it into VisAD fields.  He took a roundabout
way (on my poor advice), but we will be looking into
doing this more efficiently and would love to work with you
on this.  For each GRIB message, you would need to create
a domain set of (row, col) or (lat, lon) from the GDS section
of the GRIB message.  This would be the domain of the
FlatField.  If the domain was (row, col), you could use
a GRIBCoordinateSystem with it to transform to lat/lon.
GRIBCoordinateSystem could be enhanced to support more
GRIB projections if needed.  The range values for your
FlatField would be the decoded values from the field in
the GRIB message.  Since you would also want to have
the level information, you could create Tuple with
(level, FlatField).  Alternatively, you could build up
a 3D FieldImpl of (row, col, z) or (lat, lon, alt) and
for each GRIB message that is part of this 3D field,
you could set the samples in the 3D space according to
the values in the GRIB message.

The best structure will depend on your needs.

Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307