필터 지우기
필터 지우기

opening 5D netcdf array

조회 수: 1 (최근 30일)
Yasmin Samy
Yasmin Samy 2019년 2월 4일
편집: Yasmin Samy 2019년 2월 4일
Hello all,
So i have this netcdf file that is a 5D array (longitude,latitude,level, bin, time). I was using ncread to open the 5D array but i have a specific long and lat where i want to extract a 3D array (level, bin, time).....displaying it as (level,time) as y and x and bin as z.
I`d be happy to further clarify the question.
%filename
source='C:/Users/Output_20150501.nc'
%no. of vertical levels
ltop = 30
%no. of bins
nbins=40
%reading the variables
lat=ncread(source,'latitude');
lon=ncread(source,'longitude');
t=ncread(source,'time');
%Enter station details
la =80.054;
lo = -86.417;
stn = 'PL_May';
%find the index for the values of la and lo
% [minValue,closestIndex]
[~,I]=min(abs(lat-la));
[~,I2]=min(abs(lon-lo)); % these two lines are to find the index of the closest values to the specified lon and lat...let me know if there is a better way
%%
%reading the variables
aeroNum = ncread(source,'aNum');
a=aNum(lo,la,:,:,:) %this line didn`t work - i get another 5D array

답변 (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