cropping nc4 file with shapefile in matlab

3 次查看(过去 30 天)
I want to crop my nc4 file according to my shapefile extent. I am trying this
file = 'GLDAS_NOAH10_3H.A20050102.0000.020.nc4' ;
lon = ncread(file,'lon') ;
lat = ncread(file,'lat') ;
RF = ncread(file,'SnowDepth_inst') ;
path = [pwd filesep 'indus_upper.shp'] ;
S = shaperead(path) ;
n = length(S) ;
[a,b]=meshgrid(S.Y,S.X);
myX=[a(:)];
myY=[b(:)];
%[Z, R] = vec2mtx(S.Y, S.X, 0.25, 'filled');
%for i = 1:length(myY)
% x = S(i).X ; y = S(i).Y ;
% plot(x,y,'k')
rfi = interp2(lon,lat,RF',myX,myY) ;
I am not sure about my making of meshgrid. Anybody tell me how can i resolve my problem?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by