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 Center および File ExchangeOrange についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by