You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "ex_problemsanddangers.py", line 41, in<module>
forecast_problems += gp.get_forecasted_problems(region_ids, from_date, to_date, lang_key=1)
File "/home/jakidxav/varsomdata/varsomdata/getproblems.py", line 206, in get_forecasted_problems
problems_from='Forecast', lang_key=lang_key)
File "/home/jakidxav/varsomdata/varsomdata/getproblems.py", line 272, in get_all_problems
problem_warn = _map_warning_to_problem(warnings)
File "/home/jakidxav/varsomdata/varsomdata/getproblems.py", line 145, in _map_warning_to_problem
region_id = w.region_id
AttributeError: 'AvalancheDanger' object has no attribute 'region_id'
The problem is with the _map_warning_to_problem() method. First, you pass in a list of warnings which contain AvalancheDanger objects. A typical AvalancheDanger object has the following fields:
So we see that there is no region_id attribute which makes the program stop. I fixed that and moved on, but a similar error occurs when trying to access the publish_time attribute. Again, we can change this to date as there is no publish_time attribute. This may not be the right thing to do, however.
These changes still causes issues, this time with iterating over a list of AvalancheProblem objects in line 149. One such object looks like this:
The method is trying to access avalanche_problem_id, aval_cause_name, aval_cause_id, destructive_size_ext_name, etc when they do not exist.
I believe I have located the issue in the file varsomdata/getforcastapi.py in the method get_avalanche_warnings_deprecated. I think it has to do with an error where get_avalanche_warnings_deprecated still returns warnings that have None in the avalanche problems. See first printout in getproblems.py.
The text was updated successfully, but these errors were encountered:
We can begin to examine the error by running:
We get back:
The problem is with the
_map_warning_to_problem()
method. First, you pass in a list of warnings which containAvalancheDanger
objects. A typicalAvalancheDanger
object has the following fields:So we see that there is no
region_id
attribute which makes the program stop. I fixed that and moved on, but a similar error occurs when trying to access thepublish_time
attribute. Again, we can change this todate
as there is nopublish_time
attribute. This may not be the right thing to do, however.These changes still causes issues, this time with iterating over a list of
AvalancheProblem
objects in line 149. One such object looks like this:The method is trying to access
avalanche_problem_id
,aval_cause_name
,aval_cause_id
,destructive_size_ext_name
, etc when they do not exist.I believe I have located the issue in the file
varsomdata/getforcastapi.py
in the methodget_avalanche_warnings_deprecated
. I think it has to do with an error whereget_avalanche_warnings_deprecated
still returns warnings that haveNone
in the avalanche problems. See first printout ingetproblems.py
.The text was updated successfully, but these errors were encountered: