Skip to content

Commit

Permalink
rearrange lines to 88 character limit
Browse files Browse the repository at this point in the history
  • Loading branch information
elisalle committed Sep 10, 2024
1 parent 92afe73 commit 28aa246
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
7 changes: 4 additions & 3 deletions batch_calculator/process_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ def batch_calculation_statistics(netcdf_dir: Path, gridadmin: str, nr_years: int

if len(nan_results) > 0:
print(
"WARNING: one or more weirs found which have NaN results in their cumulative "
"discharge. Please check the nan_rows.json file for more information. "
"This file contains weir id and netcdf file where the NaN values are found. "
"WARNING: one or more weirs found which have NaN results in their "
"cumulative discharge. Please check the nan_rows.json file for more "
"information. This file contains weir id and netcdf file where the NaN "
"values are found. "
)
results_file = netcdf_dir.parent / "nan_rows.json"
with results_file.open("w") as f:
Expand Down
27 changes: 20 additions & 7 deletions batch_calculator/rain_series_simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,17 @@ def validate_sqlite(sqlite_path: Path):
).scalar()

if int(database_schema_version) < 222:
query = "SELECT timestep, aggregation_method FROM v2_aggregation_settings WHERE flow_variable='discharge'"
query = """
SELECT timestep, aggregation_method
FROM v2_aggregation_settings
WHERE flow_variable='discharge';
"""
else:
query = "SELECT timestep, aggregation_method FROM aggregation_settings WHERE flow_variable='discharge'"
query = """
SELECT timestep, aggregation_method
FROM aggregation_settings
WHERE flow_variable='discharge';
"""

rows = [row for row in session.execute(text(query))]
timesteps = np.array([row[0] for row in rows])
Expand Down Expand Up @@ -285,7 +293,11 @@ def convert_to_netcdf(rain_files_dir: Path) -> List[Dict]:
# data=np.array([0]),
# dtype=np.int32,
# )
# # one = netcdf.create_dataset("one", np.array([0.0], dtype=np.float64), dtype=np.float64)
# # one = netcdf.create_dataset(
# # "one",
# # np.array([0.0], dtype=np.float64),
# # dtype=np.float64
# # )
# time = netcdf.create_dataset("time", data=time, dtype=np.float64)
# values = netcdf.create_dataset(
# "values", data=values_converted, dtype=np.float64
Expand Down Expand Up @@ -424,9 +436,9 @@ def create_simulations_from_rain_events(
rain_files_dir: Path,
) -> List[Simulation]:
"""
Read start time from rain files filename and create simulations with the corresponding
initial state from the DWF runs. Create timeseries rain event from file data.
Save created simulations to JSON as fallback.
Read start time from rain files filename and create simulations with the
corresponding initial state from the DWF runs. Create timeseries rain event
from file data. Save created simulations to JSON as fallback.
"""
rain_event_simulations = []
warnings = []
Expand Down Expand Up @@ -584,7 +596,8 @@ def create_rain_series_simulations(
Batch rain series calculation consists of 2 parts.
First part:
- run simulation in dry state for 3 days
- create saved states for every hour in day 3 which will be used as start state for the rain series simulations
- create saved states for every hour in day 3 which will be used as
start state for the rain series simulations
\b
Second part:
Expand Down

0 comments on commit 28aa246

Please sign in to comment.