Skip to content

Commit

Permalink
Merge pull request #341 from forsyth2/update-examples
Browse files Browse the repository at this point in the history
Update examples
  • Loading branch information
forsyth2 authored Sep 22, 2020
2 parents 1e30d12 + 0fb9d05 commit e785582
Show file tree
Hide file tree
Showing 18 changed files with 308 additions and 811 deletions.
52 changes: 52 additions & 0 deletions examples/ex1-model_ts-vs-model_ts/ex1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
from acme_diags.parameter.core_parameter import CoreParameter
from acme_diags.run import runner

param = CoreParameter()
# Location of the data.
param.test_data_path = '/global/cfs/cdirs/e3sm/acme_diags/test_model_data_for_acme_diags/time-series/E3SM_v1'
param.reference_data_path = '/global/cfs/cdirs/e3sm/acme_diags/test_model_data_for_acme_diags/time-series/E3SM_v1'

# Set this parameter to True.
# By default, e3sm_diags expects the test data to be climo data.
param.test_timeseries_input = True
# Years to slice the test data, base this off the years in the filenames.
param.test_start_yr = '2011'
param.test_end_yr = '2013'

# Set this parameter to True.
# By default, e3sm_diags expects the ref data to be climo data.
param.ref_timeseries_input = True
# Years to slice the ref data, base this off the years in the filenames.
param.ref_start_yr = '1850'
param.ref_end_yr = '1852'

# When running with time-series data, you don't need to specify the name of the data.
# But you should, otherwise nothing is displayed when the test/ref name is needed.
param.short_test_name = 'historical_H1'
param.short_ref_name = 'historical_H1'

# 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'
# Name of the folder where the results are stored.
# Change `prefix` to use your directory.
#prefix = '/global/cfs/cdirs/e3sm/www/<your directory>/examples'
param.results_dir = os.path.join(prefix, 'ex1_modTS_vs_modTS_3years')

# Below are more optional arguments.

# What plotsets to run the diags on.
# If not defined, then all available sets are used.
param.sets = ['lat_lon']
# What seasons to run the diags on.
# If not defined, diags are run on ['ANN', 'DJF', 'MAM', 'JJA', 'SON'].
param.seasons = ['ANN']
# Title of the difference plots.
param.diff_title = 'Model (2011-2013) - Model (1850-1852)'
## For running with multiprocessing.
#param.multiprocessing = True
#param.num_workers = 32

runner.sets_to_run = ['lat_lon']
runner.run_diags([param])
53 changes: 53 additions & 0 deletions examples/ex2-model_ts-vs-model_ts-cmip/ex2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import os
from acme_diags.parameter.core_parameter import CoreParameter
from acme_diags.run import runner

param = CoreParameter()

# Location of the data.
param.test_data_path = '/global/cfs/cdirs/e3sm/acme_diags/test_model_data_for_acme_diags/time-series/CESM1-CAM5_cmip/'
param.reference_data_path = '/global/cfs/cdirs/e3sm/acme_diags/test_model_data_for_acme_diags/time-series/CESM1-CAM5_cmip'

# Set this parameter to True.
# By default, e3sm_diags expects the test data to be climo data.
param.test_timeseries_input = True
# Years to slice the test data, base this off the years in the filenames.
param.test_start_yr = '2001'
param.test_end_yr = '2003'

# Set this parameter to True.
# By default, e3sm_diags expects the ref data to be climo data.
param.ref_timeseries_input = True
# Years to slice the ref data, base this off the years in the filenames.
param.ref_start_yr = '1850'
param.ref_end_yr = '1852'

# When running with time-series data, you don't need to specify the name of the data.
# But you should, otherwise nothing is displayed when the test/ref name is needed.
param.short_test_name = 'CESM1-CAM5-historical'
param.short_ref_name = 'CESM1-CAM5-historical'

# 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'
# Name of the folder where the results are stored.
# Change `prefix` to use your directory.
#prefix = '/global/cfs/cdirs/e3sm/www/<your directory>/examples'
param.results_dir = os.path.join(prefix, 'ex2_modTS_vs_modTS_CMIP_3years')

# Below are more optional arguments.

# What plotsets to run the diags on.
# If not defined, then all available sets are used.
param.sets = ['lat_lon']
# What seasons to run the diags on.
# If not defined, diags are ran on ['ANN', 'DJF', 'MAM', 'JJA', 'SON'].
param.seasons = ['ANN']
# Title of the difference plots.
param.diff_title = 'Model (2001-2003) - Model (1850-1852)'
## For running with multiprocessing.
#param.multiprocessing = True
#param.num_workers = 32

runner.sets_to_run = ['lat_lon']
runner.run_diags([param])
53 changes: 53 additions & 0 deletions examples/ex3-model_ts-vs-obs_ts-cmip/ex3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import os
from acme_diags.parameter.core_parameter import CoreParameter
from acme_diags.run import runner

param = CoreParameter()

# Location of the data.
param.test_data_path = '/global/cfs/cdirs/e3sm/acme_diags/test_model_data_for_acme_diags/time-series/CESM1-CAM5_cmip/'
param.reference_data_path = '/global/cfs/cdirs/e3sm/acme_diags/obs_for_e3sm_diags/time-series/'

# Set this parameter to True.
# By default, e3sm_diags expects the test data to be climo data.
param.test_timeseries_input = True
# Years to slice the test data, base this off the years in the filenames.
param.test_start_yr = '2003'
param.test_end_yr = '2004'

# Set this parameter to True.
# By default, e3sm_diags expects the ref data to be climo data.
param.ref_timeseries_input = True
# Years to slice the ref data, base this off the years in the filenames.
param.ref_start_yr = '2003'
param.ref_end_yr = '2004'

# When running with time-series data, you don't need to specify the name of the data.
# But you should, otherwise nothing is displayed when the test/ref name is needed.
param.short_test_name = 'CESM1-CAM5-historical'
#param.short_ref_name = ''

# 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'
# Name of the folder where the results are stored.
# Change `prefix` to use your directory.
#prefix = '/global/cfs/cdirs/e3sm/www/<your directory>/examples'
param.results_dir = os.path.join(prefix, 'ex3_modTS_CMIP_vs_obs_2years')

# Below are more optional arguments.

# What plotsets to run the diags on.
# If not defined, then all available sets are used.
param.sets = ['lat_lon']
# What seasons to run the diags on.
# If not defined, diags are ran on ['ANN', 'DJF', 'MAM', 'JJA', 'SON'].
param.seasons = ['ANN']
# Title of the difference plots.
param.diff_title = 'model(2003-2004 yr_avg) - obs(2003-2004 yr_avg)'
# For running with multiprocessing.
#param.multiprocessing = True
#param.num_workers = 32

runner.sets_to_run = ['lat_lon']
runner.run_diags([param])
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ variables = ["SST"]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
contour_levels = [-1, 0, 1, 3, 6, 9, 12, 15, 18, 20, 22, 24, 26, 28, 29]
diff_levels = [-5, -4, -3, -2, -1, -0.5, -0.2, 0.2, 0.5, 1, 2, 3, 4, 5]

42 changes: 42 additions & 0 deletions examples/ex4-model-vs-model/ex4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import os
from acme_diags.parameter.core_parameter import CoreParameter
from acme_diags.run import runner

param = CoreParameter()

# Location of the ref data.
param.reference_data_path = '/global/cfs/cdirs/e3sm/acme_diags/test_model_data_for_acme_diags/climatology/'
# Name of the ref model data, used to find the climo files.
param.ref_name = '20161118.beta0.F1850COSP.ne30_ne30.edison'
# An optional, shorter name to be used instead of the ref_name.
param.short_ref_name = 'Ref: beta0.F1850COSP_ne30'

# Location of the test data.
param.test_data_path = '/global/cfs/cdirs/e3sm/acme_diags/test_model_data_for_acme_diags/climatology'
# Name of the test model data, used to find the climo files.
param.test_name = '20161118.beta0.FC5COSP.ne30_ne30.edison'
# An optional, shorter name to be used instead of the test_name.
param.short_test_name = 'Test: beta0_FC5COSP_ne30'

# 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/<your directory>/examples'
param.results_dir = os.path.join(prefix, 'ex4_model_to_model')
# 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 = 'Test Model - Ref Model'
# For running with multiprocessing.
#multiprocessing = True
#num_workers = 32

runner.sets_to_run = ['lat_lon']
runner.run_diags([param])
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

[#]
sets = ["lat_lon"]
case_id = "ERA-Interim"
variables = ["TREFHT"]
regions = ["land", "global"]
ref_name = "ERA-Interim"
reference_name = "ERA-Interim Reanalysis 1980-2016"
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]
35 changes: 35 additions & 0 deletions examples/ex5-model-vs-obs/ex5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
from acme_diags.parameter.core_parameter import CoreParameter
from acme_diags.run import runner

param = CoreParameter()

# Location of the data.
param.reference_data_path = '/global/cfs/cdirs/e3sm/acme_diags/obs_for_e3sm_diags/climatology/'
param.test_data_path = '/global/cfs/cdirs/e3sm/acme_diags/test_model_data_for_acme_diags/climatology/'
# Name of the test model data, used to find the climo files.
param.test_name = '20161118.beta0.FC5COSP.ne30_ne30.edison'
# An optional, shorter name to be used instead of the test_name.
param.short_test_name = 'beta0.FC5COSP.ne30'

# 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/<your directory>/examples'
param.results_dir = os.path.join(prefix, 'ex5_model_to_obs')

# 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 = '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

runner.sets_to_run = ['lat_lon']
runner.run_diags([param])
28 changes: 28 additions & 0 deletions examples/ex6-model-vs-obs-custom/ex6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os
from acme_diags.parameter.core_parameter import CoreParameter
from acme_diags.parameter.zonal_mean_2d_parameter import ZonalMean2dParameter
from acme_diags.run import runner

param = CoreParameter()

param.reference_data_path = '/global/cfs/cdirs/e3sm/acme_diags/obs_for_e3sm_diags/climatology/'
param.test_data_path = '/global/cfs/cdirs/e3sm/acme_diags/test_model_data_for_acme_diags/climatology/'
param.test_name = '20161118.beta0.FC5COSP.ne30_ne30.edison'
param.seasons = ["ANN"]

# Name of the folder where the results are stored.
# Change `prefix` to use your directory.
#prefix = '/global/cfs/cdirs/e3sm/www/<your directory>/examples'
param.results_dir = os.path.join(prefix, 'ex6_zonal_mean_2d_and_lat_lon_demo')

# Uncomment the two lines below to just
# run the diags with T and PRECT.
# param.selectors += ['variables']
# param.variables = ['T', 'PRECT']

# The new changes are below.
zonal_mean_2d_param = ZonalMean2dParameter()
zonal_mean_2d_param.plevs = [10.0, 20.0, 30.0]

runner.sets_to_run = ['zonal_mean_2d', 'lat_lon']
runner.run_diags([param, zonal_mean_2d_param])
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
[#]
case_id = "lat_lon_model_vs_model"
sets = ["lat_lon"]
case_id = "lat_lon_obs_vs_obs"
ref_name = "ceres_ebaf_toa_v2.8"
reference_name = "CERES-EBAF Jan 2000-Dec 2015"
reference_name = "CERES-EBAF"
variables = ["SWCF"]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
contour_levels = [-120, -110, -100, -90, -80, -70, -60, -50, -40, -30, -20, -10, 0]
contour_levels = [-180, -160, -140, -120, -100, -80, -60, -40, -20, 0]
diff_levels = [-60, -50, -40, -30, -20, -10, -5, 5, 10, 20, 30, 40, 50, 60]

[#]
case_id = "lat_lon_model_vs_model"
sets = ["lat_lon"]
case_id = "lat_lon_obs_vs_obs"
ref_name = "ceres_ebaf_toa_v2.8"
reference_name = "CERES-EBAF Jan 2000-Dec 2015"
reference_name = "CERES-EBAF"
variables = ["LWCF"]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
contour_levels = [0, 10, 20, 30, 40, 50, 60, 70, 80]
diff_levels = [-35, -30, -25, -20, -15, -10, -5, -2, 2, 5, 10, 15, 20, 25, 30, 35]

[#]
case_id = "lat_lon_model_vs_model"
sets = ["lat_lon"]
case_id = "lat_lon_obs_vs_obs"
ref_name = "ceres_ebaf_toa_v2.8"
reference_name = "CERES-EBAF Jan 2000-Dec 2015"
reference_name = "CERES-EBAF"
variables = ["NETCF"]
seasons = ["ANN", "DJF", "MAM", "JJA", "SON"]
contour_levels = [-135, -120, -105, -90, -75, -60, -45, -30, -15, 0, 15, 30, 45]
diff_levels = [-75, -50, -40, -30, -20, -10, -5, 5, 10, 20, 30, 40, 50, 75]
diff_levels = [-75, -50, -40, -30, -20, -10, -5, 5, 10, 20, 30, 40, 50, 75]
33 changes: 33 additions & 0 deletions examples/ex7-obs-vs-obs/ex7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os
from acme_diags.parameter.core_parameter import CoreParameter
from acme_diags.run import runner

param = CoreParameter()

# Location of the ref data.
param.reference_data_path = '/global/cfs/cdirs/e3sm/acme_diags/obs_for_e3sm_diags/climatology/'
# Name of the ref obs data, used to find the climo files.
param.ref_name = 'ceres_ebaf_toa_v2.8'

# Location of the test data.
param.test_data_path = '/global/cfs/cdirs/e3sm/acme_diags/obs_for_e3sm_diags/climatology/'
# Name of the test obs data, used to find the climo files.
param.test_name = 'ceres_ebaf_toa_v4.0'

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

# Below are more optional arguments.

# What seasons to run the diags on.
# If not defined, diags is ran on ['ANN', 'DJF', 'MAM', 'JJA', 'SON'].
param.seasons = ['ANN']
# 'mpl' is to create matplotlib plots, 'vcs' is for vcs plots.
param.backend = 'mpl'

runner.sets_to_run = ['lat_lon']
runner.run_diags([param])
Loading

0 comments on commit e785582

Please sign in to comment.