How to read single time steps from NETCDF data?

조회 수: 11 (최근 30일)
Arielle Patapanian
Arielle Patapanian 2020년 7월 11일
댓글: Arielle Patapanian 2020년 7월 11일
Hello! I have a netCDF file with the following dimensions and variables below. I would like to extract evaporation data for the latitude and longitude for each time step. I.e. I would the output to be a 841 x 681 grid containing evaporation data for each time step. I know there will be a lot of grids but ideally I would be able to choose which timesteps I want.
I have tried some code which I have attached below, but all I get is a 841 x 681 grid with NaN outputs. Any help would be greatly appreciated as I am very unfamilar with .NC files. Thanks so much!
Dimensions:
time = 1313 (UNLIMITED)
nv = 2
latitude = 681
longitude = 841
Variables:
time
Size: 1313x1
Dimensions: time
Datatype: int32
Attributes:
name = 'time'
bounds = 'time_bounds'
standard_name = 'time'
units = 'days since 1900-01-01'
long_name = 'time'
calendar = 'gregorian'
latitude
Size: 681x1
Dimensions: latitude
Datatype: double
Attributes:
name = 'latitude'
standard_name = 'latitude'
long_name = 'latitude'
units = 'degrees_north'
longitude
Size: 841x1
Dimensions: longitude
Datatype: double
Attributes:
name = 'longitude'
standard_name = 'longitude'
long_name = 'longitude'
units = 'degrees_east'
time_bounds
Size: 2x1313
Dimensions: nv,time
Datatype: int32
etot
Size: 841x681x1313
Dimensions: longitude,latitude,time
Datatype: single
Attributes:
name = 'etot'
standard_name = 'etot'
long_name = 'etot'
units = 'mm'
_FillValue = -999
I have tried the following code:
ncdisp('etot.nc')
lon = ncread('etot.nc','longitude') ;
lat = ncread('etot.nc','latitude') ;
time_all = ncread('etot.nc','time') ;
etot_all = ncread('etot.nc','etot');
%%
startLoc = [1 1 1312]
count = [Inf Inf 1]
etot = ncread('etot.nc','etot',startLoc,count)
%dbstop if naninf
squeeze(etot_all(:,:,1313))
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 7월 11일
Can you zip your netcdf file and attach it, or alternately post a link to where it can be found?
Arielle Patapanian
Arielle Patapanian 2020년 7월 11일
Hi!
Any year can be chosen , and then choose 'evaporation' and 'modelled landscape actual evaporation'
Thanks so much!

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

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