Skip to content

Commit

Permalink
Merge pull request #90 from Deltares/feature/DEI-147-Final-flake8-war…
Browse files Browse the repository at this point in the history
…nings

white space changes for flake
  • Loading branch information
mKlapwijk authored Nov 22, 2023
2 parents 9f4c6fd + 037b769 commit a847731
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions decoimpact/business/entities/rules/axis_filter_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ def execute(self, value_array: _xr.DataArray, logger: ILogger) -> _xr.DataArray:
Returns:
float: 2D variable
"""

if self._axis_name not in value_array.dims:
message = f"""Layer name is not in dim names \
[{value_array.dims}] layer_name [{self._axis_name}]"""
logger.log_error(message)
raise IndexError(message)

if not (
self._layer_number >= 0
and self._layer_number <= len(getattr(value_array, self._axis_name))
Expand All @@ -74,4 +74,4 @@ def execute(self, value_array: _xr.DataArray, logger: ILogger) -> _xr.DataArray:
logger.log_error(message)
raise IndexError(message)

return value_array.isel({self._axis_name: self._layer_number - 1})
return value_array.isel({self._axis_name: self._layer_number - 1})
2 changes: 1 addition & 1 deletion decoimpact/business/workflow/model_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _create_rule(rule_data: IRuleData) -> IRule:
rule_data.layer_number,
rule_data.output_variable,
)

if isinstance(rule_data, IAxisFilterRuleData):
return AxisFilterRule(
rule_data.name,
Expand Down
4 changes: 2 additions & 2 deletions decoimpact/data/api/i_axis_filter_rule_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def input_variable(self) -> str:
@abstractmethod
def layer_number(self) -> int:
"""Property for the layer number"""

@property
@abstractmethod
def axis_name(self) -> str:
"""Property for the dim name"""
"""Property for the dim name"""
3 changes: 1 addition & 2 deletions decoimpact/data/entities/axis_filter_rule_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ def input_variable(self) -> str:
def layer_number(self) -> int:
"""Property for the layer number"""
return self._layer_number

@property
def axis_name(self) -> str:
"""Property for the dimension name"""
return self._axis_name

4 changes: 2 additions & 2 deletions decoimpact/data/parsers/parser_axis_filter_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def parse_dict(self, dictionary: Dict[str, Any], logger: ILogger) -> IRuleData:
f"received a {type(axis_name)}: {axis_name}"
)
raise ValueError(message)

layer_number = get_dict_element("layer_number", dictionary)
if not isinstance(layer_number, int):
message = (
Expand All @@ -57,6 +57,6 @@ def parse_dict(self, dictionary: Dict[str, Any], logger: ILogger) -> IRuleData:
output_variable_name = get_dict_element("output_variable", dictionary)

return AxisFilterRuleData(
name, layer_number, axis_name, input_variable_name,
name, layer_number, axis_name, input_variable_name,
output_variable_name, description
)

0 comments on commit a847731

Please sign in to comment.