From e85ebc4843fa12f5df3fd448e8661224c9c4c0ad Mon Sep 17 00:00:00 2001 From: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:33:30 -0600 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Paul Madden <136389411+maddenp-noaa@users.noreply.github.com> Co-authored-by: Emily Carpenter <137525341+elcarpenterNOAA@users.noreply.github.com> --- src/uwtools/drivers/orog.py | 7 +++---- src/uwtools/resources/jsonschema/orog.jsonschema | 2 +- src/uwtools/tests/test_schemas.py | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/uwtools/drivers/orog.py b/src/uwtools/drivers/orog.py index 5db163faf..8e7abb0db 100644 --- a/src/uwtools/drivers/orog.py +++ b/src/uwtools/drivers/orog.py @@ -60,8 +60,7 @@ def input_config_file(self): yield self.taskname(str(path)) yield asset(path, path.is_file) yield self.grid_file() - inputs = self.config.get("old_line1_items") - if inputs: + if inputs := self.config.get("old_line1_items"): ordered_entries = [ "mtnres", "lonb", @@ -76,11 +75,11 @@ def input_config_file(self): inputs = " ".join([str(inputs[i]) for i in ordered_entries]) outgrid = self.config["grid_file"] orogfile = self.config.get("orog_file") - mask_only = self.config.get("mask", ".false.") + mask_only = ".true." if self.config.get("mask") else ".false." merge_file = self.config.get("merge", "none") # string none is intentional content = [i for i in [inputs, outgrid, orogfile, mask_only, merge_file] if i is not None] with writable(path) as f: - f.write("\n".join(content)) + print("\n".join(content), file=f) @tasks def provisioned_rundir(self): diff --git a/src/uwtools/resources/jsonschema/orog.jsonschema b/src/uwtools/resources/jsonschema/orog.jsonschema index 354a70fe2..32239288b 100644 --- a/src/uwtools/resources/jsonschema/orog.jsonschema +++ b/src/uwtools/resources/jsonschema/orog.jsonschema @@ -16,7 +16,7 @@ "type": "string" }, "mask": { - "type": "string" + "type": "boolean" }, "merge": { "type": "string" diff --git a/src/uwtools/tests/test_schemas.py b/src/uwtools/tests/test_schemas.py index ad1646a0d..36e340dd3 100644 --- a/src/uwtools/tests/test_schemas.py +++ b/src/uwtools/tests/test_schemas.py @@ -1577,7 +1577,7 @@ def test_schema_orog(): errors = schema_validator("orog", "properties", "orog") # Basic correctness: assert not errors(config) - # All 9 config keys are requried: + # All 9 config keys are required: assert "does not have enough properties" in errors(with_del(config, "old_line1_items", "blat")) # Other config keys are not allowed: assert "Additional properties are not allowed" in errors(