# Re: Newbie needs help...

```David Fanning wrote:
> (Where *is* Liam, anyway!?)

I'm right here, trying to get my semi-annual research report written...

> I guess if I were in your shoes, I might try to
> reformat the part of the image I was interested
> in onto a regular lat/lon grid. I'd probably try
> to use TRIANGULATE and TRIGRID first, to see if
> that would work.

In my experience, TRIANGULATE and TRIGRID work just fine when the input
arrays are small (say a few hundred rows and columns). But when you have
satellite images with thousands of rows and columns, TRIANGULATE and
TRIGRID just don't work.

> There are probably other ways to warp the image
> onto the map, but there is no getting around the
> need to do it. What you would prefer, I'm sure, is
> to have a map warped to the image. But this is NOT
> possible in IDL.

Displaying a satellite image on a map projection is one problem, and my
imagemap procedure provides one solution.

However resampling a satellite image to a regular lat/lon grid in such a
way that data values are preserved is a different problem, and there is
no easy solution in IDL. Typically, the approach is to define your
lat/lon grid (in some map projection) and then for each map grid cell,
find the closest matching location in the satellite image (nearest
neighbor). Refinements include bilinear or cubic spline interpolation.
However this algorithm is not easy to implement efficiently in IDL,
because of the penaly associated with loops. Most people implement a
resampling algorithm in some other language (e.g. C or FORTRAN), and
then read the results in IDL.

You mentioned that you are using MODIS data at 1 km resolution (1354 x
2030 pixels pre granule). One approach we use is to define a global
equal area grid; we happen to use 25 km x 25 km grid cells. We loop over
each 1 km pixel, and based on it's lat/lon, we accumulate the following
statistics in each grid cell:

Number of observations,
Sum of observations,
Minimum observation,
Maximum observation.

>From these, we can compute mean and standard deviation. it is quite
straightforward to then resample the equal area grid to an equal angle
grid which can be visualized in IDL.

If you are interested in more details, contact me directly.

Now back to my semi-annual report (sigh).

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley

PS: Here's a couple of MODIS images created in IDL:
http://earthobservatory.nasa.gov/Newsroom/NewImages/images.php3?img_id=4549
http://earthobservatory.nasa.gov/Newsroom/NewImages/images.php3?img_id=4383

```