Skip to content

Commit

Permalink
MNT: Remove unnecessary array copy=False semantics for numpy 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
greglucas committed Mar 6, 2024
1 parent ed6d896 commit b6bb3ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions lib/cartopy/mpl/gridliner.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,16 @@
)


def _fix_lons(lons):
"""
Fix the given longitudes into the range ``[-180, 180]``.
"""
lons = np.array(lons, copy=False, ndmin=1)
fixed_lons = ((lons + 180) % 360) - 180
# Make the positive 180s positive again.
fixed_lons[(fixed_lons == -180) & (lons > 0)] *= -1
return fixed_lons


def _lon_hemisphere(longitude):
"""Return the hemisphere (E, W or '' for 0) for the given longitude."""
longitude = _fix_lons(longitude)
if longitude > 0:
# Wrap the longitude to the range -180 to 180
longitude = ((longitude + 180) % 360) - 180
if longitude % 180 == 0:
hemisphere = ''
elif longitude > 0:
hemisphere = 'E'
elif longitude < 0:
else: # longitude < 0:
hemisphere = 'W'
else:
hemisphere = ''
return hemisphere


Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b6bb3ee

Please sign in to comment.