Skip to content

Commit

Permalink
lr_padded_slice arg needed in local_qdm_bc method
Browse files Browse the repository at this point in the history
  • Loading branch information
bnb32 committed May 2, 2024
1 parent ad43906 commit f0840f2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sup3r/bias/bias_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ def local_qdm_bc(data: np.array,
base_dset: str,
feature_name: str,
bias_fp,
lr_padded_slice,
threshold=0.1,
relative=True,
no_trend=False):
Expand Down Expand Up @@ -433,6 +434,13 @@ def local_qdm_bc(data: np.array,
"bias_fut_{feature_name}_params", and "base_{base_dset}_params" that
are the parameters to define the statistical distributions to be used
to correct the given `data`.
lr_padded_slice : tuple | None
Tuple of length four that slices (spatial_1, spatial_2, temporal,
features) where each tuple entry is a slice object for that axes.
Note that if this method is called as part of a sup3r forward pass, the
lr_padded_slice will be included automatically in the kwargs for the
active chunk. If this is None, no slicing will be done and the full
bias correction source shape will be used.
no_trend: bool, default=False
An option to ignore the trend component of the correction, thus
resulting in an ordinary Quantile Mapping, i.e. corrects the bias by
Expand Down Expand Up @@ -485,6 +493,11 @@ def local_qdm_bc(data: np.array,
feature_name,
bias_fp,
threshold)
if lr_padded_slice is not None:
spatial_slice = (lr_padded_slice[0], lr_padded_slice[1])
base = base[spatial_slice]
bias = bias[spatial_slice]
bias_fut = bias[spatial_slice]

if no_trend:
mf = None
Expand Down

2 comments on commit f0840f2

@castelao
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bnb32 , there was a bug here at line 500. This is fixed with PR #211. If you ran actual analysis with this version, you might need to re-run with the latest release.

@bnb32
Copy link
Collaborator Author

@bnb32 bnb32 commented on f0840f2 May 13, 2024

Choose a reason for hiding this comment

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

@bnb32 , there was a bug here at line 500. This is fixed with PR #211. If you ran actual analysis with this version, you might need to re-run with the latest release.

Yeah this is the fix I pushed, right?

Please sign in to comment.