Skip to content

Commit

Permalink
Moves position of land-sea-mask in threshold CLI (#1565)
Browse files Browse the repository at this point in the history
* Moves position of land-sea-mask in threshold CLI to be positional so that suite can supply it as a node.

* Flake8
  • Loading branch information
MoseleyS authored Sep 27, 2021
1 parent 47f9e10 commit 6310ed4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion improver/cli/threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
@cli.with_output
def process(
cube: cli.inputcube,
land_sea_mask: cli.inputcube = None,
*,
threshold_values: cli.comma_separated_list = None,
threshold_config: cli.inputjson = None,
Expand All @@ -46,7 +47,6 @@ def process(
fuzzy_factor: float = None,
collapse_coord: str = None,
vicinity: float = None,
land_sea_mask: cli.inputcube = None,
):
"""Module to apply thresholding to a parameter dataset.
Expand Down
17 changes: 6 additions & 11 deletions improver_tests/acceptance/test_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,11 @@ def test_collapse_realization_masked_data(tmp_path):
([], "kgo.nc"),
(["--collapse-coord", "realization"], "kgo_collapsed.nc"),
(
[
"--land-sea-mask",
acc.kgo_root() / "threshold" / "vicinity" / "landmask.nc",
],
[acc.kgo_root() / "threshold" / "vicinity" / "landmask.nc"],
"kgo_landmask.nc",
),
(
[
"--land-sea-mask",
acc.kgo_root() / "threshold" / "vicinity" / "landmask.nc",
"--collapse-coord",
"realization",
Expand All @@ -169,8 +165,10 @@ def test_vicinity(tmp_path, extra_args, kgo):
kgo_path = kgo_dir / kgo
input_path = kgo_dir / "input.nc"
output_path = tmp_path / "output.nc"
args = [
input_path,
args = [input_path]
if extra_args:
args += extra_args
args += [
"--output",
output_path,
"--threshold-values",
Expand All @@ -180,8 +178,6 @@ def test_vicinity(tmp_path, extra_args, kgo):
"--vicinity",
"10000",
]
if extra_args:
args += extra_args
run_cli(args)
acc.compare(output_path, kgo_path)

Expand Down Expand Up @@ -213,10 +209,9 @@ def test_landmask_without_vicinity():
input_path = kgo_dir / "input.nc"
args = [
input_path,
acc.kgo_root() / "threshold" / "vicinity" / "landmask.nc",
"--threshold-values",
"0.03",
"--land-sea-mask",
acc.kgo_root() / "threshold" / "vicinity" / "landmask.nc",
]
with pytest.raises(
ValueError, match="Cannot apply land-mask cube without in-vicinity processing"
Expand Down

0 comments on commit 6310ed4

Please sign in to comment.