cal-adapt / climakitae

A Python toolkit for retrieving, visualizing, and performing scientific analyses with data from the Cal-Adapt Analytics Engine.
https://climakitae.readthedocs.io
BSD 3-Clause "New" or "Revised" License
19 stars 2 forks source link

Update Scenario Param trigger fix #393

Closed elehmer closed 1 month ago

elehmer commented 1 month ago

Description of PR

This PR updates the _update_scenario param trigger to properly set the historical scenarios after changing the affected widgets.

Summary of changes and related issue

previously we tested if one list was in another (currently hist. scen. options vs. possible new options) using in. This apparently does not work as it was returning false when it was true. I therefore wrote a function that converts the lists into numpy arrays and compares them.

Relevant motivation and context

selections are being changed after parameters are being set and bring back incorrect data. Most obviously a problem when not using the GUI as you can't see that historical selections have changed.

Dependencies required for this change?

Fixes # (issue), delete if not necessary

Type of change

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

Checklist:

elehmer commented 1 month ago

This looks good to me, can you add some code comments in though to explain why the change was made? Maybe just a line or two from your description in the PR? The method is somewhat unintuitive I think (but makes sense with your description).

Any better?

claalmve commented 1 month ago

Looks good to me! Thanks for implementing the changes @elehmer !