Contour maps from Netcdf files
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Star Strider
2017-2-8
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 个评论
Star Strider
2017-2-8
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NetCDF 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!