Re: Resampling from lat/lon to projection

  • To: Kjell Røang <kjell@xxxxxx>
  • Subject: Re: Resampling from lat/lon to projection
  • From: Tom Whittaker <tomw@xxxxxxxxxxxxx>
  • Date: Thu, 20 Mar 2003 06:23:42 -0600
Hello Kjell...

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 (in Python):

a=load('my.netcdf.file")
dumpTypes(a)

I hope you are successful in creating the adapter for GRIB files - it would make an excellent addition to the VisAD library.

tom


Kjell Røang wrote:
Hi
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
efficient:

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

2
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?

Kjell R