Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MAfarrag committed Feb 19, 2024
1 parent 762d3cd commit 6bcb4d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions Hapi/rrm/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@author: Mostafa
"""
from typing import Any, Optional
from typing import Any, Optional, List

import numpy as np
from Oasis.harmonysearch import HSapi
Expand All @@ -26,7 +26,7 @@ class Calibration(Catchment):
performance of predicted runoff at known locations based on given
performance function
The calibration class is sub-class from the Catchment super class so you
The calibration class is subclass from the Catchment superclass, so you
need to create the Catchment object first to be able to run the calibration
"""

Expand All @@ -42,7 +42,7 @@ def __init__(
):
"""Calibration.
to instantiate the Calibration object you need to provide the following
to instantiate the Calibration object, you need to provide the following
arguments
Parameters
Expand All @@ -53,11 +53,11 @@ def __init__(
starting date.
end : [str]
end date.
fmt : [str], optional
fmt: [str], optional
format of the given date. The default is "%Y-%m-%d".
spatial_resolution : [str], optional
Lumped or 'Distributed' . The default is 'Lumped'.
temporal_resolution : [str], optional
spatial_resolution: [str], optional
Lumped or 'Distributed'. The default is 'Lumped'.
temporal_resolution: [str], optional
"Hourly" or "Daily". The default is "Daily".
"""
super().__init__(
Expand Down Expand Up @@ -101,7 +101,7 @@ def read_objective_function(self, objective_function: callable, args):

print("Objective function is read successfully")

def extract_discharge(self, factor=None):
def extract_discharge(self, factor: List = None):
"""extractDischarge.
extractDischarge method extracts the discharge hydrograph in the
Expand Down Expand Up @@ -141,7 +141,7 @@ def extract_discharge(self, factor=None):

# return error

def runCalibration(self, SpatialVarFun, OptimizationArgs, printError=None):
def run_calibration(self, SpatialVarFun, OptimizationArgs, printError=None):
"""Run Calibration.
- This function runs the calibration algorithm for the conceptual distributed
Expand Down
6 changes: 3 additions & 3 deletions Hapi/rrm/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,12 @@ def hru_hand(dem, flow_direction, flow_path_length, river):
except Exception as e:
print(e)
raise ValueError(

Check warning on line 651 in Hapi/rrm/parameters.py

View check run for this annotation

Codecov / codecov/patch

Hapi/rrm/parameters.py#L649-L651

Added lines #L649 - L651 were not covered by tests
"please check the boundaries of your catchment after cropping the catchment using the a polygon it "
"creates anomalies athe boundary"
"please check the boundaries of your catchment. After cropping the catchment using a polygon, it "
"creates anomalies at the boundary"
)

# calculate the elevation difference between the cell and the nearest drainage cell
# or height avove nearst drainage
# or height above nearst drainage
hand = np.ones((rows, cols)) * np.nan

Check warning on line 658 in Hapi/rrm/parameters.py

View check run for this annotation

Codecov / codecov/patch

Hapi/rrm/parameters.py#L658

Added line #L658 was not covered by tests

for i in range(rows):
Expand Down

0 comments on commit 6bcb4d5

Please sign in to comment.