Skip to content
Snippets Groups Projects
Commit d7e44f80 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

fix: Handling missing params

parent eaae8e8c
No related branches found
No related tags found
No related merge requests found
Pipeline #485 canceled
...@@ -36,7 +36,8 @@ def get_weather_data(): ...@@ -36,7 +36,8 @@ def get_weather_data():
# Period first # Period first
weather_data = filter_period(weather_data,time_start,time_end) weather_data = filter_period(weather_data,time_start,time_end)
# Parameters next # Parameters next
weather_data = filter_params(weather_data, parameters) if parameters is not None:
weather_data = filter_params(weather_data, parameters)
# Aggregation? # Aggregation?
return weather_data.as_dict() return weather_data.as_dict()
......
...@@ -21,7 +21,10 @@ def filter_params(weather_data, params): ...@@ -21,7 +21,10 @@ def filter_params(weather_data, params):
#print(params) #print(params)
include_columns_indexes = [] include_columns_indexes = []
for param in params: for param in params:
include_columns_indexes.append(weather_data.weatherParameters.index(param)) try:
include_columns_indexes.append(weather_data.weatherParameters.index(param))
except ValueError:
pass
for lwd in weather_data.locationWeatherData: for lwd in weather_data.locationWeatherData:
# Transpose the matrix # Transpose the matrix
# Referring to this: https://stackoverflow.com/questions/8421337/rotating-a-two-dimensional-array-in-python # Referring to this: https://stackoverflow.com/questions/8421337/rotating-a-two-dimensional-array-in-python
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment