API
CRDSClient — Module
CRDSClientA Julia client for STScI's Calibration Reference Data System (CRDS): which reference files apply to an exposure, and those files in a local cache. Rules (.pmap/.imap/.rmap) are evaluated locally once cached, so repeat lookups work offline; the cache layout and environment variables (CRDS_PATH, CRDS_SERVER_URL, CRDS_CONTEXT, CRDS_MODE, ...) are those of the Python crds client, so both can share one cache.
Best references
CRDSClient.best_references — Function
best_references(header; context = nothing, reftypes = nothing, observatory = nothing,
mode = CRDSClient.default_mode(), strict = true) -> Dict{String, String}Best reference file names for header, by reference type (lower case, e.g. "epsf"); "N/A" where the rules make a type not applicable. header is flat with the keys the rules use (e.g. "ROMAN.META.INSTRUMENT.DETECTOR"; see flatten_header and required_parkeys).
context: a.pmap("roman_0058.pmap"),"latest"/"operational"/"edit"/"build", or a date; default$CRDS_CONTEXT, else latest (resolve_context).reftypes: types to look up (default: all of the instrument's).mode::autoevaluates the rules locally (Roman, JWST) and asks the server only for rules not supported here;:localnever contacts the server;:remotelets the server choose. HST always uses the server: aCRDSOfflineErrorin:localmode or when it cannot be reached.strict = truethrows aCRDSLookupErrorlisting every type without a match and why;falsereturns"NOT FOUND <reason>"for them instead.
Throws a CRDSError when a rule file or a chosen reference is marked bad by CRDS, unless CRDS_ALLOW_BAD_RULES / CRDS_ALLOW_BAD_REFERENCES is set.
CRDSClient.get_references — Function
get_references(header; context = nothing, reftypes = nothing, observatory = nothing,
mode = CRDSClient.default_mode()) -> Dict{String, String}Local paths of the best references for header (as best_references, strict), by reference type, downloading (with size and sha1 checks) those not yet cached. Types that are not applicable are left out.
CRDSClient.required_parkeys — Function
required_parkeys(context = nothing; instrument = nothing, reftypes = nothing, observatory = nothing,
mode = CRDSClient.default_mode()) -> Vector{String}The header keys context selects on for reftypes (default all) of instrument (needed only if the context has more than one), including the instrument key itself.
CRDSClient.flatten_header — Function
flatten_header(tree; prefix = "") -> Dict{String, Any}A nested metadata tree (e.g. a Roman file's meta, as ASDF.jl returns it) as the flat header CRDS rules use: dotted, upper-case keys (flatten_header(meta; prefix = "ROMAN.META") gives "ROMAN.META.EXPOSURE.START_TIME"), leaf values unchanged; lists are left out.
Contexts and server information
CRDSClient.resolve_context — Function
resolve_context(context = nothing; observatory = nothing, mode = CRDSClient.default_mode()) -> StringThe literal .pmap that context names:
- a
.pmapname ("roman_0058.pmap") is returned as is; "latest","operational","edit","build"(optionally prefixed,"roman-latest") come from the server information;- a date (
"roman-2026-10-01","2026-10-01T12:00:00") gives the context that was current then (from the server's context history); nothinguses$CRDS_CONTEXT, else"latest".
CRDSClient.server_info — Function
server_info(observatory; refresh = false, mode = CRDSClient.default_mode()) -> DictThe CRDS server's information for observatory: latest_context, operational_context, edit_context, build_context, context_history, bad_files_list, download URLs. Read from the cache when it is younger than CRDSClient.SERVER_INFO_MAX_AGE[] (or the server is unreachable), else fetched; refresh = true fetches when possible. mode = :local never contacts the server. A read-only cache (CRDS_READONLY_CACHE) keeps the information it holds, however old (except with refresh or mode = :remote), so "latest" names the newest context it was filled with.
Reference files and the cache
CRDSClient.fetch_reference — Function
fetch_reference(name; observatory = nothing, instrument = nothing, mode = CRDSClient.default_mode()) -> StringLocal path of reference file name, downloading it (with size and sha1 checks) when it is not cached: a CRDS name ("roman_wfi_dark_0001.asdf") or an HST name as a header records it ("jref$72m18219j_ccd.fits"; the IRAF prefix is dropped, case is ignored). HST names without such a prefix need observatory = "hst". Throws a CRDSError for a file CRDS has marked bad, unless CRDS_ALLOW_BAD_REFERENCES is set.
CRDSClient.reference_path — Function
reference_path(name; instrument = nothing, observatory = nothing) -> StringWhere reference file name is (or would be) in the cache. instrument is read from standard names (roman_wfi_...), or for HST from legacy names as the Python client does, when not given.
CRDSClient.cache_paths — Function
cache_paths(observatory) -> NamedTupleWhere mappings, references and configuration of observatory are cached: the Python client's layout under $CRDS_PATH (or its other CRDS_*PATH* variables), else this package's scratch space.
Errors
CRDSClient.CRDSError — Type
A CRDS failure: a server error, a malformed mapping, a failed download or check, ...
CRDSClient.CRDSLookupError — Type
One or more reference types had no best reference. failures maps each such type to the reason (e.g. which header parameter had a value the rules do not list).
CRDSClient.CRDSOfflineError — Type
The server was needed (files not cached, or remote lookups) but could not be reached.