-
Notifications
You must be signed in to change notification settings - Fork 389
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
is_land slow for multiple coordinates #462
Comments
I doubt it. Not without taking advantage of some spatial indexing code such
that geopandas or (I think) shapely can take advantage of if explicitly set.
Btw, in case you aren't aware, basemap is considered deprecated, and you
should move off of it, moving towards packages like cartopy.
…On Wed, May 29, 2019 at 2:33 PM jakobloeg ***@***.***> wrote:
Hello, I have an application where I would like to call is_land multiple
times and for many coordinates, in the order of millions. Is there a way to
speed up this process, instead of having to call is_land with one
coordinate at the time. This is simply too slow for my application
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#462?email_source=notifications&email_token=AACHF6FNHLKA47Y7PQD6I5DPX3D7JA5CNFSM4HQQKKNKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GWR2QWA>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACHF6GYQJH6UWHV2UKZT6TPX3D7JANCNFSM4HQQKKNA>
.
|
You can create a vectorized version of def is_land(lon, lat, resolution="l", grid=5):
from mpl_toolkits.basemap import maskoceans
lon, lat = np.broadcast_arrays(lon, lat)
dummy = np.zeros(lon.shape, dtype=bool)
mask = ~maskoceans(lon, lat, dummy, resolution=resolution, grid=grid).mask
return mask and use it e.g. as follows: step = 0.25
lons = +0.5 * step + np.arange(-180, +180, +step)[None, :]
lats = -0.5 * step + np.arange(+90, -90, -step)[:, None]
land = is_land(lons, lats) I use a similar function for my own purposes, and it is way faster than the normal |
Hello, I have an application where I would like to call is_land multiple times and for many coordinates, in the order of millions. Is there a way to speed up this process, instead of having to call is_land with one coordinate at the time. This is simply too slow for my application
The text was updated successfully, but these errors were encountered: