@@ -95,41 +95,51 @@ def fetch_production(
95
95
region_key = "New Zealand"
96
96
productions = obj ["soPgenGraph" ]["data" ][region_key ]
97
97
98
- data = {
99
- "zoneKey" : zone_key ,
100
- "datetime" : date_time ,
101
- "production" : {
102
- "coal" : productions .get ("Coal" , {"generation" : None })["generation" ],
103
- "oil" : productions .get ("Diesel/Oil" , {"generation" : None })["generation" ],
104
- "gas" : productions .get ("Gas" , {"generation" : None })["generation" ],
105
- "geothermal" : productions .get ("Geothermal" , {"generation" : None })[
106
- "generation"
107
- ],
108
- "wind" : productions .get ("Wind" , {"generation" : None })["generation" ],
109
- "hydro" : productions .get ("Hydro" , {"generation" : None })["generation" ],
110
- "solar" : productions .get ("Solar" , {"generation" : None })["generation" ],
111
- "unknown" : productions .get ("Co-Gen" , {"generation" : None })["generation" ],
112
- "nuclear" : 0 , # famous issue in NZ politics
113
- },
114
- "capacity" : {
115
- "coal" : productions .get ("Coal" , {"capacity" : None })["capacity" ],
116
- "oil" : productions .get ("Diesel/Oil" , {"capacity" : None })["capacity" ],
117
- "gas" : productions .get ("Gas" , {"capacity" : None })["capacity" ],
118
- "geothermal" : productions .get ("Geothermal" , {"capacity" : None })["capacity" ],
119
- "wind" : productions .get ("Wind" , {"capacity" : None })["capacity" ],
120
- "hydro" : productions .get ("Hydro" , {"capacity" : None })["capacity" ],
121
- "solar" : productions .get ("Solar" , {"capacity" : None })["capacity" ],
122
- "battery storage" : productions .get ("Battery" , {"capacity" : None })[
123
- "capacity"
124
- ],
125
- "unknown" : productions .get ("Co-Gen" , {"capacity" : None })["capacity" ],
126
- "nuclear" : 0 , # famous issue in NZ politics
127
- },
128
- "storage" : {
129
- "battery" : productions .get ("Battery" , {"generation" : None })["generation" ],
130
- },
131
- "source" : "transpower.co.nz" ,
132
- }
98
+ data = [
99
+ {
100
+ "zoneKey" : zone_key ,
101
+ "datetime" : date_time ,
102
+ "production" : {
103
+ "coal" : productions .get ("Coal" , {"generation" : None })["generation" ],
104
+ "oil" : productions .get ("Diesel/Oil" , {"generation" : None })[
105
+ "generation"
106
+ ],
107
+ "gas" : productions .get ("Gas" , {"generation" : None })["generation" ],
108
+ "geothermal" : productions .get ("Geothermal" , {"generation" : None })[
109
+ "generation"
110
+ ],
111
+ "wind" : productions .get ("Wind" , {"generation" : None })["generation" ],
112
+ "hydro" : productions .get ("Hydro" , {"generation" : None })["generation" ],
113
+ "solar" : productions .get ("Solar" , {"generation" : None })["generation" ],
114
+ "unknown" : productions .get ("Co-Gen" , {"generation" : None })[
115
+ "generation"
116
+ ],
117
+ "nuclear" : 0 , # famous issue in NZ politics
118
+ },
119
+ "capacity" : {
120
+ "coal" : productions .get ("Coal" , {"capacity" : None })["capacity" ],
121
+ "oil" : productions .get ("Diesel/Oil" , {"capacity" : None })["capacity" ],
122
+ "gas" : productions .get ("Gas" , {"capacity" : None })["capacity" ],
123
+ "geothermal" : productions .get ("Geothermal" , {"capacity" : None })[
124
+ "capacity"
125
+ ],
126
+ "wind" : productions .get ("Wind" , {"capacity" : None })["capacity" ],
127
+ "hydro" : productions .get ("Hydro" , {"capacity" : None })["capacity" ],
128
+ "solar" : productions .get ("Solar" , {"capacity" : None })["capacity" ],
129
+ "battery storage" : productions .get ("Battery" , {"capacity" : None })[
130
+ "capacity"
131
+ ],
132
+ "unknown" : productions .get ("Co-Gen" , {"capacity" : None })["capacity" ],
133
+ "nuclear" : 0 , # famous issue in NZ politics
134
+ },
135
+ "storage" : {
136
+ "battery" : productions .get ("Battery" , {"generation" : None })[
137
+ "generation"
138
+ ],
139
+ },
140
+ "source" : "transpower.co.nz" ,
141
+ }
142
+ ]
133
143
134
144
return data
135
145
0 commit comments