Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
forsyth2 committed Dec 19, 2023
1 parent 85ac5e6 commit c7edb1d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/test_refactor/diags.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[#]
sets = ["polar"]
case_id = "ERA-Interim"
variables = ["TREFHT"]
regions = ["land", "global"]
ref_name = "ERA-Interim"
reference_name = "ERA-Interim Reanalysis"
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
contour_levels = [-35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 40]
diff_levels = [-15, -10, -5, -2, -1, -0.5, -0.2, 0, 0.2, 0.5, 1, 2, 5, 10, 15]
42 changes: 42 additions & 0 deletions examples/test_refactor/run_polar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import os
import sys

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

param = CoreParameter()

# Location of the data.
param.reference_data_path = (
"/global/cfs/cdirs/e3sm/e3sm_diags/obs_for_e3sm_diags/climatology/"
)
param.test_data_path = (
"/global/cfs/cdirs/e3sm/e3sm_diags/postprocessed_e3sm_v2_data_for_e3sm_diags/20210528.v2rc3e.piControl.ne30pg2_EC30to60E2r2.chrysalis/climatology/rgr"
)
# Name of the test model data, used to find the climo files.
param.test_name = "20210528.v2rc3e.piControl.ne30pg2_EC30to60E2r2.chrysalis"
# An optional, shorter name to be used instead of the test_name.
param.short_test_name = "v2rc3e"

# What plotsets to run the diags on.
#param.sets = ["lat_lon"]
# Name of the folder where the results are stored.
# Change `prefix` to use your directory.
prefix = "/global/cfs/cdirs/e3sm/www/forsyth/test_e3sm_refactor"
param.results_dir = os.path.join(prefix, "ex5_model_to_obs")

# Below are more optional arguments.

# Title of the difference plots.
param.diff_title = "Model - Obs."
# Save the netcdf files for each of the ref, test, and diff plot.
param.save_netcdf = True
# For running with multiprocessing.
# param.multiprocessing = True
# param.num_workers = 32
# Use the specified `.cfg` file for debugging
CFG_PATH = "diags.cfg"
sys.argv.extend(["-d", CFG_PATH])

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

0 comments on commit c7edb1d

Please sign in to comment.