How to extract variable data for given set of coordinates?

2 ビュー (過去 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 Center および File ExchangeNetCDF についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by