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

Bnb/bc smoothing #151

Merged
merged 3 commits into from
Jun 5, 2023
Merged

Bnb/bc smoothing #151

merged 3 commits into from
Jun 5, 2023

Conversation

bnb32
Copy link
Collaborator

@bnb32 bnb32 commented Jun 1, 2023

No description provided.

sup3r/bias/bias_calc.py Show resolved Hide resolved
@@ -64,6 +65,12 @@ def local_linear_bc(input, feature_name, bias_fp, lr_padded_slice,
source shape will be used.
out_range : None | tuple
Option to set floor/ceiling values on the output data.
smoothing : float
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you add this to the transforms module? Just so we don't have to recalc the bc factors? Or so you can test a bunch of smoothing factors at runtime?

The docstring isn't accurate: no inside/outside spatial domain or threshold input here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah so we don't have to recalc, which also allows me to test. Wasn't sure if we should just keep the smoothing here and remove the other.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One argument for only keeping the smoothing at the bias calc step: we'll be less likely to double-smooth. Consider that we will probably smooth the extrapolated extent and will be hard to not duplicate the smoothing in the transforms module.

For testing i would advocate for just writing a script outside of the repo that duplicates the bias correction files with different smoothing factors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on the double smoothing, although I'm not sure how much this matters outside the valid domain. I would argue for keeping the smoothing in the transforms since I don't see a reason to have to rerun bias-calc just to change smoothing. Keeping the stored bias correction factors as "true" as possible seems reasonable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you just loose the ability to smooth inside the valid domain vs. outside... That's fine though if that's your preference... I'd say keep both because the ability to smooth inside vs. outside is important esp. for sup3rcc

sup3r/bias/bias_calc.py Outdated Show resolved Hide resolved
@bnb32 bnb32 force-pushed the bnb/bc_smoothing branch 3 times, most recently from a95ccf2 to 5cdef6b Compare June 1, 2023 22:32
arr_smooth = arr[..., idt]

needs_fill = (np.isnan(arr_smooth).any() and fill_extend
or smooth_interior > 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be cautious with these kinds of operations, logical operators have an order of operations priority that is not intuitive. It's fine as-is but I would use parenthesis to make the order of operations explicit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good call, it's bitten me in the past.

@bnb32 bnb32 marked this pull request as ready for review June 5, 2023 21:11
@bnb32 bnb32 merged commit bb1a30c into main Jun 5, 2023
@bnb32 bnb32 deleted the bnb/bc_smoothing branch June 5, 2023 21:11
github-actions bot pushed a commit that referenced this pull request Jun 6, 2023
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.

2 participants