diff --git a/interp/data.py b/interp/data.py index 82ae81b..79e64f7 100644 --- a/interp/data.py +++ b/interp/data.py @@ -79,6 +79,8 @@ def set_vgs_ser(self, vgs_ser, index_type='date'): assert isinstance(vgs_ser.index, object), ( 'Data type of index of vg_ser does not match index_type!') + vgs_ser.index = vgs_ser.index.astype(str) + else: raise AssertionError( 'index_type can only be \'obj\' or \'date\'!') @@ -516,7 +518,7 @@ def set_misc_settings( n_cpus=1, plot_figs_flag=False, cell_size=None, - min_value_to_krige_thresh=None, + min_value_to_interp_thresh=None, min_cutoff_value=None, max_cutoff_value=None): @@ -535,7 +537,7 @@ def set_misc_settings( Cell size in the units that are consistent with the station coordinates system. It is used only if no drift or alignment rasters are specified. - min_value_to_krige_thresh : int or float + min_value_to_interp_thresh : int or float If all the stations have a value less than or equal to this for a given time step then all the cells are assigned the mean value of all the station values. This is good in cases like @@ -544,11 +546,11 @@ def set_misc_settings( min_cutoff_value : None or int or float If not None, interpolated values below this are set equal to it. If not None it should be less than - min_value_to_krige_thresh. + min_value_to_interp_thresh. max_cutoff_value : None or int or float If not None, interpolated values above this are set equal to it. If not None it should be greater than - min_value_to_krige_thresh + min_value_to_interp_thresh ''' assert isinstance(n_cpus, int), 'n_cpus not an integer!' @@ -573,16 +575,16 @@ def set_misc_settings( self._cell_size = float(cell_size) - if min_value_to_krige_thresh is not None: - assert isinstance(min_value_to_krige_thresh, (int, float)), ( - 'min_value_to_krige_thresh can be a float or an int if ' + if min_value_to_interp_thresh is not None: + assert isinstance(min_value_to_interp_thresh, (int, float)), ( + 'min_value_to_interp_thresh can be a float or an int if ' 'not None!') - assert -np.inf <= min_value_to_krige_thresh < np.inf, ( - 'min_value_to_krige_thresh has to be in between -infinity ' + assert -np.inf <= min_value_to_interp_thresh < np.inf, ( + 'min_value_to_interp_thresh has to be in between -infinity ' 'and +infinity!') - self._min_var_thr = float(min_value_to_krige_thresh) + self._min_var_thr = float(min_value_to_interp_thresh) if min_cutoff_value is not None: assert isinstance(min_cutoff_value, (int, float)), ( @@ -607,7 +609,7 @@ def set_misc_settings( if (self._min_var_thr is not None) and (self._min_var_cut is not None): assert self._min_var_thr >= self._min_var_cut, ( - 'min_value_to_krige_thresh has to be greater than or equal to ' + 'min_value_to_interp_thresh has to be greater than or equal to ' 'min_cutoff_value!') if (self._min_var_cut is not None) and (self._max_var_cut is not None): @@ -618,7 +620,7 @@ def set_misc_settings( if (self._min_var_thr is not None) and (self._max_var_cut is not None): assert self._min_var_thr < self._max_var_cut, ( - 'min_value_to_krige_thresh has to be less than ' + 'min_value_to_interp_thresh has to be less than ' 'max_cutoff_value!') if self._vb: @@ -627,7 +629,7 @@ def set_misc_settings( print('n_cpus:', self._n_cpus) print('plot_figs_flag:', self._plot_figs_flag) print('cell_size:', self._cell_size) - print('min_value_to_krige_thresh:', self._min_var_thr) + print('min_value_to_interp_thresh:', self._min_var_thr) print('min_cutoff_value:', self._min_var_cut) print('max_cutoff_value:', self._max_var_cut) print_el() diff --git a/interp/prepare.py b/interp/prepare.py index 6879fd9..ee92cba 100644 --- a/interp/prepare.py +++ b/interp/prepare.py @@ -496,8 +496,8 @@ def _prepare(self): self._data_df = self._data_df.reindex(self._time_rng) - if not self._vg_ser_set_flag: - self._vgs_ser = self._vgs_ser.reindex(self._time_rng) + if self._vg_ser_set_flag: + self._vgs_ser = self._vgs_ser.reindex(self._time_rng).astype(str) self._prpd_flag = True return diff --git a/interp/steps.py b/interp/steps.py index 2173a15..90838d0 100644 --- a/interp/steps.py +++ b/interp/steps.py @@ -113,7 +113,7 @@ def interpolate_subset(self, all_args): for time_stn_grp, cmn_time_stn_grp_idxs in grps_in_time: assert time_stn_grp.size == np.unique(time_stn_grp).size, ( - 'Non-unique stations in time group!') + 'Non-unique stations in step group!') time_stn_grp_ref_xs = self._crds_df.loc[time_stn_grp, 'X'].values time_stn_grp_ref_ys = self._crds_df.loc[time_stn_grp, 'Y'].values @@ -137,7 +137,7 @@ def interpolate_subset(self, all_args): nuggetness_flags[i] = check_full_nuggetness(vg_model) if nuggetness_flags[i] and self._vb: - print('Full nugget at time step:', sub_time_steps[i]) + print('Full nugget at step:', sub_time_steps[i]) else: vg_models = None diff --git a/test/test_interp.py b/test/test_interp.py index 990a89d..cb422fd 100644 --- a/test/test_interp.py +++ b/test/test_interp.py @@ -61,7 +61,7 @@ def main(): nc_time_units = 'days since 1900-01-01 00:00:00.0' nc_calendar = 'gregorian' - min_ppt_thresh = 1 # -float('inf') # 1 + min_var_val_thresh = 1 # -float('inf') # 1 min_var_val = 0.0 # None max_var_val = None @@ -157,7 +157,7 @@ def main(): n_cpus, plot_figs_flag, None, - min_ppt_thresh, + min_var_val_thresh, min_var_val, max_var_val) diff --git a/variograms/vgsinput.py b/variograms/vgsinput.py index 8fa5478..98e3020 100644 --- a/variograms/vgsinput.py +++ b/variograms/vgsinput.py @@ -81,6 +81,8 @@ def set_data( 'Data type of index of stns_time_ser_df does not match ' 'index_type!') + stns_time_ser_df.index = stns_time_ser_df.index.astype(str) + else: raise AssertionError( 'index_type can only be \'obj\' or \'date\'!')