cdo sum
Added by Suvarna Tikle over 1 year ago
Dear All,
I would like to calculate sum of each sector for 12 months(Jan 2019 to Dec 2019) from ncfile. Ncfile consist of different sectors like agl, tro etc from Dec 2018 to Jan 2020. I have tried with below two commands but hard luck. It will helpful if you suggest how to do it or rectify the cdo commands used below to get output.
1.ncra -O -y ttl -d time,,,12, --mro NMVOC.nc tota_trail_NMVOC.nc and 2. cdo yearsum 2019 NMVOC.nc year_sum_trail.nc
ncdump of my file is below
ncdump -h NMVOC.nc
netcdf NMVOC {
dimensions:
lat = 16 ;
lon = 20 ;
time = 14 ;
variables:
float lat(lat) ;
lat:_FillValue = NaNf ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:axis = "Y" ;
float lon(lon) ;
lon:_FillValue = NaNf ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:axis = "X" ;
float time(time) ;
time:_FillValue = NaNf ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:axis = "T" ;
time:units = "hours since 1850-01-01" ;
time:calendar = "gregorian" ;
int64 spatial_ref ;
spatial_ref:crs_wkt = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]" ;
spatial_ref:semi_major_axis = 6378137. ;
spatial_ref:semi_minor_axis = 6356752.31424518 ;
spatial_ref:inverse_flattening = 298.257223563 ;
spatial_ref:reference_ellipsoid_name = "WGS 84" ;
spatial_ref:longitude_of_prime_meridian = 0. ;
spatial_ref:prime_meridian_name = "Greenwich" ;
spatial_ref:geographic_crs_name = "WGS 84" ;
spatial_ref:grid_mapping_name = "latitude_longitude" ;
spatial_ref:spatial_ref = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]" ;
spatial_ref:GeoTransform = "75.10000148572419 0.10000008030941612 0.0 22.2 0.0 0.1" ;
float agl(time, lat, lon) ;
agl:_FillValue = NaNf ;
agl:standard_name = "tendency_of_atmosphere_mass_content_of_nmvocs_due_to_emissions_from_agl_sector" ;
agl:long_name = "Emissions of NMVOCs for agl sector" ;
agl:units = "kg m-2 s-1" ;
agl:sector_name = "Agriculture livestock (mma)" ;
agl:cell_method = "time: sum (interval: 1 month comment: gregorian calendar) " ;
agl:molecular_weight = "72" ;
agl:grid_mapping = "spatial_ref" ;
float awb(time, lat, lon) ;
awb:_FillValue = NaNf ;
awb:standard_name = "tendency_of_atmosphere_mass_content_of_nmvocs_due_to_emissions_from_awb_sector" ;
awb:long_name = "Emissions of NMVOCs for awb sector" ;
awb:units = "kg m-2 s-1" ;
awb:sector_name = "Agricultural waste burning" ;
awb:cell_method = "time: sum (interval: 1 month comment: gregorian calendar) " ;
awb:molecular_weight = "72" ;
awb:grid_mapping = "spatial_ref" ;
Best,
Suvarna
Replies (3)
RE: cdo sum - Added by Karin Meier-Fleischer over 1 year ago
Hi Suvarna,
what about the operator yearsum? See https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#subsection.2.8.26
cdo -yearsum -selname,agl infile.nc outfile.nc
RE: cdo sum - Added by Suvarna Tikle over 1 year ago
Suvarna Tikle wrote in RE: cdo sum:
Thank you. It's work.