zen-garden 2.7.13__tar.gz → 2.7.15__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.
Files changed (36) hide show
  1. {zen_garden-2.7.13 → zen_garden-2.7.15}/PKG-INFO +3 -8
  2. {zen_garden-2.7.13 → zen_garden-2.7.15}/README.md +2 -7
  3. {zen_garden-2.7.13 → zen_garden-2.7.15}/pyproject.toml +1 -1
  4. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/postprocess/results/results.py +21 -0
  5. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/postprocess/results/solution_loader.py +5 -0
  6. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/utils.py +27 -0
  7. {zen_garden-2.7.13 → zen_garden-2.7.15}/LICENSE.txt +0 -0
  8. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/__init__.py +0 -0
  9. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/__main__.py +0 -0
  10. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/_internal.py +0 -0
  11. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/default_config.py +0 -0
  12. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/__init__.py +0 -0
  13. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/carrier/__init__.py +0 -0
  14. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/carrier/carrier.py +0 -0
  15. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/component.py +0 -0
  16. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/element.py +0 -0
  17. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/energy_system.py +0 -0
  18. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/technology/__init__.py +0 -0
  19. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/technology/conversion_technology.py +0 -0
  20. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/technology/retrofitting_technology.py +0 -0
  21. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/technology/storage_technology.py +0 -0
  22. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/technology/technology.py +0 -0
  23. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/technology/transport_technology.py +0 -0
  24. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/model/time_steps.py +0 -0
  25. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/optimization_setup.py +0 -0
  26. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/postprocess/.gitkeep +0 -0
  27. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/postprocess/__init__.py +0 -0
  28. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/postprocess/comparisons.py +0 -0
  29. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/postprocess/postprocess.py +0 -0
  30. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/postprocess/results/__init__.py +0 -0
  31. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/preprocess/__init__.py +0 -0
  32. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/preprocess/extract_input_data.py +0 -0
  33. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/preprocess/parameter_change_log.py +0 -0
  34. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/preprocess/time_series_aggregation.py +0 -0
  35. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/preprocess/unit_handling.py +0 -0
  36. {zen_garden-2.7.13 → zen_garden-2.7.15}/zen_garden/visualization.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zen_garden
3
- Version: 2.7.13
3
+ Version: 2.7.15
4
4
  Summary: ZEN-garden is an optimization model of energy systems and value chains.
5
5
  Author: Alissa Ganter, Johannes Burger, Francesco De Marco, Lukas Kunz, Lukas Schmidt-Engelbertz, Paolo Gabrielli, Giovanni Sansavini
6
6
  Author-email: Jacob Mannhardt <zen-garden@ethz.ch>
@@ -62,7 +62,7 @@ Provides-Extra: vis
62
62
 
63
63
  <img src="https://github.com/ZEN-universe/ZEN-garden/assets/114185605/d6a9aca9-74b0-4a82-8295-43e6a78b8450" alt="drawing" width="200"/>
64
64
 
65
- Welcome to the ZEN-garden! ZEN-garden is an optimization model of energy systems and value chains.
65
+ Welcome to the ZEN-garden! ZEN-garden is an optimization framework for energy transition pathways.
66
66
  It is currently used to model the electricity system, hydrogen value chains, and carbon capture, storage and utilization (CCUS) value chains.
67
67
  However, it is designed to be modular and flexible, and can be extended to model other types of energy systems, value chains or other network-based systems.
68
68
 
@@ -80,12 +80,7 @@ If you want to work on the codebase, fork and clone the repository and install t
80
80
 
81
81
  ## Documentation
82
82
  Please refer to the documentation of the ZEN-garden framework [on Read-the-Docs](https://zen-garden.readthedocs.io/en/latest/).
83
-
84
- In the file `documentation/how_to_ZEN-garden.md`, you can find additional information on how to use the framework.
85
- The `documentation/dataset_creation_tutorial.md` file contains a tutorial on how to create a simple dataset for the framework.
86
- Additionally, example datasets are available in the `dataset_examples` folder.
87
-
88
- More in-depth manuals are available in the [discussions forum](https://github.com/ZEN-universe/ZEN-garden/discussions) of our repo.
83
+ Additionally, example datasets are available in the `dataset_examples` folder and described in [the documentation](https://zen-garden.readthedocs.io/en/latest/files/zen_garden_in_detail/dataset_examples.html).
89
84
 
90
85
  ## News
91
86
  Review recent modifications outlined in the [changelog](https://github.com/ZEN-universe/ZEN-garden/blob/main/CHANGELOG.md).
@@ -12,7 +12,7 @@
12
12
 
13
13
  <img src="https://github.com/ZEN-universe/ZEN-garden/assets/114185605/d6a9aca9-74b0-4a82-8295-43e6a78b8450" alt="drawing" width="200"/>
14
14
 
15
- Welcome to the ZEN-garden! ZEN-garden is an optimization model of energy systems and value chains.
15
+ Welcome to the ZEN-garden! ZEN-garden is an optimization framework for energy transition pathways.
16
16
  It is currently used to model the electricity system, hydrogen value chains, and carbon capture, storage and utilization (CCUS) value chains.
17
17
  However, it is designed to be modular and flexible, and can be extended to model other types of energy systems, value chains or other network-based systems.
18
18
 
@@ -30,12 +30,7 @@ If you want to work on the codebase, fork and clone the repository and install t
30
30
 
31
31
  ## Documentation
32
32
  Please refer to the documentation of the ZEN-garden framework [on Read-the-Docs](https://zen-garden.readthedocs.io/en/latest/).
33
-
34
- In the file `documentation/how_to_ZEN-garden.md`, you can find additional information on how to use the framework.
35
- The `documentation/dataset_creation_tutorial.md` file contains a tutorial on how to create a simple dataset for the framework.
36
- Additionally, example datasets are available in the `dataset_examples` folder.
37
-
38
- More in-depth manuals are available in the [discussions forum](https://github.com/ZEN-universe/ZEN-garden/discussions) of our repo.
33
+ Additionally, example datasets are available in the `dataset_examples` folder and described in [the documentation](https://zen-garden.readthedocs.io/en/latest/files/zen_garden_in_detail/dataset_examples.html).
39
34
 
40
35
  ## News
41
36
  Review recent modifications outlined in the [changelog](https://github.com/ZEN-universe/ZEN-garden/blob/main/CHANGELOG.md).
@@ -15,7 +15,7 @@ authors = [
15
15
  {name = "Giovanni Sansavini"},
16
16
  ]
17
17
  # do not change version manually! Done by bump2version
18
- version = "2.7.13"
18
+ version = "2.7.15"
19
19
  requires-python= ">=3.11,<3.14"
20
20
  description="ZEN-garden is an optimization model of energy systems and value chains."
21
21
  readme = "README.md"
@@ -673,6 +673,27 @@ class Results:
673
673
  return ""
674
674
  return component.doc
675
675
 
676
+ def get_index_names(self, component_name: str, scenario_name: Optional[str] = None) -> list[str]:
677
+ """
678
+ Docstring for get_index_names
679
+
680
+ :param self: Description
681
+ :param component_name: Description
682
+ :type component_name: str
683
+ :param scenario_name: Description
684
+ :type scenario_name: Optional[str]
685
+ :return: Description
686
+ :rtype: list[str]
687
+ """
688
+ if scenario_name is None:
689
+ scenario_name = next(iter(self.solution_loader.scenarios.keys()))
690
+ scenario = self.solution_loader.scenarios[scenario_name]
691
+ if component_name not in scenario.components:
692
+ logging.warning(f"Component {component_name} not found and the index names cannot be returned.")
693
+ return []
694
+ component = scenario.components[component_name]
695
+ return component.index_names
696
+
676
697
  def get_years(self, scenario_name: Optional[str] = None) -> list[int]:
677
698
  """
678
699
  Extracts the years of a given Scenario. If no scenario is given, a random one is taken.
@@ -10,10 +10,13 @@ import h5py # type: ignore
10
10
  import pint
11
11
  import pandas as pd
12
12
  import numpy as np
13
+ import logging
14
+
13
15
  from typing import Optional, Any,Literal
14
16
  from enum import Enum
15
17
  from functools import cache
16
18
  from zen_garden.default_config import Analysis, System, Solver
19
+ from zen_garden.utils import slice_df_by_index
17
20
 
18
21
  class ComponentType(Enum):
19
22
  parameter: str = "parameter"
@@ -788,6 +791,8 @@ def get_df_from_path(path: str, component_name: str, version: str, data_type: Li
788
791
 
789
792
  if check_if_v1_leq_v2(version,"v0"):
790
793
  pd_read = pd.read_hdf(path, component_name + f"/{data_type}")
794
+ if len(index) > 0:
795
+ pd_read = slice_df_by_index(pd_read,index)
791
796
  else:
792
797
  if data_type == "dataframe":
793
798
  try:
@@ -262,6 +262,33 @@ def reformat_slicing_index(index, component) -> tuple[str]:
262
262
 
263
263
  return ref_index
264
264
 
265
+ def slice_df_by_index(df,index_tuple) -> dict:
266
+ """ recreates the slicing index from a tuple of strings and slices the dataframe accordingly
267
+ :param df: dataframe to be sliced
268
+ :param index_tuple: tuple of strings representing the slicing index
269
+ :return: sliced dataframe
270
+ """
271
+ index = {}
272
+ for index_str in index_tuple:
273
+ if " in " in index_str:
274
+ key, value_str = index_str.split(" in ")
275
+ key = key.strip("'")
276
+ value = eval(value_str)
277
+ elif " == " in index_str:
278
+ key, value_str = index_str.split(" == ")
279
+ key = key.strip("'")
280
+ value = eval(value_str)
281
+ else:
282
+ continue
283
+ index[key] = value
284
+ for key in index:
285
+ if key in df.index.names:
286
+ if isinstance(index[key], list):
287
+ df = df.loc[df.index.get_level_values(key).isin(index[key])]
288
+ else:
289
+ df = df.xs(index[key], level=key, drop_level=False)
290
+ return df
291
+
265
292
  def get_label_position(obj,label:int):
266
293
  """ Get dict of index and coordinate for variable or constraint labels."""
267
294
  name_element = obj.get_name_by_label(int(label))
File without changes