Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Madden <[email protected]>
Co-authored-by: Emily Carpenter <[email protected]>
  • Loading branch information
3 people authored Aug 26, 2024
1 parent 6bbee01 commit e85ebc4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/uwtools/drivers/orog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/uwtools/resources/jsonschema/orog.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"type": "string"
},
"mask": {
"type": "string"
"type": "boolean"
},
"merge": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion src/uwtools/tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit e85ebc4

Please sign in to comment.