Project

General

Profile

Subtracting lag/lead days (Question on SELDATE function)

Added by Lyndon Mark Olaguera over 2 years ago

Dear CDO experts,

I am creating lead lag files using bash and cdo.

Here's my script:

#!/bin/bash

file='test.txt'

i=1
while IFS= read -r line; do
echo $line

cdo sellevel,85000 -seldate,$line ../hgt/nc/hgt_jra55_jjas_daily_1979-2020.nc hgt_850hPa_$line.nc

i=$((i+1))
done < $file

The input (test.txt) containts dates such as:

1980-07-01

I would like to get some lag and lead dates, for example, 20 days before or 10 days after 1980-07-01.
How can I subtract "days" from the "seldate" command.

Is there a work around solution for this?

I'll appreciate any help.
Lyndz