Interpolating point LAT,LON data to make gridded data

조회 수: 1 (최근 30일)
SChow
SChow 2020년 3월 30일
댓글: SChow 2020년 3월 30일
I have lat,lon,z point values (not gridded), I want to interpolate z at 1.875x1.875 degree resolution.
The below code doesnot provide desired results.
clc
clear
addpath('Z:\CDT\chadagreene-CDT-dc37894\cdt\') %%using Chad Greene's CDT toolbox https://www.chadagreene.com/CDT/CDT_Contents.html
[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(:,3),'linear','linear');%%%z=obs_data(:,5)
F.Method = 'linear';
vq1 = F(LAT,LON);
imagesc(vq1)
  댓글 수: 2
BN
BN 2020년 3월 30일
편집: BN 2020년 3월 30일
Hello
I'm not sure that is what you are looking for so I just post a comment instead of an answer. Here my achievement:
clear; clc;
% Add Chad Greene's CDT
addpath('Z:\CDT\chadagreene-CDT-dc37894\cdt\') %%using Chad Greene's CDT toolbox https://www.chadagreene.com/CDT/CDT_Contents.html
% Read csv file
obs_data=xlsread('CP_c.csv');
loni = obs_data(:,2) ;
lati = obs_data(:,1) ;
[LAT LON] = ndgrid(min(lati):1.875:max(lati), min(loni):1.875:max(loni));
%___________^^^^^^___^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
% zi = interp2(LONi,LATi,xi,loni,lati) ;
% make double in order to use in the next step
lati = double(lati);
loni = double(loni);
data = double (obs_data(:,3));
F=scatteredInterpolant(lati,loni,data,'linear','linear');%%%z=obs_data(:,5)
vq1 = F(LAT,LON);
imagesc(vq1)
SChow
SChow 2020년 3월 30일
The result from your code is similar to what I earlier got
No, the plot should look something like fig2 (as attached) after clipping the ocean (using island),
I could get similar figure by using qgis, however, scatteredInterpolant doesnot seem to work

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by