Skip to content

Commit 1943650

Browse files
louispt1noracato
andauthored
From excel bulk (#69)
* Start from excel bulk * Improved styling for packer * Unpack for inputs and metadata first implementation no tests * Unpack for sortables and custom curves early commit before playing around * From dataset for sortables * Parse options from main sheet to enable repeating submodels across all scenarios listed in main * Added gqueries * WIP refactoring packer to suite new input format - partially working * New excel format working pre-clean up * Split packer into individual packs * Simplify query processing * Tests for query pack and custom curves pack * Fix tests for multi-index * Simplifying normalisation * Simplifying inputs pack * Improved tests * refining notebooks --------- Co-authored-by: Nora Schinkel <[email protected]>
1 parent 0f06ad2 commit 1943650

37 files changed

+4382
-26946
lines changed
File renamed without changes.

examples/create_and_update_a_scenario.ipynb

Lines changed: 13 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,10 @@
2020
},
2121
{
2222
"cell_type": "code",
23-
"execution_count": 1,
23+
"execution_count": null,
2424
"id": "3ada4b30",
2525
"metadata": {},
26-
"outputs": [
27-
{
28-
"name": "stdout",
29-
"output_type": "stream",
30-
"text": [
31-
"Environment setup complete\n",
32-
" Using ETM API at https://beta.engine.energytransitionmodel.com/api/v3\n",
33-
" Token loaded? True\n",
34-
"API connection ready\n"
35-
]
36-
}
37-
],
26+
"outputs": [],
3827
"source": [
3928
"from example_helpers import setup_notebook\n",
4029
"from pyetm.models import Scenario\n",
@@ -52,7 +41,7 @@
5241
},
5342
{
5443
"cell_type": "code",
55-
"execution_count": 2,
44+
"execution_count": null,
5645
"id": "4770e6a9",
5746
"metadata": {},
5847
"outputs": [],
@@ -77,19 +66,10 @@
7766
},
7867
{
7968
"cell_type": "code",
80-
"execution_count": 6,
69+
"execution_count": null,
8170
"id": "5a1549ac",
8271
"metadata": {},
83-
"outputs": [
84-
{
85-
"ename": "ScenarioError",
86-
"evalue": "Could not update user values: {'external_coupling_industry_chemical_other_burner_crude_oil_share': ['user: Input should be a valid number, unable to parse string as a number']}",
87-
"output_type": "error",
88-
"traceback": [
89-
"\u001b[31mScenarioError\u001b[39m\u001b[31m:\u001b[39m Could not update user values: {'external_coupling_industry_chemical_other_burner_crude_oil_share': ['user: Input should be a valid number, unable to parse string as a number']}\n"
90-
]
91-
}
92-
],
72+
"outputs": [],
9373
"source": [
9474
"scenario.update_user_values({\n",
9575
" \"co_firing_biocoal_share\": 80.0,\n",
@@ -107,31 +87,10 @@
10787
},
10888
{
10989
"cell_type": "code",
110-
"execution_count": 4,
90+
"execution_count": null,
11191
"id": "7fc4dc21",
11292
"metadata": {},
113-
"outputs": [
114-
{
115-
"name": "stdout",
116-
"output_type": "stream",
117-
"text": [
118-
"Area: nl2019\n",
119-
"End year: 2050\n",
120-
"Start year: 2019\n",
121-
"Version: beta\n",
122-
"Modified inputs: 1\n",
123-
"First input: co_firing_biocoal_share = 80.0\n"
124-
]
125-
},
126-
{
127-
"ename": "IndexError",
128-
"evalue": "list index out of range",
129-
"output_type": "error",
130-
"traceback": [
131-
"\u001b[31mIndexError\u001b[39m\u001b[31m:\u001b[39m list index out of range\n"
132-
]
133-
}
134-
],
93+
"outputs": [],
13594
"source": [
13695
"print(f\"Area: {scenario.area_code}\")\n",
13796
"print(f\"End year: {scenario.end_year}\")\n",
@@ -153,18 +112,10 @@
153112
},
154113
{
155114
"cell_type": "code",
156-
"execution_count": 7,
115+
"execution_count": null,
157116
"id": "c6a65f6a",
158117
"metadata": {},
159-
"outputs": [
160-
{
161-
"name": "stdout",
162-
"output_type": "stream",
163-
"text": [
164-
"False\n"
165-
]
166-
}
167-
],
118+
"outputs": [],
168119
"source": [
169120
"scenario.update_metadata(\n",
170121
" private= True,\n",
@@ -195,19 +146,10 @@
195146
},
196147
{
197148
"cell_type": "code",
198-
"execution_count": 5,
149+
"execution_count": null,
199150
"id": "98ab2f5c",
200151
"metadata": {},
201-
"outputs": [
202-
{
203-
"ename": "AttributeError",
204-
"evalue": "'Scenario' object has no attribute 'remove_inputs'",
205-
"output_type": "error",
206-
"traceback": [
207-
"\u001b[31mAttributeError\u001b[39m\u001b[31m:\u001b[39m 'Scenario' object has no attribute 'remove_inputs'\n"
208-
]
209-
}
210-
],
152+
"outputs": [],
211153
"source": [
212154
"scenario.remove_user_values([\"co_firing_biocoal_share\"])\n",
213155
"user_vals = scenario.user_values()\n",
@@ -217,7 +159,7 @@
217159
],
218160
"metadata": {
219161
"kernelspec": {
220-
"display_name": "pyetm-FWBOHxp3",
162+
"display_name": "pyetm-qKH2ozgc",
221163
"language": "python",
222164
"name": "python3"
223165
},
@@ -231,7 +173,7 @@
231173
"name": "python",
232174
"nbconvert_exporter": "python",
233175
"pygments_lexer": "ipython3",
234-
"version": "3.12.11"
176+
"version": "3.12.9"
235177
}
236178
},
237179
"nbformat": 4,

0 commit comments

Comments
 (0)