|
| 1 | +""" |
| 2 | +This script sets up and runs a series of diagnostics for the E3SM model output. |
| 3 | +
|
| 4 | +The diagnostics include: |
| 5 | +- ENSO diagnostics |
| 6 | +- Tropical subseasonal variability diagnostics |
| 7 | +- QBO diagnostics |
| 8 | +- Diurnal cycle diagnostics |
| 9 | +- Streamflow diagnostics |
| 10 | +- Tropical cyclone analysis |
| 11 | +- ARM diagnostics |
| 12 | +
|
| 13 | +The script configures the parameters for each diagnostic, including paths to |
| 14 | +model output and observational data, time periods for analysis, and output |
| 15 | +settings. It then runs the diagnostics using the e3sm_diags package. |
| 16 | +
|
| 17 | +Parameters: |
| 18 | +- case: The name of the model case. |
| 19 | +- short_name: A short name for the model case. |
| 20 | +- results_dir: Directory where the results will be saved. |
| 21 | +- test_climo: Path to the model climatology data. |
| 22 | +- test_ts: Path to the model time-series data. |
| 23 | +- test_ts_daily_dir: Path to the model daily time-series data. |
| 24 | +- ref_climo: Path to the reference climatology data. |
| 25 | +- ref_ts: Path to the reference time-series data. |
| 26 | +- start_yr: Start year for the analysis. |
| 27 | +- end_yr: End year for the analysis. |
| 28 | +
|
| 29 | +The script uses multiprocessing to speed up the diagnostics computation. |
| 30 | +
|
| 31 | +Example usage: |
| 32 | + python complete_run_script.py |
| 33 | +""" |
| 34 | + |
| 35 | +from e3sm_diags.parameter.arm_diags_parameter import ARMDiagsParameter |
| 36 | +from e3sm_diags.parameter.core_parameter import CoreParameter |
| 37 | +from e3sm_diags.parameter.diurnal_cycle_parameter import DiurnalCycleParameter |
| 38 | +from e3sm_diags.parameter.enso_diags_parameter import EnsoDiagsParameter |
| 39 | +from e3sm_diags.parameter.qbo_parameter import QboParameter |
| 40 | +from e3sm_diags.parameter.streamflow_parameter import StreamflowParameter |
| 41 | +from e3sm_diags.parameter.tc_analysis_parameter import TCAnalysisParameter |
| 42 | +from e3sm_diags.parameter.tropical_subseasonal_parameter import ( |
| 43 | + TropicalSubseasonalParameter, |
| 44 | +) |
| 45 | +from e3sm_diags.run import runner |
| 46 | + |
| 47 | +case = "extendedOutput.v3.LR.historical_0101" |
| 48 | +short_name = "v3.LR.historical_0101" |
| 49 | +results_dir = "/global/cfs/cdirs/e3sm/www/chengzhu/tutorial2024/e3sm_diags_extended_int" |
| 50 | + |
| 51 | +test_climo = "/global/cfs/cdirs/e3sm/chengzhu/tutorial2024/v3.LR.historical_0101/post/atm/180x360_aave/clim/15yr" |
| 52 | +test_ts = "/global/cfs/cdirs/e3sm/chengzhu/tutorial2024/v3.LR.historical_0101/post/atm/180x360_aave/ts/monthly/15yr" |
| 53 | +test_ts_daily_dir = "/global/cfs/cdirs/e3sm/chengzhu/tutorial2024/v3.LR.historical_0101/post/atm/180x360_aave/ts/daily/15yr" |
| 54 | + |
| 55 | +ref_climo = "/global/cfs/cdirs/e3sm/diagnostics/observations/Atm/climatology/" |
| 56 | +ref_ts = "/global/cfs/cdirs/e3sm/diagnostics/observations/Atm/time-series" |
| 57 | + |
| 58 | +start_yr = "2000" |
| 59 | +end_yr = "2014" |
| 60 | + |
| 61 | +param = CoreParameter() |
| 62 | + |
| 63 | +# Model |
| 64 | +param.test_data_path = test_climo |
| 65 | +param.test_name = case |
| 66 | +param.short_test_name = short_name |
| 67 | + |
| 68 | +# Ref/Obs |
| 69 | +param.reference_data_path = ref_climo |
| 70 | + |
| 71 | +# Output dir |
| 72 | +param.results_dir = results_dir |
| 73 | + |
| 74 | +# Additional settings |
| 75 | +param.run_type = "model_vs_obs" |
| 76 | +param.diff_title = "Model - Observations" |
| 77 | +param.output_format = ["png"] |
| 78 | +param.output_format_subplot = [] |
| 79 | +param.multiprocessing = True |
| 80 | +param.num_workers = 24 |
| 81 | +param.seasons = ["ANN"] |
| 82 | +params = [param] |
| 83 | + |
| 84 | +# Model |
| 85 | +enso_param = EnsoDiagsParameter() |
| 86 | +enso_param.test_data_path = test_ts |
| 87 | +# enso_param.test_name = short_name |
| 88 | +enso_param.test_start_yr = start_yr |
| 89 | +enso_param.test_end_yr = end_yr |
| 90 | + |
| 91 | +# Obs |
| 92 | +enso_param.reference_data_path = ref_ts |
| 93 | +enso_param.ref_start_yr = start_yr |
| 94 | +enso_param.ref_end_yr = end_yr |
| 95 | + |
| 96 | +params.append(enso_param) |
| 97 | + |
| 98 | +trop_param = TropicalSubseasonalParameter() |
| 99 | +trop_param.test_data_path = test_ts_daily_dir |
| 100 | +# trop_param.test_name = short_name |
| 101 | +trop_param.test_start_yr = start_yr |
| 102 | +trop_param.test_end_yr = end_yr |
| 103 | + |
| 104 | +# Obs |
| 105 | +trop_param.reference_data_path = ref_ts |
| 106 | +trop_param.ref_start_yr = "2001" |
| 107 | +trop_param.ref_end_yr = "2010" |
| 108 | + |
| 109 | +params.append(trop_param) |
| 110 | +qbo_param = QboParameter() |
| 111 | +qbo_param.test_data_path = test_ts |
| 112 | +# qbo_param.test_name = short_name |
| 113 | +qbo_param.test_start_yr = start_yr |
| 114 | +qbo_param.test_end_yr = end_yr |
| 115 | +qbo_param.ref_start_yr = start_yr |
| 116 | +qbo_param.ref_end_yr = end_yr |
| 117 | + |
| 118 | +# Obs |
| 119 | +qbo_param.reference_data_path = ref_ts |
| 120 | + |
| 121 | +params.append(qbo_param) |
| 122 | +dc_param = DiurnalCycleParameter() |
| 123 | +dc_param.test_data_path = "/global/cfs/cdirs/e3sm/chengzhu/tutorial2024/v3.LR.historical_0101/post/atm/180x360_aave/clim_diurnal_8xdaily/" |
| 124 | +# dc_param.short_test_name = short_name |
| 125 | +# Plotting diurnal cycle amplitude on different scales. Default is True |
| 126 | +dc_param.normalize_test_amp = False |
| 127 | + |
| 128 | +# Obs |
| 129 | +dc_param.reference_data_path = ref_climo |
| 130 | + |
| 131 | +params.append(dc_param) |
| 132 | +streamflow_param = StreamflowParameter() |
| 133 | +streamflow_param.reference_data_path = ref_ts |
| 134 | +streamflow_param.test_data_path = "/global/cfs/cdirs/e3sm/chengzhu/tutorial2024/v3.LR.historical_0101/post/rof/native/ts/monthly/15yr/" |
| 135 | +# streamflow_param.test_name = short_name |
| 136 | +streamflow_param.test_start_yr = start_yr |
| 137 | +streamflow_param.test_end_yr = end_yr |
| 138 | + |
| 139 | +# Obs |
| 140 | +streamflow_param.reference_data_path = ref_ts |
| 141 | +streamflow_param.ref_start_yr = ( |
| 142 | + "1986" # Streamflow gauge station data range from year 1986 to 1995 |
| 143 | +) |
| 144 | +streamflow_param.ref_end_yr = "1995" |
| 145 | + |
| 146 | +params.append(streamflow_param) |
| 147 | +tc_param = TCAnalysisParameter() |
| 148 | +tc_param.test_data_path = "/global/cfs/cdirs/e3sm/chengzhu/tutorial2024/v3.LR.historical_0101/post/atm/tc-analysis_2000_2014" |
| 149 | +# tc_param.short_test_name = short_name |
| 150 | +tc_param.test_start_yr = start_yr |
| 151 | +tc_param.test_end_yr = end_yr |
| 152 | + |
| 153 | +# Obs |
| 154 | +tc_param.reference_data_path = ( |
| 155 | + "/global/cfs/cdirs/e3sm/diagnostics/observations/Atm/tc-analysis/" |
| 156 | +) |
| 157 | +# For model vs obs, the ref start and end year can be any four digit strings |
| 158 | +# For now, use all available years from obs by default |
| 159 | +tc_param.ref_start_yr = "1979" |
| 160 | +tc_param.ref_end_yr = "2018" |
| 161 | + |
| 162 | +params.append(tc_param) |
| 163 | + |
| 164 | +arm_param = ARMDiagsParameter() |
| 165 | +arm_param.reference_data_path = ( |
| 166 | + "/global/cfs/cdirs/e3sm/diagnostics/observations/Atm/arm-diags-data" |
| 167 | +) |
| 168 | +arm_param.ref_name = "armdiags" |
| 169 | +arm_param.test_data_path = ( |
| 170 | + "/global/cfs/cdirs/e3sm/chengzhu/tutorial2024/v3.LR.historical_0101/post/atm/site" |
| 171 | +) |
| 172 | +arm_param.test_name = short_name |
| 173 | +arm_param.test_start_yr = start_yr |
| 174 | +arm_param.test_end_yr = end_yr |
| 175 | +# For model vs obs, the ref start and end year can be any four digit strings. |
| 176 | +# For now, will use all available years form obs |
| 177 | +arm_param.ref_start_yr = "0001" |
| 178 | +arm_param.ref_end_yr = "0001" |
| 179 | + |
| 180 | +params.append(arm_param) |
| 181 | + |
| 182 | +# Run |
| 183 | +runner.sets_to_run = [ |
| 184 | + "lat_lon", |
| 185 | + "zonal_mean_xy", |
| 186 | + "zonal_mean_2d", |
| 187 | + "polar", |
| 188 | + "cosp_histogram", |
| 189 | + "meridional_mean_2d", |
| 190 | + "enso_diags", |
| 191 | + "qbo", |
| 192 | + "diurnal_cycle", |
| 193 | + "annual_cycle_zonal_mean", |
| 194 | + "streamflow", |
| 195 | + "zonal_mean_2d_stratosphere", |
| 196 | + "arm_diags", |
| 197 | + "tc_analysis", |
| 198 | + "aerosol_aeronet", |
| 199 | + "aerosol_budget", |
| 200 | + "tropical_subseasonal", |
| 201 | +] |
| 202 | +runner.run_diags(params) |
0 commit comments