-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheavydays_CDOs.py
64 lines (45 loc) · 4.5 KB
/
heavydays_CDOs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################
# DATA ANALYSIS - VERY WET MONSOON SEASONS IN INDIA #
# RESULTS PUBLISHED IN GEOPHYSICAL RESEARCH LETTERS #
# Code by Anja Katzenberger #
###############################################################
#Link to publication:
#https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2022GL098856
# heavy days: more than 40mm and less than 100mm
import subprocess
import os
dir = "/p/tmp/anjaka/Extremes/CMIP6_day/SecondaryData/analysis"
models = ["NESM3", "MIROC6", "INM-CM5-0", "GFDL-CM4", "EC-Earth3-Veg", "CESM2-WACCM"]
for model in models:
cdo_gtc_h = "cdo -O gtc,40 pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015_gtc40.nc"
cdo_gtc_f = "cdo -O gtc,40 pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100_gtc40.nc"
cdo_ltc_h = "cdo -O ltc,100 pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015_ltc100.nc"
cdo_ltc_f = "cdo -O ltc,100 pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100_ltc100.nc"
cdo_eq_h = "cdo -O eq pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015_gtc40.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015_ltc100.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015_gtc40_ltc100_eq.nc"
cdo_eq_f = "cdo -O eq pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100_gtc40.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100_ltc100.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100_gtc40_ltc100_eq.nc"
cdo_timsum_h = "cdo -O timsum pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015_gtc40_ltc100_eq.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015_gtc40_ltc100_eq_timsum.nc"
cdo_timsum_f = "cdo -O timsum pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100_gtc40_ltc100_eq.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100_gtc40_ltc100_eq_timsum.nc"
cdo_sub = "cdo -O sub pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100_gtc40_ltc100_eq_timsum.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015_gtc40_ltc100_eq_timsum.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_gtc40_ltc100_eq_timsum_sub.nc"
cdo_div = "cdo -O div pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_gtc40_ltc100_eq_timsum_sub.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015_gtc40_ltc100_eq_timsum.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_gtc40_ltc100_eq_timsum_sub_div.nc"
cdo_fld = "cdo -O fldmean pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_gtc40_ltc100_eq_timsum_sub.nc pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_gtc40_ltc100_eq_timsum_sub_fldmean.nc"
subprocess.check_call(cdo_gtc_h, shell=True)
subprocess.check_call(cdo_gtc_f, shell=True)
subprocess.check_call(cdo_ltc_h, shell=True)
subprocess.check_call(cdo_ltc_f, shell=True)
subprocess.check_call(cdo_eq_h, shell=True)
subprocess.check_call(cdo_eq_f, shell=True)
subprocess.check_call(cdo_timsum_h, shell=True)
subprocess.check_call(cdo_timsum_f, shell=True)
subprocess.check_call(cdo_sub, shell=True)
subprocess.check_call(cdo_div, shell=True)
subprocess.check_call(cdo_fld, shell=True)
#os.remove("pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_1965-2015_gtc40_ltc100_eq.nc")
#os.remove("pr_day_" + model + "_ssp585_JJAS_remapcon_India_mask_mul_2050-2100_gtc40_ltc100_eq.nc")
cdo_ens_div = "cdo -O ensmean *gtc40_ltc100_eq_timsum_sub_div.nc pr_day_ssp585_JJAS_remapcon_India_mask_mul_gtc40_ltc100_eq_timsum_sub_div_ensmean.nc"
cdo_ens_sub = "cdo -O ensmean *gtc40_ltc100_eq_timsum_sub.nc pr_day_ssp585_JJAS_remapcon_India_mask_mul_gtc40_ltc100_eq_timsum_sub_ensmean.nc"
cdo_fld = "cdo -O fldmean pr_day_ssp585_JJAS_remapcon_India_mask_mul_gtc40_ltc100_eq_timsum_sub_ensmean.nc pr_day_ssp585_JJAS_remapcon_India_mask_mul_gtc40_ltc100_eq_timsum_sub_ensmean_fldmean.nc"
subprocess.check_call(cdo_ens_div, shell=True)
subprocess.check_call(cdo_ens_sub, shell=True)
subprocess.check_call(cdo_fld, shell=True)