Project

General

Profile

Split by initial time

Added by Sam Hawkins almost 12 years ago

I have some grib files which contain many 72-hour forecasts from different initial times. I would like to split them into one time per file, named according to the initial time and the forecast hour e.g

2006-01-01_00_fhr00.grb
2006-01-01_00_fhr03.grb
...
2006-01-01_00_fhr72.grb

2006-01-01_12_fhr00.grb
2006-01-01_12_fhr03.grb
...
2006-01-01_12_fhr72.grb

However, the cdo split tools seem to combine the intial time and forecast time into a single (ambiguous) time stamp. Is there a way to split based on the initial time?


Replies (4)

RE: Split by initial time - Added by Jaison-Thomas Ambadan almost 12 years ago

Hi Sam,

Can you please upload a sample of your data? If the file size is > 50MB, you may select a very small geographical region using "cdo -sellonlatbox".

Cheers,
J.

RE: Split by initial time - Added by Jaison-Thomas Ambadan almost 12 years ago

Hi Sam,

The following command sequence may work for you-

cdo -splitsel,1 sample_out.grb oufile

will split into 400 files (total time-step is 400); so the first file "oufile000000.grb" (you can rename it later with linux commands) corresponds to "2006-01-01_00_fhr00.grb" and "oufile000002.grb" -> "2006-01-01_00_fhr03.grb" etc

I'm not sure if this is what you want. Also there are other options in "splitsel" operator
--------------------------------
if you want to split your input file according to initlal time:

cdo -splitsel,25 sample_out.grb oufile

You will get 16 files (you can rename it afterwards using linux commands), each with 25 time-steps (which is 1 initial time + 24 *3hour forecast). Your input file contains 400 time-step -> 16 files of 25 timestep

Please let us know if this works for you,

Cheers,
J.

RE: Split by initial time - Added by Sam Hawkins almost 12 years ago

Hi,

Yes this works. I used cdo -splitsel,1 to split each file into the individual timesteps, then a rather ugly combination of cdo sinfo, grep and python to rename them all according to initial time.

Thanks for the help.

    (1-4/4)