CDO combined commands not working
I am working in R and have netCDF files that I need to pre-process beforehand.
One file can be downloaded here: https://drive.google.com/file/d/14tbMvFaYSvHpDWTOdbSSdverkowEhNyV/view?usp=share_link
There are daily 0.25 ERA5 variables:
class : RasterBrick
dimensions : 720, 1440, 1036800, 365 (nrow, ncol, ncell, nlayers)
resolution : 0.25, 0.25 (x, y)
extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
crs : +proj=longlat +datum=WGS84 +no_defs
source : t2m.daily.an.era5.1440.720.2018.nc
names : X2018.01.01, X2018.01.02, X2018.01.03, X2018.01.04, X2018.01.05, X2018.01.06, X2018.01.07, X2018.01.08, X2018.01.09, X2018.01.10, X2018.01.11, X2018.01.12, X2018.01.13, X2018.01.14, X2018.01.15, ...
Date : 2018-01-01, 2018-12-31 (min, max)
varname : t2m
I need to remap from 0.25 to 0.5 + select a specific area.
I have tried the following with CDO:
#!/bin/sh
var=$1
yr=$2
name=$3
flist=/****/****/**/0d25_daily/${var}/${var}.daily.an.era5.1440.720.${yr}*
for f in $flist; do
echo $f
cdo -remapbil,r720x360 -sellonlatbox,-80,10,-20,15 $f ${name}_daily_ERA5_${yr}.nc
done
however when I open the file in R, I get 0 layers while normally for one year I should get a layer per day.
class : RasterBrick
dimensions : 360, 720, 259200, 0 (nrow, ncol, ncell, nlayers)
resolution : 0.5, 0.5 (x, y)
extent : -180.25, 179.75, -90, 90 (xmin, xmax, ymin, ymax)
crs : +proj=longlat +datum=WGS84 +no_defs
source : Tair_daily_ERA5_2018.nc
names : layer
varname : t2m