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

Multiplicative Quantile Delta Mapping is not applying scaling where the delta is infinite #32

Closed
btschwertfeger opened this issue Apr 17, 2023 · 0 comments · Fixed by #33
Assignees
Labels
Bug Something isn't working Must This is a must
Milestone

Comments

@btschwertfeger
Copy link
Owner

btschwertfeger commented Apr 17, 2023

Describe the bug
The multiplicative quantile delta mapping procedure produces nan values in some cases if the basis of delta is negative.

The delta can be described as:

\Delta(i) = \frac{
X_{sim,p}(i)
} {
F^{-1}{sim,h} \left{ F{sim,p } \left[ X_{sim,p}(i) \right] \right} }
where
$F^{-1}{sim,h}$ represents the inverse cumulative distribution function of the modeled data of the control period
$F
{sim,p}$ represents the cumulative distribution function of the modeled data that is to be adjusted
$X_{sim,p}(i)$ is the value of a climate variable $X$ at time step $i$

see: v1.0.0/cmethods/init.py#L1055-L1059

So if the basis is zero - the mentioned part return a zero as scaling factor instead of the maximum scaling factor (10 as default).

EDIT:

  • This also occurs on every place where the devision is applied.
  • And if the numerator is zero the value should remain zero - and not nan in some cases.

To Reproduce
A real world example would be: $X_{sim,p}(i)$ is the value of precipitation at time step $i$ and is 0.0001 mm. So if the value inserted into the cumulative distribution function returns a precipitation value that equals zero - for example when the precipitation in the control data was much higher than in the data stat is to be adjusted.

Expected behaviour
The change should not be zero (this means no change) - instead the maximum scaling factor should be applied.

Additional context
python-cmethods v1.0.0

@btschwertfeger btschwertfeger added Bug Something isn't working Must This is a must labels Apr 17, 2023
@btschwertfeger btschwertfeger self-assigned this Apr 17, 2023
@btschwertfeger btschwertfeger added this to the v1.0.1 milestone Apr 17, 2023
@btschwertfeger btschwertfeger linked a pull request Apr 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Must This is a must
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant