Skip to content

Commit

Permalink
A bit more documentation on auto things and lookups and format (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 authored Jan 11, 2025
1 parent 052a602 commit aba4e97
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/src/extending_dd.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Nearly everything in DimensionalData.jl is designed to be extensible.
- `AbstractDimStack` is easily extended to custom mixed array datasets.
`RasterStack` or `ArViZ.Dataset` are examples.
- `Lookup` can have new types added, e.g. to `AbstractSampled` or
`AbstractCategorical`. `Rasters.Projected` is a lookup that knows
`AbstractCategorical`. For example, `Rasters.Projected` is a lookup that knows
its coordinate reference system, but otherwise behaves as a regular
`Sampled` lookup.

Expand All @@ -16,7 +16,7 @@ Nearly everything in DimensionalData.jl is designed to be extensible.
## `dims`

Objects extending DimensionalData.jl that have dimensions must return
a `Tuple` of constructed `Dimension`s from `dims(obj)`.
a `Tuple` of constructed `Dimension`s from `dims(obj)`, like `(X(), Y())`.

### `Dimension` axes

Expand Down Expand Up @@ -44,7 +44,7 @@ implemented.
## `rebuild`

Rebuild methods are used to rebuild immutable objects with new field values,
in a way that is more flexible and extensible than just using ConstructionBase.jl
in a more flexible and extensible way than just using ConstructionBase.jl
reconstruction. Developers can choose to ignore some of the fields passed
by `rebuild`.

Expand Down Expand Up @@ -85,11 +85,14 @@ format(dims, array)
This lets DimensionalData detect the lookup properties, fill in missing fields
of a `Lookup`, pass keywords from `Dimension` to detected `Lookup`
constructors, and accept a wider range of dimension inputs like tuples of `Symbol`
and `Type`.
and `Type`. The way you indicate that something needs to be filled is by using the `Auto` types,
like [`AutoOrder`](@ref) or [`AutoSampling`](@ref)

Not calling `format` in the outer constructors of an `AbstractDimArray`
has undefined behaviour.

When creating lookup types, you need to define `DimensionalData.format` on your lookup type.


## Interfaces.jl interface testing

Expand Down

0 comments on commit aba4e97

Please sign in to comment.