Interpolating scattered data within a shapefile/worldmap

Hi I have x,y,zi scattered data, where x is lon, y is lat and zi is the data, I want to interpolate and extrapolate the data within the land boundaries, I used
vq = griddata(x,y,zi,xi,yi);
However, the interpolation and extrapolation was not made as desired.

2 comentarios

BN
BN el 30 de Mzo. de 2020
Editada: BN el 30 de Mzo. de 2020
Use scatteredInterpolant (https://www.mathworks.com/help/matlab/ref/scatteredinterpolant.html). It is very similar to griddata but I guess it inter polate across all area that you want.
I have tried using scatteredinterpolant, it does not work. Please find the attached file of scattered data.
clc
clear
[LAT LON]=cdtgrid(1.875);%%making meshgrid for desired data
obs_data=xlsread('Z:\CP_c.csv');
loni = obs_data(:,2) ;
lati = obs_data(:,1) ;
% zi = interp2(LONi,LATi,xi,loni,lati) ;
F=scatteredInterpolant(loni,lati,obs_data(:,5),'linear','linear');
F.Method = 'linear';
vq1 = F(LAT,LON);
imagesc(vq1)

Iniciar sesión para comentar.

Respuestas (1)

darova
darova el 30 de Mzo. de 2020
Here is my effort. Am i succeeded?
S = importdata('CP_c.csv');
A = S.data;
x = A(:,1);
y = A(:,2);
z = A(:,3);
xx = linspace(min(x),max(x),20);
yy = linspace(min(y),max(y),20);
[X,Y] = meshgrid(xx,yy);
Z = griddata(x,y,z,X,Y);
surf(X,Y,Z)

8 comentarios

SChow
SChow el 30 de Mzo. de 2020
Editada: SChow el 30 de Mzo. de 2020
hi darova,
With your code (slightly changes), I get fig 1, I do not get desired results (see fig 2):
clc
clear
addpath ( 'Z: \ CDT \ chadagreene-CDT-dc37894 \ cdt \' )
S = importdata ( 'Z: \ NO2_WORK \ CP_c.csv' );
A = S.data;
x = A (:, 1);
y = A (:, 2);
z = A (:, 3);
% xx = linspace (min (x), max (x), 20);
% yy = linspace (min (y), max (y), 20);
[X, Y] = cdtgrid (0.5); %%% meshgrid at 0.5 degree res
Z = griddata (x, y, z, X, Y);
imagescn (X, Y, Z)
darova
darova el 30 de Mzo. de 2020
It's not easy task. Do you have coordinates of each separate region? (black)
SChow
SChow el 30 de Mzo. de 2020
Editada: SChow el 30 de Mzo. de 2020
Hi darova,
Even if we can interpolate+extrapolate to the whole extent of fig1 (including the white portion), I can clip the otputs for oceans using island
Can you help me interpolate the point data to the extent of the globe?
[LAT, LON] = cdtgrid (0.5); %%% meshgrid of X and Y for the globe at 0.5 degree res
I tried this
worldmap([min(x) max(x)],[min(y) max(y)])
load coast
plotm(lat, long)
hold on
plotm(x,y,'.g')
hold off
Looks like you don't have enough data for color
Or scatter
scatterm(x,y,10,z,'fill')
SChow
SChow el 30 de Mzo. de 2020
I could plot similar scatter plot with fastscatter.
I need to interpolate the data from these points to the extent of the world
darova
darova el 30 de Mzo. de 2020
You don't have points for RUssia and Mexico
SChow
SChow el 31 de Mzo. de 2020
Yes, that is why I want to interpolate the data to Mexico and Russia.

Iniciar sesión para comentar.

Categorías

Más información sobre Interpolation en Centro de ayuda y File Exchange.

Preguntada:

el 30 de Mzo. de 2020

Comentada:

el 31 de Mzo. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by