Skip to content

Commit 989454e

Browse files
suggested changes
1 parent 3032fad commit 989454e

File tree

3 files changed

+26
-38
lines changed

3 files changed

+26
-38
lines changed

solar_consumer/data/locations.csv

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
name,latitude,longitude,region_id,region,country_code,location_type
22
nl_national,52.13,5.29,0,,nl,NATION
3-
nl_groningen,53.22,6.74,1,,nl,COUNTY
4-
nl_region_2_friesland,53.11,5.85,2,,nl,COUNTY
5-
nl_region_3_drenthe,52.86,6.62,3,,nl,COUNTY
6-
nl_region_4_overijssel,52.45,6.45,4,,nl,COUNTY
7-
nl_region_5_flevoland,52.53,5.60,5,,nl,COUNTY
8-
nl_region_6_gelderland,52.06,5.95,6,,nl,COUNTY
9-
nl_region_7_utrecht,52.08,5.17,7,,nl,COUNTY
10-
nl_region_8_noord_holland,52.58,4.87,8,,nl,COUNTY
11-
nl_region_9_zuid_holland,51.94,4.47,9,,nl,COUNTY
12-
nl_region_10_zeeland,51.45,3.84,10,,nl,COUNTY
13-
nl_region_11_noord_brabant,51.56,5.20,11,,nl,COUNTY
14-
nl_region_12_limburg,51.21,5.94,12,,nl,COUNTY
3+
nl_groningen,53.22,6.74,1,,nl,STATE
4+
nl_region_2_friesland,53.11,5.85,2,,nl,STATE
5+
nl_region_3_drenthe,52.86,6.62,3,,nl,STATE
6+
nl_region_4_overijssel,52.45,6.45,4,,nl,STATE
7+
nl_region_5_flevoland,52.53,5.60,5,,nl,STATE
8+
nl_region_6_gelderland,52.06,5.95,6,,nl,STATE
9+
nl_region_7_utrecht,52.08,5.17,7,,nl,STATE
10+
nl_region_8_noord_holland,52.58,4.87,8,,nl,STATE
11+
nl_region_9_zuid_holland,51.94,4.47,9,,nl,STATE
12+
nl_region_10_zeeland,51.45,3.84,10,,nl,STATE
13+
nl_region_11_noord_brabant,51.56,5.20,11,,nl,STATE
14+
nl_region_12_limburg,51.21,5.94,12,,nl,STATE
1515
be_belgium,50.85,4.35,,Belgium,be,NATION
16-
be_flanders,51.00,4.46,,Flanders,be,COUNTY
17-
be_wallonia,50.50,4.70,,Wallonia,be,COUNTY
18-
be_brussels,50.85,4.35,,Brussels,be,COUNTY
16+
be_flanders,51.00,4.46,,Flanders,be,STATE
17+
be_wallonia,50.50,4.70,,Wallonia,be,STATE
18+
be_brussels,50.85,4.35,,Brussels,be,STATE

solar_consumer/save/save_data_platform.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ def _get_country_config(country: str) -> dict:
2626
configs = {
2727
"nl": {
2828
"id_key": "region_id",
29-
"location_type": [dp.LocationType.NATION, dp.LocationType.COUNTY],
29+
"location_type": [dp.LocationType.NATION, dp.LocationType.STATE],
3030
"metadata_type": "number",
3131
"observer_name": "nednl",
3232
},
3333
"be": {
3434
"id_key": "region",
35-
"location_type": [dp.LocationType.NATION, dp.LocationType.COUNTY],
35+
"location_type": [dp.LocationType.NATION, dp.LocationType.STATE],
3636
"metadata_type": "string",
3737
"observer_name": "elia_be",
3838
},
@@ -171,8 +171,8 @@ async def _create_locations_from_csv(
171171

172172
if location_type_str == "NATION":
173173
location_type = dp.LocationType.NATION
174-
elif location_type_str == "COUNTY":
175-
location_type = dp.LocationType.COUNTY
174+
elif location_type_str == "STATE":
175+
location_type = dp.LocationType.STATE
176176
else:
177177
location_type = dp.LocationType.NATION
178178

@@ -382,9 +382,6 @@ async def save_generation_to_data_platform(
382382
new_effective_capacity_watts=new_cap,
383383
valid_from_utc=t,
384384
)
385-
# TODO if we run the next line, the tests seem to pass
386-
# _ = await client.update_location(req)
387-
######## code that doesnt work (maybe)
388385
tasks.append(asyncio.create_task(client.update_location(req)))
389386

390387
if len(tasks) > 0:

tests/integration/test_save_nl_and_be_to_data_platform.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ async def test_save_generation_to_data_platform(client, config):
140140

141141
location_type = dp.LocationType.NATION
142142
if loc_config.get("metadata_key") in ["region_id", "region"] and loc_config["name"] not in ["nl_national", "be_belgium"]:
143-
location_type = dp.LocationType.COUNTY
143+
location_type = dp.LocationType.STATE
144144

145145
create_location_request = dp.CreateLocationRequest(
146146
location_name=loc_config["name"],
@@ -178,15 +178,11 @@ async def test_save_generation_to_data_platform(client, config):
178178
end_timestamp_utc=datetime.datetime(2025, 1, 2, tzinfo=datetime.timezone.utc),
179179
),
180180
)
181-
import asyncio
182-
for _ in range(15):
183-
get_observations_response = await client.get_observations_as_timeseries(
184-
get_observations_request
185-
)
186-
if len(get_observations_response.values) > 0:
187-
break
188-
await asyncio.sleep(1)
189-
181+
182+
get_observations_response = await client.get_observations_as_timeseries(
183+
get_observations_request
184+
)
185+
190186
# Check that observations exist
191187
assert len(get_observations_response.values) > 0, f"No observations found for {location_name}"
192188

@@ -200,12 +196,7 @@ async def test_save_generation_to_data_platform(client, config):
200196
energy_source=dp.EnergySource.SOLAR,
201197
pivot_timestamp_utc=pivot_time
202198
)
203-
import asyncio
204-
for _ in range(15):
205-
get_location_response = await client.get_location(get_location_request)
206-
if get_location_response.effective_capacity_watts == expected_capacity:
207-
break
208-
await asyncio.sleep(1)
199+
get_location_response = await client.get_location(get_location_request)
209200
assert get_location_response.effective_capacity_watts == expected_capacity, \
210201
f"Capacity not updated correctly for {location_name}"
211202

0 commit comments

Comments
 (0)