I have a netCDF file with the foll. ncdump:
netcdf test_nc {
dimensions:
time = UNLIMITED ; // (20 currently)
latitude = 360 ;
longitude = 720 ;
N = 3 ;
strlen = 1 ;
variables:
float data_array(time, latitude, longitude, N) ;
data_array:_FillValue = -9999.f ;
data_array:units = "1" ;
data_array:long_name = "data_array" ;
char N(N, strlen) ;
double latitude(latitude) ;
latitude:standard_name = "latitude" ;
latitude:units = "degrees_north" ;
double longitude(longitude) ;
longitude:standard_name = "longitude" ;
longitude:units = "degrees_east" ;
double time(time) ;
time:standard_name = "time" ;
time:units = "days since 2000-01-01 00:00:00.0" ;
time:calendar = "gregorian" ;
}
How do I extract the last variable in the data_array
group? If I use ncks
, I can extract all of data_array
like this:
ncks -v data_array test_nc.nc output_nc.nc
However, I only want to extract the variable corresponding to N=3 in data_array
. Any solution using python netCDF4 or nco tools will work for me (but not using cdo), also needs to work on windows.