Skip to content

COMPAT: use numpy searchsorted #52

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

Merged
merged 3 commits into from
Jan 18, 2019
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ the internet into geospatial raster files. Bounding boxes can be passed in both

* `mercantile`
* `numpy`
* `pandas`
- `matplotlib`
* `pillow`
* `rasterio`
Expand Down
13 changes: 6 additions & 7 deletions contextily/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import io
import os
import numpy as np
import pandas as pd
import rasterio as rio
from PIL import Image
from rasterio.transform import from_origin
Expand Down Expand Up @@ -258,13 +257,13 @@ def bb2wdw(bb, rtr):
((row_start, row_stop), (col_start, col_stop))
'''
rbb = rtr.bounds
xi = pd.Series(np.linspace(rbb.left, rbb.right, rtr.shape[1]))
yi = pd.Series(np.linspace(rbb.bottom, rbb.top, rtr.shape[0]))
xi = np.linspace(rbb.left, rbb.right, rtr.shape[1])
yi = np.linspace(rbb.bottom, rbb.top, rtr.shape[0])

window = ((rtr.shape[0] - yi.searchsorted(bb[3])[0],
rtr.shape[0] - yi.searchsorted(bb[1])[0]),
(xi.searchsorted(bb[0])[0],
xi.searchsorted(bb[2])[0])
window = ((rtr.shape[0] - yi.searchsorted(bb[3]),
rtr.shape[0] - yi.searchsorted(bb[1])),
(xi.searchsorted(bb[0]),
xi.searchsorted(bb[2]))
)
return window

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
geopy
matplotlib
mercantile
pandas
pillow
pytest
rasterio
Expand Down