필터 지우기
필터 지우기

Contour maps from Netcdf files

조회 수: 1 (최근 30일)
David du Preez
David du Preez 2017년 2월 8일
댓글: Star Strider 2017년 2월 8일
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)

채택된 답변

Star Strider
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
David du Preez
David du Preez 2017년 2월 8일
Thank you. The first part makes sense.
Which lines are you referring to by saying "the first two arguments"
Star Strider
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 CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by