Optionalopts: {OptionalallowExtraDims?: booleanproceed with a variable carrying dimensions beyond
(lat, lon) + the series axis — a vertical level, ensemble member or band. Off by default: the
reader collapses them with no say from the caller, so this is an acknowledgement, not a fix.
Recorded on meta.extraDims
Optionaldims?: { order?: "yx" | "xy" }which trailing pair of the shape is (lat, lon). 'yx'
(CF order, the default) or 'xy' for a variable declared (…, lon, lat). Decides native
height/width only — extractGrid resamples onto whatever is requested
Optionalgrid?: { bbox?: number[]; height?: number; width?: number }PARTIAL override of the
native grid; anything omitted comes from the variable's own shape / scan().bbox. Pass bbox
alone for a file whose extent scan() could not derive (2-D curvilinear coordinates — ocean
tos-style products, rotated poles, Zarr with no CF coords); pass width/height alone to
decode coarser than native
Optionallon?: "native" | "-180..180" | "0..360"re-express the extent in a longitude convention. A global grid is genuinely rolled (the reader cannot do this — asking it for a shifted bbox returns the same pixels relabelled); a regional extent a whole turn away is relabelled with no pixel work; anything else throws rather than splitting the grid
Optionalname?: stringDataset name; defaults to the filename/URL tail
OptionalresolveUrl?: (url: string) => stringhost CORS-proxy/mirror, applied at force time
Optionalseries?: the series (time) axis. Omit for the default: the file's CF times
when it has them, otherwise integer indices over its leading dimension. false forces a single
grid. coords is an array of one coordinate per step, or a generator (i, n) => coord; ISO
strings and Dates become epoch ms, so an unlabelled file gains a REAL time axis —
{ series: { coords: i => new Date(Date.UTC(2001, i, 1)) } }. length caps the step count
(default: the leading dimension), name defaults to 'time', and unit defaults to 'ms' for
dates or 'index' for synthesized positions
Optionalvariable?: stringwhich variable; defaults to the first supported one
Optionalworkers?: numberextractGrid's worker count; defaults to SciWrid's own in a browser
and to 0 (inline) under Node, where the worker pool never resolves
Read a multi-dimensional scientific file into a
Datasetwith a real temporal axis. This is the implementation behindFimViz.parseFile/fim.addDatasetfor.nc/.grib2/.zarr— use those; this export exists for the composition root and tests, exactly likeparseSource. Every option documented below is passed straight through from them.Nothing is decoded here —
scan()reads metadata only, and the returned Dataset is a lazy series. Each axis entry is an in-file selector (ref: { select: { variable, time } }), so selecting a timestep costs no second fetch: the child shares this Dataset's bytes and decodes one slice on force. Every op,Stats,ColorScaleandRasterLayerthen work on it unchanged.Axis coordinates are numbers, not ISO strings, so
select()'s nearest-match works (it is numeric-only) — which is what a time slider needs. Epoch milliseconds (axis.unit === 'ms') when the file carries CF times or the caller supplies dates; plain positions ('index') when the file declares a leading dimension but no labels for it, which is the NetCDF3 case. The original label is kept on each entry'smeta.time. This deliberately differs from the WaterML/NWIS adapter's string coords, where exact match was acceptable becauselatest()covered the common case.One variable per Dataset: call it once per variable you want. (Folding variable in as a second axis is roadmapped — §8 — but a variable axis cannot be
reduce()d meaningfully, so it needs a guard this first slice does not yet have.)