How to extract variable data for given set of coordinates?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm currently working on Argo data. I used ncdisp to check the required variables and I need to extract Argo Temperature "TEMP" variable data for the coordinates: longitudes 60 E to 110 E and latitudes 5N to 25N.
I used ncread an checked that I need to get the TEMP data for longitudes 60.5 to 100.5 and latitudes 5.5 TO 25.5 since that is how the values are recorded in the "LONGITUDE" and "LATITUDE" variables. I would like some help on how to go about this and what codes to use.
Here's the link to the files for reference: http://apdrc.soest.hawaii.edu/projects/Argo/data/gridded/On_standard_levels/Monthly_mean/1x1/2016/m02/index.html > click on the third link (netCDF Data file)
The dimensions of the file are:
dimensions:
LONGITUDE = 360
LATITUDE = 180
LEVEL = 27
0 commentaires
Réponses (1)
KSSV
le 26 Oct 2018
ncfile = 'ArgoData.nc';
lon = ncread(ncfile,'LONGITUDE') ; nx = length(lon) ; dx = min(diff(lon)) ;
lat = ncread(ncfile,'LATITUDE') ; ny = length(lat) ; dy = min(diff(lat)) ;
[X,Y] = meshgrid(lon,lat) ;
level = 27 ;
T = ncread(ncfile,'TEMP',[1,1,level],[nx,ny,1]) ;
xi = 60.5:dx:100.5 ;
yi = 5.5:dy:25.5 ;
[Xi,Yi] = meshgrid(xi,yi) ;
Ti = interp2(X,Y,T',Xi,Yi)' ;
figure(1)
pcolor(X,Y,T') ; shading interp;
figure(2)
pcolor(Xi,Yi,Ti') ; shading interp;
3 commentaires
KSSV
le 26 Oct 2018
[1 1 level] means extract the chunk at given level i.e 27 here.
[nx ny 1] means extract the entire matrix...of size nx*ny.
Read about ncread in the documentation.
Voir également
Catégories
En savoir plus sur NetCDF 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!