From 28aa2460214cf84c5b8c28179b3034419bdf13e4 Mon Sep 17 00:00:00 2001 From: elisalle Date: Tue, 10 Sep 2024 11:43:59 +0200 Subject: [PATCH] rearrange lines to 88 character limit --- batch_calculator/process_results.py | 7 +++--- batch_calculator/rain_series_simulations.py | 27 +++++++++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/batch_calculator/process_results.py b/batch_calculator/process_results.py index b54df4e..8c67ec1 100644 --- a/batch_calculator/process_results.py +++ b/batch_calculator/process_results.py @@ -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: diff --git a/batch_calculator/rain_series_simulations.py b/batch_calculator/rain_series_simulations.py index 0cf39da..03a0620 100644 --- a/batch_calculator/rain_series_simulations.py +++ b/batch_calculator/rain_series_simulations.py @@ -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]) @@ -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 @@ -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 = [] @@ -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: