Skip to content

Commit

Permalink
handle empty country list in valid_spatial
Browse files Browse the repository at this point in the history
  • Loading branch information
christian34 committed Sep 16, 2023
1 parent 3602c7b commit 930e4a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/agroservices/ipm/fakers.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ def model_weather_data(model, time_start=None, time_end=None, length=3):
valid_spatial = None
if 'valid_spatial' in model:
if 'countries' in model['valid_spatial']:
valid_spatial = model['valid_spatial']['countries'][0]
if len(model['valid_spatial']['countries']) > 0:
valid_spatial = model['valid_spatial']['countries'][0]
return weather_data(parameters=parameters, time_start=start,
time_end=end,
interval=interval, length=length, valid_spatial=valid_spatial)
Expand Down

0 comments on commit 930e4a0

Please sign in to comment.