Use Bordado in code, tests and docs#673
Conversation
Bordado's function to create random coordinates generates a different set of random coordinates than using Verde's function. This leads to a slightly different memory estimation for equivalent sources.
leouieda
left a comment
There was a problem hiding this comment.
Looks great! Made some small suggestions. I also noticed that Bordado is missing from the list in https://www.fatiando.org/harmonica/dev/install.html#dependencies (Boule is too, actually).
| # Define grid coordinates | ||
| region = vd.get_region(coordinates) | ||
| grid_coords = vd.grid_coordinates( | ||
| region = bd.get_region((easting, northing)) |
There was a problem hiding this comment.
You could also do
| region = bd.get_region((easting, northing)) | |
| region = bd.get_region(coordinates[:2]) |
but it's not much simpler. But just in case you don't want to use (easting, northing) all the time.
There was a problem hiding this comment.
Yes! I think I prefer explicitly passing easting and northing in the guide. Since we are already defining those variables, it's not a big deal.
| import verde.base as vdb | ||
| from numba import jit | ||
| from sklearn.utils.validation import check_is_fitted | ||
| from verde import BlockReduce, median_distance |
There was a problem hiding this comment.
I'd keep the import verde as vd to maintain the clear namespace separation.
|
|
||
| import numpy as np | ||
| import verde.base as vdb | ||
| from bordado import get_region, rolling_window |
There was a problem hiding this comment.
I'd replace this with import bordado as bd to keep the namespace.
| import numpy as np | ||
| import verde as vd | ||
| import xarray as xr | ||
| from verde import make_xarray_grid |
| import numpy as np | ||
| import pooch | ||
| import verde as vd | ||
| from verde import make_xarray_grid |
Co-authored-by: Leonardo Uieda <leo@uieda.com>
Add
bordadoas required dependency. Replace some of the Verde functions (likegrid_coordinates,get_region,rolling_window, etc.) for their Bordado counterparts in source code, tests, and docs. Update the code that uses those functions: keep in mind that Bordado functions are n-dimensional, so additional coordinates are not ignored as in Verde ones.Relevant issues/PRs:
Fixes #656