Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Reverse "griddata"

Subject: Reverse "griddata"

From: Volker K

Date: 19 Feb, 2008 21:15:10

Message: 1 of 6

Hi all!

I have a problem that could be described as reversing the
griddata function. This is what it normally looks like:

ZI = griddata(x,y,z,XI,YI)

So x,y,z and XI and YI are known...

In my case XI,YI,ZI and z are known and I would like to find
x and y....

Subject: Reverse "griddata"

From: Ashish Uthama

Date: 19 Feb, 2008 21:20:10

Message: 2 of 6

z is known? so its size is available

Can you find the limits of x/y using min/max on XI,YI.
Then create x and y by equally spacing between these limits using the si=
ze =

of Z.


On Tue, 19 Feb 2008 16:15:10 -0500, Volker K <klinkv.NOSPAM@yahoo.de> =

wrote:

> Hi all!
>
> I have a problem that could be described as reversing the
> griddata function. This is what it normally looks like:
>
> ZI =3D griddata(x,y,z,XI,YI)
>
> So x,y,z and XI and YI are known...
>
> In my case XI,YI,ZI and z are known and I would like to find
> x and y....



-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Subject: Reverse

From: John D'Errico

Date: 19 Feb, 2008 22:29:06

Message: 3 of 6

"Volker K" <klinkv.NOSPAM@yahoo.de> wrote in message
<fpfgsu$s45$1@fred.mathworks.com>...
> Hi all!
>
> I have a problem that could be described as reversing the
> griddata function. This is what it normally looks like:
>
> ZI = griddata(x,y,z,XI,YI)
>
> So x,y,z and XI and YI are known...
>
> In my case XI,YI,ZI and z are known and I would like to find
> x and y....

Huh?

If XI,YI and ZI are all known, then what remains
to be found?

John

Subject: Reverse

From: Volker K

Date: 19 Feb, 2008 23:16:11

Message: 4 of 6

well, I tried to generalize my problem. Here's a more
detailed description...I hope it explains what im trying do to:

My aim is to create a m-by-n binary coastline image from a
set of coordinates.

Therefore I have:

LatArray, m-by-n, containing the Latitudes for each pixel
LonArray, m-by-n, containing the Longitudes for each pixel
m and n = 101

LatVector, q-by-1
LonVector, q-by-1
q is about 10000

The coordinates given by Lat/LonVector need to be found
within Lat/LonArray, even if the values given do not
perfectly match the values stored in the arrays. I will need
the subscripts/linear index of the array elements that
matched the vector coordinates.

Finally a new m-n blank image is created and a pixel is set
to 1, if it contains a coord. of the vector...

Right now I'm using a for loop to compute the euclidean
distance from each element of Lon/Lat-Vector to the
coordinates given in the arrays and then use the row/column
with the minimal distance for setting the pixel.

Subject: Reverse

From: John D'Errico

Date: 20 Feb, 2008 00:11:07

Message: 5 of 6

"Volker K" <klinkv.NOSPAM@yahoo.de> wrote in message
<fpfnvr$4k9$1@fred.mathworks.com>...
> well, I tried to generalize my problem. Here's a more
> detailed description...I hope it explains what im trying do to:
>
> My aim is to create a m-by-n binary coastline image from a
> set of coordinates.
>
> Therefore I have:
>
> LatArray, m-by-n, containing the Latitudes for each pixel
> LonArray, m-by-n, containing the Longitudes for each pixel
> m and n = 101
>
> LatVector, q-by-1
> LonVector, q-by-1
> q is about 10000
>
> The coordinates given by Lat/LonVector need to be found
> within Lat/LonArray, even if the values given do not
> perfectly match the values stored in the arrays. I will need
> the subscripts/linear index of the array elements that
> matched the vector coordinates.
>
> Finally a new m-n blank image is created and a pixel is set
> to 1, if it contains a coord. of the vector...
>
> Right now I'm using a for loop to compute the euclidean
> distance from each element of Lon/Lat-Vector to the
> coordinates given in the arrays and then use the row/column
> with the minimal distance for setting the pixel.

So you have a scattered set of data, with
roughly 10000 points in it, and a regular
grid.

You want to "snap" these grid points to the
regular grid? What will you do with them?

It sounds like you wish to use nearest
neighbor interpolation, predicting the value
of the function at the regular grid points
from your data. Is this correct? If so, then
it is available from griddata directly.

John

Subject: Reverse

From: Joaquim Luis

Date: 20 Feb, 2008 00:45:08

Message: 6 of 6

"Volker K" <klinkv.NOSPAM@yahoo.de> wrote in message
<fpfnvr$4k9$1@fred.mathworks.com>...
> well, I tried to generalize my problem. Here's a more
> detailed description...I hope it explains what im trying
do to:
>
> My aim is to create a m-by-n binary coastline image from a
> set of coordinates.

Why don't you use apropriate programs to do this kind of
things?


From the grdlandmask man page

"grdlandmask − Create "wet-dry" mask grdfile from shoreline
data base."

grdlandmask is one of the modules of the GMT package.


Joaquim Luis



Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics