help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: combine two geographic grids


From: Jaroslav Hajek
Subject: Re: combine two geographic grids
Date: Wed, 25 Nov 2009 20:52:45 +0100



On Wed, Nov 25, 2009 at 12:11 AM, John Reed <address@hidden> wrote:
Hi,

This is a newbie question.

I have two sets of geographical data.  One is temperature, and the other is population, as a function of longitude and latitude in California.

The two sets of data have similar resolution but unfortunately the two sets of data are on slightly different grids of longitude and latitude - I would like to combine them.

The approach I was thinking about taking is as follows:

1) make 2d meshes out of the population data longitudes and latitudes

e.g.

[long_mesh, lat_mesh] = meshgrid(population_longitudes, population_latitudes)

where population_longitudes and population_latitudes are the ordered lists of longitude and latitude for each population data point.

2) interpolate temperature values to the population meshes with griddata

e.g.

Temperature_fit = griddata(temperature_longitude, temperature_latitude, temperatures, long_mesh, lat_mesh)

where temperature_longitude, temperature_latitude are the ordered lists of longitude and latitude for each temperature data point held in temperatures.

(I could also alternatively fit a mesh of temperature longitudes and latitudes to the population data but this would require an additional step to rescale the population to a slightly different mesh size. )

My questions are:

A) Am I going about this the right or the best way?

B) Are there other octave functions more appropriate for what I would like to do?

C) Does anyone have suggestions about how to quickly get rid of the NaNs that may occur for any mesh points that fall outside the convex hull of the temperature data?  ( I was hoping to convert the NaNs to the nearest temperature data point).

Thank you,

John


If I understand correctly that both sets of data are given on rectangular grids, though the grids are different for each set, use interp2 rather than griddata. interp2 also allows extrapolation, answering C).

hth

--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]