import os

from e3sm_diags.parameter.core_parameter import CoreParameter
from e3sm_diags.run import runner

param = CoreParameter()

# Location of the ref data.
param.reference_data_path = (
    #"/global/cscratch1/sd/mengz/AMIP/cori-knl.E3SM_maint1_0_012022.e3smv1_v2like_freerun_10yrs_CTL.F2010C5-CMIP6-LR.ne30_ne30/run/e3sm_diag_input/"
    #"/global/cscratch1/sd/mengz/E3SMv2_simulation/cori-knl.E3SM_maint2_0_012022.freerun_10yrs_SENS_DEEP.F2010-CICE.ne30_ne30/run/e3sm_diag_input/"
    #"/global/cscratch1/sd/mengz/E3SMv2_simulation/cori-knl.E3SMv2_080421.e3smv2_freerun_sens2yrs_wsubmin_prcexp1_accre_so4icenuc.F2010.ne30_ne30/run/e3sm_diag_input/"
    #"/global/cscratch1/sd/mengz/AMIP/cori-knl.E3SM.e3smv1_v2like_freerun_10yrs.F2010C5-CMIP6-LR.ne30_ne30/run/e3sm_diag_input/"
    "/global/cscratch1/sd/mengz/E3SMv2_CMIP/v2_TRIGGER.LR.piControl.cori/run/time_series/"
)
# Name of the ref model data, used to find the climo files.
param.ref_names = "" #"v2_TRIGGER.LR.piControl.cori"

#"v2_TRIGGER.LR.piControl.cori"
#"cori-knl.E3SMv2_080421.e3smv2_freerun_sens2yrs_wsubmin_prcexp1_accre_so4icenuc.F2010.ne30_ne30"
#"cori-knl.E3SM.e3smv1_v2like_freerun_10yrs.F2010C5-CMIP6-LR.ne30_ne30"
#"cori-knl.E3SMv2_080421.e3smv2_freerun_sens2yrs_clubbparameters.F2010.ne30_ne30"
#"cori-knl.E3SM_maint2_0_012022.e3smv2_freerun_10yrs_SENS_WBF01.F2010-CICE.ne30_ne30"
#"cori-knl.E3SM_maint1_0_012022.e3smv1_v2like_freerun_10yrs_CTL.F2010C5-CMIP6-LR.ne30_ne30"

# An optional, shorter name to be used instead of the ref_name.
param.short_ref_name = "E3SMv2 CAPE_Trigger"
param.end_yr = "0011"
param.start_yr = "0001"
param.ref_timeseries_input = "True"

# Location of the test data.
param.test_data_path = (
    #"/global/cscratch1/sd/mengz/E3SMv2_simulation/cori-knl.E3SM_maint2_0_012022.e3smv2_freerun_10yrs_CTL.F2010-CICE.ne30_ne30/run/e3sm_diag_input1/"
    #"/global/cscratch1/sd/mengz/E3SMv2_simulation/cori-knl.E3SMv2_080421.e3smv2_freerun_10yrs.F2010.ne30_ne30/run/e3sm_diag_input/"
    "/global/cscratch1/sd/mengz/E3SMv2_CMIP/v2_CTL.LR.piControl.cori/run/time_series/"
)
# Name of the test model data, used to find the climo files.
#param.test_name = "cori-knl.E3SM_maint2_0_012022.e3smv2_freerun_10yrs_CTL.F2010-CICE.ne30_ne30"
#param.test_name = "cori-knl.E3SMv2_080421.e3smv2_freerun_10yrs.F2010.ne30_ne30"
param.test_names = ""

# An optional, shorter name to be used instead of the test_name.
param.short_test_name = "E3SMv2 CTL"
param.end_yr = "0011"
param.start_yr = "0001"
param.test_timeseries_input = "True"

# What plotsets to run the diags on.
param.sets = [""]
# Name of the folder where the results are stored.
# Change `prefix` to use your directory.
prefix = "/global/cfs/cdirs/e3sm/www/mengz/comparison"
param.results_dir = os.path.join(prefix, "v2ctl_coupled")
# This parameter modifies the software to accommodate model vs model runs.
# The default setting for run_type is 'model_vs_obs'.
param.run_type = "model_vs_model"

# Below are more optional arguments.

# 'mpl' is to create matplotlib plots, 'vcs' is for vcs plots.
param.backend = "mpl"
# Title of the difference plots.
param.diff_title = "E3SMv2 CTL - E3SMv2 CAPE_Trigger"
# For running with multiprocessing.
# multiprocessing = True
# num_workers = 32

runner.sets_to_run = ["area_mean_time_series"]
runner.run_diags([param])

