# linint2_points for station data

From: Don Morton (Don.Morton AT umontana.edu)
Date: Thu Nov 18 2004 - 13:24:25 MST

Hello, a couple of weeks ago I sought help on extracting
point data from a grid, given a lat/lon that didn't necessarily
correspond to the grid points. I was led to linint2_points() and
the initial requirements a little bit :)

Given a regular 3x3 grid varying from 45N to 47N and 112W to 114W,
and a temperature field, I can easily extract/interpolate point
data as follows:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
begin

temperature = (/ (/100, 100, 50/), \
(/100, 100, 100/), \
(/100, 100, 100/) /)

lat = (/45, 46, 47/)
lon = (/-114, -113, -112/)

; Here's the lat/lon I want station data for
y0 = 45.5
x0 = -112.5

station_temperature = linint2_points(lon, lat, temperature, \
False, x0, y0, 0)

print(station_temperature)

end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

However, what if my grid is NOT so "regular?" Suppose, as is the
case with some of my WRF output, a "row" of points might start at
45N and end at 45.2N? Does linint2_points() allow for this? In
the following, I've naively tried by placing all of my lat/lon grid
points in arrays and passing those to linint2_points(), as follows

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
begin

temperature = (/ (/100, 100, 100/), \
(/100, 50, 100/), \
(/100, 100, 100/) /)

lat_points = (/ (/45, 45.1, 45.2 /), \
(/46, 46.1, 46.2 /), \
(/47, 47.1, 47.2 /) /)

lon_points = (/ (/-114, -113, -112/), \
(/-114.1, -113.1, -112.1/), \
(/-114.2, -113.2, -112.2/) /)

; Here's the lat/lon of the location I want station data for
y0 = 45.5
x0 = -112.5

station_temperature = linint2_points(lon_points, lat_points, \
temperature, False, x0, y0, 0)

print(station_temperature)

end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

but I get an error message saying:

fatal:linint2_points: If xi is not one-dimensional, then it must have
one less dimension than fi

(Note that above, "xi" corresponds to "lon_points" and "fi" corresponds
to "temperature").

Indeed, the documentation confirms that xi must have one less dimension
than fi, but
I don't understand why this would be the case (which suggests I don't
really
understand the purpose of multi-dimension arguments for xi and yi). Is
there any place
I can go for a little more explanation? A Google search on
"linint2_points" doesn't
turn up much :)

Thanks,

Don

```--
** NOT ON CAMPUS UNTIL SPRING 2005 **
**************************************************************
Don Morton                      http://www.cs.umt.edu/~morton/
Department of Computer Science       The University of Montana
Missoula, MT 59812 | Voice (406) 243-4975 | Fax (406) 243-5139