Create time axis and merging time axis for multiple files

There were files which has same repeated wrong time axis.

Each file has different year title, but it has same time axis inside.

(Can check with “show grid/t variable“)

So, this script is very super useful for gathering split files with wrong time axis.

 

<Example>

!Target files: SST.1991.nc, SST.1992.nc … SST.1999.nc

!Target year: 1991 to 1999

!Variable name and timestep: SST, daily

 

use “SST.1991.nc”     !First year

DEFINE AXIS/T=”1-JAN-1991“:”31-DEC-1999“:1/UNIT=day tannual
LET new_SST = SST[d=1,gt=tannual]
SAVE/clo/FILE=ALL.SST.1991-1999.nc new_SST[L=1:365]

let kk = 1
repeat/name=dd/range=2:9 (;\
use “SST.199`dd`.nc“;\
LET new_SST = SST[d=1,gt=tannual];\
SAVE/FILE=ALL.SST.1991-1999.nc/APPEND new_SST[L=`kk*365+1`:`(kk+1)*365`];\
let kk = `kk + 1`;\
can d 1;\
)

 

<Summary>

1. Make time axis

2. Set timesteps

3. Save

 

So, Simple 🙂

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.