@fxi/zartigl 0.14.0 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,7 +24,7 @@ ARCO layers of [MapX](https://app.mapx.org).
24
24
  | Runtime library | `src/lib/` | `@fxi/zartigl`: the `Zartigl` facade, Zarr/WMTS/GeoVideo layers, shaders, particle simulation, point queries |
25
25
  | Catalog | `src/catalog/`, `scripts/catalog_builder/` | `@fxi/zartigl/catalog` presets and the tools that discover, describe, and validate entries |
26
26
  | GeoVideo pipeline | `scripts/geovideo/`, `.github/workflows/geovideo.yml` | Single renders and incremental archives published to S3, rendered daily on a self-hosted runner |
27
- | Demos | `src/explorer/`, `src/demo-story/` | Catalog explorer and narrative story, deployed to GitHub Pages |
27
+ | Demos | `src/explorer/`, `src/demo-story/`, `src/cube/` | Catalog explorer, narrative story and the GODAS thermocline data-cube, deployed to GitHub Pages |
28
28
  | MapX integration | `src/mapx/` | Widget and standalone snippet generation for reproducible MapX views |
29
29
 
30
30
  ## Features
@@ -214,6 +214,22 @@ npm run dev:story
214
214
  npm run build:story
215
215
  ```
216
216
 
217
+ The Pacific Thermocline Data-Cube (`src/cube/`) explores the monthly GODAS
218
+ ocean temperature of the equatorial Pacific (120° E–80° W, 14.5° S–15° N,
219
+ 0–300 m) since 1980 as an interactive cube, at
220
+ [`fxi.io/zartigl/cube`](https://fxi.io/zartigl/cube/). It provides:
221
+ - slice planes and 2D sections;
222
+ - the 20 °C isotherm;
223
+ - a Niño 3.4 timeline.
224
+
225
+ It reads five-year blocks of the catalog entry's point-series store, about
226
+ 42 MB each. `#t=YYYY-MM` opens a month.
227
+
228
+ ```bash
229
+ npm run dev:cube
230
+ npm run build:cube
231
+ ```
232
+
217
233
  The demos read the built-in catalog, which points to public browser-accessible Zarr, WMTS, and GeoVideo sources. No local data download is needed; data is fetched directly from the selected source.
218
234
 
219
235
  ## Public API
package/dist/catalog.d.ts CHANGED
@@ -29,6 +29,8 @@ export declare interface CatalogEntry {
29
29
  aliases?: string[];
30
30
  title: LocalizedText;
31
31
  description?: LocalizedText;
32
+ /** Methodology and sources: an immutable page published with the catalog. */
33
+ documentation?: string;
32
34
  category: string;
33
35
  tags?: string[];
34
36
  kind: "scalar" | "vector";
@@ -62,6 +64,21 @@ export declare interface CatalogGeoVideoSource extends CatalogSourceBase {
62
64
  indexUrl?: never;
63
65
  }
64
66
 
67
+ /**
68
+ * A link of a catalog entry, found by UUID or alias: its methodology page
69
+ * (`documentation`), its Zarr stores (`field`, `pointSeries`) or its GeoVideo
70
+ * index or manifest (`geovideo`). Undefined when the entry or the link does
71
+ * not exist. `pointSeries` comes from the entry's query source first, the
72
+ * other links from its default source first; then any source of the kind.
73
+ *
74
+ * Pass the live catalog (`(await loadCatalog()).catalog`) rather than the
75
+ * bundled one, so links follow the catalog when objects move.
76
+ */
77
+ export declare function catalogLink(layer: string, kind: CatalogLinkKind, data?: Catalog): string | undefined;
78
+
79
+ /** The links a catalog entry can resolve to; see `catalogLink`. */
80
+ export declare type CatalogLinkKind = "documentation" | "field" | "pointSeries" | "geovideo";
81
+
65
82
  export declare interface CatalogSearchOptions {
66
83
  locale?: string;
67
84
  category?: string;
package/dist/catalog.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as s, L as r, P as t, h as o, R as l, i, j as y, g as L, k as S, l as E, n as c, o as g, q as T, t as d, m, a as n, p as C, e as R, d as _, u as f, v as p, r as A, w as v, c as Y, x as u, b as P, s as k } from "./index-Cd7Nk4ve.js";
1
+ import { C as s, L as r, P as t, h as o, R as l, i, j as y, k as L, g as S, l as E, n as c, o as g, q as n, t as T, u as d, m, a as C, p as R, e as _, d as f, v as p, w as A, r as v, x as Y, c as u, y as P, b as k, s as x } from "./index-B1lj-XR_.js";
2
2
  export {
3
3
  s as CATALOG_URL,
4
4
  r as LAYER_STYLE_DEFAULTS,
@@ -6,25 +6,26 @@ export {
6
6
  o as PROVIDER_LABELS,
7
7
  l as RASTER_STYLE_KEYS,
8
8
  i as catalog,
9
- y as compareVersions,
10
- L as diffStyle,
11
- S as entryHeader,
12
- E as findCatalogEntries,
13
- c as formatTime,
14
- g as formatVertical,
9
+ y as catalogLink,
10
+ L as compareVersions,
11
+ S as diffStyle,
12
+ E as entryHeader,
13
+ c as findCatalogEntries,
14
+ g as formatTime,
15
+ n as formatVertical,
15
16
  T as getCatalogEntry,
16
17
  d as loadCatalog,
17
18
  m as mergeStyles,
18
- n as migrateLegacyStyle,
19
- C as parseLayerStyle,
20
- R as pickPreferredSource,
21
- _ as pickSourceByPriority,
22
- f as providerLabel,
23
- p as requireCatalogEntry,
24
- A as resolveEntryStyle,
25
- v as resolveLayerStyle,
26
- Y as resolveLocalizedText,
27
- u as searchCatalog,
28
- P as sourceCoversTime,
29
- k as styleForKind
19
+ C as migrateLegacyStyle,
20
+ R as parseLayerStyle,
21
+ _ as pickPreferredSource,
22
+ f as pickSourceByPriority,
23
+ p as providerLabel,
24
+ A as requireCatalogEntry,
25
+ v as resolveEntryStyle,
26
+ Y as resolveLayerStyle,
27
+ u as resolveLocalizedText,
28
+ P as searchCatalog,
29
+ k as sourceCoversTime,
30
+ x as styleForKind
30
31
  };
@@ -1716,7 +1716,7 @@ class Xt {
1716
1716
  if (!e)
1717
1717
  return null;
1718
1718
  const i = this.gl, r = this.gridTexture();
1719
- return this.options.repeatLongitude === !1 && (i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, i.NEAREST), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MAG_FILTER, i.NEAREST)), i.pixelStorei(i.UNPACK_ALIGNMENT, 1), i.texImage2D(
1719
+ return this.options.nearestMask && (i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, i.NEAREST), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MAG_FILTER, i.NEAREST)), i.pixelStorei(i.UNPACK_ALIGNMENT, 1), i.texImage2D(
1720
1720
  i.TEXTURE_2D,
1721
1721
  0,
1722
1722
  i.R8,
@@ -2015,7 +2015,7 @@ class Si {
2015
2015
  }
2016
2016
  createField(e) {
2017
2017
  const i = new Xt(this.gl, e, {
2018
- repeatLongitude: !1,
2018
+ nearestMask: !0,
2019
2019
  animateSnapshot: !0,
2020
2020
  onError: (r) => {
2021
2021
  this.field === i && !this.seeking && this.reportError(r);
package/dist/engine.d.ts CHANGED
@@ -43,6 +43,8 @@ declare interface CatalogEntry {
43
43
  aliases?: string[];
44
44
  title: LocalizedText;
45
45
  description?: LocalizedText;
46
+ /** Methodology and sources: an immutable page published with the catalog. */
47
+ documentation?: string;
46
48
  category: string;
47
49
  tags?: string[];
48
50
  kind: "scalar" | "vector";
@@ -130,6 +132,42 @@ declare interface CatalogZarrSource extends CatalogSourceBase {
130
132
  variables: CatalogVariables;
131
133
  }
132
134
 
135
+ /**
136
+ * A persistent store of Zarr chunks, as the compressed bytes the server sent,
137
+ * in the browser's Cache Storage. ZarrSource reads it before the network when
138
+ * given one (opt-in), so an app opens the chunks of a past session at once.
139
+ *
140
+ * Chunks of the to_zarr stores never change once written, except those of the
141
+ * last time chunk, which grows as months are appended. Those carry a revision
142
+ * (the length of the time axis): a stored chunk of another revision is stale
143
+ * and is read again, then replaced under the same key. A new store version has
144
+ * new URLs, so it never meets the chunks of the previous one.
145
+ */
146
+ /** A stored chunk, without its bytes. */
147
+ declare interface ChunkEntry {
148
+ url: string;
149
+ /** Bytes on disk (compressed). */
150
+ size: number;
151
+ /** When the chunk was stored, ms since the epoch. */
152
+ storedAt: number;
153
+ revision: string;
154
+ }
155
+
156
+ declare interface ChunkStore {
157
+ /** The bytes of `url`, or undefined when missing or of another revision. */
158
+ get(url: string, revision?: string): Promise<Uint8Array | undefined>;
159
+ put(url: string, bytes: Uint8Array, revision?: string): Promise<void>;
160
+ /** Every stored chunk whose URL starts with `prefix`. */
161
+ entries(prefix?: string): Promise<ChunkEntry[]>;
162
+ /** Removes these chunks. */
163
+ delete(urls: Iterable<string>): Promise<void>;
164
+ /** Origin storage use and quota, bytes, when the browser reports them. */
165
+ estimate(): Promise<{
166
+ usage: number;
167
+ quota: number;
168
+ } | undefined>;
169
+ }
170
+
133
171
  /**
134
172
  * `vec3 gradeColor(vec3 c, vec4 g)` of `colorGradeVec4`; GLSL ES 1.0 and
135
173
  * 3.0. It contains VIBRANCE_GLSL: include one or the other, never both.
@@ -498,8 +536,13 @@ export declare class GeoVideoField {
498
536
  }
499
537
 
500
538
  export declare interface GeoVideoFieldOptions {
501
- /** Repeat global grids in longitude; false for an inset MapLibre grid. */
539
+ /**
540
+ * Repeat global grids in longitude, so a mesh closed to a full turn
541
+ * blends their last column into the first one; false for an inset grid.
542
+ */
502
543
  repeatLongitude?: boolean;
544
+ /** Sample the validity mask NEAREST, as zartigl's mask threshold expects. */
545
+ nearestMask?: boolean;
503
546
  /** Play the media frames of a single-date snapshot; times then follow its media cadence. */
504
547
  animateSnapshot?: boolean;
505
548
  onError?: (error: unknown) => void;
@@ -1264,7 +1307,18 @@ declare class ZarrSource {
1264
1307
  private maxCacheSize;
1265
1308
  private abortControllers;
1266
1309
  private bloscCodecCache;
1267
- constructor(root: string, maxCacheSize?: number);
1310
+ private chunkStore;
1311
+ /**
1312
+ * `options.chunkStore` keeps the compressed chunks across sessions (see
1313
+ * chunkStore.ts); without it, chunks are only kept in memory.
1314
+ */
1315
+ constructor(root: string, maxCacheSize?: number, options?: {
1316
+ chunkStore?: ChunkStore;
1317
+ });
1318
+ /** The URL of a chunk, as fetched and as stored. */
1319
+ chunkUrl(variable: string, indices: number[]): string;
1320
+ /** The revision a stored chunk must carry to be current (see chunkRevision). */
1321
+ chunkRevision(variable: string, indices: number[]): string;
1268
1322
  init(): Promise<void>;
1269
1323
  private getArrayMeta;
1270
1324
  private getAttrs;
package/dist/engine.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Q as o, R as s, G as r, S as d, j as i, U as t, V as G, W as c, X as l, Y as V, n, Z as S, _ as L, $ as C, T as u, a0 as m, a1 as O, a2 as _, a3 as p, b as R, a4 as A, c as T, a5 as g, a6 as I, o as h, D as k, M as x, a7 as f, N as v, q as D, z as F, w as E, H as B, L as b, p as N, I as P, a8 as y, a9 as M, aa as W, ab as U, t as H, ac as Y, ad as j, ae as q, J as w, af as z, ag as J, P as K, v as Q, ah as X } from "./engine-CiDquHYk.js";
1
+ import { Q as o, R as s, G as r, S as d, j as i, U as t, V as G, W as c, X as l, Y as V, n, Z as S, _ as L, $ as C, T as u, a0 as m, a1 as O, a2 as _, a3 as p, b as R, a4 as A, c as T, a5 as g, a6 as I, o as h, D as k, M as x, a7 as f, N as v, q as D, z as F, w as E, H as B, L as b, p as N, I as P, a8 as y, a9 as M, aa as W, ab as U, t as H, ac as Y, ad as j, ae as q, J as w, af as z, ag as J, P as K, v as Q, ah as X } from "./engine-C8ZNzILO.js";
2
2
  import { B as $, a as aa, f as ea, b as oa, e as sa, c as ra, g as da, i as ia, r as ta, d as Ga } from "./backdrop-Dceb4d8E.js";
3
3
  export {
4
4
  $ as BACKDROP_OFF,