pyconvexity 0.4.0__py3-none-any.whl → 0.4.1__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.
- pyconvexity/__init__.py +87 -46
- pyconvexity/_version.py +1 -1
- pyconvexity/core/__init__.py +3 -5
- pyconvexity/core/database.py +111 -103
- pyconvexity/core/errors.py +16 -10
- pyconvexity/core/types.py +61 -54
- pyconvexity/data/__init__.py +0 -1
- pyconvexity/data/loaders/cache.py +65 -64
- pyconvexity/data/schema/01_core_schema.sql +134 -234
- pyconvexity/data/schema/02_data_metadata.sql +38 -168
- pyconvexity/data/schema/03_validation_data.sql +327 -264
- pyconvexity/data/sources/gem.py +169 -139
- pyconvexity/io/__init__.py +4 -10
- pyconvexity/io/excel_exporter.py +694 -480
- pyconvexity/io/excel_importer.py +817 -545
- pyconvexity/io/netcdf_exporter.py +66 -61
- pyconvexity/io/netcdf_importer.py +850 -619
- pyconvexity/models/__init__.py +109 -59
- pyconvexity/models/attributes.py +197 -178
- pyconvexity/models/carriers.py +70 -67
- pyconvexity/models/components.py +260 -236
- pyconvexity/models/network.py +202 -284
- pyconvexity/models/results.py +65 -55
- pyconvexity/models/scenarios.py +58 -88
- pyconvexity/solvers/__init__.py +5 -5
- pyconvexity/solvers/pypsa/__init__.py +3 -3
- pyconvexity/solvers/pypsa/api.py +150 -134
- pyconvexity/solvers/pypsa/batch_loader.py +165 -162
- pyconvexity/solvers/pypsa/builder.py +390 -291
- pyconvexity/solvers/pypsa/constraints.py +184 -162
- pyconvexity/solvers/pypsa/solver.py +968 -663
- pyconvexity/solvers/pypsa/storage.py +1377 -671
- pyconvexity/timeseries.py +63 -60
- pyconvexity/validation/__init__.py +14 -6
- pyconvexity/validation/rules.py +95 -84
- pyconvexity-0.4.1.dist-info/METADATA +46 -0
- pyconvexity-0.4.1.dist-info/RECORD +42 -0
- pyconvexity/data/schema/04_scenario_schema.sql +0 -122
- pyconvexity/data/schema/migrate_add_geometries.sql +0 -73
- pyconvexity-0.4.0.dist-info/METADATA +0 -138
- pyconvexity-0.4.0.dist-info/RECORD +0 -44
- {pyconvexity-0.4.0.dist-info → pyconvexity-0.4.1.dist-info}/WHEEL +0 -0
- {pyconvexity-0.4.0.dist-info → pyconvexity-0.4.1.dist-info}/top_level.txt +0 -0
pyconvexity/__init__.py
CHANGED
|
@@ -45,29 +45,47 @@ from pyconvexity.core.database import (
|
|
|
45
45
|
# Import main API functions
|
|
46
46
|
from pyconvexity.models import (
|
|
47
47
|
# Component operations
|
|
48
|
-
get_component,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
get_component,
|
|
49
|
+
create_component,
|
|
50
|
+
update_component,
|
|
51
|
+
delete_component,
|
|
52
|
+
list_components_by_type,
|
|
53
|
+
list_component_attributes,
|
|
54
|
+
# Attribute operations
|
|
55
|
+
set_static_attribute,
|
|
56
|
+
set_timeseries_attribute,
|
|
57
|
+
get_attribute,
|
|
58
|
+
delete_attribute,
|
|
54
59
|
# Network operations
|
|
55
|
-
create_network,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
create_network,
|
|
61
|
+
get_network_info,
|
|
62
|
+
get_network_time_periods,
|
|
63
|
+
list_networks,
|
|
64
|
+
create_carrier,
|
|
65
|
+
list_carriers,
|
|
66
|
+
get_network_config,
|
|
67
|
+
set_network_config,
|
|
59
68
|
# Scenario operations
|
|
60
|
-
create_scenario,
|
|
69
|
+
create_scenario,
|
|
70
|
+
list_scenarios,
|
|
71
|
+
get_scenario,
|
|
72
|
+
delete_scenario,
|
|
61
73
|
)
|
|
62
74
|
|
|
63
75
|
from pyconvexity.validation import (
|
|
64
|
-
get_validation_rule,
|
|
76
|
+
get_validation_rule,
|
|
77
|
+
list_validation_rules,
|
|
78
|
+
validate_timeseries_alignment,
|
|
65
79
|
)
|
|
66
80
|
|
|
67
81
|
# High-level timeseries API - recommended for new code
|
|
68
82
|
from pyconvexity.timeseries import (
|
|
69
|
-
get_timeseries,
|
|
70
|
-
|
|
83
|
+
get_timeseries,
|
|
84
|
+
set_timeseries,
|
|
85
|
+
get_timeseries_metadata,
|
|
86
|
+
get_multiple_timeseries,
|
|
87
|
+
timeseries_to_numpy,
|
|
88
|
+
numpy_to_timeseries,
|
|
71
89
|
)
|
|
72
90
|
|
|
73
91
|
# High-level API functions
|
|
@@ -75,62 +93,74 @@ __all__ = [
|
|
|
75
93
|
# Version info
|
|
76
94
|
"__version__",
|
|
77
95
|
"__author__",
|
|
78
|
-
|
|
79
96
|
# Core types
|
|
80
97
|
"StaticValue",
|
|
81
98
|
"Timeseries",
|
|
82
|
-
"TimeseriesMetadata",
|
|
99
|
+
"TimeseriesMetadata",
|
|
83
100
|
"Component",
|
|
84
101
|
"Network",
|
|
85
102
|
"CreateNetworkRequest",
|
|
86
103
|
"CreateComponentRequest",
|
|
87
|
-
|
|
88
104
|
# Database operations
|
|
89
105
|
"create_database_with_schema",
|
|
90
|
-
"database_context",
|
|
106
|
+
"database_context",
|
|
91
107
|
"open_connection",
|
|
92
108
|
"validate_database",
|
|
93
|
-
|
|
94
109
|
# Database maintenance
|
|
95
110
|
"vacuum_database",
|
|
96
|
-
"analyze_database",
|
|
111
|
+
"analyze_database",
|
|
97
112
|
"optimize_database",
|
|
98
113
|
"get_database_size_info",
|
|
99
114
|
"should_optimize_database",
|
|
100
|
-
|
|
101
115
|
# Exceptions
|
|
102
116
|
"PyConvexityError",
|
|
103
117
|
"DatabaseError",
|
|
104
118
|
"ValidationError",
|
|
105
119
|
"ComponentNotFound",
|
|
106
120
|
"AttributeNotFound",
|
|
107
|
-
|
|
108
121
|
# Component operations
|
|
109
|
-
"get_component",
|
|
110
|
-
"
|
|
111
|
-
|
|
122
|
+
"get_component",
|
|
123
|
+
"create_component",
|
|
124
|
+
"update_component",
|
|
125
|
+
"delete_component",
|
|
126
|
+
"list_components_by_type",
|
|
127
|
+
"list_component_attributes",
|
|
112
128
|
# Attribute operations
|
|
113
|
-
"set_static_attribute",
|
|
114
|
-
|
|
129
|
+
"set_static_attribute",
|
|
130
|
+
"set_timeseries_attribute",
|
|
131
|
+
"get_attribute",
|
|
132
|
+
"delete_attribute",
|
|
115
133
|
# Network operations
|
|
116
|
-
"create_network",
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
|
|
134
|
+
"create_network",
|
|
135
|
+
"get_network_info",
|
|
136
|
+
"get_network_time_periods",
|
|
137
|
+
"list_networks",
|
|
138
|
+
"create_carrier",
|
|
139
|
+
"list_carriers",
|
|
140
|
+
"get_network_config",
|
|
141
|
+
"set_network_config",
|
|
120
142
|
# Scenario operations
|
|
121
|
-
"create_scenario",
|
|
122
|
-
|
|
143
|
+
"create_scenario",
|
|
144
|
+
"list_scenarios",
|
|
145
|
+
"get_scenario",
|
|
146
|
+
"delete_scenario",
|
|
123
147
|
# Validation
|
|
124
|
-
"get_validation_rule",
|
|
125
|
-
|
|
148
|
+
"get_validation_rule",
|
|
149
|
+
"list_validation_rules",
|
|
150
|
+
"validate_timeseries_alignment",
|
|
126
151
|
# High-level timeseries API
|
|
127
|
-
"get_timeseries",
|
|
128
|
-
"
|
|
152
|
+
"get_timeseries",
|
|
153
|
+
"set_timeseries",
|
|
154
|
+
"get_timeseries_metadata",
|
|
155
|
+
"get_multiple_timeseries",
|
|
156
|
+
"timeseries_to_numpy",
|
|
157
|
+
"numpy_to_timeseries",
|
|
129
158
|
]
|
|
130
159
|
|
|
131
160
|
# Data module imports
|
|
132
161
|
try:
|
|
133
162
|
from pyconvexity import data
|
|
163
|
+
|
|
134
164
|
__all__.append("data")
|
|
135
165
|
except ImportError:
|
|
136
166
|
# Data dependencies not available
|
|
@@ -139,13 +169,24 @@ except ImportError:
|
|
|
139
169
|
# Optional imports with graceful fallbacks
|
|
140
170
|
try:
|
|
141
171
|
from pyconvexity.solvers.pypsa import (
|
|
142
|
-
solve_network,
|
|
143
|
-
|
|
172
|
+
solve_network,
|
|
173
|
+
build_pypsa_network,
|
|
174
|
+
solve_pypsa_network,
|
|
175
|
+
load_network_components,
|
|
176
|
+
apply_constraints,
|
|
177
|
+
store_solve_results,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
__all__.extend(
|
|
181
|
+
[
|
|
182
|
+
"solve_network",
|
|
183
|
+
"build_pypsa_network",
|
|
184
|
+
"solve_pypsa_network",
|
|
185
|
+
"load_network_components",
|
|
186
|
+
"apply_constraints",
|
|
187
|
+
"store_solve_results",
|
|
188
|
+
]
|
|
144
189
|
)
|
|
145
|
-
__all__.extend([
|
|
146
|
-
"solve_network", "build_pypsa_network", "solve_pypsa_network",
|
|
147
|
-
"load_network_components", "apply_constraints", "store_solve_results"
|
|
148
|
-
])
|
|
149
190
|
except ImportError:
|
|
150
191
|
# PyPSA not available
|
|
151
192
|
pass
|
|
@@ -153,9 +194,8 @@ except ImportError:
|
|
|
153
194
|
# Excel I/O functionality
|
|
154
195
|
try:
|
|
155
196
|
from pyconvexity.io import ExcelModelExporter, ExcelModelImporter
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
])
|
|
197
|
+
|
|
198
|
+
__all__.extend(["ExcelModelExporter", "ExcelModelImporter"])
|
|
159
199
|
except ImportError:
|
|
160
200
|
# Excel dependencies not available
|
|
161
201
|
pass
|
|
@@ -163,6 +203,7 @@ except ImportError:
|
|
|
163
203
|
|
|
164
204
|
try:
|
|
165
205
|
from pyconvexity.io import NetCDFModelExporter, NetCDFModelImporter
|
|
206
|
+
|
|
166
207
|
__all__.extend(["NetCDFModelExporter", "NetCDFModelImporter"])
|
|
167
208
|
except ImportError:
|
|
168
209
|
# NetCDF dependencies not available
|
pyconvexity/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.4.
|
|
1
|
+
__version__ = "0.4.1"
|
pyconvexity/core/__init__.py
CHANGED
|
@@ -36,16 +36,15 @@ from pyconvexity.core.database import (
|
|
|
36
36
|
__all__ = [
|
|
37
37
|
# Errors
|
|
38
38
|
"PyConvexityError",
|
|
39
|
-
"DatabaseError",
|
|
39
|
+
"DatabaseError",
|
|
40
40
|
"ValidationError",
|
|
41
41
|
"ComponentNotFound",
|
|
42
42
|
"AttributeNotFound",
|
|
43
43
|
"InvalidDataType",
|
|
44
44
|
"TimeseriesError",
|
|
45
|
-
|
|
46
45
|
# Types
|
|
47
46
|
"StaticValue",
|
|
48
|
-
"AttributeValue",
|
|
47
|
+
"AttributeValue",
|
|
49
48
|
"ValidationRule",
|
|
50
49
|
"Component",
|
|
51
50
|
"Network",
|
|
@@ -53,10 +52,9 @@ __all__ = [
|
|
|
53
52
|
"TimeseriesValidationResult",
|
|
54
53
|
"CreateComponentRequest",
|
|
55
54
|
"CreateNetworkRequest",
|
|
56
|
-
|
|
57
55
|
# Database
|
|
58
56
|
"DatabaseContext",
|
|
59
57
|
"open_connection",
|
|
60
|
-
"validate_database",
|
|
58
|
+
"validate_database",
|
|
61
59
|
"create_database_with_schema",
|
|
62
60
|
]
|