Commit c201bedb authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Revised tests. Added parameterized as test requirement. Replaced deprecated...


Revised tests. Added parameterized as test requirement. Replaced deprecated numpy data types with builtin types. Fixed dead link in the docs.
Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 039e89a7
Pipeline #19572 failed with stage
in 1 minute and 58 seconds
......@@ -113,6 +113,6 @@ This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypack
.. _coverage: https://danschef.git-pages.gfz-potsdam.de/geoarray/coverage/
.. _nosetests: https://danschef.git-pages.gfz-potsdam.de/geoarray/nosetests_reports/nosetests.html
.. _conda: https://conda.io/docs/
.. _here: examples/notebooks/features_and_usage.ipynb
.. _here: https://git.gfz-potsdam.de/danschef/geoarray/-/blob/master/examples/notebooks/features_and_usage.ipynb
.. _pip: https://pip.pypa.io
.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/
......@@ -674,7 +674,7 @@ class GeoArray(object):
arr = self[:, :, fromBand] if self.ndim == 3 and fromBand is not None else self[:]
if self.nodata is None:
mask = np.ones((self.rows, self.cols), np.bool)
mask = np.ones((self.rows, self.cols), bool)
elif np.isnan(self.nodata):
nanmask = np.isnan(arr)
......@@ -971,7 +971,7 @@ class GeoArray(object):
# write _arr_cache
self._arr_cache = dict(pos=arr_pos, arr_cached=out_arr)
return out_arr # TODO implement check of returned datatype (e.g. NoDataMask should always return np.bool
return out_arr # TODO implement check of returned datatype (e.g. NoDataMask should always return bool
# TODO -> would be np.int8 if an int8 file is read from disk
def save(self, out_path, fmt='ENVI', creationOptions=None):
......@@ -1156,7 +1156,7 @@ class GeoArray(object):
palette = copy(palette) # allows to modify the colormap as in-place modifications are not allowed anymore
if nodataVal is not None and \
np.std(image2plot.astype(np.float)) != 0: # do not show nodata; float is needed to avoid overflow error
np.std(image2plot.astype(float)) != 0: # do not show nodata; float is needed to avoid overflow error
image2plot = np.ma.masked_equal(image2plot, nodataVal)
vmin_auto = np.nanpercentile(image2plot.compressed(), pmin)
......@@ -1214,7 +1214,7 @@ class GeoArray(object):
res_factor=res_factor, nodataVal=nodataVal, ignore_rotation=ignore_rotation)
palette, vmin, vmax = self._get_cmap_vmin_vmax(cmap, vmin, vmax, pmin, pmax, image2plot, nodataVal)
if nodataVal is not None and np.std(image2plot.astype(np.float)) != 0:
if nodataVal is not None and np.std(image2plot.astype(float)) != 0:
image2plot = np.ma.masked_equal(image2plot, nodataVal)
# check availability of holoviews
......
......@@ -38,7 +38,7 @@ class BadDataMask(GeoArray):
if self.is_inmem:
# validate input data - before converting to bool
self._validate_array_values(self.arr)
self.arr = self.arr.astype(np.bool)
self.arr = self.arr.astype(bool)
# del self._mask_baddata, self.mask_baddata # TODO delete property (requires deleter)
......@@ -50,7 +50,7 @@ class BadDataMask(GeoArray):
def arr(self, ndarray):
assert isinstance(ndarray, np.ndarray), "'arr' can only be set to a numpy array!"
self._validate_array_values(ndarray)
self._arr = ndarray.astype(np.bool)
self._arr = ndarray.astype(bool)
def _validate_array_values(self, maskarray):
pixelVals_in_mask = sorted(list(np.unique(maskarray)))
......@@ -71,7 +71,7 @@ class NoDataMask(GeoArray):
if self.is_inmem:
# validate input data - before converting to bool
self._validate_array_values(self.arr)
self.arr = self.arr.astype(np.bool)
self.arr = self.arr.astype(bool)
# del self._mask_nodata, self.mask_nodata # TODO delete property (requires deleter)
# TODO disk-mode: init must check the numbers of bands, and ideally also the pixel values in mask
......@@ -84,7 +84,7 @@ class NoDataMask(GeoArray):
def arr(self, ndarray):
assert isinstance(ndarray, np.ndarray), "'arr' can only be set to a numpy array!"
self._validate_array_values(ndarray)
self._arr = ndarray.astype(np.bool)
self._arr = ndarray.astype(bool)
def _validate_array_values(self, maskarray):
pixelVals_in_mask = sorted(list(np.unique(maskarray)))
......
......@@ -57,7 +57,7 @@ req_interactive_plotting = [
req_setup = ['setuptools-git']
req_test = req + ["coverage", "nose", "nose2", "nose-htmloutput", "rednose", "urlchecker"]
req_test = req + ["coverage", "nose", "nose2", "nose-htmloutput", "rednose", "urlchecker", "parameterized"]
req_doc = ['sphinx-argparse', 'sphinx_rtd_theme']
......
......@@ -26,6 +26,7 @@ dependencies:
# test/docs requirements
- coverage
- flake8
- parameterized
- pycodestyle
- pydocstyle
- pylint
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment