Subsetting a region using ncea netcedf command
Subsetting a region using ncea netcedf command
Hi all
I have a typical result roms_his_Y1M1.nc for the Benguela ROMS example.
I want to reduce the area of this domain directly from the out netcdf file.
Looking for do this, I found this information (see : http://jisao.washington.edu/data/nco/)
_______________________________________________________________________________________________________
10) Subsetting a region or time, and decimating.
Subsetting a region of an array is handled differently than subsetting time.
i) Subsetting a region
Say you have a global dataset, and you only want the data for the northeast portion of the Pacific cean.
ncea -d lat,minimum_lat,maximum_lat -d lon,minimum_lon,maximum_lon in.nc out.nc
where "lat" is what latitudes are called your file, and minimum_lat and maximum_lat are latitudes. Integer latitudes/longitudes are treated as indices, and floating point latitudes/longitudes are actual latitudes/longitudes. An example is in the NCO documentation.
__________________________________________________________________________________
The Benguela exaple has these values from my romstools_params.m file:
lonmin = 8; % Minimum longitude [degree east]
lonmax = 22; % Maximum longitude [degree east]
latmin = -38; % Minimum latitude [degree north]
latmax = -26; % Maximum latitude [degree north]
Therefore, if I want to reduce this domain by one unit for each side, I guess must write:
ncea -d lat,9,21 -d lon,-37,-27 roms_his_Y1M1.nc roms_his_Y1M1_out.nc
But I get the following error:
ncea: ERROR dimension lat is not in input file
I think that I need the lat and lon values...
Who can tell me how to solve the problem? I would appreciate your help.
Thanks in advance,
Re: Subsetting a region using ncea netcedf command
Your problem is with dimensions. The correct dimensions are eta_rho, xi_rho for the rho variables.
The syntaxis is for example
ncea -d eta_rho,1,10 -d xi_rho,1,10 roms_his_Y1M1.nc out.nc
where 1 and 10 are index for this dimension. You should consider the xi_u and eta_v and agree in the syntaxis.
regards
The syntaxis is for example
ncea -d eta_rho,1,10 -d xi_rho,1,10 roms_his_Y1M1.nc out.nc
where 1 and 10 are index for this dimension. You should consider the xi_u and eta_v and agree in the syntaxis.
regards