Project

General

Profile

how to split a dataset based on the value of a field?

Added by Natalia L about 5 years ago

Hi,

I have a netcdf file containing an emission database. So, the file includes several fields like lon, lat, country, emis_cat_shortsnap, pollutant1, pollutant2 etc.

The emission categories are 10. So I want to generate separate datasets for each one of the ten categories keeping also all the other fields(lon,lat,pollutant etc). I tried to use the splitcode or selvar with no success.

For example,

cdo select,name=emis_cat_shortsnap,selcode,8 $Database_maindir/"data.nc" $Database_maindir/"data_snap8.nc"

creates a file containing only the emis_cat_shortsnap field. No other fields. The same occurs when using splitcode.

Thank you,
Natalia


Replies (1)

RE: how to split a dataset based on the value of a field? - Added by Karin Meier-Fleischer about 5 years ago

Hi Natalia,

without your data it is not possible to help unless your cdo example will result in an error. The select operator do not accept selcode it only accepts code, so do you mean

cdo select,name=emis_cat_shortsnap,code=8 $Database_maindir/data.nc $Database_maindir/data_snap8.nc
What is the number 8, a code number? Or is it the value of a variable? Please, upload the input data and some more explanations.

-Karin

    (1-1/1)