Skip to content

Commit fc515d5

Browse files
authored
Merge pull request #276 from sentinel-hub/feat/fix-dependecy-updates
Fix dependecy updates
2 parents a57147e + 986e9f1 commit fc515d5

33 files changed

+63
-65
lines changed

core/eolearn/core/eodata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def _parse_feature_value(self, value):
736736
'dimension{}'.format(self.feature_type, self.ndim, 's' if self.ndim > 1 else ''))
737737

738738
if self.feature_type.is_discrete():
739-
if not issubclass(value.dtype.type, (np.integer, np.bool, np.bool_, np.bool8)):
739+
if not issubclass(value.dtype.type, (np.integer, bool, np.bool_, np.bool8)):
740740
msg = '{} is a discrete feature type therefore dtype of data should be a subtype of ' \
741741
'numpy.integer or numpy.bool, found type {}. In the future an error will be raised because ' \
742742
'of this'.format(self.feature_type, value.dtype.type)

core/eolearn/tests/test_eodata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_numpy_feature_types(self):
3737

3838
data_examples = []
3939
for size in range(6):
40-
for dtype in [np.float32, np.float64, np.float, np.uint8, np.int64, np.bool]:
40+
for dtype in [np.float32, np.float64, float, np.uint8, np.int64, bool]:
4141
data_examples.append(np.zeros((2, ) * size, dtype=dtype))
4242

4343
for feature_type in FeatureTypeSet.RASTER_TYPES:
@@ -252,8 +252,8 @@ def test_concatenate_missmatched_timeless(self):
252252
_ = EOPatch.concatenate(eop1, eop2)
253253

254254
def test_equals(self):
255-
eop1 = EOPatch(data={'bands': np.arange(2 * 3 * 3 * 2).reshape(2, 3, 3, 2)})
256-
eop2 = EOPatch(data={'bands': np.arange(2 * 3 * 3 * 2).reshape(2, 3, 3, 2)})
255+
eop1 = EOPatch(data={'bands': np.arange(2 * 3 * 3 * 2, dtype=np.float32).reshape(2, 3, 3, 2)})
256+
eop2 = EOPatch(data={'bands': np.arange(2 * 3 * 3 * 2, dtype=np.float32).reshape(2, 3, 3, 2)})
257257
self.assertEqual(eop1, eop2)
258258

259259
eop1.data['bands'][1, ...] = np.nan

coregistration/eolearn/coregistration/coregistration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def execute(self, eopatch):
141141
sliced_data = [np.clip(d, np.percentile(d, 5), np.percentile(d, 95)) for d in sliced_data]
142142
except BaseException:
143143
LOGGER.warning("Could not calculate gradients, using original data")
144-
sliced_data = [d for d in sliced_data]
144+
sliced_data = list(sliced_data)
145145

146146
iflag = self._get_interpolation_flag(self.interpolation_type)
147147

features/eolearn/features/blob.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ def __init__(self, feature, blob_object, **blob_parameters):
7373
self.blob_parameters = blob_parameters
7474

7575
def _compute_blob(self, data):
76-
result = np.zeros(data.shape, dtype=np.float)
76+
result = np.zeros(data.shape, dtype=float)
7777
for time in range(data.shape[0]):
7878
for band in range(data.shape[-1]):
7979
image = data[time, :, :, band]
8080
res = np.asarray(self.blob_object(image, **self.blob_parameters))
81-
x_coord = res[:, 0].astype(np.int)
82-
y_coord = res[:, 1].astype(np.int)
81+
x_coord = res[:, 0].astype(int)
82+
y_coord = res[:, 1].astype(int)
8383
radius = res[:, 2] * sqrt(2)
8484
result[time, x_coord, y_coord, band] = radius
8585
return result

features/eolearn/features/haralick.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _custom_texture(self, glcm):
152152
return res
153153

154154
def _calculate_haralick(self, data):
155-
result = np.empty(data.shape, dtype=np.float)
155+
result = np.empty(data.shape, dtype=float)
156156
# For each date and each band
157157
for time in range(data.shape[0]):
158158
for band in range(data.shape[3]):

features/eolearn/features/hog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _compute_hog(self, data):
6262
(int(data.shape[1] // self.pixels_per_cell[0]) - self.cells_per_block[0] + 1) *
6363
self.cells_per_block[0],
6464
(int(data.shape[2] // self.pixels_per_cell[1]) - self.cells_per_block[1] + 1) *
65-
self.cells_per_block[1], self.n_orientations), dtype=np.float)
65+
self.cells_per_block[1], self.n_orientations), dtype=float)
6666
if self.visualize:
6767
im_visu = np.empty(data.shape[0:3] + (1,))
6868
for time in range(data.shape[0]):

features/eolearn/features/interpolation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ def interpolate_data(self, data, times, resampled_times):
317317
# find NaNs that start or end a time-series
318318
row_nans, col_nans = np.where(self._get_start_end_nans(data))
319319
nan_row_res_indices = np.array([index for index in ori2res[row_nans] if index is not None], dtype=np.int32)
320-
nan_col_res_indices = np.array([index is not None for index in ori2res[row_nans]],
321-
dtype=np.bool)
320+
nan_col_res_indices = np.array([index is not None for index in ori2res[row_nans]], dtype=bool)
321+
322322
if nan_row_res_indices.size:
323323
# mask out from output values the starting/ending NaNs
324324
res_temp_values[nan_row_res_indices, col_nans[nan_col_res_indices]] = np.nan
@@ -400,7 +400,7 @@ def execute(self, eopatch):
400400
# Apply a mask on data
401401
if self.mask_feature is not None:
402402
for mask_type, mask_name in self.mask_feature(eopatch):
403-
negated_mask = ~eopatch[mask_type][mask_name].astype(np.bool)
403+
negated_mask = ~eopatch[mask_type][mask_name].astype(bool)
404404
feature_data = self._mask_feature_data(feature_data, negated_mask, mask_type)
405405

406406
# Flatten array

features/eolearn/features/local_binary_pattern.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, feature, nb_points=24, radius=3):
4444
raise ValueError('Local binary pattern task parameters must be positives')
4545

4646
def _compute_lbp(self, data):
47-
result = np.empty(data.shape, dtype=np.float)
47+
result = np.empty(data.shape, dtype=float)
4848
for time in range(data.shape[0]):
4949
for band in range(data.shape[-1]):
5050
image = data[time, :, :, band]

features/eolearn/features/radiometric_normalization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def _geoville_index_by_percentile(self, data, percentile):
122122
k_arr = (valid_obs - 1) * (percentile / 100.0)
123123
k_arr = np.where(k_arr < 0, 0, k_arr)
124124
f_arr = np.floor(k_arr + 0.5)
125-
f_arr = f_arr.astype(np.int)
125+
f_arr = f_arr.astype(int)
126126
# get floor value of reference band and index band
127127
ind = f_arr.astype("int16")
128128
y_val, x_val = ind_tmp.shape[1], ind_tmp.shape[2]

features/eolearn/features/temporal_features.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def execute(self, eopatch):
145145

146146
madata = np.ma.array(data,
147147
dtype=np.float32,
148-
mask=np.logical_or(~valid_data_mask.astype(np.bool), np.isnan(data)))
148+
mask=np.logical_or(~valid_data_mask.astype(bool), np.isnan(data)))
149149

150150
argmax_data = np.ma.MaskedArray.argmax(madata, axis=0)
151151
argmin_data = np.ma.MaskedArray.argmin(madata, axis=0)
@@ -206,7 +206,7 @@ def execute(self, eopatch):
206206

207207
ndvi = np.ma.array(eopatch.data[self.data_feature],
208208
dtype=np.float32,
209-
mask=~valid_data_mask.astype(np.bool))
209+
mask=~valid_data_mask.astype(bool))
210210

211211
all_dates = np.asarray([x.toordinal() for x in eopatch.timestamp])
212212

0 commit comments

Comments
 (0)