API Reference
Public
SpaceDataModel.AbstractCoordinateSystem — Type
AbstractCoordinateSystemBase abstract type for all coordinate system implementations.
SpaceDataModel.AbstractCoordinateVector — Type
AbstractCoordinateVectorBase abstract type to represent coordinates in a coordinate systems.
SpaceDataModel.AbstractDataVariable — Type
A variable v of a type derived from AbstractDataVariable should at least implement:
Base.parent(v): the parent array of the variable
Optional:
times(v): the timestamps of the variableunits(v): the units of the variablegetmeta(v): the metadata of the variablename(v): the name of the variabledim(v, i): thei-th dimension of the variabledim(v, name): the dimension namednameof the variable
SpaceDataModel.AbstractReferenceFrame — Type
A specific realization of a reference system.
SpaceDataModel.AbstractRepresentation — Type
Abstract base for representing a point in a 3D coordinate system.
Reference:
- https://docs.astropy.org/en/stable/coordinates/representations.html
- https://github.com/JuliaEarth/CoordRefSystems.jl/blob/main/src/crs.jl
SpaceDataModel.Archive — Type
Archive(pattern, reader=(paths, t0, t1) -> paths)A source mirroring a URL-per-step archive: remotefiles enumerates, localize caches, reader(paths, t0, t1) opens and returns data over [t0, t1).
Unpublished steps are dropped, a gap being normal; a range publishing nothing throws, since no reader can open an empty file list.
SpaceDataModel.ContinuousTimeRanges — Type
An iterator over continuous segments of a time array, where consecutive times differ by at most max_dt.
SpaceDataModel.Dataset — Method
Dataset(name, source; selectors=(;), metadata=NoMetadata(), kw...)A named dataset with domains for its selectors and a source that materializes it over a time range via getdata.
selectors maps each selector name to its domain: a single value, a collection, or Any for open. Values are spelled as strings.
name may carry {selector} placeholders, filled when selection pins open domains; a source templates itself the same way.
SpaceDataModel.FilePattern — Type
FilePattern(pattern; cadence=Day(1), kw...)A template for the names of an archive's files, one per cadence.
Text in {} is a placeholder: {t:fmt} renders the step's start through the Dates format fmt ({t:mm-dd}, {t:yyyyjjj} with j for day of year) and {t1:fmt} the last instant it covers, for archives naming both ends. A name without a format is a keyword; {name|U} and {name|L} render its value upper- or lowercased. Everything else is literal.
Keywords may be filled at construction, when specializing, or at the call; every one must be filled before a name is rendered. Filling a keyword with "*" leaves a wildcard for resolve_url to match against the archive's listing.
julia> using Dates
julia> FilePattern("g13_xrs_1m_{t:yyyymm}01_{t1:yyyymmdd}.nc"; cadence=Month(1))(Date(2012, 2))
"g13_xrs_1m_20120201_20120229.nc"SpaceDataModel.FilePattern — Method
Fill keywords and t, giving a URL.
SpaceDataModel.Product — Type
Product(dataset, variable; metadata=NoMetadata(), kw...)A variable of a dataset: with optional layered metadata (e.g. a plot label override).
SpaceDataModel.Registry — Type
Registry(name, datasets; defaults=(;), metadata=NoMetadata(), kw...)A relation of Datasets: rows sharing a selector vocabulary. A mission, an instrument, or any other grouping is a Registry.
SpaceDataModel.SchemaDict — Type
SchemaDict(schema, data)
SchemaDict(schema, pairs::Pair...)Dict tagged with a MetadataSchema, recovered by get_schema.
SpaceDataModel.TimeRanges — Type
An iterator over a series of time ranges that are window long, with a cadence of cadence.
SpaceDataModel.Transformed — Type
Transformed(f, source; metadata=NoMetadata(), kw...)A derived product: getdata materializes source and applies f to the result.
SpaceDataModel.available — Function
available(x, t0, t1; kwargs...)Times in [t0, t1) at which x has data.
SpaceDataModel.get_schema — Method
get_schema(data)Get the metadata schema for data. Returns the tagged schema if metadata is a SchemaDict, otherwise infers from content ("CATDESC" ⇒ ISTPSchema), falling back to DefaultSchema.
SpaceDataModel.getcsys — Method
getcsys(x)Get the coordinate system of x. Ideally, this should return both the reference frame and coordinate representation.
If x is a instance of AbstractCoordinateSystem, return x itself. If x is a type of AbstractCoordinateSystem, return an instance of the coordinate system, i.e. x().
This is a generic function, packages should extend it for their own types.
SpaceDataModel.getdata — Function
getdata(x, t0, t1; kwargs...)Materialize x over [t0, t1).
SpaceDataModel.getmeta — Function
getmeta(x, key, default=nothing)Get metadata value associated with key for object x, or default if key is not present.
SpaceDataModel.getmeta — Method
getmeta(x)Get metadata for object x. If x does not have metadata, return NoMetadata().
SpaceDataModel.localize — Method
localize(url; dir=datadir(), update=false) -> String
localize(urls; ntasks=4, kw...) -> Vector{String}Return a local path for each URL, downloading files missing from the cache.
Set the SPACE_DATA_DIR environment variable to override the default cache directory.
Set update = true to force re-download, or a Period to refetch if the local copy is older.
SpaceDataModel.remotefiles — Method
remotefiles(p::FilePattern, t0, t1; refresh=false, version="*", kw...) :: Vector{String}URLs of the files over [t0, t1). Steps with no published file are dropped rather than an error, since a gap in an archive is normal.
Keywords fill p's placeholders; version defaults to the * wildcard, picking the highest listed. refresh=true bypasses memoized directory listings.
SpaceDataModel.resolve_url — Method
resolve_url(url; refresh=false)Concrete URL for url, where each * in the file name is replaced with the highest version field published in the directory, or nothing if the directory lists no such file.
A field matches any width and any separator (e.g., v03, v03.06, v03_01, v1.1.10). A name may carry more than one, as MAVEN's …_v02_r00.cdf does; fields rank left to right.
SpaceDataModel.setmeta — Function
setmeta(x, key => value, ...; symbolkey => value2, ...)
setmeta(x, dict::AbstractDict)Update metadata for object x for key key to have value value and return x.
SpaceDataModel.setmeta! — Function
setmeta!(x, key => value, ...; symbolkey => value2, ...)
setmeta!(x, dict::AbstractDict)Update metadata for object x in-place and return x. The metadata container must be mutable.
The arguments could be multiple key-value pairs or a dictionary of metadata; keyword arguments are also accepted.
Examples
setmeta!(x, :units => "m/s", :source => "sensor")
setmeta!(x, Dict(:units => "m/s", :quality => "good"))
setmeta!(x; units="m/s", calibrated=true)Throws an error if the metadata is not mutable. Use setmeta for immutable metadata.
Private
Base.filter — Method
filter(reg::Registry; selectors...)The rows of reg every supplied selector matches, each with the matched columns pinned.
SpaceDataModel.dim — Function
dim(x, i)
dim(x, name)Get the i-th dimension of object x, or the dimension associated with the given name. The default implementation returns axes(x, i).
A dimension may be time-varying or dependent on other dimensions; in such cases, the effective size of the corresponding array dimension ndims can be greater than 1.
SpaceDataModel.pin — Method
pin(ds, values; complete=false)Pin the open domains of ds named in values and rebuild its name and source with the pinned spellings; untouched domains stay open unless complete=true, which demands every one resolves.
SpaceDataModel.resolve — Method
resolve(data, lookup)Resolve metadata value from data using lookup.
Patterns
"key"/:key: direct metadata lookup("k1", "k2", ...): priority lookup, first hit winsVia(f, lookup):f(data)then resolvelookupon the resultlookup => default: usedefault(ordefault(data)) if lookup missesf::Function: callf(data)
SpaceDataModel.select — Method
select(reg; selectors...)The one dataset of reg every supplied selector matches, with omitted selectors filled from reg.defaults where the dataset carries them.
SpaceDataModel.vocabulary — Method
Selector names any of the registry's datasets carries.