Project

General

Profile

Splitting into timesteps

Added by Vassa Pupkunder about 6 years ago

Hello!

Now we must use
"cdo -splitsel,1 my.nc split_"
"cdo showtimesteps my.nc > list.txt"
and then to rename split_* files according to timesteps from the "list.txt".

Is there any smart way to split .nc file into timesteps using timesteps names for resulting filenames?


Replies (1)

RE: Splitting into timesteps - Added by Karin Meier-Fleischer about 6 years ago

Hi Vassa,

a short shell script will do it for you, e.g.

#!/bin/ksh

cdo showtimestamp my.nc > list.txt
cdo -splitsel,1 my.nc split_

times=($(cat list.txt))

x=0; for f in $(ls split_*.nc); do mv $f tas_${times[$x]}.nc; let x=$x+1; done

exit

-Karin

    (1-1/1)