You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, iris.analysis.cartography.wrap_lons promotes dtype to np.float64. This is causing some users to have to manually change the dtype back to its original version.
# It is important to use 64bit floating precision when changing a floats
# numbers range.
lons=lons.astype(np.float64)
return ((lons-base+period*2) %period) +base
I believe this is done to avoid rounding errors within the calculation. If this is the case, It may be worth converting back to the original dtype after the calculation with something like the following code:
orig_dtype = lons.dtype
lons = lons.astype(np.float64)
return (((lons – base + period * 2) % period) + base).astype(orig_dtype)
The text was updated successfully, but these errors were encountered:
📰 Custom Issue
Currently,
iris.analysis.cartography.wrap_lons
promotes dtype tonp.float64
. This is causing some users to have to manually change the dtype back to its original version.iris/lib/iris/analysis/cartography.py
Lines 70 to 73 in 98baee2
I believe this is done to avoid rounding errors within the calculation. If this is the case, It may be worth converting back to the original dtype after the calculation with something like the following code:
The text was updated successfully, but these errors were encountered: