Contour maps from Netcdf files
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
David du Preez
il 8 Feb 2017
Commentato: Star Strider
il 8 Feb 2017
I want to make a contour map of the TCO variable for 10 January 2007 from a Netcdf file. I also only want to display southern hemisphere latitudes.
I have tried the code below but it doesn't work.
ncdisp('BodekerScientificCombinedOzoneV3.0_2007_Unpatched.nc')
ncid1 = netcdf.open('BodekerScientificCombinedOzoneV3.0_2007_Unpatched.nc','NC_NOWRITE');
TCO1 = netcdf.getVar(ncid1,3,[0 0 0],[288 180 1]);
lon1 = netcdf.getVar(ncid1,1,0,180);
lat1 = netcdf.getVar(ncid1,0,0,288);
for p = 1:180
for q = 1:288
map1(q,p) = TCO1(p,q);
end
end
contour(lon1,lat1,map1)
0 Commenti
Risposta accettata
Star Strider
il 8 Feb 2017
You can eliminate the loop with the transpose function or operator ('):
map1 = TCO1';
You either need to reverse the first two arguments to use the transposed matrix:
contourf(lat1,lon1,map1)
or not transpose it to use your original code.
2 Commenti
Star Strider
il 8 Feb 2017
My pleasure.
Those refer to the contourf call. Generically:
contourf(Arg1, Arg2, Matrix)
so the first two arguments (inputs) are the vectors (or matrices) that create the x- and y-axes scales.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su NetCDF in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!