Skip to content

Commit a5f582f

Browse files
authored
Merge pull request #222 from NREL/gb/bug_bc_import
fixed bias calc class import path
2 parents 5dda178 + 505bc00 commit a5f582f

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

sup3r/bias/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .bias_transforms import (global_linear_bc, local_linear_bc,
44
local_qdm_bc, monthly_local_linear_bc)
55
from .bias_calc import (LinearCorrection, MonthlyLinearCorrection,
6-
SkillAssessment)
6+
MonthlyScalarCorrection, SkillAssessment)
77
from .qdm import QuantileDeltaMappingCorrection
88

99
__all__ = [
@@ -13,6 +13,7 @@
1313
"monthly_local_linear_bc",
1414
"LinearCorrection",
1515
"MonthlyLinearCorrection",
16+
"MonthlyScalarCorrection",
1617
"QuantileDeltaMappingCorrection",
1718
"SkillAssessment",
1819
]

sup3r/bias/bias_calc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def get_node_cmd(cls, config):
249249
import_str = 'import time;\n'
250250
import_str += 'from gaps import Status;\n'
251251
import_str += 'from rex import init_logger;\n'
252-
import_str += f'from sup3r.bias.bias_calc import {cls.__name__};\n'
252+
import_str += f'from sup3r.bias import {cls.__name__};\n'
253253

254254
if not hasattr(cls, 'run'):
255255
msg = ('I can only get you a node command for subclasses of '

sup3r/bias/bias_calc_cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def from_config(ctx, config_file, verbose=False, pipeline_step=None):
4242
exec_kwargs = config.get('execution_control', {})
4343
hardware_option = exec_kwargs.pop('option', 'local')
4444
calc_class_name = config['bias_calc_class']
45-
BiasCalcClass = getattr(sup3r.bias.bias_calc, calc_class_name)
45+
BiasCalcClass = getattr(sup3r.bias, calc_class_name)
4646
basename = config['job_name']
4747
log_pattern = config.get('log_pattern', None)
4848

sup3r/bias/bias_transforms.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_spatial_bc_quantiles(lat_lon: np.array,
8585
8686
Recover the parameters that describe the statistical distribution
8787
previously estimated with
88-
:class:`~sup3r.bias.bias_calc.QuantileDeltaMappingCorrection` for three
88+
:class:`~sup3r.bias.qdm.QuantileDeltaMappingCorrection` for three
8989
datasets: ``base`` (historical reference), ``bias`` (historical biased
9090
reference), and ``bias_fut`` (the future biased dataset, usually the data
9191
to correct).
@@ -119,27 +119,27 @@ def get_spatial_bc_quantiles(lat_lon: np.array,
119119
the ``base_dset``. It has a shape of (I, J, P), where (I, J) are the
120120
same first two dimensions of the given `lat_lon` and P is the number
121121
of parameters and depends on the type of distribution. See
122-
:class:`~sup3r.bias.bias_calc.QuantileDeltaMappingCorrection` for more
122+
:class:`~sup3r.bias.qdm.QuantileDeltaMappingCorrection` for more
123123
details.
124124
bias : np.array
125125
Parameters used to define the statistical distribution estimated for
126126
(historical) ``feature_name``. It has a shape of (I, J, P), where
127127
(I, J) are the same first two dimensions of the given `lat_lon` and P
128128
is the number of parameters and depends on the type of distribution.
129-
See :class:`~sup3r.bias.bias_calc.QuantileDeltaMappingCorrection` for
129+
See :class:`~sup3r.bias.qdm.QuantileDeltaMappingCorrection` for
130130
more details.
131131
bias_fut : np.array
132132
Parameters used to define the statistical distribution estimated for
133133
(future) ``feature_name``. It has a shape of (I, J, P), where (I, J)
134134
are the same first two dimensions of the given `lat_lon` and P is the
135135
number of parameters used and depends on the type of distribution. See
136-
:class:`~sup3r.bias.bias_calc.QuantileDeltaMappingCorrection` for more
136+
:class:`~sup3r.bias.qdm.QuantileDeltaMappingCorrection` for more
137137
details.
138138
cfg : dict
139139
Metadata used to guide how to use of the previous parameters on
140140
reconstructing the statistical distributions. For instance,
141141
`cfg['dist']` defines the type of distribution. See
142-
:class:`~sup3r.bias.bias_calc.QuantileDeltaMappingCorrection` for more
142+
:class:`~sup3r.bias.qdm.QuantileDeltaMappingCorrection` for more
143143
details, including which metadata is saved.
144144
145145
Warnings
@@ -150,7 +150,7 @@ def get_spatial_bc_quantiles(lat_lon: np.array,
150150
151151
See Also
152152
--------
153-
sup3r.bias.bias_calc.QuantileDeltaMappingCorrection
153+
sup3r.bias.qdm.QuantileDeltaMappingCorrection
154154
Estimate the statistical distributions loaded here.
155155
156156
Examples
@@ -458,7 +458,7 @@ def local_qdm_bc(data: np.array,
458458
459459
See Also
460460
--------
461-
sup3r.bias.bias_calc.QuantileDeltaMappingCorrection :
461+
sup3r.bias.qdm.QuantileDeltaMappingCorrection :
462462
Estimate probability distributions required by QDM method
463463
464464
Notes

sup3r/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def bias_calc(ctx, verbose):
202202
arguments required to call the
203203
204204
The config has high level ``bias_calc_class`` and ``jobs`` keys. The
205-
``bias_calc_class`` is a class name from the :mod:`sup3r.bias.bias_calc`
205+
``bias_calc_class`` is a class name from the :mod:`sup3r.bias`
206206
module, and the ``jobs`` argument is a list of kwargs required to
207207
initialize the ``bias_calc_class`` and run the ``bias_calc_class.run()``
208208
method (for example, see

sup3r/preprocessing/data_handling/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ def qdm_bc(self,
13371337
13381338
Bias correct this DataHandler's data with Quantile Delta Mapping. The
13391339
required statistical distributions should be pre-calculated using
1340-
:class:`sup3r.bias.bias_calc.QuantileDeltaMappingCorrection`.
1340+
:class:`sup3r.bias.qdm.QuantileDeltaMappingCorrection`.
13411341
13421342
Warning: There is no guarantee that the coefficients from ``bc_files``
13431343
match the resource processed here. Be careful choosing ``bc_files``.

0 commit comments

Comments
 (0)