@oceanum/layers 0.1.1

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/dist/index.js ADDED
@@ -0,0 +1,539 @@
1
+ import { PcolorLayer as q, ParticleLayer as R, PartmeshLayer as A, ContourLayer as B } from "@oceanum/deck-gl-grid";
2
+ import { CompositeLayer as T } from "@deck.gl/core";
3
+ import { Dataset as U } from "@oceanum/datamesh";
4
+ function W(a, e) {
5
+ const n = { x: a.x, y: a.y };
6
+ return e.xvector && e.yvector ? (n.u = e.xvector, n.v = e.yvector) : n.c = e.magnitude, n;
7
+ }
8
+ function E(a, e) {
9
+ const n = { x: a.x, y: a.y };
10
+ return e.xvector && e.yvector ? (n.u = e.xvector, n.v = e.yvector) : (n.m = e.magnitude, n.d = e.direction), n;
11
+ }
12
+ function O(a) {
13
+ const e = [];
14
+ return a.magnitude && e.push(a.magnitude), a.xvector && e.push(a.xvector), a.yvector && e.push(a.yvector), a.direction && e.push(a.direction), e;
15
+ }
16
+ function $(a, e) {
17
+ if (!a || a.length === 0) return 0;
18
+ const n = e instanceof Date ? e.getTime() / 1e3 : new Date(e).getTime() / 1e3;
19
+ let t = 0, l = a.length - 1;
20
+ for (; t < l; ) {
21
+ const o = t + l >> 1;
22
+ a[o] < n ? t = o + 1 : l = o;
23
+ }
24
+ return t > 0 && Math.abs(a[t - 1] - n) < Math.abs(a[t] - n) ? t - 1 : t;
25
+ }
26
+ function C(a, e) {
27
+ return e <= 0 ? 0 : Math.max(0, Math.min(a, e - 1));
28
+ }
29
+ function L(a, e, n) {
30
+ if (!a || a.length === 0) return [0, 0];
31
+ const t = a.length < 2 || a[1] >= a[0];
32
+ let l = 0, o = a.length - 1;
33
+ if (t) {
34
+ let r = 0, s = a.length - 1;
35
+ for (; r < s; ) {
36
+ const i = r + s >> 1;
37
+ a[i] < e ? r = i + 1 : s = i;
38
+ }
39
+ for (l = Math.max(0, r - 1), r = l, s = a.length - 1; r < s; ) {
40
+ const i = r + s + 1 >> 1;
41
+ a[i] > n ? s = i - 1 : r = i;
42
+ }
43
+ o = Math.min(a.length - 1, r + 1);
44
+ } else {
45
+ let r = 0, s = a.length - 1;
46
+ for (; r < s; ) {
47
+ const i = r + s >> 1;
48
+ a[i] > n ? r = i + 1 : s = i;
49
+ }
50
+ for (l = Math.max(0, r - 1), r = l, s = a.length - 1; r < s; ) {
51
+ const i = r + s + 1 >> 1;
52
+ a[i] < e ? s = i - 1 : r = i;
53
+ }
54
+ o = Math.min(a.length - 1, r + 1);
55
+ }
56
+ return [l, o];
57
+ }
58
+ function w(a, e) {
59
+ return { start: a, stop: e, step: null };
60
+ }
61
+ async function j(a, e, n, t, l, o, r) {
62
+ const s = {}, i = {}, c = a.variables[e.x], d = a.variables[e.y], [h, m] = await Promise.all([
63
+ c.get([w(r[0], r[1] + 1)]),
64
+ d.get([w(o[0], o[1] + 1)])
65
+ ]);
66
+ s[e.x] = { data: h }, s[e.y] = { data: m };
67
+ const v = n.map(async (b) => {
68
+ const p = a.variables[b];
69
+ if (!p) return;
70
+ const x = p.dimensions.map((f) => e.t && f === e.t ? t : e.z && f === e.z ? l : f === e.y ? w(o[0], o[1] + 1) : f === e.x ? w(r[0], r[1] + 1) : null), k = await p.get(x);
71
+ i[b] = { data: k };
72
+ });
73
+ return await Promise.all(v), { coords: s, data_vars: i };
74
+ }
75
+ function M(a, e = 0.1) {
76
+ const n = a.getBounds(), t = n[0][0], l = n[0][1], o = n[1][0], r = n[1][1], s = o - t, i = r - l, c = s * e, d = i * e;
77
+ return {
78
+ west: t - c,
79
+ south: Math.max(-90, l - d),
80
+ east: o + c,
81
+ north: Math.min(90, r + d)
82
+ };
83
+ }
84
+ function H(a, e) {
85
+ return e ? a.west >= e.west && a.south >= e.south && a.east <= e.east && a.north <= e.north : !1;
86
+ }
87
+ function V(a, e) {
88
+ let n = null;
89
+ const t = ((...l) => {
90
+ n && clearTimeout(n), n = setTimeout(() => {
91
+ n = null, a(...l);
92
+ }, e);
93
+ });
94
+ return t.cancel = () => {
95
+ n && (clearTimeout(n), n = null);
96
+ }, t;
97
+ }
98
+ const X = {
99
+ onMetadataError: (a) => console.warn(`[OceanumLayer] ${a.message}`),
100
+ onChunkError: (a) => console.warn(`[OceanumLayer] ${a.message}`),
101
+ onVariableError: (a) => console.warn(`[OceanumLayer] ${a.message}`),
102
+ onValidationError: (a) => console.error(`[OceanumLayer] ${a.message}`)
103
+ }, Y = {
104
+ serviceUrl: { type: "string", value: "https://layers.app.oceanum.io" },
105
+ authHeaders: { type: "object", value: {} },
106
+ layerId: { type: "string", value: null },
107
+ instance: { type: "string", value: null },
108
+ time: { type: "string", value: null },
109
+ level: { type: "number", value: 0 },
110
+ colormap: { type: "object", value: null },
111
+ opacity: { type: "number", value: 1 },
112
+ altitude: { type: "number", value: 0 },
113
+ globalWrap: { type: "boolean", value: !1 },
114
+ scale: { type: "number", value: 1 },
115
+ offset: { type: "number", value: 0 },
116
+ pickable: { type: "boolean", value: !1 },
117
+ visible: { type: "boolean", value: !0 },
118
+ viewportPadding: { type: "number", value: 0.1 },
119
+ debounceWait: { type: "number", value: 100 },
120
+ onDataLoad: { type: "function", value: null },
121
+ errorHandlers: { type: "object", value: null },
122
+ xvector: { type: "string", value: null },
123
+ yvector: { type: "string", value: null },
124
+ magnitude: { type: "string", value: null },
125
+ direction: { type: "string", value: null },
126
+ directionConvention: { type: "string", value: "NAUTICAL_FROM" }
127
+ };
128
+ function g(a) {
129
+ return a.props;
130
+ }
131
+ function _(a) {
132
+ return a.state;
133
+ }
134
+ function P(a) {
135
+ return a.context;
136
+ }
137
+ class y extends T {
138
+ static layerName = "OceanumBaseLayer";
139
+ static defaultProps = Y;
140
+ initializeState() {
141
+ this.setState({
142
+ dataset: null,
143
+ loading: !1,
144
+ slicing: !1,
145
+ error: null,
146
+ instance: null,
147
+ coordNames: null,
148
+ times: null,
149
+ nlevels: 0,
150
+ lats: null,
151
+ lons: null,
152
+ timeIndex: 0,
153
+ levelIndex: 0,
154
+ latRange: [0, 0],
155
+ lonRange: [0, 0],
156
+ fetchedBbox: null,
157
+ slicedData: null,
158
+ datakeys: null,
159
+ debouncedSlice: V(
160
+ () => this._requestSlice(),
161
+ g(this).debounceWait
162
+ )
163
+ }), this._openDataset();
164
+ }
165
+ shouldUpdateState({ changeFlags: e }) {
166
+ return e.somethingChanged;
167
+ }
168
+ updateState({ props: e, oldProps: n, changeFlags: t }) {
169
+ const l = e, o = n, r = _(this);
170
+ if (l.debounceWait !== o.debounceWait && (r.debouncedSlice && r.debouncedSlice.cancel(), this.setState({
171
+ debouncedSlice: V(() => this._requestSlice(), l.debounceWait)
172
+ })), l.layerId !== o.layerId || l.instance !== o.instance || l.serviceUrl !== o.serviceUrl || this._variablePropsChanged(l, o)) {
173
+ this._openDataset();
174
+ return;
175
+ }
176
+ if (!r.dataset) return;
177
+ let s = !1;
178
+ if (l.time !== o.time && r.times) {
179
+ const i = l.time ? $(r.times, l.time) : 0;
180
+ i !== r.timeIndex && (this.setState({ timeIndex: i }), s = !0);
181
+ }
182
+ if (l.level !== o.level) {
183
+ const i = C(l.level || 0, r.nlevels);
184
+ i !== r.levelIndex && (this.setState({ levelIndex: i }), s = !0);
185
+ }
186
+ if (s) {
187
+ this._requestSlice();
188
+ return;
189
+ }
190
+ if (t.viewportChanged && P(this).viewport) {
191
+ const i = M(
192
+ P(this).viewport,
193
+ l.viewportPadding
194
+ );
195
+ if (!H(i, r.fetchedBbox)) {
196
+ const c = L(r.lons, i.west, i.east), d = L(r.lats, i.south, i.north);
197
+ this.setState({ latRange: d, lonRange: c, fetchedBbox: i }), r.debouncedSlice && r.debouncedSlice();
198
+ }
199
+ }
200
+ }
201
+ finalizeState() {
202
+ const e = _(this);
203
+ e.debouncedSlice && e.debouncedSlice.cancel();
204
+ }
205
+ _variablePropsChanged(e, n) {
206
+ return e.magnitude !== n.magnitude || e.direction !== n.direction || e.xvector !== n.xvector || e.yvector !== n.yvector || e.directionConvention !== n.directionConvention;
207
+ }
208
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
209
+ _validateVariableProps(e) {
210
+ return null;
211
+ }
212
+ _buildDatakeys(e) {
213
+ return { x: e.x, y: e.y };
214
+ }
215
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
216
+ _createInnerLayer(e, n) {
217
+ return null;
218
+ }
219
+ _fireError(e, n) {
220
+ const t = { type: e, ...n };
221
+ this.setState({ error: t });
222
+ const l = g(this).errorHandlers || {}, o = `on${e.charAt(0).toUpperCase() + e.slice(1)}Error`, r = l[o] || X[o];
223
+ r && r(t);
224
+ }
225
+ async _openDataset() {
226
+ const e = g(this), { serviceUrl: n, layerId: t, authHeaders: l } = e;
227
+ if (!n || !t) return;
228
+ const o = this._validateVariableProps(e);
229
+ if (o) {
230
+ this._fireError("validation", { message: o });
231
+ return;
232
+ }
233
+ this.setState({ loading: !0, error: null });
234
+ try {
235
+ let r = `${n}/zarr/${t}`, s = e.instance;
236
+ if (!s) {
237
+ const u = await this._discoverInstances(r, l || {});
238
+ u.length > 0 && (u.sort(), s = u[u.length - 1]);
239
+ }
240
+ s && (r = `${r}/${s}`);
241
+ const i = await U.zarr(r, l || {}), c = i.coordkeys;
242
+ if (!c || !c.x || !c.y)
243
+ throw new Error(
244
+ "Dataset is missing required coordinate mappings (x, y) in _coordinates"
245
+ );
246
+ const d = O(e);
247
+ for (const u of d)
248
+ if (!i.variables[u]) {
249
+ const S = Object.keys(i.variables);
250
+ this._fireError("variable", {
251
+ layerId: t,
252
+ variable: u,
253
+ availableVariables: S,
254
+ message: `Variable "${u}" not found in dataset. Available: ${S.join(", ")}`
255
+ }), this.setState({ loading: !1 });
256
+ return;
257
+ }
258
+ const [h, m, v] = await Promise.all([
259
+ i.variables[c.x]?.get(),
260
+ i.variables[c.y]?.get(),
261
+ c.t && i.variables[c.t] ? i.variables[c.t].get() : null
262
+ ]), b = c.z && i.dimensions[c.z] ? i.dimensions[c.z] : 0, p = e.time && v ? $(v, e.time) : 0, D = C(e.level || 0, b), x = {
263
+ x: c.x,
264
+ y: c.y,
265
+ t: c.t,
266
+ z: c.z
267
+ }, k = this._buildDatakeys(x);
268
+ let f = [
269
+ 0,
270
+ m ? m.length - 1 : 0
271
+ ], I = [
272
+ 0,
273
+ h ? h.length - 1 : 0
274
+ ], z = null;
275
+ if (P(this).viewport) {
276
+ const u = M(
277
+ P(this).viewport,
278
+ e.viewportPadding
279
+ );
280
+ h && (I = L(h, u.west, u.east)), m && (f = L(m, u.south, u.north)), z = u;
281
+ }
282
+ if (this.setState({
283
+ dataset: i,
284
+ loading: !1,
285
+ instance: s,
286
+ coordNames: x,
287
+ times: v,
288
+ nlevels: b,
289
+ lats: m,
290
+ lons: h,
291
+ timeIndex: p,
292
+ levelIndex: D,
293
+ latRange: f,
294
+ lonRange: I,
295
+ fetchedBbox: z,
296
+ datakeys: k
297
+ }), e.onDataLoad) {
298
+ const u = v ? Array.from(
299
+ v,
300
+ (S) => new Date(S * 1e3)
301
+ ) : [];
302
+ e.onDataLoad({
303
+ dataset: i,
304
+ times: u,
305
+ nlevels: b,
306
+ instance: s
307
+ });
308
+ }
309
+ this._requestSlice();
310
+ } catch (r) {
311
+ this._fireError("metadata", {
312
+ layerId: t,
313
+ message: `Failed to open dataset: ${r.message}`,
314
+ cause: r
315
+ }), this.setState({ loading: !1 });
316
+ }
317
+ }
318
+ async _discoverInstances(e, n) {
319
+ try {
320
+ const t = await fetch(`${e}/.zmetadata`, {
321
+ headers: n
322
+ });
323
+ if (!t.ok) return [];
324
+ const l = await t.json();
325
+ if (!l.metadata) return [];
326
+ const o = /* @__PURE__ */ new Set();
327
+ for (const r of Object.keys(l.metadata)) {
328
+ const s = r.split("/");
329
+ s.length === 2 && s[1] === ".zgroup" && o.add(s[0]);
330
+ }
331
+ return Array.from(o);
332
+ } catch {
333
+ return [];
334
+ }
335
+ }
336
+ async _requestSlice() {
337
+ const e = _(this), { dataset: n, coordNames: t, timeIndex: l, levelIndex: o, latRange: r, lonRange: s } = e;
338
+ if (!n || !t) return;
339
+ const i = O(g(this));
340
+ if (i.length !== 0) {
341
+ this.setState({ slicing: !0 });
342
+ try {
343
+ const c = await j(
344
+ n,
345
+ t,
346
+ i,
347
+ l,
348
+ o,
349
+ r,
350
+ s
351
+ );
352
+ this.setState({ slicedData: c, slicing: !1, error: null });
353
+ } catch (c) {
354
+ this._fireError("chunk", {
355
+ layerId: g(this).layerId,
356
+ time: e.times ? new Date(e.times[l] * 1e3) : null,
357
+ level: o,
358
+ message: `Chunk fetch failed: ${c.message}`,
359
+ cause: c
360
+ }), this.setState({ slicing: !1 });
361
+ }
362
+ }
363
+ }
364
+ renderLayers() {
365
+ const e = _(this);
366
+ return !e.slicedData || !e.datakeys ? [] : this._createInnerLayer(e.slicedData, e.datakeys);
367
+ }
368
+ }
369
+ const F = {
370
+ ...y.defaultProps,
371
+ color: { type: "array", value: [200, 200, 200] },
372
+ material: !1
373
+ };
374
+ class ee extends y {
375
+ static layerName = "OceanumPcolorLayer";
376
+ static defaultProps = F;
377
+ _validateVariableProps(e) {
378
+ const n = !!e.magnitude, t = e.xvector && e.yvector;
379
+ return !n && !t ? 'OceanumPcolorLayer requires "magnitude" or "xvector" + "yvector"' : null;
380
+ }
381
+ _buildDatakeys(e) {
382
+ return W(e, this.props);
383
+ }
384
+ _createInnerLayer(e, n) {
385
+ const t = this.props;
386
+ return new q({
387
+ id: `${t.id}-inner`,
388
+ data: e,
389
+ datakeys: n,
390
+ opacity: t.opacity,
391
+ altitude: t.altitude,
392
+ globalWrap: t.globalWrap,
393
+ colormap: t.colormap,
394
+ scale: t.scale,
395
+ offset: t.offset,
396
+ color: t.color,
397
+ material: t.material,
398
+ pickable: t.pickable,
399
+ visible: t.visible
400
+ });
401
+ }
402
+ }
403
+ const N = {
404
+ ...y.defaultProps,
405
+ speed: { type: "number", value: 1 },
406
+ npart: { type: "number", value: 1e3 },
407
+ size: { type: "number", value: 3 },
408
+ length: { type: "number", value: 12 },
409
+ color: { type: "array", value: [200, 200, 200] }
410
+ };
411
+ class te extends y {
412
+ static layerName = "OceanumParticleLayer";
413
+ static defaultProps = N;
414
+ _validateVariableProps(e) {
415
+ const n = e.xvector && e.yvector, t = e.magnitude && e.direction;
416
+ return !n && !t ? 'OceanumParticleLayer requires "xvector" + "yvector" or "magnitude" + "direction"' : n && t ? 'OceanumParticleLayer: provide "xvector" + "yvector" or "magnitude" + "direction", not both' : null;
417
+ }
418
+ _buildDatakeys(e) {
419
+ return E(e, this.props);
420
+ }
421
+ _createInnerLayer(e, n) {
422
+ const t = this.props;
423
+ return new R({
424
+ id: `${t.id}-inner`,
425
+ data: e,
426
+ datakeys: n,
427
+ opacity: t.opacity,
428
+ altitude: t.altitude,
429
+ globalWrap: t.globalWrap,
430
+ colormap: t.colormap,
431
+ scale: t.scale,
432
+ offset: t.offset,
433
+ color: t.color,
434
+ direction: t.directionConvention,
435
+ speed: t.speed,
436
+ npart: t.npart,
437
+ size: t.size,
438
+ length: t.length,
439
+ pickable: t.pickable,
440
+ visible: t.visible
441
+ });
442
+ }
443
+ }
444
+ const G = {
445
+ ...y.defaultProps,
446
+ speed: { type: "number", value: 1 },
447
+ size: { type: "number", value: 3 },
448
+ color: { type: "array", value: [200, 200, 200] },
449
+ meshShape: { type: "string", value: "cone" },
450
+ meshLength: { type: "number", value: 4 },
451
+ meshWidth: { type: "number", value: 1 },
452
+ meshSize: { type: "number", value: 1 }
453
+ };
454
+ class ae extends y {
455
+ static layerName = "OceanumPartmeshLayer";
456
+ static defaultProps = G;
457
+ _validateVariableProps(e) {
458
+ const n = e.xvector && e.yvector, t = e.magnitude && e.direction;
459
+ return !n && !t ? 'OceanumPartmeshLayer requires "xvector" + "yvector" or "magnitude" + "direction"' : n && t ? 'OceanumPartmeshLayer: provide "xvector" + "yvector" or "magnitude" + "direction", not both' : null;
460
+ }
461
+ _buildDatakeys(e) {
462
+ return E(e, this.props);
463
+ }
464
+ _createInnerLayer(e, n) {
465
+ const t = this.props;
466
+ return new A({
467
+ id: `${t.id}-inner`,
468
+ data: e,
469
+ datakeys: n,
470
+ opacity: t.opacity,
471
+ altitude: t.altitude,
472
+ globalWrap: t.globalWrap,
473
+ colormap: t.colormap,
474
+ scale: t.scale,
475
+ offset: t.offset,
476
+ color: t.color,
477
+ direction: t.directionConvention,
478
+ speed: t.speed,
479
+ size: t.size,
480
+ mesh: {
481
+ shape: t.meshShape,
482
+ length: t.meshLength,
483
+ width: t.meshWidth,
484
+ size: t.meshSize
485
+ },
486
+ pickable: t.pickable,
487
+ visible: t.visible
488
+ });
489
+ }
490
+ }
491
+ const J = {
492
+ ...y.defaultProps,
493
+ levels: { type: "array", value: [] },
494
+ labelSize: { type: "number", value: 12 },
495
+ labelColor: { type: "array", value: [255, 255, 255, 255] },
496
+ smoothing: { type: "boolean", value: !1 },
497
+ numLabels: { type: "number", value: 1 },
498
+ color: { type: "array", value: [200, 200, 200] }
499
+ };
500
+ class ne extends y {
501
+ static layerName = "OceanumContourLayer";
502
+ static defaultProps = J;
503
+ _validateVariableProps(e) {
504
+ const n = !!e.magnitude, t = e.xvector && e.yvector;
505
+ return !n && !t ? 'OceanumContourLayer requires "magnitude" or "xvector" + "yvector"' : null;
506
+ }
507
+ _buildDatakeys(e) {
508
+ return W(e, this.props);
509
+ }
510
+ _createInnerLayer(e, n) {
511
+ const t = this.props;
512
+ return new B({
513
+ id: `${t.id}-inner`,
514
+ data: e,
515
+ datakeys: n,
516
+ opacity: t.opacity,
517
+ altitude: t.altitude,
518
+ globalWrap: t.globalWrap,
519
+ colormap: t.colormap,
520
+ scale: t.scale,
521
+ offset: t.offset,
522
+ color: t.color,
523
+ levels: t.levels,
524
+ labelSize: t.labelSize,
525
+ labelColor: t.labelColor,
526
+ smoothing: t.smoothing,
527
+ numLabels: t.numLabels,
528
+ pickable: t.pickable,
529
+ visible: t.visible
530
+ });
531
+ }
532
+ }
533
+ export {
534
+ y as OceanumBaseLayer,
535
+ ne as OceanumContourLayer,
536
+ te as OceanumParticleLayer,
537
+ ae as OceanumPartmeshLayer,
538
+ ee as OceanumPcolorLayer
539
+ };
@@ -0,0 +1,72 @@
1
+ import { CompositeLayer } from './test/__mocks__/deck-gl-core.ts';
2
+ import { Dataset, HttpZarr } from './test/__mocks__/oceanum-datamesh.ts';
3
+ import { CoordNames, VariableProps, ScalarDatakeys, VectorDatakeys } from './utils/coordinates';
4
+ import { SlicedData } from './utils/dataset-slice';
5
+ export interface Colormap {
6
+ scale: string[];
7
+ domain: number[];
8
+ }
9
+ export interface OnDataLoadInfo {
10
+ dataset: Dataset<HttpZarr>;
11
+ times: Date[];
12
+ nlevels: number;
13
+ instance: string | null;
14
+ }
15
+ export interface LayerError {
16
+ type: string;
17
+ message: string;
18
+ layerId?: string;
19
+ cause?: Error;
20
+ [key: string]: unknown;
21
+ }
22
+ export interface ErrorHandlers {
23
+ onMetadataError?: (err: LayerError) => void;
24
+ onChunkError?: (err: LayerError) => void;
25
+ onVariableError?: (err: LayerError) => void;
26
+ onValidationError?: (err: LayerError) => void;
27
+ }
28
+ export interface OceanumLayerProps extends VariableProps {
29
+ serviceUrl: string | null;
30
+ authHeaders: Record<string, string>;
31
+ layerId: string | null;
32
+ instance: string | null;
33
+ time: string | Date | null;
34
+ level: number;
35
+ colormap: Colormap | null;
36
+ opacity: number;
37
+ altitude: number;
38
+ globalWrap: boolean;
39
+ scale: number;
40
+ offset: number;
41
+ pickable: boolean;
42
+ visible: boolean;
43
+ viewportPadding: number;
44
+ debounceWait: number;
45
+ onDataLoad: ((info: OnDataLoadInfo) => void) | null;
46
+ errorHandlers: ErrorHandlers | null;
47
+ directionConvention: string;
48
+ id: string;
49
+ }
50
+ type DeckDefaultProp = {
51
+ type: string;
52
+ value: any;
53
+ } | boolean;
54
+ export default class OceanumBaseLayer extends CompositeLayer {
55
+ static layerName: string;
56
+ static defaultProps: Record<string, DeckDefaultProp>;
57
+ initializeState(): void;
58
+ shouldUpdateState({ changeFlags }: any): boolean;
59
+ updateState({ props, oldProps, changeFlags }: any): void;
60
+ finalizeState(): void;
61
+ _variablePropsChanged(props: OceanumLayerProps, oldProps: OceanumLayerProps): boolean;
62
+ _validateVariableProps(_props: OceanumLayerProps): string | null;
63
+ _buildDatakeys(coordNames: CoordNames): ScalarDatakeys | VectorDatakeys;
64
+ _createInnerLayer(_slicedData: SlicedData, _datakeys: ScalarDatakeys | VectorDatakeys): any;
65
+ private _fireError;
66
+ private _openDataset;
67
+ private _discoverInstances;
68
+ private _requestSlice;
69
+ renderLayers(): any;
70
+ }
71
+ export {};
72
+ //# sourceMappingURL=oceanum-base-layer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oceanum-base-layer.d.ts","sourceRoot":"","sources":["../src/oceanum-base-layer.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,45 @@
1
+ import { ContourLayer } from './test/__mocks__/deck-gl-grid.ts';
2
+ import { default as OceanumBaseLayer, OceanumLayerProps } from './oceanum-base-layer';
3
+ import { CoordNames, ScalarDatakeys } from './utils/coordinates';
4
+ import { SlicedData } from './utils/dataset-slice';
5
+ export interface OceanumContourLayerProps extends OceanumLayerProps {
6
+ levels: number[];
7
+ labelSize: number;
8
+ labelColor: [number, number, number, number];
9
+ smoothing: boolean;
10
+ numLabels: number;
11
+ color: [number, number, number];
12
+ }
13
+ export default class OceanumContourLayer extends OceanumBaseLayer {
14
+ static layerName: string;
15
+ static defaultProps: {
16
+ levels: {
17
+ type: string;
18
+ value: never[];
19
+ };
20
+ labelSize: {
21
+ type: string;
22
+ value: number;
23
+ };
24
+ labelColor: {
25
+ type: string;
26
+ value: number[];
27
+ };
28
+ smoothing: {
29
+ type: string;
30
+ value: boolean;
31
+ };
32
+ numLabels: {
33
+ type: string;
34
+ value: number;
35
+ };
36
+ color: {
37
+ type: string;
38
+ value: number[];
39
+ };
40
+ };
41
+ _validateVariableProps(props: OceanumLayerProps): string | null;
42
+ _buildDatakeys(coordNames: CoordNames): ScalarDatakeys;
43
+ _createInnerLayer(slicedData: SlicedData, datakeys: ScalarDatakeys): ContourLayer;
44
+ }
45
+ //# sourceMappingURL=oceanum-contour-layer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oceanum-contour-layer.d.ts","sourceRoot":"","sources":["../src/oceanum-contour-layer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAYD,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,gBAAgB;IAC/D,OAAgB,SAAS,SAAyB;IAClD,OAAgB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;MAAgB;IAEnC,sBAAsB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI;IAS/D,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,cAAc;IAItD,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc;CAsB5E"}
@@ -0,0 +1,40 @@
1
+ import { ParticleLayer } from './test/__mocks__/deck-gl-grid.ts';
2
+ import { default as OceanumBaseLayer, OceanumLayerProps } from './oceanum-base-layer';
3
+ import { CoordNames, VectorDatakeys } from './utils/coordinates';
4
+ import { SlicedData } from './utils/dataset-slice';
5
+ export interface OceanumParticleLayerProps extends OceanumLayerProps {
6
+ speed: number;
7
+ npart: number;
8
+ size: number;
9
+ length: number;
10
+ color: [number, number, number];
11
+ }
12
+ export default class OceanumParticleLayer extends OceanumBaseLayer {
13
+ static layerName: string;
14
+ static defaultProps: {
15
+ speed: {
16
+ type: string;
17
+ value: number;
18
+ };
19
+ npart: {
20
+ type: string;
21
+ value: number;
22
+ };
23
+ size: {
24
+ type: string;
25
+ value: number;
26
+ };
27
+ length: {
28
+ type: string;
29
+ value: number;
30
+ };
31
+ color: {
32
+ type: string;
33
+ value: number[];
34
+ };
35
+ };
36
+ _validateVariableProps(props: OceanumLayerProps): string | null;
37
+ _buildDatakeys(coordNames: CoordNames): VectorDatakeys;
38
+ _createInnerLayer(slicedData: SlicedData, datakeys: VectorDatakeys): ParticleLayer;
39
+ }
40
+ //# sourceMappingURL=oceanum-particle-layer.d.ts.map