-
Notifications
You must be signed in to change notification settings - Fork 6
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
Allow custom coordinate dimensions #512
Comments
See https://github.com/creare-com/podpac/tree/feature/arbitrary-coordinate-dims Looks like this might be pretty straight-forward actually. Needs some careful testing through, and still need that utility function. With the above changes, this works: In [1]: import podpac
In [2]: c1 = podpac.Coordinates([[1, 2, 3]], ['mydim'])
---------------------------------------------------------------------------
TraitError Traceback (most recent call last)
<snip>
TraitError: The 'name' trait of an ArrayCoordinates1d instance expected any of ['lat', 'lon', 'alt', 'time'] or None, not the str 'mydim'.
In [3]: podpac.core.coordinates.utils.VALID_DIMENSION_NAMES.append('mydim')
In [4]: c1 = podpac.Coordinates([[1, 2, 3]], ['mydim'])
In [5]: n = podpac.data.Array(source=[1, 2, 3], coordinates=c1)
In [6]: n.eval(c1[1:])
Out[6]:
<xarray.UnitsDataArray (mydim: 2)>
array([2., 3.])
Coordinates:
* mydim (mydim) float64 2.0 3.0
Attributes:
layer_style: <podpac.core.style.Style object at 0x7fec11c57be0>
crs: +proj=longlat +datum=WGS84 +no_defs +vunits=m |
I think testing will require us to make sure that any hardcoding of the valid dimensions is replaced with looking through |
I want to create a utility function |
See https://github.com/creare-com/podpac/blob/develop/podpac/core/common_test_utils.py. This is an odd example of hardcoding. This only seems to be used for testing the coordinate creation? I don't really understand the point of this test or why we would make a hardcoded list of permutations and not use a library (itertools.permutations for example) |
This is just fine because it lives in the test, and the base |
Would like to meet about this.
|
Both seem okay, and a change is not needed right now. |
|
Import of
|
See 7416d41 Couple of questions about the valid dims.
|
We decided that if |
We decided not to update the |
We decided for nearest neighbor interpolators the tolerance and scale for other dimensions are traits. All custom dimensions must share the same tolerance and the same scale. The default value for tolerance is |
|
Rebase went shaky. Just created a new branch, |
We merged the new branch |
Description
Allow downstream applications to specify arbitrary coordinate dimensions.
Describe the solution you'd like
I might have an application where I want to pull data from a dataset based on coordinates with dimensions other than ["lat", "lon", "alt", "time"]
Sample Code
The text was updated successfully, but these errors were encountered: