pyconvexity 0.3.8.post6__py3-none-any.whl → 0.3.8.post7__py3-none-any.whl
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 pyconvexity might be problematic. Click here for more details.
- pyconvexity/_version.py +1 -1
- pyconvexity/models/__init__.py +68 -31
- {pyconvexity-0.3.8.post6.dist-info → pyconvexity-0.3.8.post7.dist-info}/METADATA +1 -1
- {pyconvexity-0.3.8.post6.dist-info → pyconvexity-0.3.8.post7.dist-info}/RECORD +6 -6
- {pyconvexity-0.3.8.post6.dist-info → pyconvexity-0.3.8.post7.dist-info}/WHEEL +0 -0
- {pyconvexity-0.3.8.post6.dist-info → pyconvexity-0.3.8.post7.dist-info}/top_level.txt +0 -0
pyconvexity/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.3.
|
|
1
|
+
__version__ = "0.3.8post7"
|
pyconvexity/models/__init__.py
CHANGED
|
@@ -12,49 +12,85 @@ from pyconvexity.models.components import (
|
|
|
12
12
|
)
|
|
13
13
|
|
|
14
14
|
from pyconvexity.models.attributes import (
|
|
15
|
-
set_static_attribute, set_timeseries_attribute, get_attribute, delete_attribute
|
|
15
|
+
set_static_attribute, set_timeseries_attribute, get_attribute, delete_attribute,
|
|
16
|
+
get_timeseries, get_timeseries_metadata
|
|
16
17
|
)
|
|
17
18
|
|
|
18
19
|
from pyconvexity.models.network import (
|
|
19
20
|
create_network, get_network_info, get_network_time_periods, list_networks,
|
|
20
|
-
create_carrier,
|
|
21
|
+
create_carrier, get_network_config, set_network_config,
|
|
21
22
|
get_component_counts, get_master_scenario_id, resolve_scenario_id,
|
|
22
23
|
get_first_network, get_network_by_name
|
|
23
24
|
)
|
|
24
25
|
|
|
25
26
|
# Import from new modules
|
|
26
27
|
from pyconvexity.models.scenarios import (
|
|
27
|
-
list_scenarios
|
|
28
|
-
get_scenario_by_name, get_scenario_by_id, get_master_scenario
|
|
28
|
+
list_scenarios,
|
|
29
|
+
get_scenario_by_name, get_scenario_by_id, get_master_scenario,
|
|
30
|
+
Scenario
|
|
29
31
|
)
|
|
30
32
|
|
|
31
33
|
from pyconvexity.models.results import (
|
|
32
|
-
get_solve_results, get_yearly_results
|
|
34
|
+
get_solve_results, get_yearly_results,
|
|
35
|
+
SolveResults, YearlyResults
|
|
33
36
|
)
|
|
34
37
|
|
|
35
38
|
from pyconvexity.models.carriers import (
|
|
36
|
-
list_carriers
|
|
37
|
-
get_carrier_by_name, get_carrier_by_id, get_carrier_colors
|
|
39
|
+
list_carriers,
|
|
40
|
+
get_carrier_by_name, get_carrier_by_id, get_carrier_colors,
|
|
41
|
+
Carrier
|
|
38
42
|
)
|
|
39
43
|
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
# Backward compatibility aliases
|
|
45
|
+
def get_scenario(conn, scenario_id):
|
|
46
|
+
"""Backward compatible alias for get_scenario_by_id."""
|
|
47
|
+
return get_scenario_by_id(conn, scenario_id)
|
|
48
|
+
|
|
49
|
+
def create_scenario(conn, network_id, name, description=None, is_master=False):
|
|
50
|
+
"""
|
|
51
|
+
Create a new scenario.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
conn: Database connection
|
|
55
|
+
network_id: Network ID
|
|
56
|
+
name: Scenario name
|
|
57
|
+
description: Optional description
|
|
58
|
+
is_master: Whether this is the master scenario (will demote existing master)
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
Scenario ID
|
|
62
|
+
"""
|
|
63
|
+
cursor = conn.execute("""
|
|
64
|
+
INSERT INTO scenarios (network_id, name, description, is_master)
|
|
65
|
+
VALUES (?, ?, ?, ?)
|
|
66
|
+
""", (network_id, name, description, is_master))
|
|
67
|
+
|
|
68
|
+
scenario_id = cursor.lastrowid
|
|
69
|
+
return scenario_id
|
|
70
|
+
|
|
71
|
+
def delete_scenario(conn, scenario_id):
|
|
72
|
+
"""
|
|
73
|
+
Delete a scenario (cannot delete master scenario).
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
conn: Database connection
|
|
77
|
+
scenario_id: Scenario ID to delete
|
|
78
|
+
|
|
79
|
+
Raises:
|
|
80
|
+
ValidationError: If trying to delete master scenario or scenario doesn't exist
|
|
81
|
+
"""
|
|
82
|
+
from pyconvexity.core.errors import ValidationError
|
|
83
|
+
|
|
84
|
+
# Check if it's a master scenario
|
|
85
|
+
scenario = get_scenario_by_id(conn, scenario_id)
|
|
86
|
+
if scenario.is_master:
|
|
87
|
+
raise ValidationError("Cannot delete master scenario")
|
|
88
|
+
|
|
89
|
+
# Delete the scenario
|
|
90
|
+
cursor = conn.execute("DELETE FROM scenarios WHERE id = ?", (scenario_id,))
|
|
91
|
+
|
|
92
|
+
if cursor.rowcount == 0:
|
|
93
|
+
raise ValidationError(f"Scenario with ID {scenario_id} not found")
|
|
58
94
|
|
|
59
95
|
__all__ = [
|
|
60
96
|
# Component operations
|
|
@@ -65,6 +101,7 @@ __all__ = [
|
|
|
65
101
|
|
|
66
102
|
# Attribute operations
|
|
67
103
|
"set_static_attribute", "set_timeseries_attribute", "get_attribute", "delete_attribute",
|
|
104
|
+
"get_timeseries", "get_timeseries_metadata",
|
|
68
105
|
|
|
69
106
|
# Network operations
|
|
70
107
|
"create_network", "get_network_info", "get_network_time_periods", "list_networks",
|
|
@@ -73,15 +110,15 @@ __all__ = [
|
|
|
73
110
|
"get_first_network", "get_network_by_name",
|
|
74
111
|
|
|
75
112
|
# Scenario operations (backward compatible)
|
|
76
|
-
"create_scenario", "
|
|
77
|
-
"
|
|
113
|
+
"create_scenario", "list_scenarios", "get_scenario", "delete_scenario",
|
|
114
|
+
"get_scenario_by_name", "get_scenario_by_id", "get_master_scenario",
|
|
115
|
+
"Scenario",
|
|
78
116
|
|
|
79
117
|
# Results operations
|
|
80
118
|
"get_solve_results", "get_yearly_results",
|
|
119
|
+
"SolveResults", "YearlyResults",
|
|
81
120
|
|
|
82
121
|
# Carrier operations
|
|
83
|
-
"
|
|
122
|
+
"get_carrier_by_name", "get_carrier_by_id", "get_carrier_colors",
|
|
123
|
+
"Carrier",
|
|
84
124
|
]
|
|
85
|
-
|
|
86
|
-
# Expose primary list_scenarios for convenience
|
|
87
|
-
list_scenarios = list_scenarios_primary
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
pyconvexity/__init__.py,sha256=eiAFroO4n-z8F0jTLpJgBIO7vtSxu9ovu3G2N-qqpUo,4783
|
|
2
|
-
pyconvexity/_version.py,sha256=
|
|
2
|
+
pyconvexity/_version.py,sha256=TT4-Unz31te2wVt1PTzfm8_E_k8zxoNBZUtkxDpvnl0,27
|
|
3
3
|
pyconvexity/timeseries.py,sha256=4p1Tdpa1otqDvCq2zppA4tw660sF_XWb8Xobib-cCms,11340
|
|
4
4
|
pyconvexity/core/__init__.py,sha256=MgVa5rrRWIi2w1UI1P4leiBntvHeeOPv0Thm0DEXBHo,1209
|
|
5
5
|
pyconvexity/core/database.py,sha256=M02q4UkJqAPeTXuwng9I7kHm16reJ7eq7wccWxnhE5I,15227
|
|
@@ -26,7 +26,7 @@ pyconvexity/io/excel_exporter.py,sha256=pjgvTs5vq9K61mNOVutEzaH5Zx4FgrDG4Xc_YmXh
|
|
|
26
26
|
pyconvexity/io/excel_importer.py,sha256=M7YcBqKUVzOMoR5HN-v8M2UnZgHRfhqgXBMUVD10-IQ,56898
|
|
27
27
|
pyconvexity/io/netcdf_exporter.py,sha256=AMM-uXBj8sh86n5m57aZ6S7LulAyIx_HM-eM-26BrWQ,7428
|
|
28
28
|
pyconvexity/io/netcdf_importer.py,sha256=nv4CYYqnbCBeznwCU_JGBMTbg-BGNpXKlsqbu2R8fTU,72152
|
|
29
|
-
pyconvexity/models/__init__.py,sha256=
|
|
29
|
+
pyconvexity/models/__init__.py,sha256=2HMICM5WX1h0MzxGHkKwUrsc5Tm1-P1Yl_PA0OFmyFI,4309
|
|
30
30
|
pyconvexity/models/attributes.py,sha256=LTvYF0hl56HeLjS8ZVocZWLhbLRTNhmZ5gUKxf93eSE,18254
|
|
31
31
|
pyconvexity/models/carriers.py,sha256=-nmasYvsaUeYPY1B0QdzfF_eph2HUFb5n3KF3CFd-YI,3700
|
|
32
32
|
pyconvexity/models/components.py,sha256=wWRdX6vErZrQhhLTnHBLDOnkmLjbHY2e9J9ITZJi3F8,18287
|
|
@@ -43,7 +43,7 @@ pyconvexity/solvers/pypsa/solver.py,sha256=7jaksRKMaQuFYWb7Pl7rw7Pu0kO5DPysQX2Jt
|
|
|
43
43
|
pyconvexity/solvers/pypsa/storage.py,sha256=T-0qEryiEy_8G4KiscPoiiWvTPd_OGqpLczW0_Xm85E,87331
|
|
44
44
|
pyconvexity/validation/__init__.py,sha256=_6SVqXkaDFqmagub_O064Zm_QIdBrOra-Gvvbo9vM4I,549
|
|
45
45
|
pyconvexity/validation/rules.py,sha256=6Kak12BVfUpjmgB5B7Wre55eGc5e1dvIdFca-vN-IFI,9296
|
|
46
|
-
pyconvexity-0.3.8.
|
|
47
|
-
pyconvexity-0.3.8.
|
|
48
|
-
pyconvexity-0.3.8.
|
|
49
|
-
pyconvexity-0.3.8.
|
|
46
|
+
pyconvexity-0.3.8.post7.dist-info/METADATA,sha256=pABuFQ8YuN_H4j8ATRJqO4QjBuYRB-RRVyPDNJxdLOI,4886
|
|
47
|
+
pyconvexity-0.3.8.post7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
48
|
+
pyconvexity-0.3.8.post7.dist-info/top_level.txt,sha256=wFPEDXVaebR3JO5Tt3HNse-ws5aROCcxEco15d6j64s,12
|
|
49
|
+
pyconvexity-0.3.8.post7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|