Skip to content

Commit

Permalink
Remove obsolete Python2 int/float converting relics
Browse files Browse the repository at this point in the history
  • Loading branch information
eumiro committed Jan 8, 2021
1 parent 545832e commit b548394
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/cartopy/crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ def __init__(self, central_longitude=0.0, globe=None):
x_max = a_rad * 180
y_max = a_rad * 90
# Set the threshold around 0.5 if the x max is 180.
self._threshold = x_max / 360.
self._threshold = x_max / 360
super().__init__(proj4_params, x_max, y_max, globe=globe)

@property
Expand Down
2 changes: 1 addition & 1 deletion lib/cartopy/feature/nightshade.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _julian_day(date):
month += 12
year -= 1

B = 2 - int(year/100) + int(int(year/100)/4)
B = 2 - year // 100 + (year // 100) // 4
C = ((second/60 + minute)/60 + hour)/24

JD = (int(365.25*(year + 4716)) + int(30.6001*(month+1)) +
Expand Down
2 changes: 1 addition & 1 deletion lib/cartopy/io/ogc_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def _image_and_extent(self, wms_proj, wms_srs, wms_extent, output_proj,
target_resolution)

def fetch_raster(self, projection, extent, target_resolution):
target_resolution = [int(np.ceil(val)) for val in target_resolution]
target_resolution = [math.ceil(val) for val in target_resolution]
wms_srs = self._native_srs(projection)
if wms_srs is not None:
wms_proj = projection
Expand Down
16 changes: 8 additions & 8 deletions lib/cartopy/mpl/geoaxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,11 +1105,11 @@ def background_img(self, name='ne_shaded', resolution='low', extent=None,
else:
# return only a subset of the image:
# set up coordinate arrays:
d_lat = 180.0 / img.shape[0]
d_lon = 360.0 / img.shape[1]
d_lat = 180 / img.shape[0]
d_lon = 360 / img.shape[1]
# latitude starts at 90N for this image:
lat_pts = (np.arange(img.shape[0]) * -d_lat - (d_lat / 2.0)) + 90.0
lon_pts = (np.arange(img.shape[1]) * d_lon + (d_lon / 2.0)) - 180.0
lat_pts = (np.arange(img.shape[0]) * -d_lat - (d_lat / 2)) + 90
lon_pts = (np.arange(img.shape[1]) * d_lon + (d_lon / 2)) - 180

# which points are in range:
lat_in_range = np.logical_and(lat_pts >= extent[2],
Expand All @@ -1126,10 +1126,10 @@ def background_img(self, name='ne_shaded', resolution='low', extent=None,
# now join them up:
img_subset = np.concatenate((img_subset1, img_subset2), axis=1)
# now define the extent for output that matches those points:
ret_extent = [lon_pts[lon_in_range1][0] - d_lon / 2.0,
lon_pts[lon_in_range2][-1] + d_lon / 2.0 + 360,
lat_pts[lat_in_range][-1] - d_lat / 2.0,
lat_pts[lat_in_range][0] + d_lat / 2.0]
ret_extent = [lon_pts[lon_in_range1][0] - d_lon / 2,
lon_pts[lon_in_range2][-1] + d_lon / 2 + 360,
lat_pts[lat_in_range][-1] - d_lat / 2,
lat_pts[lat_in_range][0] + d_lat / 2]
else:
# not crossing the dateline, so just find the region:
lon_in_range = np.logical_and(lon_pts >= extent[0],
Expand Down
2 changes: 1 addition & 1 deletion lib/cartopy/mpl/gridliner.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def _crs_transform(self):
def _round(x, base=5):
if np.isnan(base):
base = 5
return int(base * round(float(x) / base))
return int(base * round(x / base))

def _find_midpoints(self, lim, ticks):
# Find the center point between each lat gridline.
Expand Down

0 comments on commit b548394

Please sign in to comment.