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

Add support for generating N-dimensional grids #138

Closed
leouieda opened this issue Oct 9, 2018 · 0 comments · Fixed by #390
Closed

Add support for generating N-dimensional grids #138

leouieda opened this issue Oct 9, 2018 · 0 comments · Fixed by #390
Labels
enhancement Idea or request for a new feature

Comments

@leouieda
Copy link
Member

leouieda commented Oct 9, 2018

Description of the desired feature

Grids are generated by the BaseGridder.grid method, which relies on coordinates.grid_coordinates to generate the coordinates for prediction. There is a heavy assumption of only 2 dimensions for the grid in the code: region is assumed to be [W, E, S, N], assigning coords to xarray.Dataset is hard-coded, etc. This is fine for gridders in this package because none of them support predicting data in 3D from 2D observations.

This is not the case for harmonic functions, like gravity and magnetic data. Because of Green's identities, you can predict these data anywhere in space from observations on a surface. This is know as the equivalent layer technique and it will be implemented in harmonica using Verde as a basis. So it would be good to:

  • Add support for grid_coordinates to take N-dimensional region, spacing, and shape. For example, grid_coordinates(region=[0, 10, 0, 20, 0, 30], shape=(10, 11, 12)) should produce three 3D arrays.
  • Change BaseGridder.grid to set the Dataset coords attribute dynamically depending on the shape of the coordinates produced by grid_coordinates.
@leouieda leouieda added enhancement Idea or request for a new feature help wanted labels Oct 9, 2018
@leouieda leouieda added this to the 1.1.0 milestone Oct 9, 2018
leouieda added a commit that referenced this issue Oct 11, 2018
Gridder methods `grid`, `scatter`, and `profile` now take in `**kwargs`
and pass them along to the coordinate generation functions. This will
allow extra flexibility for passing in arguments, like a grid height or
configuration, without needing to keep the methods in sync with the
functions.

Removed the `coordinate_system` mechanics from `profile` because it
wasn't implemented and is probably gonna take a while. Will introduce it
back when we finally have a geographic coordinate gridder. This
simplifies the coordinate naming schemes and other functions.

This is a step towards #138
leouieda added a commit that referenced this issue Oct 11, 2018
Gridder methods `grid`, `scatter`, and `profile` now take in `**kwargs`
and pass them along to the coordinate generation functions. This will
allow extra flexibility for passing in arguments, like a grid height or
configuration, without needing to keep the methods in sync with the
functions.

Removed the `coordinate_system` mechanics from `profile` because it
wasn't implemented and is probably gonna take a while. Will introduce it
back when we finally have a geographic coordinate gridder. This
simplifies the coordinate naming schemes and other functions.

This is a step towards #138
leouieda added a commit that referenced this issue Oct 11, 2018
The `grid_coordinates`, `scatter_points`, and `profile_coordinates` all
accept a new a `extra_coords` argument with the constant value to be
used as an extra coordinate. If given, then the output will have an
extra coordinate array of the same shape as the rest and with that
single value. If a list is given, multiple extra coordinate arrays will
be returned.

This can be used to specify constant coordinates to a grid generator,
like height or time, to generate a 2D grid/scatter/profile from data
that requires 3+ coordinates.

A step towards #138
@leouieda leouieda removed this from the 1.1.0 milestone Oct 11, 2018
leouieda added a commit that referenced this issue Oct 11, 2018
The `grid_coordinates`, `scatter_points`, and `profile_coordinates` all
accept a new a `extra_coords` argument with the constant value to be
used as an extra coordinate. If given, then the output will have an
extra coordinate array of the same shape as the rest and with that
single value. If a list is given, multiple extra coordinate arrays will
be returned.

This can be used to specify constant coordinates to a grid generator,
like height or time, to generate a 2D grid/scatter/profile from data
that requires 3+ coordinates.

A step towards #138
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