Skip to content

Commit

Permalink
Removes wx from variable names in metadata_interpreter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MoseleyS committed Oct 3, 2023
1 parent f3f8b5f commit 42319a8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions improver/developer_tools/metadata_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@
"lwe_thickness_of_snowfall_amount",
"thickness_of_rainfall_amount",
]
WXCODE_MODE_CM = lambda hour: CellMethod(
CATEGORICAL_MODE_CM = lambda hour: CellMethod(
method="mode", coords="time", intervals=f"{hour} hour"
)
WXCODE_NAMES = ["weather_code"]
CATEGORICAL_NAMES = ["weather_code"]

# Compliant, required and forbidden attributes
NONCOMP_ATTRS = [
Expand Down Expand Up @@ -474,20 +474,20 @@ def run(self, cube: Cube) -> None:

elif cube.name() in SPECIAL_CASES:
self.field_type = self.diagnostic = cube.name()
if cube.name() in WXCODE_NAMES:
if cube.name() in CATEGORICAL_NAMES:
for cm in cube.cell_methods:
valid_wx_cm = False
valid_categorical_cm = False
for hour in [1, 3]:
wx_cell_method = WXCODE_MODE_CM(hour)
if cm == wx_cell_method:
expected_cell_method = CATEGORICAL_MODE_CM(hour)
if cm == expected_cell_method:
diagnostic = self.diagnostic.replace("_", " ")
self.methods += (
f"{cm.method} of {cm.intervals[0]} "
f"{diagnostic} over {cm.coord_names[0]}"
)
valid_wx_cm = True
valid_categorical_cm = True
break
if not valid_wx_cm:
if not valid_categorical_cm:
self.errors.append(
f"Unexpected cell methods {cube.cell_methods}"
)
Expand Down Expand Up @@ -649,7 +649,7 @@ def vstring(source_metadata):
if interpreter.diagnostic not in SPECIAL_CASES:
output.extend(_format_standard_cases(interpreter, verbose, vstring))

if interpreter.diagnostic in WXCODE_NAMES and interpreter.methods:
if interpreter.diagnostic in CATEGORICAL_NAMES and interpreter.methods:
output.append(f"These {field_type} are {interpreter.methods}")
if verbose:
output.append(vstring("cell methods"))
Expand Down

0 comments on commit 42319a8

Please sign in to comment.