Skip to content
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

Method to calculate finite-difference derivative on arbitrary points #115

Open
leouieda opened this issue Sep 1, 2018 · 0 comments · May be fixed by #245
Open

Method to calculate finite-difference derivative on arbitrary points #115

leouieda opened this issue Sep 1, 2018 · 0 comments · May be fixed by #245
Labels
enhancement Idea or request for a new feature

Comments

@leouieda
Copy link
Member

leouieda commented Sep 1, 2018

Description of the desired feature

With our Green's functions interpolators, we can predict data at any point once we have a fitted model. We could have a method BaseGridder.predict_derivative(coordinates, direction=(east, north)) to calculate (central) finite-difference derivatives on a given set of points on arbitrary directions (given by a direction vector or keywords like north and east). The method could allow for arbitrary precision (FD order) as well. This method can later be used to grid derivatives, either through a new method or an argument to BaseGridder.grid.

An example usage would be:

import verde as vd
data = vd.datasets.fetch_rio_magnetic()
coordinates = projection((data.longitude, data.latitude))
spline = vd.Spline().fit(coordinates, data.total_field_anomaly_nt)
east_deriv = spline.predict_derivative(coordinates, direction="east")
# Or using a vector
north_deriv = spline.predict_derivative(coordinates, direction=(0, 1))

A challenge would be determining the spacing for the finite differences. There are probably methods out there for estimating this (maybe Fukushima (2018)). For now, just having the spacing as an argument is more than enough. We can worry about automation later.

It would be good also to calculate second or third derivatives. This could be an argument to the method that defaults to order=1 for first-derivative. But this is not a priority and can be implemented in subsequent PRs.

@leouieda leouieda added enhancement Idea or request for a new feature help wanted labels Sep 1, 2018
@leouieda leouieda added this to the 0.2.0 milestone Sep 1, 2018
@leouieda leouieda removed this from the 1.1.0 milestone Oct 11, 2018
@leouieda leouieda linked a pull request Mar 17, 2020 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Idea or request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant