VisAD already has methods to very efficiently resample data from one
CoordinateSystem to another. Otherwise, the most efficient way is to
step through your 'destination' grid, compute the lat/lon for each
point, and then look up the point (just an indexing for a regular
lat/lon grid) and do your interpolation.
As I said, VisAD can also do this, and provides several built-in
projections (for example, see GRIBCoordinateSystem where I've
pre-defined several GRIB grids), including generalized conformal. The
main reason to use the CoordinateSystems is that it allows you to more
easily combine data and displays in different projections.
Regarding writing a file adapter, the job is to turn the external format
(GRIB file) into a VisAD Data object. Most file adapters turn the
entire file into one Data object. In the case of grid files, the "top
level" is often a Tuple. An excellent example of this is provided by
the NetCDF adapter ("Plain"). To most easily see the structure, do this
I hope you are successful in creating the adapter for GRIB files - it
would make an excellent addition to the VisAD library.
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
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.
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?