Abstract base package for dimensional arrays and their specific traits Note this is package currently in the discussion stage.
It is proposed to add behind each point, a possible interface (from the user point of view)
- Return coordinates lon/lat/depth/time (and arbitrary dimension) for a given index i,j,k,...
coord(A,:latitude,i,j,k) # or better coord(A,Lat(),i,j,k)
lat(A,i,j,k) # for common dimension names
lat(A,j) # if grids are aligned with longitude/latitude/depth/time...; otherwise an error
lon
- Return the value at a given index i,j,k... (the result is no longer georeferenced).
value(A,i,j,k)
- Tell what each coordinate represent (is the 3rd dimension time or depth or something else?).
coordnames(x) # would return :longitude, :latitude, ... or Lon(), Lat()
Use the CF convention names (longitude, latitude, time, …)
- Subsetting based on lon/lat/depth/time (and arbitrary dimension) bounding box
- Irregular grid subsetting returns either: a masked array or a vector of points - need to decide
which occurs on
getinidex
.
A[Lat(x), Lon(y), Time(At(t))]
- Find the k nearest points for a given location
- Integral over a raster (knowing the "volume" of each grid cell)
volume(A,i,j,k)
- Is the cell value for the start, middle or (probably never) the end of the duration/span? Is it an average of the whole period or a specific point in the cell. These specifications should also generalise to any dimension type.
- Categorical dimensions with no size and optional ordered/unordered status
- Arrays can be plotted correctly using the grid information
plot(A[:,:,n])
- units and other metadata
- Zero cost indexing (only works on regular grids?)
- Lazy affine transformations on the data
https://gist.github.com/meggart/e29e6381d9400ff789eefbccc109d6f9