Project

General

Profile

Creating a loop to use cdo commands » 05_whole_ts5.sh

Mudit Mudit, 2022-02-22 10:06

 
#!/bin/bash
tmpdir=./tmp5
mkdir -p $tmpdir
for year in $(seq -w 1961 2014) ; do
echo $year
cdo -seltimestep,49/60 pr_Amon_BCC-CSM2-MR_dcppA-hindcast_s${year}-r1i1p1f1_gn_${year}01-$((year+9))12.nc $tmpdir/series${year}.nc
done
cd $tmpdir
cdo mergetime '*.nc' series_s1961_t5.nc

cdo remapbil,/run/media/mudit/BackupPlus/PhD_Works/data_cmip6/data_dcpp/data_dcpp_pr/BCC-CSM2-MR_dcppA-hindcast/newgrid1deg.txt series_s1961_t5.nc series_s1961_t5_pr.nc

cdo -ymonsub series_s1961_t5_pr.nc -ymonmean series_s1961_t5_pr.nc series_s1961_t5_BCC-CSM2-MR_pr_anom.nc

cdo detrend series_s1961_t5_BCC-CSM2-MR_pr_anom.nc series_s1961_t5_BCC-CSM2-MR_pr_anom_detrend.nc

cdo yearmean -selmon,6/9 series_s1961_t5_BCC-CSM2-MR_pr_anom_detrend.nc series_s1961_t5_BCC-CSM2-MR_pr_jjas_mean_anom_detrend.nc

cdo sellonlatbox,70,90,10,30 series_s1961_t5_BCC-CSM2-MR_pr_jjas_mean_anom_detrend.nc series_s1961_t5_BCC-CSM2-MR_pr_jjas_mean_anom_detrend_ismr.nc

cdo fldavg series_s1961_t5_BCC-CSM2-MR_pr_jjas_mean_anom_detrend_ismr.nc series_s1961_t5_BCC-CSM2-MR_pr_jjas_mean_anom_detrend_ismr_index.nc

rm -rf series_s1961_t5_BCC-CSM2-MR_pr_jjas_mean_anom_detrend_ismr.nc
rm -rf series_s1961_t5_BCC-CSM2-MR_pr_jjas_mean_anom_detrend.nc
rm -rf series_s1961_t5_BCC-CSM2-MR_pr_anom_detrend.nc
rm -rf series_s1961_t5_BCC-CSM2-MR_pr_anom.nc
rm -rf series_s1961_t5.nc

exit 0
(1-1/6)