Netcdf file, subregion selection
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello everybody,
Hope someone can help me out.
I have extracted a variable temp having dimensions 609 x 881 x 12 being lon x lat x depth respectively. This variable represents surface temperature over the arctic. I want to extract a subregion having this coordinates fram = (lon>=0 & lon<=20 & lat>=76 & lat<=80);
This is to have a final pcolot plot of the temperature in the region. Below what I did so far..
temp = ncread('topaz_V4_myocean_arctic_grid1to8_da_class1_20140115.nc','temperature');%%-------- change month!
temp_lev1 = temp(:,:,1);
LON = ncread('topaz_V4_myocean_arctic_grid1to8_da_class1_20140115.nc', 'longitude');
LAT = ncread('topaz_V4_myocean_arctic_grid1to8_da_class1_20140115.nc', 'latitude');
fram = (lon>=0 & lon<=20 & lat>=76 & lat<=80);
West = 0;
East = 20;
North= 80;
South = 76;
latmin = South;
latmax = North;
lonmin = West;
lonmax = East;
trovalat = LAT>=latmin & LAT<=latmax;
trovalon = LON>=lonmin & LON<=lonmax;
newlat = LAT(trovalat);
newlon = LON(trovalon);
[ix,iy] = meshgrid(newlon,newlat);
tempt = temp;
tempr = squeeze(tempt(:,trovalat,trovalon));
tempr (tempr == -32767)= NaN;
figure()
m_proj('MERCATOR', 'lon',[West East],'lat',[South North]);
hold on
m_pcolor (ix, iy, tempr)
shading interp;
colormap;
caxis([0 3])
t= colorbar ('eastoutside');
m_grid
Thank you!
0 commentaires
Réponses (0)
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!