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

Raise warning when one or more parameters has no data #4

Closed
2 tasks done
volcan01010 opened this issue Apr 20, 2021 · 3 comments
Closed
2 tasks done

Raise warning when one or more parameters has no data #4

volcan01010 opened this issue Apr 20, 2021 · 3 comments

Comments

@volcan01010
Copy link
Contributor

volcan01010 commented Apr 20, 2021

Summary

As a pyvolcans user, I want a warning when one or more parameters has no data so that I can exclude it from the analysis and get fairer comparisons.

Description

The results for Auckland Field look like this:

$ pyvolcans -v "Auckland Field"
PyVOLCANS: Supplied weights: {'tectonic_setting': 0.2, 'geochemistry': 0.2, 'morphology': 0.2, 'eruption_size': 0.2, 'eruption_style': 0.2}
Top 10 analogue volcanoes for Auckland Field, New Zealand (241020):
                    name         country  smithsonian_id  total_analogy  ATs       AG  AM  ASz      ASt
Pali-Aike Volcanic Field Chile-Argentina          358080       0.760784  0.2 0.160784 0.2  0.0 0.200000
                  Huambo            Peru          354005       0.756863  0.2 0.156863 0.2  0.0 0.200000
                Pinacate          Mexico          341001       0.752778  0.2 0.177778 0.2  0.0 0.175000
     Cayutue-La Vigueria           Chile          358012       0.749020  0.2 0.149020 0.2  0.0 0.200000
       Andahua-Orcopampa            Peru          354004       0.749020  0.2 0.149020 0.2  0.0 0.200000
           Chichinautzin          Mexico          341080       0.745384  0.2 0.151634 0.2  0.0 0.193750
 Naolinco Volcanic Field          Mexico          341095       0.744608  0.2 0.169608 0.2  0.0 0.175000
  Kaikohe-Bay of Islands     New Zealand          241010       0.741176  0.2 0.141176 0.2  0.0 0.200000
    Michoacan-Guanajuato          Mexico          341060       0.733111  0.2 0.149020 0.2  0.0 0.184091
San Pablo Volcanic Field     Philippines          273060       0.725980  0.2 0.150980 0.2  0.0 0.175000

Note that the ASz column is all 0, suggesting that there is no source data for eruption size. This caps the total analogy value at 0.8, which suggests there are no volcanoes with a very good match. It would be good to raise a Warning to let users know about this. (This could be similar to the warning when many volcanoes have the same score).

The warning would be especially valuable when users are not using verbose mode as they wouldn't see the individual scores.

See this Tweet thread for details: https://twitter.com/Tyranakisaurus/status/1384469161569566720

Acceptance criteria

  • pyvolcans "Auckland Field" raises a Warning that there is no eruption_size data
  • Warning recommends manually setting weights to exclude bad parameter
@PTierz
Copy link
Collaborator

PTierz commented May 24, 2021

Hi @volcan01010!

Thank you very much for setting up this issue!

I have tried to address the issue in commits d4dda82, 753fe80, inside the plot-bars branch. I am checking the acceptance criteria above because they are working as expected in my local machine, but please double-check these additional acceptance criteria below:

  • pyvolcans -v 221251 raises the following warning message: PyVOLCANS: WARNING!!! The following volcanological criteria do not have any data available for the selected target volcano (Unnamed): morphology, eruption_size, eruption_style. Please consider excluding these criteria from your weighting scheme (i.e. setting their weights to zero).
  • pyvolcans -v 243091 raises the following warning message: PyVOLCANS: WARNING!!! The following volcanological criteria do not have any data available for the selected target volcano (Unnamed): morphology. Please consider excluding these criteria from your weighting scheme (i.e. setting their weights to zero).
  • pyvolcans -v 274050 raises the following warning message: PyVOLCANS: WARNING!!! The following volcanological criteria do not have any data available for the selected target volcano (Unnamed): geochemistry, morphology, eruption_style. Please consider excluding these criteria from your weighting scheme (i.e. setting their weights to zero).

Very many thanks in advance!
Pablo

PS. Please note that there were some issues with the tests when introducing the my_volcano_data_dictionary that checks for data availability for each of the volcanological criteria, and considering the selected target volcano. I have implemented some changes to make the tests pass again (please see commit c54c715), but there might be better, more stable solutions to the one that I have chosen. Thank you very much!

@volcan01010
Copy link
Contributor Author

volcan01010 commented May 28, 2021

I just ran this and all the acceptance criteria pass. Nice one.

Looking at the code, there are a couple of changes to make:

  • Replace the PyvolcansError with a warnings.warn (https://pymotw.com/2/warnings/). Then you don't need to catch it and pass them.
  • Move the checking of the criteria/weighting results into the calculate_weighted_analogy_matrix. This way you don't need to return the my_volcano_data_dictionary back up to the main function.

@PTierz
Copy link
Collaborator

PTierz commented Oct 6, 2021

This Issue was solved through changes implemented in the fix-open-issue branch, which has now been merged into main (see pull request #13). I am, therefore, closing the Issue with this comment.

If there was any outstanding task to be implemented, please let us know: @jifarquharson

Very many thanks in advance.
Best regards,
Pablo

@PTierz PTierz closed this as completed Oct 6, 2021
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

2 participants