Skip to content

Commit

Permalink
Replace np.string_ with np.bytes_ for numpy 2 in cf writer
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Sep 21, 2023
1 parent c980ab2 commit 3bfcc34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions satpy/writers/cf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
np.dtype('int32'), np.dtype('uint32'),
np.dtype('int64'), np.dtype('uint64'),
np.dtype('float32'), np.dtype('float64'),
np.string_]
np.bytes_]

# Unsigned and int64 isn't CF 1.7 compatible
# Note: Unsigned and int64 are CF 1.9 compatible
Expand All @@ -209,7 +209,7 @@
np.dtype('int32'),
np.dtype('float32'),
np.dtype('float64'),
np.string_]
np.bytes_]

CF_VERSION = 'CF-1.7'

Expand Down Expand Up @@ -582,7 +582,7 @@ def _remove_satpy_attrs(new_data):
def _format_prerequisites_attrs(dataarray):
"""Reformat prerequisites attribute value to string."""
if 'prerequisites' in dataarray.attrs:
dataarray.attrs['prerequisites'] = [np.string_(str(prereq)) for prereq in dataarray.attrs['prerequisites']]
dataarray.attrs['prerequisites'] = [np.bytes_(str(prereq)) for prereq in dataarray.attrs['prerequisites']]
return dataarray


Expand Down

0 comments on commit 3bfcc34

Please sign in to comment.