Commit 728ab0a0 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed ValueError in case NaN is used as nodata value for float data type. Bumped version.


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 28ffa0e6
Pipeline #29667 passed with stages
in 2 minutes and 25 seconds
......@@ -3,10 +3,11 @@ History
=======
0.15.2 (coming soon)
--------------------
0.15.2 (29.10.2021)
-------------------
* Added compatibility to the 'HDF:"/path/file.hdf":subdataset' syntax when opening HDF sub-datasets directly.
* Fixed ValueError in case NaN is used as nodata value for float data type.
0.15.1 (22.10.2021)
......
......@@ -156,8 +156,11 @@ class GeoArray(object):
return
if not dt_min <= _nodata <= dt_max:
raise ValueError("The given no-data value (%s) is out range for data type %s."
% (self._initParams['nodata'], str(np.dtype(self.dtype))))
if np.issubdtype(self.dtype, np.floating) and np.isnan(_nodata):
pass
else:
raise ValueError("The given no-data value (%s) is out range for data type %s."
% (self._initParams['nodata'], str(np.dtype(self.dtype))))
@property
def arr(self):
......
......@@ -22,5 +22,5 @@
# limitations under the License.
__version__ = '0.15.1'
__versionalias__ = '20211022.01'
__version__ = '0.15.2'
__versionalias__ = '20211029.01'
......@@ -185,6 +185,9 @@ class Test_GeoArray(TestCase):
# test float nodata value together with integer array data type
GeoArray(np.array([1, 2]).astype(np.uint8), nodata=0.)
# test NaN nodata value together with float array data type
GeoArray(np.array([1, 2]).astype(np.float), nodata=np.nan)
@parameterized.expand(_get_gA_inMem_notInMem())
def test_calc_mask_nodata(self, _, gA):
def test_with_flag_all(_gA):
......
Supports Markdown
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