How to set missing days with mergetime
Added by Fredrick AJ. almost 7 years ago
Hi Guys,
I am using:
cdo mergetime infiles*.nc janfiles.nc
to merge daily data files starting from day 11 through 25 in a January month. How can I include missing data days ie. 1 through 10 and 26 through 31?
Thanks
Faj
Replies (2)
RE: How to set missing days with mergetime - Added by Karin Meier-Fleischer almost 7 years ago
Hi Faj,
hm, you have to create the missing timesteps with variables having only missing data which I would do within a Korn Shell script like
#!/bin/ksh #-- merge your jan files cdo mergetime infiles*.nc janfiles.nc #-- create 1 timestep with missing values cdo -setctomiss,1e20 -addc,1e20 -mulc,0 -seltimestep,1 janfiles.nc tmp_1tstep.nc #-- copy janfiles.nc to temporary file cp janfiles.nc ooo1.nc #-- create and add missing files 1 to 10 for i in $(seq 1 10) do cdo -O -mergetime -settaxis,2000-01-${i},12:00:00,1day tmp_1tstep.nc ooo1.nc tmp.nc mv tmp.nc ooo1.nc done #-- create and add missing files 26 to 31 for i in $(seq 26 31) do cdo -O -mergetime -settaxis,2000-01-${i},12:00:00,1day tmp_1tstep.nc ooo1.nc tmp.nc mv tmp.nc ooo1.nc done #-- rename temporary file ooo1.nc to janfiles.nc containing now 31 timesteps mv ooo1.nc janfiles #-- delete temporary file tmp_1tstep.nc rm -rf tmp_1tstep.nc exit
-Karin
RE: How to set missing days with mergetime - Added by Fredrick AJ. almost 7 years ago
Thanks Karin,
for the hint and code..
Best regards
Faj