Skip to content

Commit

Permalink
fix distance upper bound setting
Browse files Browse the repository at this point in the history
  • Loading branch information
grantbuster committed Dec 7, 2023
1 parent b3b8009 commit 0106b8f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sup3r/bias/bias_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ def run(self,
futures = {}
for bias_gid in self.bias_meta.index:
raster_loc = np.where(self.bias_gid_raster == bias_gid)
dist, base_gid = self.get_base_gid(bias_gid)
_, base_gid = self.get_base_gid(bias_gid)

if not base_gid.any():
self.bad_bias_gids.append(bias_gid)
Expand Down
2 changes: 1 addition & 1 deletion sup3r/preprocessing/data_handling/exo_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __init__(self,
self._source_lat_lon = None
self._hr_time_index = None
self._src_time_index = None
self._distance_upper_bound = None
self._distance_upper_bound = distance_upper_bound
self.cache_data = cache_data
self.cache_dir = cache_dir
self.temporal_slice = temporal_slice
Expand Down
9 changes: 5 additions & 4 deletions tests/bias/test_bias_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,11 @@ def test_nc_base_file():
good_err = 'only to be used with `base_handler` as a `sup3r.DataHandler` '
assert good_err in str(exc.value)

base_data, _ = calc.get_base_data(calc.base_fps, calc.base_dset,
base_gid, calc.base_handler,
daily_reduction='avg',
base_dh_inst=calc.base_dh)
# make sure this doesnt raise error now that calc.base_dh is provided
calc.get_base_data(calc.base_fps, calc.base_dset,
base_gid, calc.base_handler,
daily_reduction='avg',
base_dh_inst=calc.base_dh)

out = calc.run(fill_extend=True, max_workers=1)

Expand Down
2 changes: 1 addition & 1 deletion tests/data_handling/test_utils_topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import matplotlib.pyplot as plt
import numpy as np
import pytest
from scipy.spatial import KDTree
from rex import Resource
from rex import Outputs

Expand Down Expand Up @@ -77,6 +76,7 @@ def test_topo_extraction_h5(s_enhance, plot=False):
exo_coords = te.source_lat_lon[iloc]

# make sure all mapped high-res exo coordinates are closest to gid
# pylint: disable=consider-using-enumerate
for i in range(len(exo_coords)):
dist = hr_wtk_meta - exo_coords[i]
dist = np.hypot(dist[:, 0], dist[:, 1])
Expand Down

0 comments on commit 0106b8f

Please sign in to comment.