Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove FutureWarning from use of np.issubdtype(obj, np.str) #2954

Merged
merged 1 commit into from
Feb 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/iris/coords.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2010 - 2017, Met Office
# (C) British Crown Copyright 2010 - 2018, Met Office
#
# This file is part of Iris.
#
Expand Down Expand Up @@ -1159,7 +1159,7 @@ def collapsed(self, dims_to_collapse=None):
raise ValueError('Cannot partially collapse a coordinate (%s).'
% self.name())

if np.issubdtype(self.dtype, np.str):
if np.issubdtype(self.dtype, np.str_):
# Collapse the coordinate by serializing the points and
# bounds as strings.
def serialize(x):
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -3556,7 +3556,7 @@ def rolling_window(self, coord, aggregator, window, **kwargs):

new_bounds = iris.util.rolling_window(coord_.points, window)

if np.issubdtype(new_bounds.dtype, np.str):
if np.issubdtype(new_bounds.dtype, np.str_):
# Handle case where the AuxCoord contains string. The points
# are the serialized form of the points contributing to each
# window and the bounds are the first and last points in the
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/fileformats/_pyke_rules/fc_rules_cf.krb
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ fc_extras
attributes['invalid_units'] = attr_units
attr_units = cf_units._UNKNOWN_UNIT_STRING

if np.issubdtype(cf_var.dtype, np.str):
if np.issubdtype(cf_var.dtype, np.str_):
attr_units = cf_units._NO_UNIT_STRING

# Get any assoicated calendar for a time reference coordinate.
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/fileformats/cf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2010 - 2017, Met Office
# (C) British Crown Copyright 2010 - 2018, Met Office
#
# This file is part of Iris.
#
Expand Down Expand Up @@ -73,7 +73,7 @@

# NetCDF returns a different type for strings depending on Python version.
def _is_str_dtype(var):
return ((six.PY2 and np.issubdtype(var.dtype, np.str)) or
return ((six.PY2 and np.issubdtype(var.dtype, np.str_)) or
(six.PY3 and np.issubdtype(var.dtype, np.bytes_)))


Expand Down
2 changes: 1 addition & 1 deletion lib/iris/fileformats/netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,7 @@ def _create_cf_variable(self, cube, dimension_names, coord):
cf_dimensions = [dimension_names[dim] for dim in
cube.coord_dims(coord)]

if np.issubdtype(coord.points.dtype, np.str):
if np.issubdtype(coord.points.dtype, np.str_):
string_dimension_depth = coord.points.dtype.itemsize
if coord.points.dtype.kind == 'U':
string_dimension_depth //= 4
Expand Down