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

Better handle edges of surge lookup matrix #15

Merged
merged 10 commits into from
Jan 7, 2025
Merged

Conversation

bolliger32
Copy link
Member

@bolliger32 bolliger32 commented Jan 5, 2025

Not sure when it happened, but presumably due to some xarray updates, we now sometimes return missing values when pulling the surge impacts lookup for the no-climate-change scenario b/c we are at the lower bound of LSLR and sometimes due to some floating point issues are slightly below the lower bound. However, we do have real cases where interpolation targets are meaningfully below the lower bound of the matrix, in which case we want to assign 0s (which we are doing incorrectly at the moment). This PR updates the surge lookup creation to bump the lower and upper bounds of lslr by 2*epsilon so that we don't erroneously return 0s at the bounds of lslr lookup. It also improves our ability to catch other cases of unintentional surge lookup table interpolation targets falling outside the bounds of the table.

I also realized that the dask.distributed.wait function was not catching errored futures but instead was just releasing when all futures were either finished or errored. Not sure if this was always the case or a change in functionality of recent Dask versions, but now we use client.gather for futures that return None (so they are negligible in local memory impact) instead of wait

get_refA now also handles the potential edge case where it is run on a single segment, which previously would throw an error

@bolliger32 bolliger32 changed the title Draft: Better handle edges of surge lookup matrix Better handle edges of surge lookup matrix Jan 7, 2025
@bolliger32 bolliger32 merged commit b9b6349 into main Jan 7, 2025
1 check passed
@bolliger32 bolliger32 deleted the bugfix/surge-edgecase branch January 7, 2025 23:56
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

Successfully merging this pull request may close these issues.

1 participant