@fxi/zartigl 0.14.1 → 0.15.0

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
@@ -66,13 +66,13 @@ function p(e) {
66
66
  }
67
67
  export {
68
68
  c as B,
69
- u as C,
70
- l as a,
69
+ l as C,
70
+ s as a,
71
71
  p as b,
72
- h as c,
73
- f as d,
74
- y as e,
75
- s as f,
72
+ y as c,
73
+ h as d,
74
+ f as e,
75
+ u as f,
76
76
  m as g,
77
77
  O as i,
78
78
  R as r
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-BDIf6Jc0.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-jwaF2X-1.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
  };
package/dist/engine.d.ts CHANGED
@@ -38,11 +38,19 @@ declare interface BackdropStyle {
38
38
  */
39
39
  export declare function backdropVec4(backdrop: BackdropStyle): [number, number, number, number];
40
40
 
41
+ /**
42
+ * A ChunkStore in Cache Storage `name`; a store that keeps nothing where Cache
43
+ * Storage is unavailable (insecure context, some private modes), so callers need no check.
44
+ */
45
+ export declare function cacheChunkStore(name?: string): ChunkStore;
46
+
41
47
  declare interface CatalogEntry {
42
48
  id: string;
43
49
  aliases?: string[];
44
50
  title: LocalizedText;
45
51
  description?: LocalizedText;
52
+ /** Methodology and sources: an immutable page published with the catalog. */
53
+ documentation?: string;
46
54
  category: string;
47
55
  tags?: string[];
48
56
  kind: "scalar" | "vector";
@@ -130,6 +138,49 @@ declare interface CatalogZarrSource extends CatalogSourceBase {
130
138
  variables: CatalogVariables;
131
139
  }
132
140
 
141
+ /**
142
+ * A persistent store of Zarr chunks, as the compressed bytes the server sent,
143
+ * in the browser's Cache Storage. ZarrSource reads it before the network when
144
+ * given one (opt-in), so an app opens the chunks of a past session at once.
145
+ *
146
+ * Chunks of the to_zarr stores never change once written, except those of the
147
+ * last time chunk, which grows as months are appended. Those carry a revision
148
+ * (the length of the time axis): a stored chunk of another revision is stale
149
+ * and is read again, then replaced under the same key. A new store version has
150
+ * new URLs, so it never meets the chunks of the previous one.
151
+ */
152
+ /** A stored chunk, without its bytes. */
153
+ export declare interface ChunkEntry {
154
+ url: string;
155
+ /** Bytes on disk (compressed). */
156
+ size: number;
157
+ /** When the chunk was stored, ms since the epoch. */
158
+ storedAt: number;
159
+ revision: string;
160
+ }
161
+
162
+ /**
163
+ * The chunk revision a store expects for `indices` of a variable: the length of
164
+ * the time axis for chunks of the last time chunk, which grows; empty for every
165
+ * other chunk, which never changes.
166
+ */
167
+ export declare function chunkRevision(dimensions: readonly string[], shape: readonly number[], chunks: readonly number[], indices: readonly number[]): string;
168
+
169
+ export declare interface ChunkStore {
170
+ /** The bytes of `url`, or undefined when missing or of another revision. */
171
+ get(url: string, revision?: string): Promise<Uint8Array | undefined>;
172
+ put(url: string, bytes: Uint8Array, revision?: string): Promise<void>;
173
+ /** Every stored chunk whose URL starts with `prefix`. */
174
+ entries(prefix?: string): Promise<ChunkEntry[]>;
175
+ /** Removes these chunks. */
176
+ delete(urls: Iterable<string>): Promise<void>;
177
+ /** Origin storage use and quota, bytes, when the browser reports them. */
178
+ estimate(): Promise<{
179
+ usage: number;
180
+ quota: number;
181
+ } | undefined>;
182
+ }
183
+
133
184
  /**
134
185
  * `vec3 gradeColor(vec3 c, vec4 g)` of `colorGradeVec4`; GLSL ES 1.0 and
135
186
  * 3.0. It contains VIBRANCE_GLSL: include one or the other, never both.
@@ -190,6 +241,13 @@ export declare function createProgram(gl: WebGL2RenderingContext, vertSource: st
190
241
 
191
242
  export declare function createShader(gl: WebGL2RenderingContext, type: number, source: string): WebGLShader;
192
243
 
244
+ export declare interface DecodedChunk {
245
+ data: Float32Array;
246
+ shape: [number, number];
247
+ latRange: [number, number];
248
+ lonRange: [number, number];
249
+ }
250
+
193
251
  /** Trail length in frames for a 0–1 `fade`. */
194
252
  export declare function fadeToFrames(fade: number): number;
195
253
 
@@ -1225,7 +1283,26 @@ export declare interface VelocityTexturePair {
1225
1283
  /** `vec3 applyVibrance(vec3 c, float v)`; GLSL ES 1.0 and 3.0. */
1226
1284
  export declare const VIBRANCE_GLSL: string;
1227
1285
 
1228
- declare interface ZarrAttrs {
1286
+ export declare interface ZarrArrayMeta {
1287
+ zarr_format: number;
1288
+ shape: number[];
1289
+ chunks: number[];
1290
+ dtype: string;
1291
+ compressor: {
1292
+ id: string;
1293
+ level?: number;
1294
+ clevel?: number;
1295
+ cname?: string;
1296
+ shuffle?: number;
1297
+ blocksize?: number;
1298
+ } | null;
1299
+ fill_value: number | string | null;
1300
+ order: string;
1301
+ filters: unknown[] | null;
1302
+ dimension_separator?: string;
1303
+ }
1304
+
1305
+ export declare interface ZarrAttrs {
1229
1306
  _ARRAY_DIMENSIONS?: string[];
1230
1307
  units?: string;
1231
1308
  standard_name?: string;
@@ -1235,13 +1312,20 @@ declare interface ZarrAttrs {
1235
1312
  [key: string]: unknown;
1236
1313
  }
1237
1314
 
1238
- declare interface ZarrChunkFetchResult {
1315
+ export declare interface ZarrChunkFetchResult {
1239
1316
  data: Float32Array;
1240
1317
  missing: boolean;
1241
1318
  status?: number;
1242
1319
  url: string;
1243
1320
  }
1244
1321
 
1322
+ export declare interface ZarrConsolidatedMeta {
1323
+ zarr_consolidated_format: number;
1324
+ metadata: Record<string, ZarrArrayMeta | ZarrAttrs | {
1325
+ zarr_format: number;
1326
+ }>;
1327
+ }
1328
+
1245
1329
  declare interface ZarrPointSample {
1246
1330
  axisValue: number;
1247
1331
  time?: number;
@@ -1249,7 +1333,7 @@ declare interface ZarrPointSample {
1249
1333
  values: Record<string, number>;
1250
1334
  }
1251
1335
 
1252
- declare interface ZarrPointSeriesResult {
1336
+ export declare interface ZarrPointSeriesResult {
1253
1337
  longitude: number;
1254
1338
  latitude: number;
1255
1339
  depth?: number;
@@ -1257,7 +1341,7 @@ declare interface ZarrPointSeriesResult {
1257
1341
  points: ZarrPointSample[];
1258
1342
  }
1259
1343
 
1260
- declare class ZarrSource {
1344
+ export declare class ZarrSource {
1261
1345
  private root;
1262
1346
  private meta;
1263
1347
  private coords;
@@ -1269,7 +1353,18 @@ declare class ZarrSource {
1269
1353
  private maxCacheSize;
1270
1354
  private abortControllers;
1271
1355
  private bloscCodecCache;
1272
- constructor(root: string, maxCacheSize?: number);
1356
+ private chunkStore;
1357
+ /**
1358
+ * `options.chunkStore` keeps the compressed chunks across sessions (see
1359
+ * chunkStore.ts); without it, chunks are only kept in memory.
1360
+ */
1361
+ constructor(root: string, maxCacheSize?: number, options?: {
1362
+ chunkStore?: ChunkStore;
1363
+ });
1364
+ /** The URL of a chunk, as fetched and as stored. */
1365
+ chunkUrl(variable: string, indices: number[]): string;
1366
+ /** The revision a stored chunk must carry to be current (see chunkRevision). */
1367
+ chunkRevision(variable: string, indices: number[]): string;
1273
1368
  init(): Promise<void>;
1274
1369
  private getArrayMeta;
1275
1370
  private getAttrs;
@@ -1355,7 +1450,7 @@ declare class ZarrSource {
1355
1450
  private loadCoordinates;
1356
1451
  }
1357
1452
 
1358
- declare interface ZarrTimeDimension {
1453
+ export declare interface ZarrTimeDimension {
1359
1454
  min: number;
1360
1455
  max: number;
1361
1456
  step?: number;
@@ -1364,7 +1459,7 @@ declare interface ZarrTimeDimension {
1364
1459
  values: number[];
1365
1460
  }
1366
1461
 
1367
- declare interface ZarrVerticalDimension {
1462
+ export declare interface ZarrVerticalDimension {
1368
1463
  name: string;
1369
1464
  label: "depth" | "pressure" | string;
1370
1465
  units?: string;
package/dist/engine.js CHANGED
@@ -1,64 +1,67 @@
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
- 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";
1
+ import { C as o, G as s, a as r, b as i, c as d, d as c, e as t, f as G, g as l, h as n, i as V, j as S, k as C, R as u, T as L, V as m, l as O, Z as R, m as _, n as p, o as A, p as h, q as k, r as T, s as g, t as x, u as I, v, w as F, x as D, y as E, z as f, A as B, B as N, D as b, E as y, F as P, H as M, I as W, J as U, K as H, L as K, M as Y, N as Z, O as j, P as q, Q as w, S as z, U as J, W as Q, X, Y as $, _ as aa } from "./geovideo-index-D-BHqpO6.js";
2
+ import { B as oa, C as sa, a as ra, b as ia, c as da, d as ca, g as ta, i as Ga, r as la, e as na } from "./backdrop-BMwRyFI5.js";
3
3
  export {
4
- $ as BACKDROP_OFF,
4
+ oa as BACKDROP_OFF,
5
5
  o as COLOR_GRADE_GLSL,
6
- aa as COLOR_GRADE_OFF,
7
- ea as COLOR_GRADE_VIBRANT,
6
+ sa as COLOR_GRADE_OFF,
7
+ ra as COLOR_GRADE_VIBRANT,
8
8
  s as GEOVIDEO_SCALAR_GLSL,
9
9
  r as GLOW_GAIN,
10
- d as GLOW_GLSL,
11
- i as GLOW_SCALE,
12
- t as GeoVideoArchiveSource,
13
- G as GeoVideoClock,
14
- c as GeoVideoCodecScalarSource,
10
+ i as GLOW_GLSL,
11
+ d as GLOW_SCALE,
12
+ c as GeoVideoArchiveSource,
13
+ t as GeoVideoClock,
14
+ G as GeoVideoCodecScalarSource,
15
15
  l as GeoVideoField,
16
- V as GeoVideoFrameSource,
17
- n as GeoVideoPlayback,
16
+ n as GeoVideoFrameSource,
17
+ V as GeoVideoPlayback,
18
18
  S as GeoVideoScalarSource,
19
- L as GeoVideoVectorSource,
20
- C as RANDOM_GLSL,
21
- u as TrailFade,
19
+ C as GeoVideoVectorSource,
20
+ u as RANDOM_GLSL,
21
+ L as TrailFade,
22
22
  m as VELOCITY_BLEND_GLSL,
23
23
  O as VIBRANCE_GLSL,
24
+ R as ZarrSource,
24
25
  _ as alphaFadeAt,
25
26
  p as assertGeoVideoIndexIdentity,
26
- oa as backdropVec4,
27
- sa as colorGradeToGrade,
28
- ra as colorGradeVec4,
29
- R as createColorRampTexture,
30
- A as createGeoVideoFrameSource,
31
- T as createProgram,
32
- g as createShader,
27
+ ia as backdropVec4,
28
+ A as cacheChunkStore,
29
+ h as chunkRevision,
30
+ da as colorGradeToGrade,
31
+ ca as colorGradeVec4,
32
+ k as createColorRampTexture,
33
+ T as createGeoVideoFrameSource,
34
+ g as createProgram,
35
+ x as createShader,
33
36
  I as fadeToFrames,
34
- h as fadeToOpacity,
35
- k as formatUnit,
36
- x as geoVideoChunkSources,
37
- f as geoVideoGrid,
38
- v as geoVideoIndexChunks,
39
- D as geoVideoScalarUniforms,
40
- F as geoVideoTimelineValues,
41
- E as getPalettes,
42
- da as gradeToColorGrade,
43
- B as isGeoVideoArchiveSource,
44
- ia as isHexColor,
45
- b as loadGeoVideoIndex,
46
- N as loadGeoVideoManifest,
47
- P as nextChunk,
48
- y as nextChunkSpan,
49
- M as pairChunk,
50
- W as pairChunkSpan,
51
- U as parseTimeRange,
52
- ta as resolveBackdrop,
53
- Ga as resolveColorGrade,
54
- H as resolveColorRamp,
55
- Y as stepTime,
56
- j as subtractIsoDuration,
57
- q as timeBracket,
58
- w as timeRangeBounds,
59
- z as timeStep,
60
- J as validateGeoVideoIndex,
61
- K as validateGeoVideoManifest,
62
- Q as validateScalarColorDomain,
63
- X as velocityTexels
37
+ v as fadeToOpacity,
38
+ F as formatUnit,
39
+ D as geoVideoChunkSources,
40
+ E as geoVideoGrid,
41
+ f as geoVideoIndexChunks,
42
+ B as geoVideoScalarUniforms,
43
+ N as geoVideoTimelineValues,
44
+ b as getPalettes,
45
+ ta as gradeToColorGrade,
46
+ y as isGeoVideoArchiveSource,
47
+ Ga as isHexColor,
48
+ P as loadGeoVideoIndex,
49
+ M as loadGeoVideoManifest,
50
+ W as nextChunk,
51
+ U as nextChunkSpan,
52
+ H as pairChunk,
53
+ K as pairChunkSpan,
54
+ Y as parseTimeRange,
55
+ la as resolveBackdrop,
56
+ na as resolveColorGrade,
57
+ Z as resolveColorRamp,
58
+ j as stepTime,
59
+ q as subtractIsoDuration,
60
+ w as timeBracket,
61
+ z as timeRangeBounds,
62
+ J as timeStep,
63
+ Q as validateGeoVideoIndex,
64
+ X as validateGeoVideoManifest,
65
+ $ as validateScalarColorDomain,
66
+ aa as velocityTexels
64
67
  };