필터 지우기
필터 지우기

mask the data relating to the contour of the continents

조회 수: 6 (최근 30일)
Carlos Batista
Carlos Batista 2014년 7월 11일
답변: Chad Greene 2014년 12월 5일
Does anyone have a solution to mask the data relating to the contour of the continents of a netcdf file?
  댓글 수: 1
Carlos Batista
Carlos Batista 2014년 7월 11일
I'm having a doubt that the following (...)
I am using netcdf data of sea surface temperature (SST) of the entire globe. I have these file data of SST and the values of the contours of the continents (32767 values).
I write this for this script
NCID netcdf.open = ('anom.sst.nc', 'NC_NOWRITE'); %%%%%%%% LONGITUDE [sst, xtype, varDimIDs, varAtts] = netcdf.inqVar (NCID, 0); varid = netcdf.inqVarID (NCID, sst); Lonn = double (netcdf.getVar (NCID, varid));
%%%%%%%% LATITUDE [sst, xtype, varDimIDs, varAtts] = netcdf.inqVar (NCID, 1); varid = netcdf.inqVarID (NCID, sst); LATN = double (netcdf.getVar (NCID, varid));
%%% time [sst, xtype, varDimIDs, varAtts] = netcdf.inqVar (NCID, 2);
%%% time [sst, xtype, varDimIDs, varAtts] = netcdf.inqVar (NCID, 3);
%%% time [sst, xtype, varDimIDs, varAtts] = netcdf.inqVar (NCID, 4);
varid = netcdf.inqVarID (NCID, sst); % Open my date data = double (netcdf.getVar (NCID, varid));
%%%%%%%%%%%%%%%%%%%% My question is: How to inform pro Matlab does not consider the values of the contours of the continents?

댓글을 달려면 로그인하십시오.

채택된 답변

Chad Greene
Chad Greene 2014년 7월 11일
Perhaps inpolygon will do it?
  댓글 수: 2
Carlos Batista
Carlos Batista 2014년 7월 11일
Thanks Chad for your answer!!
Chad, the inpolygon isn't only for graphics? I need inform in matrix of Matlab that the value 32767 not is considerable!!! How declare for the matlab matrix that an value don't is considerable ??
Thanks again!
Chad Greene
Chad Greene 2014년 7월 11일
Perhaps I misunderstood your question. Here is what I thought:
My assumption was that you have a grid of SST data, a corresponding grid of latitudes, a grid of longitudes, and 32767 points that define the outline of the continents. If this is true, inpolygon should tell you which grid points are inside the outline of the continents.
But I think I misunderstood. If you have a grid where all land values are given the value 32767, set them to NaN by
SST(SST==32767)=NaN;
Then you can plot sea surface temperatures easily with pcolor or pcolorm.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Chad Greene
Chad Greene 2014년 12월 5일
Another solution is the landmask function on FEX.

Community Treasure Hunt

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

Start Hunting!

Translated by