rtc-tools 2.5.1rc1__tar.gz → 2.5.2a2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rtc-tools might be problematic. Click here for more details.

Files changed (56) hide show
  1. {rtc-tools-2.5.1rc1/src/rtc_tools.egg-info → rtc-tools-2.5.2a2}/PKG-INFO +1 -1
  2. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/setup.py +2 -2
  3. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2/src/rtc_tools.egg-info}/PKG-INFO +1 -1
  4. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtc_tools.egg-info/requires.txt +2 -2
  5. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/_version.py +3 -3
  6. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/data/pi.py +8 -8
  7. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/collocated_integrated_optimization_problem.py +5 -3
  8. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/csv_lookup_table_mixin.py +7 -0
  9. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/goal_programming_mixin.py +3 -3
  10. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/io_mixin.py +2 -1
  11. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/optimization_problem.py +26 -4
  12. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/COPYING.LESSER +0 -0
  13. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/MANIFEST.in +0 -0
  14. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/README.md +0 -0
  15. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/setup.cfg +0 -0
  16. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtc_tools.egg-info/SOURCES.txt +0 -0
  17. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtc_tools.egg-info/dependency_links.txt +0 -0
  18. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtc_tools.egg-info/entry_points.txt +0 -0
  19. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtc_tools.egg-info/top_level.txt +0 -0
  20. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/__init__.py +0 -0
  21. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/_internal/__init__.py +0 -0
  22. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/_internal/alias_tools.py +0 -0
  23. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/_internal/caching.py +0 -0
  24. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/_internal/casadi_helpers.py +0 -0
  25. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/_internal/debug_check_helpers.py +0 -0
  26. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/data/__init__.py +0 -0
  27. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/data/csv.py +0 -0
  28. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/data/interpolation/__init__.py +0 -0
  29. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/data/interpolation/bspline.py +0 -0
  30. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/data/interpolation/bspline1d.py +0 -0
  31. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/data/interpolation/bspline2d.py +0 -0
  32. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/data/netcdf.py +0 -0
  33. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/data/rtc.py +0 -0
  34. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/data/storage.py +0 -0
  35. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/__init__.py +0 -0
  36. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/control_tree_mixin.py +0 -0
  37. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/csv_mixin.py +0 -0
  38. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/goal_programming_mixin_base.py +0 -0
  39. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/homotopy_mixin.py +0 -0
  40. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/initial_state_estimation_mixin.py +0 -0
  41. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/linearization_mixin.py +0 -0
  42. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/linearized_order_goal_programming_mixin.py +0 -0
  43. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/min_abs_goal_programming_mixin.py +0 -0
  44. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/modelica_mixin.py +0 -0
  45. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/netcdf_mixin.py +0 -0
  46. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/pi_mixin.py +0 -0
  47. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/single_pass_goal_programming_mixin.py +0 -0
  48. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/optimization/timeseries.py +0 -0
  49. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/rtctoolsapp.py +0 -0
  50. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/simulation/__init__.py +0 -0
  51. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/simulation/csv_mixin.py +0 -0
  52. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/simulation/io_mixin.py +0 -0
  53. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/simulation/pi_mixin.py +0 -0
  54. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/simulation/simulation_problem.py +0 -0
  55. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/src/rtctools/util.py +0 -0
  56. {rtc-tools-2.5.1rc1 → rtc-tools-2.5.2a2}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rtc-tools
3
- Version: 2.5.1rc1
3
+ Version: 2.5.2a2
4
4
  Summary: Toolbox for control and optimization of water systems.
5
5
  Home-page: https://oss.deltares.nl/web/rtc-tools/home
6
6
  Author: Deltares
@@ -42,8 +42,8 @@ setup(
42
42
  packages = find_packages("src"),
43
43
  package_dir = {"": "src"},
44
44
  install_requires = ["casadi == 3.5.*",
45
- "numpy >= 1.16.0",
46
- "scipy >= 1.0.0",
45
+ "numpy >= 1.16.0, <1.23",
46
+ "scipy >= 1.0.0, <1.11",
47
47
  "pymoca == 0.9.*",
48
48
  "rtc-tools-channel-flow >= 1.1.0"],
49
49
  tests_require = ['pytest', 'pytest-runner'],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rtc-tools
3
- Version: 2.5.1rc1
3
+ Version: 2.5.2a2
4
4
  Summary: Toolbox for control and optimization of water systems.
5
5
  Home-page: https://oss.deltares.nl/web/rtc-tools/home
6
6
  Author: Deltares
@@ -1,6 +1,6 @@
1
1
  casadi==3.5.*
2
- numpy>=1.16.0
3
- scipy>=1.0.0
2
+ numpy<1.23,>=1.16.0
3
+ scipy<1.11,>=1.0.0
4
4
  pymoca==0.9.*
5
5
  rtc-tools-channel-flow>=1.1.0
6
6
 
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2022-12-08T16:06:43+0000",
11
+ "date": "2023-03-21T15:45:07+0100",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "3f949d10da42fb1aa8b9888f742771dd50947494",
15
- "version": "2.5.1rc1"
14
+ "full-revisionid": "51c2d6cf97df52e8a6790dc74aa9ec0866fc5a5c",
15
+ "version": "2.5.2a2"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -732,14 +732,6 @@ class Timeseries:
732
732
  if self.__binary:
733
733
  f = io.open(self.binary_path, 'wb')
734
734
 
735
- if self.timezone is not None:
736
- timezone = self.__xml_root.find('pi:timeZone', ns)
737
- if timezone is None:
738
- timezone = ET.Element('{%s}' % (ns['pi'], ) + 'timeZone')
739
- # timeZone has to be the first element according to the schema
740
- self.__xml_root.insert(0, timezone)
741
- timezone.text = str(self.timezone)
742
-
743
735
  if self.make_new_file:
744
736
  # Force reinitialization in case write() is called more than once
745
737
  self.__reset_xml_tree()
@@ -753,6 +745,14 @@ class Timeseries:
753
745
  ensemble_member=ensemble_member, miss_val=-999, unit=unit)
754
746
 
755
747
  for ensemble_member in range(len(self.__values)):
748
+ if self.timezone is not None:
749
+ timezone = self.__xml_root.find('pi:timeZone', ns)
750
+ if timezone is None:
751
+ timezone = ET.Element('{%s}' % (ns['pi'],) + 'timeZone')
752
+ # timeZone has to be the first element according to the schema
753
+ self.__xml_root.insert(0, timezone)
754
+ timezone.text = str(self.timezone)
755
+
756
756
  for series in self.__xml_root.findall('pi:series', ns):
757
757
  header = series.find('pi:header', ns)
758
758
 
@@ -227,7 +227,7 @@ class CollocatedIntegratedOptimizationProblem(OptimizationProblem, metaclass=ABC
227
227
 
228
228
  if self.integrated_states:
229
229
  warnings.warn("Integrated states are deprecated and support will be removed in a future version.",
230
- FutureWarning)
230
+ FutureWarning, stacklevel=1)
231
231
 
232
232
  # Variables that are integrated states are not yet allowed to have size > 1
233
233
  for variable in self.integrated_states:
@@ -442,7 +442,8 @@ class CollocatedIntegratedOptimizationProblem(OptimizationProblem, metaclass=ABC
442
442
  # Establish integrator theta
443
443
  theta = self.theta
444
444
  if theta < 1:
445
- warnings.warn("Explicit collocation is deprecated and will be removed in a future version.", FutureWarning)
445
+ warnings.warn("Explicit collocation is deprecated and will be removed in a future version.",
446
+ FutureWarning, stacklevel=1)
446
447
 
447
448
  # Set CasADi function options
448
449
  options = self.solver_options()
@@ -1326,7 +1327,8 @@ class CollocatedIntegratedOptimizationProblem(OptimizationProblem, metaclass=ABC
1326
1327
  ca.repmat(np.nan, len(self.path_variables)),
1327
1328
  ca.repmat(np.nan, len(self.__extra_constant_inputs))),
1328
1329
  ca.repmat(np.nan, len(self.extra_variables))])
1329
- delayed_feedback_history[i, :] = history_delayed_feedback_res
1330
+ delayed_feedback_history[i, :] = [
1331
+ float(val) for val in history_delayed_feedback_res]
1330
1332
 
1331
1333
  initial_delayed_feedback = delayed_feedback_function.call(
1332
1334
  self.__func_initial_inputs[ensemble_member], False, True)
@@ -293,6 +293,11 @@ class CSVLookupTableMixin(OptimizationProblem):
293
293
  curve_name, *curvefit_options))
294
294
  return tuple(curvefit_options)
295
295
 
296
+ def check_lookup_table(lookup_table):
297
+ if lookup_table in self.__lookup_tables:
298
+ raise Exception(
299
+ "Cannot add lookup table {},"
300
+ "since there is already one with this name.".format(lookup_table))
296
301
  # Read CSV files
297
302
  logger.info(
298
303
  "CSVLookupTableMixin: Generating Splines from lookup table data.")
@@ -365,6 +370,7 @@ class CSVLookupTableMixin(OptimizationProblem):
365
370
  symbols = [ca.SX.sym(inputs[0])]
366
371
  if not valid_cache:
367
372
  function = ca.Function('f', symbols, [BSpline1D(*tck)(symbols[0])])
373
+ check_lookup_table(output)
368
374
  self.__lookup_tables[output] = LookupTable(symbols, function, tck)
369
375
 
370
376
  elif len(csvinput.dtype.names) == 3:
@@ -400,6 +406,7 @@ class CSVLookupTableMixin(OptimizationProblem):
400
406
  symbols = [ca.SX.sym(inputs[0]), ca.SX.sym(inputs[1])]
401
407
  if not valid_cache:
402
408
  function = ca.Function('f', symbols, [BSpline2D(*tck)(symbols[0], symbols[1])])
409
+ check_lookup_table(output)
403
410
  self.__lookup_tables[output] = LookupTable(symbols, function, tck)
404
411
 
405
412
  else:
@@ -563,7 +563,7 @@ class GoalProgrammingMixin(_GoalProgrammingMixinBase):
563
563
  self.pre()
564
564
 
565
565
  # Group goals into subproblems
566
- subproblems = []
566
+ self.subproblems = []
567
567
  goals = self.goals()
568
568
  path_goals = self.path_goals()
569
569
 
@@ -580,7 +580,7 @@ class GoalProgrammingMixin(_GoalProgrammingMixinBase):
580
580
  priorities = {int(goal.priority) for goal in itertools.chain(goals, path_goals) if not goal.is_empty}
581
581
 
582
582
  for priority in sorted(priorities):
583
- subproblems.append((
583
+ self.subproblems.append((
584
584
  priority,
585
585
  [goal for goal in goals if int(goal.priority) == priority and not goal.is_empty],
586
586
  [goal for goal in path_goals if int(goal.priority) == priority and not goal.is_empty]))
@@ -605,7 +605,7 @@ class GoalProgrammingMixin(_GoalProgrammingMixinBase):
605
605
  self.__results_are_current = False
606
606
  self.__original_constant_input_keys = {}
607
607
  self.__original_parameter_keys = {}
608
- for i, (priority, goals, path_goals) in enumerate(subproblems):
608
+ for i, (priority, goals, path_goals) in enumerate(self.subproblems):
609
609
  logger.info("Solving goals at priority {}".format(priority))
610
610
 
611
611
  # Call the pre priority hook
@@ -310,5 +310,6 @@ class IOMixin(OptimizationProblem, metaclass=ABCMeta):
310
310
  Deprecated, use `io.reference_datetime` and `io.datetimes`, or override behavior using
311
311
  :py:meth:`OptimizationProblem.times` and/or :py:attr:`OptimizationProblem.initial_time`.
312
312
  """
313
- warnings.warn('get_forecast_index() is deprecated and will be removed in the future', FutureWarning)
313
+ warnings.warn('get_forecast_index() is deprecated and will be removed in the future',
314
+ FutureWarning, stacklevel=1)
314
315
  return bisect.bisect_left(self.io.datetimes, self.io.reference_datetime)
@@ -155,12 +155,34 @@ class OptimizationProblem(DataStoreAccessor, metaclass=ABCMeta):
155
155
 
156
156
  success, log_level = self.solver_success(self.__solver_stats, log_solver_failure_as_error)
157
157
 
158
+ return_status = self.__solver_stats['return_status']
159
+ if 'secondary_return_status' in self.__solver_stats:
160
+ return_status = "{}: {}".format(return_status, self.__solver_stats['secondary_return_status'])
161
+ wall_clock_time = "elapsed time not read"
162
+ if 't_wall_total' in self.__solver_stats:
163
+ wall_clock_time = "{} seconds".format(self.__solver_stats['t_wall_total'])
164
+ elif 't_wall_solver' in self.__solver_stats:
165
+ wall_clock_time = "{} seconds".format(self.__solver_stats['t_wall_solver'])
166
+
158
167
  if success:
159
- logger.log(log_level, "Solver succeeded with status {}".format(
160
- self.__solver_stats['return_status']))
168
+ logger.log(log_level, "Solver succeeded with status {} ({}).".format(
169
+ return_status, wall_clock_time))
161
170
  else:
162
- logger.log(log_level, "Solver failed with status {}".format(
163
- self.__solver_stats['return_status']))
171
+ try:
172
+ ii = [y[0] for y in self.loop_over_error].index(self.priority)
173
+ loop_error_indicator = self.loop_over_error[ii][1]
174
+ try:
175
+ loop_error = self.loop_over_error[ii][2]
176
+ if loop_error_indicator and loop_error in return_status:
177
+ log_level = logging.INFO
178
+ except IndexError:
179
+ if loop_error_indicator:
180
+ log_level = logging.INFO
181
+ logger.log(log_level, "Solver succeeded with status {} ({}).".format(
182
+ return_status, wall_clock_time))
183
+ except (AttributeError, ValueError):
184
+ logger.log(log_level, "Solver succeeded with status {} ({}).".format(
185
+ return_status, wall_clock_time))
164
186
 
165
187
  # Do any postprocessing
166
188
  if postprocessing:
File without changes
File without changes
File without changes
File without changes
File without changes