Netcdf file, subregion selection
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu NetCDF finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!