Skip to content

Commit

Permalink
Renaming k_test to not be confused with other statistical tests avail…
Browse files Browse the repository at this point in the history
…able in numpy or other libraries.
  • Loading branch information
kenkehoe committed Nov 6, 2024
1 parent 9b49b86 commit 27afad0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions act/qc/bsrn_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def bsrn_comparison_tests(
test_meaning=test_meaning,
)

def k_test(
def normalized_rradiance_test(
self,
test,
dni=None,
Expand Down Expand Up @@ -878,7 +878,7 @@ def k_test(
.. code-block:: python
ds = act.io.arm.read_arm_netcdf(act.tests.EXAMPLE_BRS, cleanup_qc=True)
ds.qcfilter.k_test(
ds.qcfilter.normalized_rradiance_test(
['Clearness index', 'Upper total transmittance',
'Upper direct transmittance', 'Upper diffuse transmittance'],
dhi='down_short_diffuse_hemisp',
Expand All @@ -905,11 +905,11 @@ def k_test(
if test_options[0].lower() in test:
if dni is None:
raise RuntimeError(
"Need to set 'dni' keyword to perform 'Clearness index' test in k_test()."
"Need to set 'dni' keyword to perform 'Clearness index' test in normalized_rradiance_test()."
)
if dhi is None:
raise RuntimeError(
"Need to set 'dhi' keyword to perform 'Clearness index' test in k_test()."
"Need to set 'dhi' keyword to perform 'Clearness index' test in normalized_rradiance_test()."
)

if use_dask and isinstance(self._ds[dni].data, da.Array):
Expand Down Expand Up @@ -943,11 +943,11 @@ def k_test(
if test_options[1].lower() in test:
if dni is None:
raise RuntimeError(
"Need to set 'dni' keyword to perform 'Upper total transmittance' test in k_test()."
"Need to set 'dni' keyword to perform 'Upper total transmittance' test in normalized_rradiance_test()."
)
if dhi is None:
raise RuntimeError(
"Need to set 'dhi' keyword to perform 'Upper total transmittance' test in k_test()."
"Need to set 'dhi' keyword to perform 'Upper total transmittance' test in normalized_rradiance_test()."
)

if use_dask and isinstance(self._ds[dni].data, da.Array):
Expand Down Expand Up @@ -982,11 +982,11 @@ def k_test(
if test_options[2].lower() in test:
if dni is None:
raise RuntimeError(
"Need to set 'dni' keyword to perform 'Upper direct transmittance' test in k_test()."
"Need to set 'dni' keyword to perform 'Upper direct transmittance' test in normalized_rradiance_test()."
)
if ghi is None:
raise RuntimeError(
"Need to set 'ghi' keyword to perform 'Upper direct transmittance' test in k_test()."
"Need to set 'ghi' keyword to perform 'Upper direct transmittance' test in normalized_rradiance_test()."
)

if use_dask and isinstance(self._ds[dni].data, da.Array):
Expand Down Expand Up @@ -1019,7 +1019,7 @@ def k_test(
if test_options[3].lower() in test:
if dhi is None:
raise RuntimeError(
"Need to set 'dhi' keyword to perform 'Upper diffuse transmittance' test in k_test()."
"Need to set 'dhi' keyword to perform 'Upper diffuse transmittance' test in normalized_rradiance_test()."
)

if use_dask and isinstance(self._ds[dhi].data, da.Array):
Expand Down
2 changes: 1 addition & 1 deletion examples/qc/plot_qc_bsrn.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
)

# Add K-tests QC to ancillary QC variables.
ds.qcfilter.k_test(
ds.qcfilter.normalized_rradiance_test(
[
'Clearness index',
'Upper total transmittance',
Expand Down
6 changes: 3 additions & 3 deletions tests/qc/test_bsrn_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def test_bsrn_limits_test():
assert np.sum(result) == 38


def test_k_test():
def test_normalized_rradiance_test():
keep_vars = [
'short_direct_normal',
'down_short_diffuse_hemisp',
Expand All @@ -323,14 +323,14 @@ def test_k_test():
]
for test in tests:
with pytest.raises(RuntimeError):
ds.qcfilter.k_test(test)
ds.qcfilter.normalized_rradiance_test(test)

for use_dask in [False, True]:
ds = read_arm_netcdf(EXAMPLE_BRS, keep_variables=keep_vars)
data = ds['short_direct_normal'].values
data[1050:1100] = data[1050:1100] + 400
ds['short_direct_normal'].values = data
ds.qcfilter.k_test(
ds.qcfilter.normalized_rradiance_test(
tests,
dni='short_direct_normal',
dhi='down_short_diffuse_hemisp',
Expand Down

0 comments on commit 27afad0

Please sign in to comment.