Skip to content

Commit

Permalink
bc removed from dual_data_handler in favor of performing it on lr_han…
Browse files Browse the repository at this point in the history
…dler before sending through dual_data_handler.
  • Loading branch information
bnb32 committed Sep 14, 2023
1 parent 6e84e7a commit 5ec2206
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions sup3r/preprocessing/data_handling/dual_data_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import pandas as pd

from sup3r.preprocessing.data_handling.mixin import (CacheHandlingMixIn,
TrainingPrepMixIn,
)
TrainingPrepMixIn)
from sup3r.utilities.regridder import Regridder
from sup3r.utilities.utilities import spatial_coarsening

Expand All @@ -29,8 +28,6 @@ def __init__(self,
shuffle_time=False,
s_enhance=15,
t_enhance=1,
bc_files=None,
bc_threshold=0.1,
val_split=0.0):
"""Initialize data handler using hr and lr data handlers for h5 data
and nc data
Expand All @@ -56,19 +53,6 @@ def __init__(self,
Spatial enhancement factor
t_enhance : int
Temporal enhancement factor
bc_files : list | tuple | str | None
One or more filepaths to .h5 files output by
MonthlyLinearCorrection or LinearCorrection. Used to bias correct
low resolution data prior to regrdding. These should contain
datasets named "{feature}_scalar" and "{feature}_adder" where
{feature} is one of the features contained by this DataHandler and
the data is a 3D array of shape (lat, lon, time) where time is
length 1 for annual correction or 12 for monthly correction. Bias
correction is only run if bc_files is not None.
bc_threshold : float
Nearest neighbor euclidean distance threshold. If the DataHandler
coordinates are more than this value away from the bias correction
lat/lon, an error is raised.
val_split : float
Percentage of data to reserve for validation.
"""
Expand All @@ -94,8 +78,6 @@ def __init__(self,
self.hr_time_index = None
self.lr_val_time_index = None
self.hr_val_time_index = None
self.bc_files = bc_files
self.bc_threshold = bc_threshold

if self.try_load and self.load_cached:
self.load_cached_data()
Expand Down Expand Up @@ -315,9 +297,6 @@ def lr_input_data(self):
if self._lr_input_data is None:
if self.lr_dh.data is None:
self.lr_dh.load_cached_data()
if self.bc_files is not None:
logger.info('Running bias correction on low resolution data.')
self.lr_dh.lin_bc(self.bc_files, self.bc_threshold)
self._lr_input_data = self.lr_dh.data[
..., :self.lr_required_shape[2], :]
return self._lr_input_data
Expand Down

0 comments on commit 5ec2206

Please sign in to comment.