FIMViz.jsAPI
    Preparing search index...

    Class Dataset

    Index
    • Parameters

      • Optionalinit: {
            axes?: DatasetAxis[];
            axis?: DatasetAxis;
            bounds?: DatasetBounds;
            crs?: string;
            data?: any;
            format?: "geotiff" | "geojson" | "kml" | "kmz" | "shp" | "hazus";
            id?: string;
            kind?: "raster" | "vector";
            meta?: any;
            name?: string;
            resolveUrl?: (url: string) => string;
            selector?: any;
            url?: string;
        } = {}
        • Optionalaxes?: DatasetAxis[]
        • Optionalaxis?: DatasetAxis

          1-D sugar for a single selection axis

        • Optionalbounds?: DatasetBounds

          expressed in crs

        • Optionalcrs?: string

          native CRS; null when unknown

        • Optionaldata?: any

          inlined payload only (raster bytes or parsed GeoJSON)

        • Optionalformat?: "geotiff" | "geojson" | "kml" | "kmz" | "shp" | "hazus"
        • Optionalid?: string
        • Optionalkind?: "raster" | "vector"
        • Optionalmeta?: any
        • Optionalname?: string
        • OptionalresolveUrl?: (url: string) => string

          url root only: resolver applied to the URL at force time

        • Optionalselector?: any

          an in-file selection passed to the materializer as root.select (normally produced by select() off a selector ref, not passed by hand)

        • Optionalurl?: string

          a URI root (set via Dataset.fromURL); leaves data null

      Returns Dataset

    axes: DatasetAxis[]
    crs: string
    data: any
    format: "geotiff" | "geojson" | "kml" | "kmz" | "shp" | "hazus"
    id: string
    kind: "raster" | "vector"
    name: string
    • get bounds(): DatasetBounds

      The footprint, in crs. Constructor-known for a root (or an op whose result is knowable upfront, e.g. clip), null when it genuinely isn't (e.g. a fresh reproject() node — the real bounds depend on what the warp actually produces). Once this node is FORCED, reads the real value off the memoized result instead — so ds.reproject(crs).grid().then(() => ds2.bounds) (ds2 being the reprojected node) reflects the true post-warp footprint rather than staying stuck at the construction-time placeholder.

      Returns DatasetBounds

    • get isMaterialized(): boolean

      Has this node been forced (decoded/warped) yet?

      Returns boolean

    • get meta(): any

      Free-form metadata (GDAL legend/unit/noData, …). Same self-updating rule as bounds: once forced, reads off the memoized result — which matters for raster ops like reproject whose reprojector refreshes dimension fields (width/height) that the pre-force value can't know.

      Returns any

    • get selector(): any

      The in-file selection this Dataset forces with, or null.

      Returns any

    • get warnings(): string[]

      Warnings collected when this node was forced (implicit reprojection, defaults, …).

      Returns string[]

    • Clip (crop) to a bbox — the footprint shrinks to the overlap, snapped to pixel edges. Lazy.

      Parameters

      • bbox: { east: number; north: number; south: number; west: number }

      Returns Dataset

    • Band math: combine this raster with others per pixel (LHS-conform — the others are resampled onto THIS grid). op: difference/ratio (binary) or sum/mean/min/max (N-ary). Lazy N-ary op node.

      Parameters

      • others: Dataset | Dataset[]
      • Optionalopts: { method?: string; op?: string } = {}

      Returns Dataset

    • Save the original bytes/content to disk. Inline roots only (a URL root has no local bytes yet). document is ambient, so this costs nothing in the import graph.

      Returns void

    • Reduce this raster's pixels grouped by another raster's values — a TERMINAL returning a table, not a Dataset. The third kind of reduction in the model:

      verb collapses grouped by returns
      reduce(op) a selection axis a Dataset (one grid)
      zonalStats(zones) space geometry a table
      groupBy(by) space another raster's values a table

      This is what "one variable as a series against another" means concretely — mean depth per land-use class, rainfall binned by elevation, a rating curve. It is a distinct verb rather than an overload because the grouping key comes from data, not from the axis model or from geometry.

      by is conformed onto THIS Dataset's grid (the same LHS-conform rule combine uses), and a pixel counts only where both rasters have a value.

      await depth.groupBy(landuse);                  // one row per distinct land-use code
      await rain.groupBy(dem, { bins: 10 }); // ten equal-width elevation bands
      await rain.groupBy(dem, { bins: [0, 100, 500, 2000] });

      Parameters

      • by: Dataset

        a raster Dataset whose values define the groups

      • Optionalopts: {
            bins?: number | number[];
            byNoData?: number;
            method?: string;
            noData?: number;
        } = {}

      Returns Promise<any[]>

    • Hillshade — a shaded-relief illumination raster via Horn's method (rasterOps.hillshadeGrid). Lazy.

      Parameters

      • Optionalopts: {
            altitude?: number;
            azimuth?: number;
            cellsizeX?: number;
            cellsizeY?: number;
            zFactor?: number;
        } = {}

      Returns Dataset

    • Mask by a polygon: pixels outside the polygon become transparent (NaN) on force — or inside, with { invert }. Footprint unchanged. Lazy: builds a node; the transform runs at terminal.

      Parameters

      • polygon: any[] | SpatialFilter

        a SpatialFilter, or a ring/multi-ring of {lat,lng}|[lat,lng]

      • Optionalopts: { invert?: boolean } = {}

      Returns Dataset

    • Rasterize this vector Dataset onto a new grid (vector→raster, the kind-changing op — PACKAGE_ROADMAP §2 "vectorize/rasterize"). field burns each feature's property value; omit for a constant burnValue. Bounds default to this Dataset's own footprint; width/height are required (a vector carries no inherent pixel resolution). Lazy.

      Parameters

      • opts: {
            bounds?: DatasetBounds;
            burnValue?: number;
            field?: string;
            height: number;
            width: number;
        } = {}

      Returns Dataset

    • Reclassify pixel values by rules (see rasterOps.reclassifyGrid) — EITHER a range-rules array ([{min?,max?,value?}], first-match-wins; a rule with no value is a "keep matched pixel's value" band) OR a single callback (value, index) => number|null|undefined called once per valid pixel with its raw value and flat row-major index (row*width+col), returning the new value directly — not limited to a contiguous range, and skips rule-matching entirely (one call per pixel instead of a per-rule scan), so it's both the more general and the cheaper form once you need more than a couple of simple ranges. Either form: returning null/undefined (or no rule matching) → unmatched → transparent (default) or kept. Lazy.

      ⚠️ A callback does NOT survive toRecord() (structured-clone can't carry functions) — forcing it (.grid()) works fine in-session, but toRecord() on this node (or a descendant of it) throws naming the op, rather than silently dropping it. Use range rules for a chain you need to persist/reload from Storage.

      Parameters

      • rules:
            | { max?: number; min?: number; value?: number }[]
            | ((value: number, index: number) => number)
      • Optionalopts: { unmatched?: "nodata" | "keep" } = {}

      Returns Dataset

    • Reduce this Dataset's selection axis to ONE grid — collapse a temporal/vertical stack (e.g. a stage/time series) via a per-pixel reducer. Sugar over select()+combine(): resolves every axis entry to a child Dataset, then LHS-conforms/reduces them exactly like combine() (PACKAGE_ROADMAP §2 "3-D / aggregation", the payoff of the axes model). Lazy.

      Parameters

      • Optionalop: "min" | "max" | "sum" | "mean" = "mean"
      • Optionalopts: { axis?: string | number; method?: string; variant?: string } = {}

      Returns Dataset

    • Drop the memoized decode (evictable cache — the slider's stale-load guard calls this).

      Returns void

    • Reproject to toCrs as a LAZY op. Returns a new Dataset; the warp runs only on force, dispatched through the registered reprojector (this file imports no GDAL). An exact same-CRS request is a no-op that returns this. Rasters only (vectors are EPSG:4326 by spec).

      Parameters

      • toCrs: string

      Returns Dataset

    • Resample onto a specific target grid — lazy: the resample runs on force, via geo/resample.js's resampleGrid (also directly barrel-exported as resampleGrid/alignRasters, so a caller can use either this Dataset-shaped convenience or the raw function on pixel arrays). target is either a resample-native meta object { width, height, bw, bs, be, bn }, or anything grid-shaped — { width, height, bounds: {north,south,east,west} } — e.g. another (already-forced) Dataset's .grid() result. method defaults to 'nearest' (pure-JS, always available); the GDAL-only methods (cubic/lanczos/mode/min/max/med/q1/q3) need a resampler registered via registerResampler (the escape hatch) or forcing throws a clear error. The result adopts the target's footprint/resolution; crs is unchanged (this resamples, it does not reproject).

      Parameters

      • target:
            | {
                be: number;
                bn: number;
                bs: number;
                bw: number;
                height: number;
                width: number;
            }
            | {
                bounds: { east: number; north: number; south: number; west: number };
                height: number;
                width: number;
            }
      • Optionalopts: { method?: string; noData?: number } = {}

      Returns Dataset

    • Resolve one selection-axis entry into a child Dataset (lazy). Sugar over selectAxisEntry: it picks the entry, resolves its ref, and carries the entry's opaque meta. Returns null when no entry matches. Kind-neutral: which variant (raster vs vector) is the caller's call.

      The ref decides what kind of child comes back (see DatasetAxisEntry):

      • a URL (bare, or a named variant picked via opts.variant) → a URL-rooted child, format inferred from the URL. One file per entry.
      • an in-file selector ({ select: {…} }) → a child rooted on the SAME source as this Dataset (its bytes or URL, plus resolver), carrying the selector for the materializer. One file, many entries — a NetCDF/GRIB2/Zarr time axis.

      Either way the child has no axes of its own: it is one payload, not a series, so it forces through load()/grid() like any other Dataset and every op chains off it normally.

      Parameters

      • coord: string | number
      • Optionalopts: { axis?: string | number; base?: string; nearest?: boolean; variant?: string } = {}
        • Optionalaxis?: string | number

          which axis (index or name) to look up on

        • Optionalbase?: string

          URL prefix prepended to a resolved URL ref (ignored by selector refs)

        • Optionalnearest?: boolean

          fall back to the closest numeric coord on a miss

        • Optionalvariant?: string

          required when the matched entry's ref has named URL variants (e.g. {raster, vector})

      Returns Dataset

    • Look up an entry on one axis by coordinate. Exact match first; with { nearest: true } (default) and a NUMERIC axis, falls back to the closest coord. axis selects which axis (index or name).

      Parameters

      • coord: string | number
      • Optionalopts: { axis?: string | number; nearest?: boolean } = {}
        • Optionalaxis?: string | number

          which axis (index or name) to look up on

        • Optionalnearest?: boolean

          fall back to the closest numeric coord on a miss

      Returns DatasetAxisEntry

    • Narrow one axis to the window [from, to] — a series in, series out operation, which is what separates it from select(). select(coord) resolves to ONE payload and hands back something forceable; selectRange hands back another selection-axis Dataset, still lazy, still unforceable on its own. That is the point: everything that works on the full series works on the window, reduce() most of all — "the mean of these six hours" is selectRange(a, b).reduce('mean'), with no new machinery on either side.

      Both bounds are inclusive, and the comparison is a plain >=/<= on the entry coords, so it is type-agnostic: numeric coords (epoch milliseconds, a stage in feet) compare numerically, and ISO-8601 strings compare lexicographically, which for ISO-8601 is the same as chronologically. Reversed bounds are swapped rather than rejected. Unlike select() there is no nearest-match: a window is already tolerant of falling between samples, so a range narrower than the sampling interval matches nothing and returns null — which is honest, where snapping would silently hand back a wider span than asked for.

      Coords are compared as given — Date.parse(iso) for the epoch-millisecond axes parseSciwrid builds. The engine stays domain-neutral about what a coordinate means.

      const storm = ds.selectRange(Date.parse('2023-08-29T00:00Z'), Date.parse('2023-08-30T00:00Z'));
      storm.axis.entries.length; // just that day's steps
      await storm.reduce('max').grid(); // peak rainfall WITHIN the window
      storm.select(coord); // and one step out of it, as usual

      Parameters

      • from: string | number

        inclusive lower bound

      • to: string | number

        inclusive upper bound

      • Optionalopts: { axis?: string | number } = {}
        • Optionalaxis?: string | number

          which axis (index or name) to narrow

      Returns Dataset

      a Dataset whose chosen axis holds only the matching entries; null when the axis is missing/empty or nothing falls inside the window

    • Slope — per-pixel terrain steepness via Horn's method, computed in pure JS on the decoded grid (no GDAL — see rasterOps.slopeGrid; PACKAGE_ROADMAP §2 "terrain"). Lazy.

      Parameters

      • Optionalopts: {
            cellsizeX?: number;
            cellsizeY?: number;
            unit?: "degrees" | "percent";
            zFactor?: number;
        } = {}

      Returns Dataset

    • Metadata view (without the heavy data payload). Axes are lightweight (URLs), so they stay.

      Returns any

    • A structured-cloneable record for Storage.put(). Default: the SOURCE + op recipe (small) — a root inline Dataset still serializes with data and round-trips exactly as before (back-compat); a URL root carries url; a derived node nests its INPUT records under inputs with its op. Pass { storeMaterialized: true } to also embed the decoded RasterGrid/VectorFeatures (the node must be materialized already — call await ds.load() first).

      Parameters

      • Optionalopts: { storeMaterialized?: boolean } = {}
        • OptionalstoreMaterialized?: boolean

          also embed the decoded RasterGrid/VectorFeatures snapshot

      Returns any

    • The named variants available at one axis coordinate, or null when that entry has none.

      Variants are not an axis and deliberately never became one, so they need their own way to be discovered — previously the only way to learn an entry had them was to call select() without one and read the thrown error, which is no way to build a picker.

      Why not an axis (see DECISIONS §1.1): a variant switches the Dataset's kind.tif gives a raster in an unknown CRS, .kmz a vector in EPSG:4326 — while every genuine axis preserves kind, CRS and bounds. It is a choice of encoding of the same datum, not a coordinate in the data.

      ds.variantsAt(19.5);                       // → ['raster', 'vector']  (or null)
      ds.select(19.5, { variant: 'raster' });

      Parameters

      • coord: string | number
      • Optionalopts: { axis?: string | number; nearest?: boolean } = {}

      Returns string[]

    • Parameters

      • zones: any
      • opts: {} = {}

      Returns Promise<
          {
              area: number;
              count: number;
              id: any;
              max: number;
              mean: number;
              min: number;
              sum: number;
          }[],
      >

    • Every format that can be decoded right now — built-ins plus anything registered. Build a file picker's accept list from it, or check an upload before parsing.

      Returns string[]

    • Rehydrate a record (recipe or materialized). Structured clone drops prototypes, so this is required.

      Parameters

      • record: any

      Returns Dataset

    • A URI-rooted Dataset. It fetches + decodes into a RasterGrid/VectorFeatures on FORCE — nothing happens now. Format/kind are inferred from the URL when not given. This is what folds the decoded Grid/Features back into Dataset: a URL Dataset IS the materialized value, lazily.

      Parameters

      • url: string
      • Optionalopts: {
            bounds?: DatasetBounds;
            crs?: string;
            format?: "geotiff" | "geojson" | "kml" | "kmz" | "shp" | "hazus";
            kind?: "raster" | "vector";
            meta?: any;
            name?: string;
            resolveUrl?: (url: string) => string;
        } = {}
        • Optionalbounds?: DatasetBounds
        • Optionalcrs?: string

          defaults to 'EPSG:4326' for vector formats, null (unknown) for raster

        • Optionalformat?: "geotiff" | "geojson" | "kml" | "kmz" | "shp" | "hazus"

          inferred from the URL's extension when omitted

        • Optionalkind?: "raster" | "vector"

          inferred from format when omitted

        • Optionalmeta?: any
        • Optionalname?: string

          defaults to the URL's filename

        • OptionalresolveUrl?: (url: string) => string

          a resolver (host CORS-proxy/mirror) applied to the URL at force time

      Returns Dataset

    • A JIT fallback invoked at most once, on the first force that finds no reprojector registered — how the GDAL warp auto-loads with no setup call.

      Parameters

      • fn: () => Promise<void>

      Returns void

    • Supply a resampler for the methods the pure-JS path doesn't implement (cubic/lanczos/…), which resampleTo({ method }) otherwise throws on. Synchronous and pixel-level — GDAL's own richer methods go through the warp seam instead (see geo/resample.js).

      Parameters

      • fn: Function

      Returns void