From 45ca59f108817be4834b91e753a029fc237caa53 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:14:32 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../concentration_tracker_for_space.py | 58 ++++++++++--------- .../test_concentration_tracker_for_space.py | 54 +++++++++-------- 2 files changed, 60 insertions(+), 52 deletions(-) diff --git a/src/landlab/components/concentration_tracker/concentration_tracker_for_space.py b/src/landlab/components/concentration_tracker/concentration_tracker_for_space.py index 9e20e5d55..3f990fc27 100644 --- a/src/landlab/components/concentration_tracker/concentration_tracker_for_space.py +++ b/src/landlab/components/concentration_tracker/concentration_tracker_for_space.py @@ -36,8 +36,8 @@ class ConcentrationTrackerForSpace(Component): :class:`~.SpaceLargeScaleEroder` step and a stop_tracking(dt) method immediately after every :class:`~.SpaceLargeScaleEroder` step. See the docstring examples below. - - The required inputs "phi", "fraction_fines", and "settling_velocity" + + The required inputs "phi", "fraction_fines", and "settling_velocity" must have the same value as those used for the instance of :class:`~.SpaceLargeScaleEroder`. @@ -288,13 +288,12 @@ class ConcentrationTrackerForSpace(Component): def __init__( self, grid, - phi: float|None=None, - fraction_fines: float|None=None, - settling_velocity: float|None=None, + phi: float | None = None, + fraction_fines: float | None = None, + settling_velocity: float | None = None, concentration_initial=0, concentration_in_bedrock=0, ): - """ Parameters ---------- @@ -311,31 +310,34 @@ def __init__( concentration_in_bedrock: positive float, array, or field name (optional) Concentration in bedrock, [-/L^3] """ - + if phi is None: - raise ValueError("`phi` is a required input parameter. " - "It must have the same value as the `phi` input " - "parameter used for the `SpaceLargeScaleEroder` " - "instance to which this component is coupled. " - "See the docstring in each component for details." - ) + raise ValueError( + "`phi` is a required input parameter. " + "It must have the same value as the `phi` input " + "parameter used for the `SpaceLargeScaleEroder` " + "instance to which this component is coupled. " + "See the docstring in each component for details." + ) if fraction_fines is None: - raise ValueError("`fraction_fines` is a required input parameter. " - "It must have the same value as the same input " - "parameter used for the `SpaceLargeScaleEroder` " - "instance to which this component is coupled. " - "The parameter is named `F_f` in SpaceLargeScaleEroder. " - "See the docstring in each component for details." - ) + raise ValueError( + "`fraction_fines` is a required input parameter. " + "It must have the same value as the same input " + "parameter used for the `SpaceLargeScaleEroder` " + "instance to which this component is coupled. " + "The parameter is named `F_f` in SpaceLargeScaleEroder. " + "See the docstring in each component for details." + ) if settling_velocity is None: - raise ValueError("`settling_velocity` is a required input parameter. " - "It must have the same value as the same input " - "parameter used for the `SpaceLargeScaleEroder` " - "instance to which this component is coupled. " - "It is named `v_s` in SpaceLargeScaleEroder. " - "See the docstring in each component for details." - ) - + raise ValueError( + "`settling_velocity` is a required input parameter. " + "It must have the same value as the same input " + "parameter used for the `SpaceLargeScaleEroder` " + "instance to which this component is coupled. " + "It is named `v_s` in SpaceLargeScaleEroder. " + "See the docstring in each component for details." + ) + super().__init__(grid) # Store grid and parameters diff --git a/tests/components/concentration_tracker/test_concentration_tracker_for_space.py b/tests/components/concentration_tracker/test_concentration_tracker_for_space.py index 929b2ae2c..ce4e43615 100644 --- a/tests/components/concentration_tracker/test_concentration_tracker_for_space.py +++ b/tests/components/concentration_tracker/test_concentration_tracker_for_space.py @@ -219,30 +219,36 @@ def setup_method(self): # Add forced flow router and flux fields to grid and apply values. flow_us_node_order = [5, 6, 7, 8, 3, 2, 1, 0, 4, 9, 10, 11, 12, 13, 14] - flow_receiver_ids = [[0, 1, 2, 3, 4], - [5, 5, 6, 7, 8], - [10, 11, 12, 13, 14], - ] - discharge = [[0.0, 0.0, 0.0, 0.0, 0.0], - [1.0, 1.0, 1.0, 1.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0], - ] - Qs_out = [[0.0, 0.0, 0.0, 0.0, 0.0], - [0.0, 0.0, 0.0, 1.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0], - ] - Er = [[0.0, 0.0, 0.0, 0.0, 0.0], - [0.0, 0.0, 0.0, 1.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0], - ] - Es = [[0.0, 0.0, 0.0, 0.0, 0.0], - [0.0, 0.0, 0.0, 1.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0], - ] - Dsw = [[0.0, 0.0, 0.0, 0.0, 0.0], - [0.0, 0.0, 0.0, 1.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0], - ] + flow_receiver_ids = [ + [0, 1, 2, 3, 4], + [5, 5, 6, 7, 8], + [10, 11, 12, 13, 14], + ] + discharge = [ + [0.0, 0.0, 0.0, 0.0, 0.0], + [1.0, 1.0, 1.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0], + ] + Qs_out = [ + [0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0], + ] + Er = [ + [0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0], + ] + Es = [ + [0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0], + ] + Dsw = [ + [0.0, 0.0, 0.0, 0.0, 0.0], + [0.0, 0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0], + ] self.mg.add_field("flow__receiver_node", flow_receiver_ids, at="node") self.mg.add_field("flow__upstream_node_order", flow_us_node_order, at="node")