YAXArrays.jl
YAXArrays.jl copied to clipboard
Extracting values at lat lon in YAXArrays 0.5
In the documentation, an important section on how to extract values a bunch of lat lon pairs is gone. To my mind, it would be important to have something on this in the documentation.
For reference, here is the documentation that was removed lately:
Indexing and subsetting
As for most array types, YAXArray also provides special indexing behavior when using the square brackets for indexing. Assuming that
cis a YAXArray, there are 3 different semantics to use the square brackets with, depending on the types of the arguments provided to getindex.
- Ranges and Integers only as for example
c[1,4:8,:]will access the underlying data according to the provided index in index space and read the data into memory as a plain Julia Array. It is equivalent toc.data[1,4:8,:].- Keyword arguments with values or Intervals as for example
c[longitude = 30..50, time=Date(2005,6,1), variable="air_temperature"]. This always creates a view into the specified subset of the data and return a new YAXArray with new axes without reading the data. Intervals and values are always interpreted in the units as provided by the axis values.- A Tables.jl-compatible object for irregular extraction of a list of points or sub-arrays and random locations. For example calling
c[[(lon=30,lat=42),(lon=-50,lat=2.5)]]will extract data at the specified coordinates and along all additional axes into memory. It returns a new YAXArray with a new Multi-Index axis along the selected longitudes and latitudes.
https://github.com/JuliaDataCubes/YAXArrays.jl/blob/ae03f7c44c86cfa98d90204a8626c37b3a60a17a/docs/examples/UserGuide/creating.jl#L37C1-L37C1
thanks for opening this issue. I removed this because now all indexing is handle by DD, and there are several examples across the docs. However, I do agree that a small section on how to do it with the new syntax should be added. I will try to do something later today, after work 😄 (office-hours).
there is section on that nowadays. https://juliadatacubes.github.io/YAXArrays.jl/stable/UserGuide/select.html#Select-elements