Interpolate NaN depth values in the bathymatry

조회 수: 4 (최근 30일)
Hasara kalpani Thennakoon Thennakoon Mudiyanselage
답변: Cris LaPierre 2021년 12월 21일
I have a bathymatry data set with logitudes,latitudes and depths which i used to create a bathymatry for a certain area(matfile attached). But due to the Nan values in the depth data resulting map is little blury over some area.I would like to interpolate the NaN values withing the ocean area and make the map more detailed. (I have attached my code) Attached below is the map I got and the image below that is the one i expect .
  댓글 수: 2
Cris LaPierre
Cris LaPierre 2021년 11월 15일
I'm not convinced there are NaN values in the water. Instead, any land mass has been replaced with NaN except for right along the shore. Is there any way to get that elevation data back? That would make creating the desired plot easy.
load bathymatryGOF.mat
[Lat Lon] = meshgrid(lat_range,lon_range);
depth_range(isnan(depth_range)) = 10;
axesm('eqdcylin',"MapLatLimit",lat_range([1,end]),"MapLonLimit",lon_range([1,end]))
pcolorm(Lat,Lon,depth_range);
demcmap(depth_range)
tightmap
colorbar
Hasara kalpani Thennakoon Thennakoon Mudiyanselage
Thanks @Cris LaPierre. Here by I am sending the link to the originak nc file of global bathymatry data. And the code I used to extract my desired location
https://livettu-my.sharepoint.com/:u:/g/personal/hathen_ttu_ee/Ec4EnO-5jppKh2ObqccjaYUBS8V1mQ8JTbFY7bgPqwX7Qw?e=itACq8
ncfile='bsbd-0.9.3.nc';
ncdisp('bsbd-0.9.3.nc')
lon=ncread('bsbd-0.9.3.nc','lon');
lat=ncread('bsbd-0.9.3.nc','lat');
depth=ncread('bsbd-0.9.3.nc','depth');
lat_range=lat([1394:1730],:);
lon_range=lon([1949:2694],:);
depth_range=depth([1949:2694],[1394:1730])
pcolor(lat_range,lon_range,depth_range);
shading interp
camroll(90) t% rotate plot
set(gca, 'YDir','reverse')

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

답변 (2개)

Raj Bhakta
Raj Bhakta 2021년 11월 21일
A similiar question at StackOverflow might provide an answer
They used the TriScatteredInterp function in matlab and an inpaint_nans function from MATLAB central. https://www.mathworks.com/matlabcentral/fileexchange/4551-inpaint_nans

Cris LaPierre
Cris LaPierre 2021년 12월 21일
There is no elevation data in the nc file, just depth. If it is a matter of getting the coloring to match, you can use the plotting capabilities in the mapping toolbox combined with a custom colormap for the water to more closely approximate the original figure.
load bathymatryGOF.mat
[Lat Lon] = meshgrid(lat_range,lon_range);
depth_range(isnan(depth_range)) = 10;
% create map axes. Set lat/lon limits
axesm('eqdcylin',"MapLatLimit",lat_range([1,end]),"MapLonLimit",lon_range([1,end]))
pcolorm(Lat,Lon,depth_range);
% define custom colormap for sea (Based on colors in original figure)
cmapsea = [0.125 0.10 0.15;
0.25 0.45 0.55;
1 1 1];
% apply custom colormap
demcmap(depth_range,[],cmapsea,[])
tightmap
colorbar

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by