Skip to content

Commit

Permalink
Use np.str_ instead of np.unicode_
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Sep 21, 2023
1 parent 18da8fd commit 6f77d18
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion satpy/readers/hdf4_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self, filename, filename_info, filetype_info):
def _collect_attrs(self, name, attrs):
for key, value in attrs.items():
value = np.squeeze(value)
if issubclass(value.dtype.type, (np.bytes_, np.unicode_)) and not value.shape:
if issubclass(value.dtype.type, (np.bytes_, np.str_)) and not value.shape:
value = value.item() # convert to scalar
if not isinstance(value, str):
# python 3 - was scalar numpy array of bytes
Expand Down
2 changes: 1 addition & 1 deletion satpy/writers/cf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
if netCDF4 is None and h5netcdf is None:
raise ImportError('Ensure that the netCDF4 or h5netcdf package is installed.')

# Numpy datatypes compatible with all netCDF4 backends. ``np.unicode_`` is
# Numpy datatypes compatible with all netCDF4 backends. ``np.str_`` is
# excluded because h5py (and thus h5netcdf) has problems with unicode, see
# https://github.com/h5py/h5py/issues/624."""
NC4_DTYPES = [np.dtype('int8'), np.dtype('uint8'),
Expand Down

0 comments on commit 6f77d18

Please sign in to comment.