Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor]: Refactor integration tests and add use_cfg flag to run_diags() #747

Merged
merged 31 commits into from
Dec 13, 2023
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0c7307a
Remove default diags running with only Python API
tomvothecoder Nov 29, 2023
00865fe
Clean up `test_all_sets.py` and `test_diags.py`
tomvothecoder Nov 29, 2023
083ae3c
Fix paths for enso_diags in `all_sets_modified.cfg`
tomvothecoder Nov 29, 2023
daf1940
Fix referenced paths in `test_all_sets_image_diffs.py`
tomvothecoder Nov 29, 2023
9b55499
Remove unused NERSC function
tomvothecoder Nov 29, 2023
cb9f64e
Add debug mode
tomvothecoder Nov 30, 2023
715c025
Fix missing default value to debug in get_final_parameters
tomvothecoder Nov 30, 2023
0cdca64
Update pyproject.toml
tomvothecoder Nov 30, 2023
2f96ca4
Update e3sm_diags/run.py
tomvothecoder Nov 30, 2023
590fc37
Update e3sm_diags/run.py
tomvothecoder Nov 30, 2023
e7b049d
Fix sets to run
tomvothecoder Nov 30, 2023
9cb6777
Fix default sets
tomvothecoder Nov 30, 2023
0b99fff
Fix `test_all_sets_and_all_season`
tomvothecoder Nov 30, 2023
d19d4da
Refactor how cfg parameters are set
tomvothecoder Nov 30, 2023
7c9c607
Fix removal of CoreParameter default sets breaking integration test
tomvothecoder Nov 30, 2023
4c0a057
Fix class property and default sets
tomvothecoder Nov 30, 2023
63e29bf
Fix property
tomvothecoder Nov 30, 2023
4e24fb2
Update docstring
tomvothecoder Nov 30, 2023
4d562ce
Update e3sm_diags/run.py
tomvothecoder Nov 30, 2023
c2b5cf9
Fix comments
tomvothecoder Nov 30, 2023
2942f25
Fix cfg_params being modified in memory
tomvothecoder Nov 30, 2023
8618ba9
Update Makefile commands
tomvothecoder Nov 30, 2023
4e7bf9c
Revert core_parser changes
tomvothecoder Nov 30, 2023
3122650
Revert formatting changes
tomvothecoder Dec 1, 2023
720dc10
Revert formatting
tomvothecoder Dec 1, 2023
3ae6d54
Rename `debug` to `use_cfg`
tomvothecoder Dec 12, 2023
d3e0c9a
Update use_cfg param in test
tomvothecoder Dec 12, 2023
5eaf7b3
Remove `test_all_sets_modified_image_counts.py`
tomvothecoder Dec 12, 2023
9f1862a
Remove `test_dataset.py` and move `test_run.py` to unit tests dir
tomvothecoder Dec 12, 2023
13547ad
Update attr comment in Run class
tomvothecoder Dec 12, 2023
3ff0aa7
Rename `debug_params` to `params`
tomvothecoder Dec 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update use_cfg param in test
  • Loading branch information
tomvothecoder committed Dec 13, 2023
commit d3e0c9ad81eedc875e197fa872bbfc14d643dbcd
1 change: 1 addition & 0 deletions e3sm_diags/plot/cartopy/arm_diags_plot.py
Original file line number Diff line number Diff line change
@@ -174,6 +174,7 @@ def plot_convection_onset_statistics(
var_time_absolute = cwv.getTime().asComponentTime()
time_interval = int(var_time_absolute[1].hour - var_time_absolute[0].hour)

# FIXME: UnboundLocalError: local variable 'cwv_max' referenced before assignment
number_of_bins = int(np.ceil((cwv_max - cwv_min) / bin_width))
bin_center = np.arange(
(cwv_min + (bin_width / 2)),
6 changes: 3 additions & 3 deletions e3sm_diags/run.py
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ def __init__(self):
self.sets_to_run = []

@property
def has_cfg_file_arg(self):
def is_cfg_file_arg_set(self):
"""A property to check if `-d/--diags` was set to a `.cfg` filepath.

Returns
@@ -48,7 +48,7 @@ def run_diags(
parameters : List[CoreParameter]
A list of parameters defined through the Python API.
use_cfg : bool, optional
Run diagnostics a `.cfg` file, by default True.
Also run diagnostics using a `.cfg` file, by default True.

* If True, run all sets using the list of parameters passed in
this function and parameters defined in a .cfg file (if
@@ -155,7 +155,7 @@ def _get_parameters_with_api_and_cfg(
"""
run_params = []

if self.has_cfg_file_arg:
if self.is_cfg_file_arg_set:
cfg_params = self._get_custom_params_from_cfg_file()
else:
run_type = parameters[0].run_type
2 changes: 1 addition & 1 deletion tests/integration/test_all_sets_modified_image_counts.py
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ def test_all_sets_modified_produces_the_expected_number_of_images():
params_results: List[CoreParameter] = []

for param in params:
result = runner.run_diags([param], use_cfg=True)
result = runner.run_diags([param], use_cfg=False)
params_results.extend(result)

# The result directory should be the same for all diagnostic sets.