Skip to content

Commit

Permalink
fix: find closest weather sensor
Browse files Browse the repository at this point in the history
Signed-off-by: F.N. Claessen <felix@seita.nl>
  • Loading branch information
Flix6x committed Jul 14, 2023
1 parent 090529b commit c577eba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions flexmeasures/data/models/forecasting/model_spec_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ def configure_regressors_for_nearest_weather_sensor(
)
for sensor_name in correlated_sensor_names:

# Find nearest weather sensor
# Find the nearest weather sensor
closest_sensor = Sensor.find_closest(
generic_asset_type_name=sensor.generic_asset.generic_asset_type.name,
generic_asset_type_name="weather station",

This comment has been minimized.

Copy link
@nhoening

nhoening Jul 14, 2023

Contributor

This string is chosen because flexmeasures-openweathermap uses it, correct?

So there is an implicit dependency here. We should at least comment on this here.
A potential resolution could be that it is configurable (can be a follow-up issue).

This comment has been minimized.

Copy link
@Flix6x

Flix6x Jul 15, 2023

Author Contributor

Correct. Could someone else pick this up?

sensor_name=sensor_name,
object=sensor,
)
Expand Down
6 changes: 3 additions & 3 deletions flexmeasures/data/models/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,12 @@ def find_closest(
Can be called with an object that has latitude and longitude properties, for example:
sensor = Sensor.find_closest("weather_station", "wind speed", object=generic_asset)
sensor = Sensor.find_closest("weather station", "wind speed", object=generic_asset)
Can also be called with latitude and longitude parameters, for example:
sensor = Sensor.find_closest("weather_station", "temperature", latitude=32, longitude=54)
sensor = Sensor.find_closest("weather_station", "temperature", lat=32, lng=54)
sensor = Sensor.find_closest("weather station", "temperature", latitude=32, longitude=54)
sensor = Sensor.find_closest("weather station", "temperature", lat=32, lng=54)
Finally, pass in an account_id parameter if you want to query an account other than your own. This only works for admins. Public assets are always queried.
"""
Expand Down

0 comments on commit c577eba

Please sign in to comment.