cropping nc4 file with shapefile in matlab

3 vues (au cours des 30 derniers jours)
Muhammad Usman Saleem
Muhammad Usman Saleem le 25 Fév 2017
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?
  1 commentaire
Muhammad Usman Saleem
Muhammad Usman Saleem le 25 Fév 2017
my shapefile and nc4 file attached with this post

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by