mergetime data sets with some missing levels
Added by Matt Thompson almost 12 years ago
All,
I'm wondering if CDO can do something or not (my guess, not, but you never know). I have some station data (one grid point) that looks like this:
$ cdo sinfon LEF_200901_co2.nc4
File format: netCDF4 classic
-1 : Institut Source Ttype Levels Num Gridsize Num Dtype : Parameter name
1 : unknown unknown instant 6 1 1 1 F64 : CO2
2 : unknown unknown instant 6 1 1 1 F64 : Uncertainty
Grid coordinates :
1 : lonlat > size : dim = 1 nx = 1 ny = 1
lon : first = -90.2732 degrees_east
lat : first = 45.9451 degrees_north
Vertical coordinates :
1 : generic m : 11 30 76 122 244 396
Time coordinate : 744 steps
RefTime = 2009-01-01 00:00:00 Units = minutes Calendar = standard
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
2009-01-01 00:00:00 2009-01-01 01:00:00 2009-01-01 02:00:00 2009-01-01 03:00:00
2009-01-01 04:00:00 2009-01-01 05:00:00 2009-01-01 06:00:00 2009-01-01 07:00:00
2009-01-01 08:00:00 2009-01-01 09:00:00 2009-01-01 10:00:00 2009-01-01 11:00:00
2009-01-01 12:00:00 2009-01-01 13:00:00 2009-01-01 14:00:00 2009-01-01 15:00:00
...
So for the month of January, there is station data on 6 levels, and most months look like this. However, for some months, only certain levels are reported, e.g., July:
$ cdo sinfon LEF_200907_co2.nc4
File format: netCDF4 classic
-1 : Institut Source Ttype Levels Num Gridsize Num Dtype : Parameter name
1 : unknown unknown instant 3 1 1 1 F64 : CO2
2 : unknown unknown instant 3 1 1 1 F64 : Uncertainty
Grid coordinates :
1 : lonlat > size : dim = 1 nx = 1 ny = 1
lon : first = -90.2732 degrees_east
lat : first = 45.9451 degrees_north
Vertical coordinates :
1 : generic m : 30 122 396
Time coordinate : 744 steps
RefTime = 2009-07-01 00:00:00 Units = minutes Calendar = standard
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
2009-07-01 00:00:00 2009-07-01 01:00:00 2009-07-01 02:00:00 2009-07-01 03:00:00
2009-07-01 04:00:00 2009-07-01 05:00:00 2009-07-01 06:00:00 2009-07-01 07:00:00
2009-07-01 08:00:00 2009-07-01 09:00:00 2009-07-01 10:00:00 2009-07-01 11:00:00
...
Note how for July, only 30, 122, and 396 levels are reported.
A straight mergetime fails, of course:
$ cdo mergetime LEF_200901_co2.nc4 LEF_200907_co2.nc4 test.nc4 cdo mergetime (Abort): Input streams have different number of records per timestep!
but what I'd like in the end is to mergetime all the monthly files into a single yearly file, and, where months are missing levels, have missing value for those levels for that month.
Obviously, the challenge is the "adding missing levels". Once that is done, mergetime can do the rest. Is there a good way to do this with CDO, or would it be easier to write a netCDF Python script, say, to just make new files based on the old ones where I create and fill in the missing levels.
Thanks,
Matt
Replies (2)
RE: mergetime data sets with some missing levels - Added by Jaison-Thomas Ambadan almost 12 years ago
did you try merge instead of mergetime ?
RE: mergetime data sets with some missing levels - Added by Jaison-Thomas Ambadan almost 12 years ago
I guess most likely that won't work, sorry. I had a similar situation (merging different levels of same variable) but has same time stamp.