Skip to content

Commit

Permalink
Pass test
Browse files Browse the repository at this point in the history
  • Loading branch information
znicholls committed Jun 15, 2021
1 parent 338bb14 commit c1d0279
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions cf_units/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1738,10 +1738,8 @@ def convert(self, value, other, ctype=FLOAT64, inplace=False):
result, self.cftime_unit, self.calendar)
result = cftime.date2num(
result_datetimes, other.cftime_unit, other.calendar)
# Preserve the datatype of the input array if it was float32.
if (isinstance(value, np.ndarray) and
value.dtype == np.float32):
result = result.astype(np.float32)
if isinstance(value, np.ndarray) and np.issubsctype(value.dtype, np.floating):
result = result.astype(value.dtype)
else:
try:
ut_converter = _ud.get_converter(self.ut_unit,
Expand Down
2 changes: 1 addition & 1 deletion cf_units/tests/unit/unit/test_Unit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2015 - 2020, Met Office
# (C) British Crown Copyright 2015 - 2021, Met Office
#
# This file is part of cf-units.
#
Expand Down

0 comments on commit c1d0279

Please sign in to comment.