Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve impact calc error messages #669

Closed
chahank opened this issue Mar 2, 2023 · 6 comments
Closed

Improve impact calc error messages #669

chahank opened this issue Mar 2, 2023 · 6 comments
Assignees

Comments

@chahank
Copy link
Member

chahank commented Mar 2, 2023

Currently, the ImpactCalc.impact() method generates non-understandable error messages if the input data is inconsistent. For instance, if the input Hazard object has type Hazard.haz_type = '', the impact computation fails. Smilarly is probably the case if the Exposures has no properly defined impf_haz_type column.

@leonie-villiger
Copy link
Collaborator

leonie-villiger commented Mar 28, 2023

I could reproduce the issue by setting the Hazard.haz_type = '' before applying ImpactCalc.impact(). But what do you mean with the impf_haz_type in the Exposure? For instance, if I load a exposure layer through the data API (e.g., exp = client.get_litpop(exponents=(0,1), country='CHE')) I don't have a column impf_haz_type... do you simply mean if the impf_ column is missing?

@chahank
Copy link
Member Author

chahank commented Mar 28, 2023

The column impf_{haz_type} (haz_type must be replaced with the hazard type, e.g. 'RF') must be there to make an impact computation. If it is missing, the impact computation fails with a cryptic message. Does this help?

@leonie-villiger
Copy link
Collaborator

leonie-villiger commented Mar 29, 2023

Ok, could reproduce the error 😃 E.g., impf_TC in the Exposure and haz_type = WC in the Hazard yields an error. However, climada allows to leave the hazard type unspecified in the Expsoure, i.e., impf_ (with an empty hazard type) works as long as the hazard type is specified in the Hazard. Anyway, I'll try to implenent an improved error message.

@leonie-villiger
Copy link
Collaborator

Issue solved with pull request #691

@luseverin
Copy link
Collaborator

There is stil a confusing error message when one uses the ImpactCalc.impact() when the impact function id of the impf_haz_type column from the Exposures has no match in the ImpactFuncSet.

@peanutfun
Copy link
Member

Fixed by #863

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants