Project

General

Profile

RE: Issue with climate data sets ยป run.sh

Jonathan Tinsley, 2023-06-30 18:27

 
#!/usr/bin/env bash

wrong_time='1980-01-01T00:00:00'

infiles=$(ls Tmin*.nc)

for f in $infiles
do
echo "$f\n----------------------------------"
outfile="${f%.nc}_remap.nc"

last_t=$(cdo -s -showtimestamp -seltimestep,-1 $f | sed -e 's/ //g')

cmd_deltime=""

if [ $last_t == $wrong_time ]; then
cmd_deltime="-seltimestep,1/-2"
echo "---- $f -- $cmd_deltime"
fi

cdo -setreftime,1980-01-01,00:00:00,1days \
-setcalendar,365_day \
${cmd_deltime} \
-del29feb \
$f $outfile
done
    (1-1/1)