Skip to content

Commit

Permalink
fix pylint issues for used-before-assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
MuellerSeb committed May 18, 2024
1 parent e35ac2f commit 2c41982
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/gstools/covmodel/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def fit_variogram(
def _pre_para(model, para_select, sill, anis):
"""Preprocess selected parameters."""
var_last = False
var_tmp = 0.0 # init value
for par in para_select:
if par not in model.arg_bounds:
raise ValueError(f"fit: unknown parameter in selection: {par}")
Expand Down Expand Up @@ -464,6 +465,7 @@ def _post_fitting(model, para, popt, anis, is_dir_vario):
fit_para = {}
para_skip = 0
opt_skip = 0
var_tmp = 0.0 # init value
for par in DEFAULT_PARA:
if para[par]:
if par == "var": # set variance last
Expand Down
1 change: 1 addition & 0 deletions src/gstools/field/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ def update_plane(label):
s.vline.set_data(2 * [s.valinit], [-0.1, 1.1])
s.reset()
im.set_extent(ax_extents[p])
asp = 1.0 # init value
if aspect == "quad":
asp = ax_rngs[planes[p][0]] / ax_rngs[planes[p][1]]
if aspect is not None:
Expand Down
1 change: 1 addition & 0 deletions src/gstools/krige/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ def _get_krige_vecs(
# determine the chunk size
chunk_size = len(pos[0]) if chunk_slice[1] is None else chunk_slice[1]
chunk_size -= chunk_slice[0]
chunk_pos = None # init value
res = np.empty((self.krige_size, chunk_size), dtype=np.double)
if only_mean:
# set points to limit of the covariance to only get the mean
Expand Down
3 changes: 1 addition & 2 deletions src/gstools/transform/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,7 @@ def binary(
"""
if not process and divide is None:
_check_for_default_normal(fld)
if divide is None:
mean = 0.0 if process and not keep_mean else fld.mean
mean = 0.0 if process and not keep_mean else fld.mean
divide = mean if divide is None else divide
upper = mean + np.sqrt(fld.model.sill) if upper is None else upper
lower = mean - np.sqrt(fld.model.sill) if lower is None else lower
Expand Down

0 comments on commit 2c41982

Please sign in to comment.