How to extract single years and corresponding data out of a netcdf file?

2 Ansichten (letzte 30 Tage)
Hi!
I have a netcdf file with the following variables. Etot (evaporation total data) is the data I am after. Ideally I would like to create a series of arrays for each time step.
The array/grid would have the dimensions of the latitude and longitude (i.e. be 681 x 841), and contain the evaporation data for each time step.
So far all I've done is read in the netcdf variables.
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
This is the code I'm trying to run, but I'm just getting a NaN matrix of the dimensions 841 x 681 (the dimensions I want)
ncdisp('e0.nc')
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)

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by