필터 지우기
필터 지우기

How to extract variable data for given set of coordinates?

조회 수: 1 (최근 30일)
Keegan Carvalho
Keegan Carvalho 2018년 10월 25일
편집: Keegan Carvalho 2018년 10월 26일
I'm currently working on Argo data. I used ncdisp to check the required variables and I need to extract Argo Temperature "TEMP" variable data for the coordinates: longitudes 60 E to 110 E and latitudes 5N to 25N.
I used ncread an checked that I need to get the TEMP data for longitudes 60.5 to 100.5 and latitudes 5.5 TO 25.5 since that is how the values are recorded in the "LONGITUDE" and "LATITUDE" variables. I would like some help on how to go about this and what codes to use.
Here's the link to the files for reference: http://apdrc.soest.hawaii.edu/projects/Argo/data/gridded/On_standard_levels/Monthly_mean/1x1/2016/m02/index.html > click on the third link (netCDF Data file)
The dimensions of the file are:
dimensions:
LONGITUDE = 360
LATITUDE = 180
LEVEL = 27

답변 (1개)

KSSV
KSSV 2018년 10월 26일
ncfile = 'ArgoData.nc';
lon = ncread(ncfile,'LONGITUDE') ; nx = length(lon) ; dx = min(diff(lon)) ;
lat = ncread(ncfile,'LATITUDE') ; ny = length(lat) ; dy = min(diff(lat)) ;
[X,Y] = meshgrid(lon,lat) ;
level = 27 ;
T = ncread(ncfile,'TEMP',[1,1,level],[nx,ny,1]) ;
xi = 60.5:dx:100.5 ;
yi = 5.5:dy:25.5 ;
[Xi,Yi] = meshgrid(xi,yi) ;
Ti = interp2(X,Y,T',Xi,Yi)' ;
figure(1)
pcolor(X,Y,T') ; shading interp;
figure(2)
pcolor(Xi,Yi,Ti') ; shading interp;
  댓글 수: 3
KSSV
KSSV 2018년 10월 26일
[1 1 level] means extract the chunk at given level i.e 27 here.
[nx ny 1] means extract the entire matrix...of size nx*ny.
Read about ncread in the documentation.
Keegan Carvalho
Keegan Carvalho 2018년 10월 26일
편집: Keegan Carvalho 2018년 10월 26일
Thanks KSSV. I wanted to find the coordinates (LATITUDE,LONGITUDE) and LEVEL at which TEMP~20°C. So I thought I could set LEVEL=1, 2.. 27 and find 20°C individually since the Ti file (generated using your code above) is 41x21.
Is there a faster and efficient way to do this with codes? Or should I go ahead with the above plan?

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

카테고리

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