@loaders.gl/scientific 5.0.0-beta.1 → 5.0.0-beta.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 +5 -2
- package/dist/index.cjs +78 -4110
- package/dist/index.cjs.map +4 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/parsers/parse-npy.d.ts +15 -0
- package/dist/lib/parsers/parse-npy.d.ts.map +1 -0
- package/dist/lib/parsers/parse-npy.js +81 -0
- package/dist/lib/parsers/parse-npy.js.map +1 -0
- package/dist/netcdf/bundled.cjs +1 -2
- package/dist/netcdf/index.cjs +1 -2
- package/dist/netcdf/index.cjs.map +2 -2
- package/dist/netcdf/netcdf-loader-with-parser.cjs +1 -2
- package/dist/netcdf/netcdf-loader-with-parser.js +1 -1
- package/dist/netcdf/netcdf-loader-with-parser.js.map +1 -1
- package/dist/netcdf/netcdf-loader.cjs +5 -4
- package/dist/netcdf/netcdf-loader.cjs.map +7 -0
- package/dist/netcdf/netcdf-loader.js +1 -1
- package/dist/netcdf/netcdf-source-loader-types.js +1 -1
- package/dist/netcdf/netcdf-source-loader.js +1 -1
- package/dist/netcdf/unbundled.cjs +1 -2
- package/dist/netcdf.min.js +3 -3
- package/dist/npy-format.d.ts +12 -0
- package/dist/npy-format.d.ts.map +1 -0
- package/dist/npy-format.js +15 -0
- package/dist/npy-format.js.map +1 -0
- package/dist/npy-loader-types.cjs +80 -0
- package/dist/npy-loader-types.cjs.map +7 -0
- package/dist/npy-loader-types.d.ts +73 -0
- package/dist/npy-loader-types.d.ts.map +1 -0
- package/dist/npy-loader-types.js +34 -0
- package/dist/npy-loader-types.js.map +1 -0
- package/dist/npy-loader.cjs +273 -0
- package/dist/npy-loader.cjs.map +6 -0
- package/dist/npy-loader.d.ts +27 -0
- package/dist/npy-loader.d.ts.map +1 -0
- package/dist/npy-loader.js +15 -0
- package/dist/npy-loader.js.map +1 -0
- package/dist/npy-worker.d.ts +2 -0
- package/dist/npy-worker.d.ts.map +1 -0
- package/dist/npy-worker.js +750 -0
- package/dist/npy-worker.js.map +1 -0
- package/dist/vtk/index.cjs +4 -4118
- package/dist/vtk/index.cjs.map +2 -2
- package/dist/vtk/vtk-xml.js +4 -4
- package/dist/vtk/vtk-xml.js.map +1 -1
- package/dist/workers/npy-worker.d.ts +2 -0
- package/dist/workers/npy-worker.d.ts.map +1 -0
- package/dist/workers/npy-worker.js +7 -0
- package/dist/workers/npy-worker.js.map +1 -0
- package/dist/zarr/geo-zarr-source-loader.d.ts.map +1 -1
- package/dist/zarr/geo-zarr-source-loader.js +162 -43
- package/dist/zarr/geo-zarr-source-loader.js.map +1 -1
- package/dist/zarr/index.cjs +194 -43
- package/dist/zarr/index.cjs.map +2 -2
- package/dist/zarr/lib/spatial-multiscales.d.ts +13 -2
- package/dist/zarr/lib/spatial-multiscales.d.ts.map +1 -1
- package/dist/zarr/lib/spatial-multiscales.js +94 -8
- package/dist/zarr/lib/spatial-multiscales.js.map +1 -1
- package/dist/zarr/ome-zarr-source-loader.js +1 -1
- package/dist/zarr/zarr-loader-types.cjs +161 -0
- package/dist/zarr/zarr-loader-types.cjs.map +7 -0
- package/dist/zarr/zarr-loader-types.js +1 -1
- package/dist/zarr.dev.js +194 -43
- package/dist/zarr.min.js +40 -40
- package/package.json +42 -7
- package/src/index.ts +5 -0
- package/src/lib/parsers/parse-npy.ts +123 -0
- package/src/netcdf/netcdf-loader-with-parser.ts +1 -1
- package/src/npy-format.ts +17 -0
- package/src/npy-loader-types.ts +50 -0
- package/src/npy-loader.ts +21 -0
- package/src/npy-worker.ts +6 -0
- package/src/vtk/vtk-xml.ts +4 -4
- package/src/workers/npy-worker.ts +8 -0
- package/src/zarr/geo-zarr-source-loader.ts +195 -44
- package/src/zarr/lib/spatial-multiscales.ts +104 -8
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// dist/zarr/zarr-loader-types.js
|
|
31
|
+
var zarr_loader_types_exports = {};
|
|
32
|
+
__export(zarr_loader_types_exports, {
|
|
33
|
+
GeoZarrSourceLoader: () => GeoZarrSourceLoader,
|
|
34
|
+
OMEZarrSourceLoader: () => OMEZarrSourceLoader,
|
|
35
|
+
SpatialDataSourceLoader: () => SpatialDataSourceLoader,
|
|
36
|
+
ZarrArraySourceLoader: () => ZarrArraySourceLoader
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(zarr_loader_types_exports);
|
|
39
|
+
var VERSION = true ? "5.0.0-beta.2" : "latest";
|
|
40
|
+
var OMEZarrSourceLoader = {
|
|
41
|
+
dataType: null,
|
|
42
|
+
batchType: null,
|
|
43
|
+
name: "OMEZarrSourceLoader",
|
|
44
|
+
id: "omezarr",
|
|
45
|
+
module: "scientific",
|
|
46
|
+
version: VERSION,
|
|
47
|
+
extensions: ["zarr"],
|
|
48
|
+
mimeTypes: [],
|
|
49
|
+
type: "omezarr",
|
|
50
|
+
fromUrl: true,
|
|
51
|
+
fromBlob: false,
|
|
52
|
+
options: {
|
|
53
|
+
zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
|
|
54
|
+
omezarr: { interleaved: false, defaultChannels: void 0 }
|
|
55
|
+
},
|
|
56
|
+
defaultOptions: {
|
|
57
|
+
zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
|
|
58
|
+
omezarr: { interleaved: false, defaultChannels: void 0 }
|
|
59
|
+
},
|
|
60
|
+
testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
|
|
61
|
+
preload: async () => (await import("@loaders.gl/scientific/zarr/ome-zarr-source-loader")).OMEZarrSourceLoaderWithParser,
|
|
62
|
+
createDataSource(_data, _options, _coreApi) {
|
|
63
|
+
throw new Error("OMEZarrSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/ome-zarr-source-loader import");
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var GeoZarrSourceLoader = {
|
|
67
|
+
dataType: null,
|
|
68
|
+
batchType: null,
|
|
69
|
+
name: "GeoZarrSourceLoader",
|
|
70
|
+
id: "geozarr",
|
|
71
|
+
module: "scientific",
|
|
72
|
+
version: VERSION,
|
|
73
|
+
extensions: ["zarr"],
|
|
74
|
+
mimeTypes: [],
|
|
75
|
+
type: "geozarr",
|
|
76
|
+
fromUrl: true,
|
|
77
|
+
fromBlob: false,
|
|
78
|
+
options: {
|
|
79
|
+
zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
|
|
80
|
+
geozarr: {
|
|
81
|
+
array: void 0,
|
|
82
|
+
spatialDimensions: void 0,
|
|
83
|
+
transform: void 0,
|
|
84
|
+
coordinateReferenceSystem: void 0,
|
|
85
|
+
defaultSelection: void 0
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
defaultOptions: {
|
|
89
|
+
zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
|
|
90
|
+
geozarr: {
|
|
91
|
+
array: void 0,
|
|
92
|
+
spatialDimensions: void 0,
|
|
93
|
+
transform: void 0,
|
|
94
|
+
coordinateReferenceSystem: void 0,
|
|
95
|
+
defaultSelection: void 0
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
|
|
99
|
+
preload: async () => (await import("@loaders.gl/scientific/zarr/geo-zarr-source-loader")).GeoZarrSourceLoaderWithParser,
|
|
100
|
+
createDataSource(_data, _options, _coreApi) {
|
|
101
|
+
throw new Error("GeoZarrSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/geo-zarr-source-loader import");
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var ZarrArraySourceLoader = {
|
|
105
|
+
dataType: null,
|
|
106
|
+
batchType: null,
|
|
107
|
+
name: "ZarrArraySourceLoader",
|
|
108
|
+
id: "zarr-array",
|
|
109
|
+
module: "scientific",
|
|
110
|
+
version: VERSION,
|
|
111
|
+
extensions: ["zarr"],
|
|
112
|
+
mimeTypes: [],
|
|
113
|
+
type: "zarr-array",
|
|
114
|
+
fromUrl: true,
|
|
115
|
+
fromBlob: false,
|
|
116
|
+
options: {
|
|
117
|
+
zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
|
|
118
|
+
zarrArray: { path: void 0, dimensions: void 0 }
|
|
119
|
+
},
|
|
120
|
+
defaultOptions: {
|
|
121
|
+
zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
|
|
122
|
+
zarrArray: { path: void 0, dimensions: void 0 }
|
|
123
|
+
},
|
|
124
|
+
testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
|
|
125
|
+
preload: async () => (await import("@loaders.gl/scientific/zarr/zarr-array-source")).ZarrArraySourceLoaderWithParser,
|
|
126
|
+
createDataSource(_data, _options, _coreApi) {
|
|
127
|
+
throw new Error("ZarrArraySourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/zarr-array-source import");
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
var SpatialDataSourceLoader = {
|
|
131
|
+
dataType: null,
|
|
132
|
+
batchType: null,
|
|
133
|
+
name: "SpatialDataSourceLoader",
|
|
134
|
+
id: "spatial-data",
|
|
135
|
+
module: "scientific",
|
|
136
|
+
version: VERSION,
|
|
137
|
+
extensions: ["zarr"],
|
|
138
|
+
mimeTypes: [],
|
|
139
|
+
type: "spatial-data",
|
|
140
|
+
fromUrl: true,
|
|
141
|
+
fromBlob: false,
|
|
142
|
+
options: {
|
|
143
|
+
zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true }
|
|
144
|
+
},
|
|
145
|
+
defaultOptions: {
|
|
146
|
+
zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true }
|
|
147
|
+
},
|
|
148
|
+
testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
|
|
149
|
+
preload: async () => (await import("@loaders.gl/scientific/zarr/spatial-data-source")).SpatialDataSourceLoaderWithParser,
|
|
150
|
+
createDataSource(_data, _options, _coreApi) {
|
|
151
|
+
throw new Error("SpatialDataSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/spatial-data-source import");
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
155
|
+
0 && (module.exports = {
|
|
156
|
+
GeoZarrSourceLoader,
|
|
157
|
+
OMEZarrSourceLoader,
|
|
158
|
+
SpatialDataSourceLoader,
|
|
159
|
+
ZarrArraySourceLoader
|
|
160
|
+
});
|
|
161
|
+
//# sourceMappingURL=zarr-loader-types.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/zarr/zarr-loader-types.ts"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {CoreAPI, SourceLoader} from '@loaders.gl/core/loader-utils';\nimport type {GeoZarrRasterSource, GeoZarrSourceLoaderOptions} from './geo-zarr-source-loader';\nimport type {OMEZarrImageSource, ZarrSourceLoaderOptions} from './ome-zarr-source-loader';\nimport type {SpatialDataSource, SpatialDataSourceLoaderOptions} from './spatial-data-source';\nimport type {ZarrArraySource, ZarrArraySourceLoaderOptions} from './zarr-array-source';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** Metadata-only OME-Zarr loader. */\nexport const OMEZarrSourceLoader = {\n dataType: null as unknown as OMEZarrImageSource,\n batchType: null as never,\n name: 'OMEZarrSourceLoader',\n id: 'omezarr',\n module: 'scientific',\n version: VERSION,\n extensions: ['zarr'],\n mimeTypes: [],\n type: 'omezarr',\n fromUrl: true,\n fromBlob: false,\n options: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n omezarr: {interleaved: false, defaultChannels: undefined!}\n } as ZarrSourceLoaderOptions,\n defaultOptions: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n omezarr: {interleaved: false, defaultChannels: undefined!}\n },\n testURL: (url: string): boolean => /\\.zarr(?:$|[/?#])/i.test(url),\n preload: async () =>\n (await import('@loaders.gl/scientific/zarr/ome-zarr-source-loader'))\n .OMEZarrSourceLoaderWithParser,\n createDataSource(\n _data: string,\n _options: ZarrSourceLoaderOptions,\n _coreApi?: CoreAPI\n ): OMEZarrImageSource {\n throw new Error(\n 'OMEZarrSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/ome-zarr-source-loader import'\n );\n }\n} as const satisfies SourceLoader<OMEZarrImageSource>;\n\n/** Metadata-only GeoZarr loader. */\nexport const GeoZarrSourceLoader = {\n dataType: null as unknown as GeoZarrRasterSource,\n batchType: null as never,\n name: 'GeoZarrSourceLoader',\n id: 'geozarr',\n module: 'scientific',\n version: VERSION,\n extensions: ['zarr'],\n mimeTypes: [],\n type: 'geozarr',\n fromUrl: true,\n fromBlob: false,\n options: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n geozarr: {\n array: undefined!,\n spatialDimensions: undefined!,\n transform: undefined!,\n coordinateReferenceSystem: undefined!,\n defaultSelection: undefined!\n }\n } as GeoZarrSourceLoaderOptions,\n defaultOptions: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n geozarr: {\n array: undefined!,\n spatialDimensions: undefined!,\n transform: undefined!,\n coordinateReferenceSystem: undefined!,\n defaultSelection: undefined!\n }\n },\n testURL: (url: string): boolean => /\\.zarr(?:$|[/?#])/i.test(url),\n preload: async () =>\n (await import('@loaders.gl/scientific/zarr/geo-zarr-source-loader'))\n .GeoZarrSourceLoaderWithParser,\n createDataSource(\n _data: string,\n _options: GeoZarrSourceLoaderOptions,\n _coreApi?: CoreAPI\n ): GeoZarrRasterSource {\n throw new Error(\n 'GeoZarrSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/geo-zarr-source-loader import'\n );\n }\n} as const satisfies SourceLoader<GeoZarrRasterSource>;\n\n/** Metadata-only direct Zarr array loader. */\nexport const ZarrArraySourceLoader = {\n dataType: null as unknown as ZarrArraySource,\n batchType: null as never,\n name: 'ZarrArraySourceLoader',\n id: 'zarr-array',\n module: 'scientific',\n version: VERSION,\n extensions: ['zarr'],\n mimeTypes: [],\n type: 'zarr-array',\n fromUrl: true,\n fromBlob: false,\n options: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n zarrArray: {path: undefined!, dimensions: undefined!}\n } as ZarrArraySourceLoaderOptions,\n defaultOptions: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n zarrArray: {path: undefined!, dimensions: undefined!}\n },\n testURL: (url: string): boolean => /\\.zarr(?:$|[/?#])/i.test(url),\n preload: async () =>\n (await import('@loaders.gl/scientific/zarr/zarr-array-source')).ZarrArraySourceLoaderWithParser,\n createDataSource(\n _data: string,\n _options: ZarrArraySourceLoaderOptions,\n _coreApi?: CoreAPI\n ): ZarrArraySource {\n throw new Error(\n 'ZarrArraySourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/zarr-array-source import'\n );\n }\n} as const satisfies SourceLoader<ZarrArraySource>;\n\n/** Metadata-only SpatialData loader. */\nexport const SpatialDataSourceLoader = {\n dataType: null as unknown as SpatialDataSource,\n batchType: null as never,\n name: 'SpatialDataSourceLoader',\n id: 'spatial-data',\n module: 'scientific',\n version: VERSION,\n extensions: ['zarr'],\n mimeTypes: [],\n type: 'spatial-data',\n fromUrl: true,\n fromBlob: false,\n options: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true}\n } as SpatialDataSourceLoaderOptions,\n defaultOptions: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true}\n },\n testURL: (url: string): boolean => /\\.zarr(?:$|[/?#])/i.test(url),\n preload: async () =>\n (await import('@loaders.gl/scientific/zarr/spatial-data-source'))\n .SpatialDataSourceLoaderWithParser,\n createDataSource(\n _data: string,\n _options: SpatialDataSourceLoaderOptions,\n _coreApi?: CoreAPI\n ): SpatialDataSource {\n throw new Error(\n 'SpatialDataSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/spatial-data-source import'\n );\n }\n} as const satisfies SourceLoader<SpatialDataSource>;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
5
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
|
-
const VERSION = typeof "5.0.0-beta.
|
|
6
|
+
const VERSION = typeof "5.0.0-beta.2" !== 'undefined' ? "5.0.0-beta.2" : 'latest';
|
|
7
7
|
/** Metadata-only OME-Zarr loader. */
|
|
8
8
|
export const OMEZarrSourceLoader = {
|
|
9
9
|
dataType: null,
|
package/dist/zarr.dev.js
CHANGED
|
@@ -12685,6 +12685,11 @@ var __exports__ = (() => {
|
|
|
12685
12685
|
this.feature = feature;
|
|
12686
12686
|
}
|
|
12687
12687
|
};
|
|
12688
|
+
function isZarritaError(err2, ...tags) {
|
|
12689
|
+
if (!(err2 instanceof ZarritaError))
|
|
12690
|
+
return false;
|
|
12691
|
+
return tags.length === 0 || tags.includes(err2._tag);
|
|
12692
|
+
}
|
|
12688
12693
|
|
|
12689
12694
|
// ../../node_modules/zarrita/dist/src/codecs/_shared.js
|
|
12690
12695
|
function unimplementedEncode(codecName) {
|
|
@@ -15582,7 +15587,9 @@ var __exports__ = (() => {
|
|
|
15582
15587
|
}
|
|
15583
15588
|
|
|
15584
15589
|
// src/zarr/lib/spatial-multiscales.ts
|
|
15585
|
-
function getSpatialMultiscaleLevels(attributes, array2) {
|
|
15590
|
+
function getSpatialMultiscaleLevels(attributes, array2, { spatialOME = false } = {}) {
|
|
15591
|
+
const omeMultiscales = spatialOME ? getOMEMultiscales(attributes) : null;
|
|
15592
|
+
if (omeMultiscales) return getOMEMultiscaleLevels(omeMultiscales, array2);
|
|
15586
15593
|
const multiscales = attributes?.multiscales;
|
|
15587
15594
|
const layout = multiscales?.layout;
|
|
15588
15595
|
if (!Array.isArray(layout) || !layout.length) return [];
|
|
@@ -15592,18 +15599,78 @@ var __exports__ = (() => {
|
|
|
15592
15599
|
}
|
|
15593
15600
|
const assets = entries.map((entry) => entry.asset);
|
|
15594
15601
|
if (new Set(assets).size !== assets.length) throw new Error("Duplicate spatial multiscales asset.");
|
|
15602
|
+
return resolveLevels(assets, array2, entries);
|
|
15603
|
+
}
|
|
15604
|
+
function getOMEMultiscales(attributes) {
|
|
15605
|
+
if (Array.isArray(attributes?.multiscales)) return attributes.multiscales;
|
|
15606
|
+
const ome = attributes?.ome;
|
|
15607
|
+
return Array.isArray(ome?.multiscales) ? ome.multiscales : null;
|
|
15608
|
+
}
|
|
15609
|
+
function getOMEMultiscaleLevels(multiscales, array2) {
|
|
15610
|
+
const candidates = multiscales.filter((multiscale2) => {
|
|
15611
|
+
const datasets2 = multiscale2?.datasets;
|
|
15612
|
+
return Array.isArray(datasets2) && datasets2.some((dataset) => isChildPath(dataset?.path) && (array2 === dataset.path || array2.startsWith(`${dataset.path}/`)));
|
|
15613
|
+
});
|
|
15614
|
+
if (!candidates.length) return [];
|
|
15615
|
+
if (candidates.length > 1) throw new Error("Array belongs to more than one OME-NGFF multiscale.");
|
|
15616
|
+
const multiscale = candidates[0];
|
|
15617
|
+
const datasets = multiscale.datasets;
|
|
15618
|
+
if (datasets.some((dataset) => !dataset || !isChildPath(dataset.path))) {
|
|
15619
|
+
throw new Error("OME-NGFF dataset paths must be relative child paths.");
|
|
15620
|
+
}
|
|
15621
|
+
const paths = datasets.map((dataset) => dataset.path);
|
|
15622
|
+
if (new Set(paths).size !== paths.length) throw new Error("Duplicate OME-NGFF dataset path.");
|
|
15623
|
+
const axes = getOMEAxisNames(multiscale.axes);
|
|
15624
|
+
return resolveLevels(paths, array2, datasets.map(() => ({}))).map((level, index) => ({
|
|
15625
|
+
...level,
|
|
15626
|
+
scale: getOMEScale(axes, [
|
|
15627
|
+
datasets[index].coordinateTransformations,
|
|
15628
|
+
multiscale.coordinateTransformations
|
|
15629
|
+
])
|
|
15630
|
+
}));
|
|
15631
|
+
}
|
|
15632
|
+
function resolveLevels(assets, array2, attributes) {
|
|
15595
15633
|
const matches2 = assets.filter((asset) => array2 === asset || array2.startsWith(`${asset}/`));
|
|
15596
15634
|
if (matches2.length !== 1) return [];
|
|
15597
15635
|
const suffix = array2.slice(matches2[0].length);
|
|
15598
|
-
return
|
|
15599
|
-
id:
|
|
15600
|
-
array: `${
|
|
15601
|
-
...suffix ? { group:
|
|
15602
|
-
attributes:
|
|
15636
|
+
return assets.map((asset, index) => ({
|
|
15637
|
+
id: asset,
|
|
15638
|
+
array: `${asset}${suffix}`,
|
|
15639
|
+
...suffix ? { group: asset } : {},
|
|
15640
|
+
attributes: attributes[index]
|
|
15603
15641
|
}));
|
|
15604
15642
|
}
|
|
15643
|
+
function getOMEAxisNames(axes) {
|
|
15644
|
+
const names = Array.isArray(axes) ? axes.map((axis) => typeof axis === "string" ? axis : axis?.name) : [];
|
|
15645
|
+
if (!names.length || names.some((name) => typeof name !== "string" || !name)) {
|
|
15646
|
+
throw new Error("OME-NGFF multiscales require named axes.");
|
|
15647
|
+
}
|
|
15648
|
+
if (new Set(names).size !== names.length) throw new Error("Duplicate OME-NGFF axis name.");
|
|
15649
|
+
return names;
|
|
15650
|
+
}
|
|
15651
|
+
function getOMEScale(axes, transformLists) {
|
|
15652
|
+
const scale = axes.map(() => 1);
|
|
15653
|
+
for (const transforms of transformLists) {
|
|
15654
|
+
if (transforms === void 0) continue;
|
|
15655
|
+
if (!Array.isArray(transforms)) {
|
|
15656
|
+
throw new Error("OME-NGFF coordinateTransformations must be a list.");
|
|
15657
|
+
}
|
|
15658
|
+
for (const transform of transforms) {
|
|
15659
|
+
if (transform?.type === "translation") continue;
|
|
15660
|
+
if (transform?.type !== "scale") {
|
|
15661
|
+
throw new Error(`Unsupported OME-NGFF coordinate transformation ${String(transform?.type)}.`);
|
|
15662
|
+
}
|
|
15663
|
+
const values = transform.scale;
|
|
15664
|
+
if (!Array.isArray(values) || values.length !== axes.length || values.some((value) => typeof value !== "number" || !Number.isFinite(value) || value === 0)) {
|
|
15665
|
+
throw new Error("OME-NGFF scale must give one finite non-zero value per axis.");
|
|
15666
|
+
}
|
|
15667
|
+
values.forEach((value, index) => scale[index] *= value);
|
|
15668
|
+
}
|
|
15669
|
+
}
|
|
15670
|
+
return Object.fromEntries(axes.map((axis, index) => [axis, scale[index]]));
|
|
15671
|
+
}
|
|
15605
15672
|
function isChildPath(value) {
|
|
15606
|
-
return typeof value === "string" && value.length > 0 && !/[\\%:?#\u0000
|
|
15673
|
+
return typeof value === "string" && value.length > 0 && !/[\\%:?#\u0000- ]/.test(value) && value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
15607
15674
|
}
|
|
15608
15675
|
|
|
15609
15676
|
// src/zarr/geo-zarr-source-loader.ts
|
|
@@ -15676,9 +15743,7 @@ var __exports__ = (() => {
|
|
|
15676
15743
|
}
|
|
15677
15744
|
/** Opens sibling array metadata without selecting or decoding their samples. */
|
|
15678
15745
|
async loadGridMetadata() {
|
|
15679
|
-
const { metadata, group: group2 } = await this.getInitializationPromise();
|
|
15680
|
-
const groupAttributes = metadata.metadata?.groupAttributes;
|
|
15681
|
-
const layout = getSpatialMultiscaleLevels(groupAttributes, metadata.array);
|
|
15746
|
+
const { metadata, group: group2, layout } = await this.getInitializationPromise();
|
|
15682
15747
|
const levels = [];
|
|
15683
15748
|
for (const level of layout) {
|
|
15684
15749
|
if (level.array === metadata.array) {
|
|
@@ -15701,6 +15766,15 @@ var __exports__ = (() => {
|
|
|
15701
15766
|
levels.push({ id: level.id, array: level.array });
|
|
15702
15767
|
}
|
|
15703
15768
|
}
|
|
15769
|
+
const selectedScale = layout.find((level) => level.array === metadata.array)?.scale;
|
|
15770
|
+
if (selectedScale) {
|
|
15771
|
+
for (const [index, level] of levels.entries()) {
|
|
15772
|
+
const scale = layout[index].scale;
|
|
15773
|
+
if (level.metadata && !isConsistentOMELevel(scale, selectedScale, level.metadata, metadata)) {
|
|
15774
|
+
delete level.metadata;
|
|
15775
|
+
}
|
|
15776
|
+
}
|
|
15777
|
+
}
|
|
15704
15778
|
const normalizedLevels = levels.length ? levels : [{ id: metadata.array, array: metadata.array, metadata }];
|
|
15705
15779
|
const matrices = normalizedLevels.map((level) => getSpatialChunkMatrix(level.id, level.metadata));
|
|
15706
15780
|
const commonCoordinateReferenceSystem = typeof metadata.crs === "string" && normalizedLevels.every((level) => level.metadata?.crs === metadata.crs) ? metadata.crs : void 0;
|
|
@@ -15825,11 +15899,25 @@ var __exports__ = (() => {
|
|
|
15825
15899
|
const array2 = await open(group2.resolve(arrayPath), { kind: "array", signal });
|
|
15826
15900
|
const groupAttributes = normalizeAttributes(group2.attrs);
|
|
15827
15901
|
const arrayAttributes = normalizeAttributes(array2.attrs);
|
|
15828
|
-
const
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
)
|
|
15902
|
+
const openGroupAttributes = async (path) => normalizeAttributes((await open(group2.resolve(path), { kind: "group", signal })).attrs);
|
|
15903
|
+
let layout = getSpatialMultiscaleLevels(groupAttributes, arrayPath, {
|
|
15904
|
+
spatialOME: declaresCoordinateReferenceSystem({ ...groupAttributes, ...arrayAttributes })
|
|
15905
|
+
});
|
|
15906
|
+
let level = layout.find((candidate) => candidate.array === arrayPath);
|
|
15907
|
+
let levelGroupAttributes = level?.group ? await openGroupAttributes(level.group) : {};
|
|
15908
|
+
if (!layout.length) {
|
|
15909
|
+
const omeLayout = getOMELevelsOrEmpty(groupAttributes, arrayPath);
|
|
15910
|
+
const omeLevel = omeLayout.find((candidate) => candidate.array === arrayPath);
|
|
15911
|
+
const omeLevelGroupAttributes = omeLevel?.group ? await openGroupAttributes(omeLevel.group).catch((error) => {
|
|
15912
|
+
rethrowUnlessAbsent(error);
|
|
15913
|
+
return {};
|
|
15914
|
+
}) : {};
|
|
15915
|
+
if (declaresCoordinateReferenceSystem(omeLevelGroupAttributes)) {
|
|
15916
|
+
layout = omeLayout;
|
|
15917
|
+
level = omeLevel;
|
|
15918
|
+
levelGroupAttributes = omeLevelGroupAttributes;
|
|
15919
|
+
}
|
|
15920
|
+
}
|
|
15833
15921
|
const attributes = {
|
|
15834
15922
|
...groupAttributes,
|
|
15835
15923
|
...levelGroupAttributes,
|
|
@@ -15863,17 +15951,25 @@ var __exports__ = (() => {
|
|
|
15863
15951
|
const xDimensionIndex = dimensions.indexOf(spatialDimensions[1]);
|
|
15864
15952
|
const width = array2.shape[xDimensionIndex];
|
|
15865
15953
|
const height = array2.shape[yDimensionIndex];
|
|
15866
|
-
|
|
15954
|
+
let gridMappingPromise;
|
|
15955
|
+
const getGridMapping = () => gridMappingPromise ||= loadCFGridMapping(group2, arrayPath, attributes, signal);
|
|
15956
|
+
const coordinateTransform = options?.transform || normalizeAffineTransform(attributes["spatial:transform"]) || // An ancestor grid mapping can be shared by several multiscale levels: it gives the CRS only.
|
|
15957
|
+
normalizeGDALGeoTransform(
|
|
15958
|
+
await getGridMapping().then((mapping) => mapping?.local ? mapping.attributes.GeoTransform : null)
|
|
15959
|
+
) || (!metadataOnly ? await loadCFCoordinateTransform(group2, arrayPath, spatialDimensions, signal) : null);
|
|
15867
15960
|
if (!coordinateTransform) {
|
|
15868
15961
|
throw new Error(
|
|
15869
|
-
"GeoZarrRasterSource requires spatial:transform metadata, explicit geozarr.transform, or regular 1D CF coordinate arrays."
|
|
15962
|
+
"GeoZarrRasterSource requires spatial:transform metadata, explicit geozarr.transform, a CF grid-mapping GeoTransform, or regular 1D CF coordinate arrays."
|
|
15870
15963
|
);
|
|
15871
15964
|
}
|
|
15872
15965
|
const declaredRegistration = normalizeRegistration(attributes["spatial:registration"]);
|
|
15873
15966
|
const transform = declaredRegistration === "node" ? convertNodeTransformToPixelTransform(coordinateTransform) : coordinateTransform;
|
|
15874
15967
|
const declaredBoundingBox = normalizeBoundingBox(attributes["spatial:bbox"]);
|
|
15875
15968
|
const boundingBox = declaredRegistration === "pixel" && declaredBoundingBox ? toRasterBoundingBox(declaredBoundingBox) : getTransformBoundingBox(transform, width, height);
|
|
15876
|
-
const coordinateReferenceSystem = options?.coordinateReferenceSystem || normalizeDeclaredCoordinateReferenceSystem(attributes) ||
|
|
15969
|
+
const coordinateReferenceSystem = options?.coordinateReferenceSystem || normalizeDeclaredCoordinateReferenceSystem(attributes) || getCFCoordinateReferenceSystem(
|
|
15970
|
+
(await getGridMapping())?.attributes || null,
|
|
15971
|
+
spatialDimensions
|
|
15972
|
+
);
|
|
15877
15973
|
const defaultSelection = options?.defaultSelection || {};
|
|
15878
15974
|
const selectionDimensions = dimensions.map((dimensionName, dimensionIndex) => ({
|
|
15879
15975
|
name: dimensionName,
|
|
@@ -15913,7 +16009,7 @@ var __exports__ = (() => {
|
|
|
15913
16009
|
transform,
|
|
15914
16010
|
registration: declaredRegistration
|
|
15915
16011
|
};
|
|
15916
|
-
return { group: group2, array: array2, metadata, xDimensionIndex, yDimensionIndex };
|
|
16012
|
+
return { group: group2, array: array2, metadata, xDimensionIndex, yDimensionIndex, layout };
|
|
15917
16013
|
}
|
|
15918
16014
|
};
|
|
15919
16015
|
function normalizeAttributes(attributes) {
|
|
@@ -15973,12 +16069,19 @@ var __exports__ = (() => {
|
|
|
15973
16069
|
translateY - (rotationY + scaleY) / 2
|
|
15974
16070
|
];
|
|
15975
16071
|
}
|
|
15976
|
-
async function loadCFCoordinateTransform(group2, spatialDimensions, signal) {
|
|
16072
|
+
async function loadCFCoordinateTransform(group2, arrayPath, spatialDimensions, signal) {
|
|
16073
|
+
let coordinates;
|
|
15977
16074
|
try {
|
|
15978
|
-
|
|
15979
|
-
loadCoordinateValues(group2, spatialDimensions[0], signal),
|
|
15980
|
-
loadCoordinateValues(group2, spatialDimensions[1], signal)
|
|
16075
|
+
coordinates = await Promise.all([
|
|
16076
|
+
loadCoordinateValues(group2, arrayPath, spatialDimensions[0], signal),
|
|
16077
|
+
loadCoordinateValues(group2, arrayPath, spatialDimensions[1], signal)
|
|
15981
16078
|
]);
|
|
16079
|
+
} catch (error) {
|
|
16080
|
+
rethrowUnlessAbsent(error);
|
|
16081
|
+
return null;
|
|
16082
|
+
}
|
|
16083
|
+
const [yCoordinates, xCoordinates] = coordinates;
|
|
16084
|
+
try {
|
|
15982
16085
|
const scaleX = getRegularCoordinateSpacing(xCoordinates, spatialDimensions[1]);
|
|
15983
16086
|
const scaleY = getRegularCoordinateSpacing(yCoordinates, spatialDimensions[0]);
|
|
15984
16087
|
return [scaleX, 0, xCoordinates[0] - scaleX / 2, 0, scaleY, yCoordinates[0] - scaleY / 2];
|
|
@@ -15986,11 +16089,8 @@ var __exports__ = (() => {
|
|
|
15986
16089
|
return null;
|
|
15987
16090
|
}
|
|
15988
16091
|
}
|
|
15989
|
-
async function loadCoordinateValues(group2, coordinateName, signal) {
|
|
15990
|
-
const coordinateArray = await
|
|
15991
|
-
kind: "array",
|
|
15992
|
-
signal
|
|
15993
|
-
});
|
|
16092
|
+
async function loadCoordinateValues(group2, arrayPath, coordinateName, signal) {
|
|
16093
|
+
const { array: coordinateArray } = await openNearestArray(group2, arrayPath, coordinateName, signal);
|
|
15994
16094
|
if (coordinateArray.shape.length !== 1 || coordinateArray.shape[0] < 2) {
|
|
15995
16095
|
throw new Error(
|
|
15996
16096
|
`Coordinate ${coordinateName} must be a one-dimensional array with at least two values.`
|
|
@@ -16002,6 +16102,23 @@ var __exports__ = (() => {
|
|
|
16002
16102
|
}
|
|
16003
16103
|
return Array.from(coordinateChunk.data);
|
|
16004
16104
|
}
|
|
16105
|
+
async function openNearestArray(group2, arrayPath, name, signal) {
|
|
16106
|
+
const segments = arrayPath.split("/").slice(0, -1);
|
|
16107
|
+
let lastError;
|
|
16108
|
+
for (let depth = segments.length; depth >= 0; depth--) {
|
|
16109
|
+
const path = [...segments.slice(0, depth), name].join("/");
|
|
16110
|
+
try {
|
|
16111
|
+
const array2 = await open(group2.resolve(path), { kind: "array", signal });
|
|
16112
|
+
return { array: array2, local: depth === segments.length };
|
|
16113
|
+
} catch (error) {
|
|
16114
|
+
if (!isZarritaError(error, "NotFoundError")) {
|
|
16115
|
+
throw error;
|
|
16116
|
+
}
|
|
16117
|
+
lastError = error;
|
|
16118
|
+
}
|
|
16119
|
+
}
|
|
16120
|
+
throw lastError;
|
|
16121
|
+
}
|
|
16005
16122
|
function getRegularCoordinateSpacing(coordinates, coordinateName) {
|
|
16006
16123
|
const spacing = (coordinates.at(-1) - coordinates[0]) / (coordinates.length - 1);
|
|
16007
16124
|
if (!Number.isFinite(spacing) || spacing === 0) {
|
|
@@ -16016,22 +16133,27 @@ var __exports__ = (() => {
|
|
|
16016
16133
|
}
|
|
16017
16134
|
return spacing;
|
|
16018
16135
|
}
|
|
16019
|
-
async function
|
|
16136
|
+
async function loadCFGridMapping(group2, arrayPath, attributes, signal) {
|
|
16020
16137
|
const gridMapping = normalizeString(attributes.grid_mapping);
|
|
16021
|
-
if (gridMapping)
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16138
|
+
if (!gridMapping) return null;
|
|
16139
|
+
const gridMappingName = gridMapping.trim().split(/[\s:]/, 1)[0];
|
|
16140
|
+
try {
|
|
16141
|
+
const { array: array2, local } = await openNearestArray(group2, arrayPath, gridMappingName, signal);
|
|
16142
|
+
return { attributes: normalizeAttributes(array2.attrs), local };
|
|
16143
|
+
} catch (error) {
|
|
16144
|
+
rethrowUnlessAbsent(error);
|
|
16145
|
+
return null;
|
|
16146
|
+
}
|
|
16147
|
+
}
|
|
16148
|
+
function rethrowUnlessAbsent(error) {
|
|
16149
|
+
if (!isZarritaError(error, "NotFoundError")) {
|
|
16150
|
+
throw error;
|
|
16151
|
+
}
|
|
16152
|
+
}
|
|
16153
|
+
function getCFCoordinateReferenceSystem(gridMappingAttributes, spatialDimensions) {
|
|
16154
|
+
const coordinateReferenceSystem = gridMappingAttributes && (normalizeString(gridMappingAttributes.crs_wkt) || normalizeString(gridMappingAttributes.spatial_ref) || normalizeString(gridMappingAttributes["proj:wkt2"]) || normalizeString(gridMappingAttributes["proj:code"]));
|
|
16155
|
+
if (coordinateReferenceSystem) {
|
|
16156
|
+
return coordinateReferenceSystem;
|
|
16035
16157
|
}
|
|
16036
16158
|
const normalizedDimensions = spatialDimensions.map((dimension) => dimension.toLowerCase());
|
|
16037
16159
|
if (["lat", "latitude"].includes(normalizedDimensions[0]) && ["lon", "longitude"].includes(normalizedDimensions[1])) {
|
|
@@ -16039,6 +16161,35 @@ var __exports__ = (() => {
|
|
|
16039
16161
|
}
|
|
16040
16162
|
return void 0;
|
|
16041
16163
|
}
|
|
16164
|
+
function normalizeGDALGeoTransform(value) {
|
|
16165
|
+
const coefficients = typeof value === "string" ? value.trim().split(/\s+/).map(Number) : value;
|
|
16166
|
+
if (!Array.isArray(coefficients) || coefficients.length !== 6 || coefficients.some((coefficient) => typeof coefficient !== "number" || !Number.isFinite(coefficient))) {
|
|
16167
|
+
return null;
|
|
16168
|
+
}
|
|
16169
|
+
const [originX, pixelWidth, rotationX, originY, rotationY, pixelHeight] = coefficients;
|
|
16170
|
+
if (pixelWidth === 0 || pixelHeight === 0) return null;
|
|
16171
|
+
return [pixelWidth, rotationX, originX, rotationY, pixelHeight, originY];
|
|
16172
|
+
}
|
|
16173
|
+
function getOMELevelsOrEmpty(attributes, arrayPath) {
|
|
16174
|
+
try {
|
|
16175
|
+
return getSpatialMultiscaleLevels(attributes, arrayPath, { spatialOME: true });
|
|
16176
|
+
} catch {
|
|
16177
|
+
return [];
|
|
16178
|
+
}
|
|
16179
|
+
}
|
|
16180
|
+
function declaresCoordinateReferenceSystem(attributes) {
|
|
16181
|
+
return Boolean(
|
|
16182
|
+
normalizeDeclaredCoordinateReferenceSystem(attributes) || normalizeString(attributes.grid_mapping)
|
|
16183
|
+
);
|
|
16184
|
+
}
|
|
16185
|
+
function isConsistentOMELevel(scale, selectedScale, level, selected) {
|
|
16186
|
+
return selected.spatialDimensions.every((dimension, index) => {
|
|
16187
|
+
const coefficient = index === 0 ? 4 : 0;
|
|
16188
|
+
const expected = Math.abs(scale[dimension] / selectedScale[dimension]);
|
|
16189
|
+
const actual = Math.abs(level.transform[coefficient] / selected.transform[coefficient]);
|
|
16190
|
+
return Number.isFinite(expected) && Math.abs(actual - expected) <= expected * 1e-6;
|
|
16191
|
+
});
|
|
16192
|
+
}
|
|
16042
16193
|
function getTransformBoundingBox(transform, width, height) {
|
|
16043
16194
|
const corners = [
|
|
16044
16195
|
transformPosition(transform, 0, 0),
|