@loaders.gl/scientific 5.0.0-beta.1 → 5.0.0-beta.10
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 +11 -4
- package/dist/hdf5/http-range-reader.d.ts.map +1 -1
- package/dist/hdf5/http-range-reader.js +2 -12
- package/dist/hdf5/http-range-reader.js.map +1 -1
- package/dist/hdf5/index.cjs +2 -11
- package/dist/hdf5/index.cjs.map +2 -2
- package/dist/index.cjs +136 -4152
- package/dist/index.cjs.map +4 -3
- package/dist/index.d.ts +14 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- 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 +47 -46
- package/dist/netcdf/index.cjs +47 -46
- package/dist/netcdf/index.cjs.map +3 -3
- package/dist/netcdf/index.d.ts +2 -1
- package/dist/netcdf/index.d.ts.map +1 -1
- package/dist/netcdf/index.js +2 -1
- package/dist/netcdf/index.js.map +1 -1
- package/dist/netcdf/netcdf-loader-with-parser.cjs +396 -2
- package/dist/netcdf/netcdf-loader-with-parser.d.ts +10 -0
- package/dist/netcdf/netcdf-loader-with-parser.d.ts.map +1 -1
- package/dist/netcdf/netcdf-loader-with-parser.js +3 -1
- package/dist/netcdf/netcdf-loader-with-parser.js.map +1 -1
- package/dist/netcdf/netcdf-loader.cjs +12 -9
- package/dist/netcdf/netcdf-loader.cjs.map +7 -0
- package/dist/netcdf/netcdf-loader.d.ts +10 -21
- package/dist/netcdf/netcdf-loader.d.ts.map +1 -1
- package/dist/netcdf/netcdf-loader.js +6 -3
- package/dist/netcdf/netcdf-loader.js.map +1 -1
- package/dist/netcdf/netcdf-source-loader.cjs +17 -31
- package/dist/netcdf/netcdf-source-loader.d.ts +2 -20
- package/dist/netcdf/netcdf-source-loader.d.ts.map +1 -1
- package/dist/netcdf/netcdf-source-loader.js +22 -20
- package/dist/netcdf/netcdf-source-loader.js.map +1 -1
- package/dist/netcdf/unbundled.cjs +47 -46
- package/dist/netcdf.dev.js +3095 -2654
- package/dist/netcdf.min.js +4 -4
- 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/{netcdf/netcdf-source-loader-types.cjs → npy-loader-types.cjs} +34 -35
- package/dist/npy-loader-types.cjs.map +7 -0
- package/dist/npy-loader-types.d.ts +53 -0
- package/dist/npy-loader-types.d.ts.map +1 -0
- package/dist/npy-loader-types.js +32 -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 +1285 -0
- package/dist/npy-worker.js.map +1 -0
- package/dist/nrrd/parse-nrrd.d.ts +22 -0
- package/dist/nrrd/parse-nrrd.d.ts.map +1 -0
- package/dist/nrrd/parse-nrrd.js +228 -0
- package/dist/nrrd/parse-nrrd.js.map +1 -0
- package/dist/nrrd-loader-types.cjs +58 -0
- package/dist/nrrd-loader-types.cjs.map +7 -0
- package/dist/nrrd-loader-types.d.ts +31 -0
- package/dist/nrrd-loader-types.d.ts.map +1 -0
- package/dist/nrrd-loader-types.js +25 -0
- package/dist/nrrd-loader-types.js.map +1 -0
- package/dist/nrrd-loader.cjs +252 -0
- package/dist/nrrd-loader.cjs.map +6 -0
- package/dist/nrrd-loader.d.ts +16 -0
- package/dist/nrrd-loader.d.ts.map +1 -0
- package/dist/nrrd-loader.js +8 -0
- package/dist/nrrd-loader.js.map +1 -0
- package/dist/vtk/index.cjs +26 -4117
- package/dist/vtk/index.cjs.map +3 -3
- package/dist/vtk/vtk-xml.js +4 -4
- package/dist/vtk/vtk-xml.js.map +1 -1
- package/dist/vtk/vtk.d.ts.map +1 -1
- package/dist/vtk/vtk.js +19 -1
- package/dist/vtk/vtk.js.map +1 -1
- package/dist/vtk-loader-types.cjs +58 -0
- package/dist/vtk-loader-types.cjs.map +7 -0
- package/dist/vtk-loader-types.d.ts +34 -0
- package/dist/vtk-loader-types.d.ts.map +1 -0
- package/dist/vtk-loader-types.js +25 -0
- package/dist/vtk-loader-types.js.map +1 -0
- package/dist/vtk-loader.cjs +384 -0
- package/dist/vtk-loader.cjs.map +6 -0
- package/dist/vtk-loader.d.ts +21 -0
- package/dist/vtk-loader.d.ts.map +1 -0
- package/dist/vtk-loader.js +21 -0
- package/dist/vtk-loader.js.map +1 -0
- 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 → geo-zarr-loader.d.ts} +9 -9
- package/dist/zarr/geo-zarr-loader.d.ts.map +1 -0
- package/dist/zarr/{geo-zarr-source-loader.js → geo-zarr-loader.js} +167 -48
- package/dist/zarr/geo-zarr-loader.js.map +1 -0
- package/dist/zarr/index.cjs +221 -70
- package/dist/zarr/index.cjs.map +3 -3
- package/dist/zarr/index.d.ts +8 -8
- package/dist/zarr/index.d.ts.map +1 -1
- package/dist/zarr/index.js +4 -4
- package/dist/zarr/index.js.map +1 -1
- 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.d.ts → ome-zarr-loader.d.ts} +9 -9
- package/dist/zarr/ome-zarr-loader.d.ts.map +1 -0
- package/dist/zarr/{ome-zarr-source-loader.js → ome-zarr-loader.js} +5 -5
- package/dist/zarr/ome-zarr-loader.js.map +1 -0
- package/dist/zarr/{spatial-data-source.d.ts → spatial-data-loader.d.ts} +11 -11
- package/dist/zarr/spatial-data-loader.d.ts.map +1 -0
- package/dist/zarr/{spatial-data-source.js → spatial-data-loader.js} +7 -7
- package/dist/zarr/spatial-data-loader.js.map +1 -0
- package/dist/zarr/{zarr-array-source.d.ts → zarr-array-loader.d.ts} +9 -9
- package/dist/zarr/{zarr-array-source.d.ts.map → zarr-array-loader.d.ts.map} +1 -1
- package/dist/zarr/{zarr-array-source.js → zarr-array-loader.js} +5 -5
- package/dist/zarr/{zarr-array-source.js.map → zarr-array-loader.js.map} +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.d.ts +32 -32
- package/dist/zarr/zarr-loader-types.d.ts.map +1 -1
- package/dist/zarr/zarr-loader-types.js +24 -24
- package/dist/zarr/zarr-loader-types.js.map +1 -1
- package/dist/zarr.dev.js +294 -80
- package/dist/zarr.min.js +40 -40
- package/package.json +54 -7
- package/src/hdf5/http-range-reader.ts +3 -11
- package/src/index.ts +27 -16
- package/src/lib/parsers/parse-npy.ts +123 -0
- package/src/netcdf/index.ts +2 -5
- package/src/netcdf/netcdf-loader-with-parser.ts +3 -1
- package/src/netcdf/netcdf-loader.ts +5 -3
- package/src/netcdf/netcdf-source-loader.ts +32 -24
- package/src/npy-format.ts +17 -0
- package/src/npy-loader-types.ts +47 -0
- package/src/npy-loader.ts +21 -0
- package/src/npy-worker.ts +6 -0
- package/src/nrrd/parse-nrrd.ts +267 -0
- package/src/nrrd-loader-types.ts +25 -0
- package/src/nrrd-loader.ts +7 -0
- package/src/vtk/vtk-xml.ts +4 -4
- package/src/vtk/vtk.ts +28 -1
- package/src/vtk-loader-types.ts +25 -0
- package/src/vtk-loader.ts +19 -0
- package/src/workers/npy-worker.ts +8 -0
- package/src/zarr/{geo-zarr-source-loader.ts → geo-zarr-loader.ts} +206 -55
- package/src/zarr/index.ts +17 -17
- package/src/zarr/lib/spatial-multiscales.ts +104 -8
- package/src/zarr/{ome-zarr-source-loader.ts → ome-zarr-loader.ts} +11 -11
- package/src/zarr/{spatial-data-source.ts → spatial-data-loader.ts} +16 -16
- package/src/zarr/{zarr-array-source.ts → zarr-array-loader.ts} +10 -10
- package/src/zarr/zarr-loader-types.ts +35 -35
- package/dist/netcdf/netcdf-source-loader-types.d.ts +0 -28
- package/dist/netcdf/netcdf-source-loader-types.d.ts.map +0 -1
- package/dist/netcdf/netcdf-source-loader-types.js +0 -32
- package/dist/netcdf/netcdf-source-loader-types.js.map +0 -1
- package/dist/zarr/geo-zarr-source-loader.d.ts.map +0 -1
- package/dist/zarr/geo-zarr-source-loader.js.map +0 -1
- package/dist/zarr/ome-zarr-source-loader.d.ts.map +0 -1
- package/dist/zarr/ome-zarr-source-loader.js.map +0 -1
- package/dist/zarr/spatial-data-source.d.ts.map +0 -1
- package/dist/zarr/spatial-data-source.js.map +0 -1
- package/src/netcdf/netcdf-source-loader-types.ts +0 -45
package/dist/zarr.dev.js
CHANGED
|
@@ -2563,18 +2563,17 @@ var __exports__ = (() => {
|
|
|
2563
2563
|
var zarr_bundle_exports = {};
|
|
2564
2564
|
__export(zarr_bundle_exports, {
|
|
2565
2565
|
FetchError: () => import_core3.FetchError,
|
|
2566
|
+
GeoZarrLoader: () => GeoZarrLoaderWithParser,
|
|
2566
2567
|
GeoZarrRasterSource: () => GeoZarrRasterSource,
|
|
2567
|
-
GeoZarrSourceLoader: () => GeoZarrSourceLoaderWithParser,
|
|
2568
2568
|
JSONLoader: () => JSONLoader,
|
|
2569
2569
|
NullLoader: () => import_core3.NullLoader,
|
|
2570
|
-
NullWorkerLoader: () => import_core3.NullWorkerLoader,
|
|
2571
2570
|
OMEZarrImageSource: () => OMEZarrImageSource,
|
|
2572
|
-
|
|
2571
|
+
OMEZarrLoader: () => OMEZarrLoaderWithParser,
|
|
2573
2572
|
RequestScheduler: () => RequestScheduler,
|
|
2573
|
+
SpatialDataLoader: () => SpatialDataLoaderWithParser,
|
|
2574
2574
|
SpatialDataSource: () => SpatialDataSource,
|
|
2575
|
-
|
|
2575
|
+
ZarrArrayLoader: () => ZarrArrayLoaderWithParser,
|
|
2576
2576
|
ZarrArraySource: () => ZarrArraySource,
|
|
2577
|
-
ZarrArraySourceLoader: () => ZarrArraySourceLoaderWithParser,
|
|
2578
2577
|
ZarrPixelSource: () => zarr_pixel_source_default,
|
|
2579
2578
|
_BrowserFileSystem: () => import_core3._BrowserFileSystem,
|
|
2580
2579
|
_fetchProgress: () => import_core3._fetchProgress,
|
|
@@ -2584,6 +2583,7 @@ var __exports__ = (() => {
|
|
|
2584
2583
|
concatenateArrayBuffersAsync: () => concatenateArrayBuffersAsync,
|
|
2585
2584
|
coreApi: () => import_core3.coreApi,
|
|
2586
2585
|
createDataSource: () => import_core3.createDataSource,
|
|
2586
|
+
createDataSourceSync: () => import_core3.createDataSourceSync,
|
|
2587
2587
|
document: () => document_,
|
|
2588
2588
|
encode: () => import_core3.encode,
|
|
2589
2589
|
encodeInBatches: () => import_core3.encodeInBatches,
|
|
@@ -3221,6 +3221,35 @@ var __exports__ = (() => {
|
|
|
3221
3221
|
return log3;
|
|
3222
3222
|
}
|
|
3223
3223
|
var log2 = createLog();
|
|
3224
|
+
var NullLog = class {
|
|
3225
|
+
/** Discards debug messages. */
|
|
3226
|
+
log() {
|
|
3227
|
+
return ignoreMessage;
|
|
3228
|
+
}
|
|
3229
|
+
/** Discards informational messages. */
|
|
3230
|
+
info() {
|
|
3231
|
+
return ignoreMessage;
|
|
3232
|
+
}
|
|
3233
|
+
/** Discards messages marked to be emitted once. */
|
|
3234
|
+
once() {
|
|
3235
|
+
return ignoreMessage;
|
|
3236
|
+
}
|
|
3237
|
+
/** Discards warnings. */
|
|
3238
|
+
warn() {
|
|
3239
|
+
return ignoreMessage;
|
|
3240
|
+
}
|
|
3241
|
+
/** Discards errors. */
|
|
3242
|
+
error() {
|
|
3243
|
+
return ignoreMessage;
|
|
3244
|
+
}
|
|
3245
|
+
};
|
|
3246
|
+
function ignoreMessage() {
|
|
3247
|
+
}
|
|
3248
|
+
var nullLog = new NullLog();
|
|
3249
|
+
function getLoaderLog(options) {
|
|
3250
|
+
const logger = options?.core?.log;
|
|
3251
|
+
return logger === null ? nullLog : logger || log2;
|
|
3252
|
+
}
|
|
3224
3253
|
|
|
3225
3254
|
// ../core/src/loader-utils/lib/javascript-utils/is-type.ts
|
|
3226
3255
|
var isBoolean = (value) => typeof value === "boolean";
|
|
@@ -3859,7 +3888,7 @@ var __exports__ = (() => {
|
|
|
3859
3888
|
return authenticatedFetch;
|
|
3860
3889
|
}
|
|
3861
3890
|
function getAuthenticatedFetch(options = {}) {
|
|
3862
|
-
const fetchOption = options.
|
|
3891
|
+
const fetchOption = options.core?.fetch;
|
|
3863
3892
|
let fetchFunction;
|
|
3864
3893
|
if (typeof fetchOption === "function") {
|
|
3865
3894
|
fetchFunction = fetchOption;
|
|
@@ -4064,6 +4093,8 @@ var __exports__ = (() => {
|
|
|
4064
4093
|
options;
|
|
4065
4094
|
data;
|
|
4066
4095
|
url;
|
|
4096
|
+
/** Stable query-visible name, resolved without fetching source data. */
|
|
4097
|
+
name;
|
|
4067
4098
|
/** Shared parser options derived from the source options, excluding source-only core controls. */
|
|
4068
4099
|
loadOptions;
|
|
4069
4100
|
/** A resolved fetch function extracted from the shared core options. */
|
|
@@ -4080,6 +4111,7 @@ var __exports__ = (() => {
|
|
|
4080
4111
|
);
|
|
4081
4112
|
this.data = data;
|
|
4082
4113
|
this.url = typeof data === "string" ? resolvePath(data) : "";
|
|
4114
|
+
this.name = getDataSourceName(data, this.options);
|
|
4083
4115
|
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
|
|
4084
4116
|
this.loadOptions = loadOptions;
|
|
4085
4117
|
const fetch2 = getFetchFunction(loadOptions);
|
|
@@ -4088,6 +4120,8 @@ var __exports__ = (() => {
|
|
|
4088
4120
|
this.fetch = fetch2;
|
|
4089
4121
|
}
|
|
4090
4122
|
setProps(options) {
|
|
4123
|
+
if (options.core?.name !== void 0 && options.core.name !== this.name)
|
|
4124
|
+
throw new Error("Data source names are fixed at creation.");
|
|
4091
4125
|
const mergedOptions = mergeOptions(this.options, options);
|
|
4092
4126
|
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
|
|
4093
4127
|
this.options = mergedOptions;
|
|
@@ -4117,7 +4151,7 @@ var __exports__ = (() => {
|
|
|
4117
4151
|
if (callback) {
|
|
4118
4152
|
callback(normalizedError, this);
|
|
4119
4153
|
} else {
|
|
4120
|
-
|
|
4154
|
+
getLoaderLog(this.options).warn(`${this.constructor.name}: ${normalizedError.message}`)();
|
|
4121
4155
|
}
|
|
4122
4156
|
return normalizedError;
|
|
4123
4157
|
}
|
|
@@ -4135,23 +4169,13 @@ var __exports__ = (() => {
|
|
|
4135
4169
|
if (options?.core) {
|
|
4136
4170
|
loadOptions.core = { ...options.core };
|
|
4137
4171
|
const parserCore = loadOptions.core;
|
|
4138
|
-
for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
|
|
4172
|
+
for (const key of ["type", "name", "attributions", "loaders", "onError", "loadOptions"]) {
|
|
4139
4173
|
delete parserCore[key];
|
|
4140
4174
|
}
|
|
4141
4175
|
if (Object.keys(parserCore).length === 0) {
|
|
4142
4176
|
delete loadOptions.core;
|
|
4143
4177
|
}
|
|
4144
4178
|
}
|
|
4145
|
-
const topLevelBaseUri = typeof loadOptions.baseUri === "string" ? loadOptions.baseUri : void 0;
|
|
4146
|
-
const topLevelBaseUrl = typeof loadOptions.baseUrl === "string" ? loadOptions.baseUrl : void 0;
|
|
4147
|
-
if (topLevelBaseUri !== void 0 || topLevelBaseUrl !== void 0) {
|
|
4148
|
-
loadOptions.core ||= {};
|
|
4149
|
-
if (loadOptions.core.baseUrl === void 0) {
|
|
4150
|
-
loadOptions.core.baseUrl = topLevelBaseUrl ?? topLevelBaseUri;
|
|
4151
|
-
}
|
|
4152
|
-
delete loadOptions.baseUri;
|
|
4153
|
-
delete loadOptions.baseUrl;
|
|
4154
|
-
}
|
|
4155
4179
|
return loadOptions;
|
|
4156
4180
|
}
|
|
4157
4181
|
function normalizeError(error, message) {
|
|
@@ -4166,10 +4190,47 @@ var __exports__ = (() => {
|
|
|
4166
4190
|
function unavailableCoreApiMethod(methodName) {
|
|
4167
4191
|
return () => {
|
|
4168
4192
|
throw new Error(
|
|
4169
|
-
`CoreAPI.${methodName} is unavailable. Use @loaders.gl/core.
|
|
4193
|
+
`CoreAPI.${methodName} is unavailable. Use @loaders.gl/core.createDataSourceSync().`
|
|
4170
4194
|
);
|
|
4171
4195
|
};
|
|
4172
4196
|
}
|
|
4197
|
+
function getDataSourceName(data, options) {
|
|
4198
|
+
const explicitName = options.core?.name;
|
|
4199
|
+
if (explicitName !== void 0) {
|
|
4200
|
+
if (typeof explicitName !== "string" || !explicitName.trim())
|
|
4201
|
+
throw new Error("Data source name must be a non-empty string.");
|
|
4202
|
+
return explicitName;
|
|
4203
|
+
}
|
|
4204
|
+
if (data && typeof data === "object") {
|
|
4205
|
+
const named = data;
|
|
4206
|
+
if (typeof named.name === "string" && named.name.trim())
|
|
4207
|
+
return data instanceof Blob ? removeFileExtension(named.name) : named.name;
|
|
4208
|
+
const metadata = named.schema?.metadata;
|
|
4209
|
+
const embeddedName = metadata instanceof Map ? metadata.get("name") : metadata?.name;
|
|
4210
|
+
if (typeof embeddedName === "string" && embeddedName.trim()) return embeddedName;
|
|
4211
|
+
}
|
|
4212
|
+
if (typeof data === "string") {
|
|
4213
|
+
try {
|
|
4214
|
+
const url = new URL(data.replace(/\\/g, "/"), "https://source.invalid/");
|
|
4215
|
+
if (!["data:", "blob:"].includes(url.protocol)) {
|
|
4216
|
+
let basename = url.pathname.split("/").filter(Boolean).pop();
|
|
4217
|
+
if (basename) {
|
|
4218
|
+
try {
|
|
4219
|
+
basename = decodeURIComponent(basename);
|
|
4220
|
+
} catch {
|
|
4221
|
+
}
|
|
4222
|
+
return removeFileExtension(basename);
|
|
4223
|
+
}
|
|
4224
|
+
}
|
|
4225
|
+
} catch {
|
|
4226
|
+
}
|
|
4227
|
+
}
|
|
4228
|
+
return options.core?.type && options.core.type !== "auto" ? options.core.type : "source";
|
|
4229
|
+
}
|
|
4230
|
+
function removeFileExtension(name) {
|
|
4231
|
+
const extension = name.lastIndexOf(".");
|
|
4232
|
+
return extension > 0 ? name.slice(0, extension) : name;
|
|
4233
|
+
}
|
|
4173
4234
|
|
|
4174
4235
|
// ../../node_modules/@math.gl/geospatial/dist/crs/spatial-reference.js
|
|
4175
4236
|
function createSpatialReference(options = {}) {
|
|
@@ -4233,6 +4294,7 @@ var __exports__ = (() => {
|
|
|
4233
4294
|
metadata: field.metadata || Object.freeze({})
|
|
4234
4295
|
})
|
|
4235
4296
|
);
|
|
4297
|
+
const queryCapabilities = Object.freeze({ ...options.capabilities });
|
|
4236
4298
|
return Object.freeze({
|
|
4237
4299
|
sourceType: options.sourceType,
|
|
4238
4300
|
queryType: options.queryType,
|
|
@@ -4241,7 +4303,8 @@ var __exports__ = (() => {
|
|
|
4241
4303
|
description: options.description,
|
|
4242
4304
|
schema,
|
|
4243
4305
|
columns: Object.freeze(columns),
|
|
4244
|
-
capabilities:
|
|
4306
|
+
capabilities: queryCapabilities,
|
|
4307
|
+
queryCapabilities,
|
|
4245
4308
|
spatial: options.spatial ? Object.freeze({
|
|
4246
4309
|
...options.spatial,
|
|
4247
4310
|
bounds: options.spatial.bounds ? Object.freeze({
|
|
@@ -12685,6 +12748,11 @@ var __exports__ = (() => {
|
|
|
12685
12748
|
this.feature = feature;
|
|
12686
12749
|
}
|
|
12687
12750
|
};
|
|
12751
|
+
function isZarritaError(err2, ...tags) {
|
|
12752
|
+
if (!(err2 instanceof ZarritaError))
|
|
12753
|
+
return false;
|
|
12754
|
+
return tags.length === 0 || tags.includes(err2._tag);
|
|
12755
|
+
}
|
|
12688
12756
|
|
|
12689
12757
|
// ../../node_modules/zarrita/dist/src/codecs/_shared.js
|
|
12690
12758
|
function unimplementedEncode(codecName) {
|
|
@@ -15096,7 +15164,7 @@ var __exports__ = (() => {
|
|
|
15096
15164
|
return [...directChildren].sort();
|
|
15097
15165
|
}
|
|
15098
15166
|
|
|
15099
|
-
// src/zarr/ome-zarr-
|
|
15167
|
+
// src/zarr/ome-zarr-loader.ts
|
|
15100
15168
|
var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
15101
15169
|
async function loadZarrConsolidatedMetadata(url, options = {}) {
|
|
15102
15170
|
const fetcher = options.fetch || fetch;
|
|
@@ -15193,12 +15261,12 @@ var __exports__ = (() => {
|
|
|
15193
15261
|
return await open(location, { kind: "group", signal });
|
|
15194
15262
|
}
|
|
15195
15263
|
};
|
|
15196
|
-
var
|
|
15264
|
+
var OMEZarrLoaderWithParser = {
|
|
15197
15265
|
dataType: null,
|
|
15198
15266
|
/** Runtime source type marker used by `createDataSource()` type inference. */
|
|
15199
15267
|
dataSource: null,
|
|
15200
15268
|
batchType: null,
|
|
15201
|
-
name: "
|
|
15269
|
+
name: "OMEZarrLoader",
|
|
15202
15270
|
id: "omezarr",
|
|
15203
15271
|
module: "scientific",
|
|
15204
15272
|
version: VERSION4,
|
|
@@ -15232,7 +15300,7 @@ var __exports__ = (() => {
|
|
|
15232
15300
|
}
|
|
15233
15301
|
},
|
|
15234
15302
|
testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
|
|
15235
|
-
|
|
15303
|
+
createDataSourceSync: (data, options, coreApi2) => new OMEZarrImageSource(data, options, coreApi2)
|
|
15236
15304
|
};
|
|
15237
15305
|
var OMEZarrImageSource = class extends ZarrSource {
|
|
15238
15306
|
/** Shared source initialization request. */
|
|
@@ -15582,7 +15650,9 @@ var __exports__ = (() => {
|
|
|
15582
15650
|
}
|
|
15583
15651
|
|
|
15584
15652
|
// src/zarr/lib/spatial-multiscales.ts
|
|
15585
|
-
function getSpatialMultiscaleLevels(attributes, array2) {
|
|
15653
|
+
function getSpatialMultiscaleLevels(attributes, array2, { spatialOME = false } = {}) {
|
|
15654
|
+
const omeMultiscales = spatialOME ? getOMEMultiscales(attributes) : null;
|
|
15655
|
+
if (omeMultiscales) return getOMEMultiscaleLevels(omeMultiscales, array2);
|
|
15586
15656
|
const multiscales = attributes?.multiscales;
|
|
15587
15657
|
const layout = multiscales?.layout;
|
|
15588
15658
|
if (!Array.isArray(layout) || !layout.length) return [];
|
|
@@ -15592,28 +15662,88 @@ var __exports__ = (() => {
|
|
|
15592
15662
|
}
|
|
15593
15663
|
const assets = entries.map((entry) => entry.asset);
|
|
15594
15664
|
if (new Set(assets).size !== assets.length) throw new Error("Duplicate spatial multiscales asset.");
|
|
15665
|
+
return resolveLevels(assets, array2, entries);
|
|
15666
|
+
}
|
|
15667
|
+
function getOMEMultiscales(attributes) {
|
|
15668
|
+
if (Array.isArray(attributes?.multiscales)) return attributes.multiscales;
|
|
15669
|
+
const ome = attributes?.ome;
|
|
15670
|
+
return Array.isArray(ome?.multiscales) ? ome.multiscales : null;
|
|
15671
|
+
}
|
|
15672
|
+
function getOMEMultiscaleLevels(multiscales, array2) {
|
|
15673
|
+
const candidates = multiscales.filter((multiscale2) => {
|
|
15674
|
+
const datasets2 = multiscale2?.datasets;
|
|
15675
|
+
return Array.isArray(datasets2) && datasets2.some((dataset) => isChildPath(dataset?.path) && (array2 === dataset.path || array2.startsWith(`${dataset.path}/`)));
|
|
15676
|
+
});
|
|
15677
|
+
if (!candidates.length) return [];
|
|
15678
|
+
if (candidates.length > 1) throw new Error("Array belongs to more than one OME-NGFF multiscale.");
|
|
15679
|
+
const multiscale = candidates[0];
|
|
15680
|
+
const datasets = multiscale.datasets;
|
|
15681
|
+
if (datasets.some((dataset) => !dataset || !isChildPath(dataset.path))) {
|
|
15682
|
+
throw new Error("OME-NGFF dataset paths must be relative child paths.");
|
|
15683
|
+
}
|
|
15684
|
+
const paths = datasets.map((dataset) => dataset.path);
|
|
15685
|
+
if (new Set(paths).size !== paths.length) throw new Error("Duplicate OME-NGFF dataset path.");
|
|
15686
|
+
const axes = getOMEAxisNames(multiscale.axes);
|
|
15687
|
+
return resolveLevels(paths, array2, datasets.map(() => ({}))).map((level, index) => ({
|
|
15688
|
+
...level,
|
|
15689
|
+
scale: getOMEScale(axes, [
|
|
15690
|
+
datasets[index].coordinateTransformations,
|
|
15691
|
+
multiscale.coordinateTransformations
|
|
15692
|
+
])
|
|
15693
|
+
}));
|
|
15694
|
+
}
|
|
15695
|
+
function resolveLevels(assets, array2, attributes) {
|
|
15595
15696
|
const matches2 = assets.filter((asset) => array2 === asset || array2.startsWith(`${asset}/`));
|
|
15596
15697
|
if (matches2.length !== 1) return [];
|
|
15597
15698
|
const suffix = array2.slice(matches2[0].length);
|
|
15598
|
-
return
|
|
15599
|
-
id:
|
|
15600
|
-
array: `${
|
|
15601
|
-
...suffix ? { group:
|
|
15602
|
-
attributes:
|
|
15699
|
+
return assets.map((asset, index) => ({
|
|
15700
|
+
id: asset,
|
|
15701
|
+
array: `${asset}${suffix}`,
|
|
15702
|
+
...suffix ? { group: asset } : {},
|
|
15703
|
+
attributes: attributes[index]
|
|
15603
15704
|
}));
|
|
15604
15705
|
}
|
|
15706
|
+
function getOMEAxisNames(axes) {
|
|
15707
|
+
const names = Array.isArray(axes) ? axes.map((axis) => typeof axis === "string" ? axis : axis?.name) : [];
|
|
15708
|
+
if (!names.length || names.some((name) => typeof name !== "string" || !name)) {
|
|
15709
|
+
throw new Error("OME-NGFF multiscales require named axes.");
|
|
15710
|
+
}
|
|
15711
|
+
if (new Set(names).size !== names.length) throw new Error("Duplicate OME-NGFF axis name.");
|
|
15712
|
+
return names;
|
|
15713
|
+
}
|
|
15714
|
+
function getOMEScale(axes, transformLists) {
|
|
15715
|
+
const scale = axes.map(() => 1);
|
|
15716
|
+
for (const transforms of transformLists) {
|
|
15717
|
+
if (transforms === void 0) continue;
|
|
15718
|
+
if (!Array.isArray(transforms)) {
|
|
15719
|
+
throw new Error("OME-NGFF coordinateTransformations must be a list.");
|
|
15720
|
+
}
|
|
15721
|
+
for (const transform of transforms) {
|
|
15722
|
+
if (transform?.type === "identity" || transform?.type === "translation") continue;
|
|
15723
|
+
if (transform?.type !== "scale") {
|
|
15724
|
+
throw new Error(`Unsupported OME-NGFF coordinate transformation ${String(transform?.type)}.`);
|
|
15725
|
+
}
|
|
15726
|
+
const values = transform.scale;
|
|
15727
|
+
if (!Array.isArray(values) || values.length !== axes.length || values.some((value) => typeof value !== "number" || !Number.isFinite(value) || value === 0)) {
|
|
15728
|
+
throw new Error("OME-NGFF scale must give one finite non-zero value per axis.");
|
|
15729
|
+
}
|
|
15730
|
+
values.forEach((value, index) => scale[index] *= value);
|
|
15731
|
+
}
|
|
15732
|
+
}
|
|
15733
|
+
return Object.fromEntries(axes.map((axis, index) => [axis, scale[index]]));
|
|
15734
|
+
}
|
|
15605
15735
|
function isChildPath(value) {
|
|
15606
|
-
return typeof value === "string" && value.length > 0 && !/[\\%:?#\u0000
|
|
15736
|
+
return typeof value === "string" && value.length > 0 && !/[\\%:?#\u0000- ]/.test(value) && value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
15607
15737
|
}
|
|
15608
15738
|
|
|
15609
|
-
// src/zarr/geo-zarr-
|
|
15739
|
+
// src/zarr/geo-zarr-loader.ts
|
|
15610
15740
|
var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
15611
|
-
var
|
|
15741
|
+
var GeoZarrLoaderWithParser = {
|
|
15612
15742
|
dataType: null,
|
|
15613
15743
|
/** Runtime source type marker used by `createDataSource()` type inference. */
|
|
15614
15744
|
dataSource: null,
|
|
15615
15745
|
batchType: null,
|
|
15616
|
-
name: "
|
|
15746
|
+
name: "GeoZarrLoader",
|
|
15617
15747
|
id: "geozarr",
|
|
15618
15748
|
module: "scientific",
|
|
15619
15749
|
version: VERSION5,
|
|
@@ -15653,7 +15783,7 @@ var __exports__ = (() => {
|
|
|
15653
15783
|
}
|
|
15654
15784
|
},
|
|
15655
15785
|
testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
|
|
15656
|
-
|
|
15786
|
+
createDataSourceSync: (data, options, coreApi2) => new GeoZarrRasterSource(data, options, coreApi2)
|
|
15657
15787
|
};
|
|
15658
15788
|
var GeoZarrRasterSource = class _GeoZarrRasterSource extends ZarrSource {
|
|
15659
15789
|
/** Shared source initialization request. */
|
|
@@ -15676,9 +15806,7 @@ var __exports__ = (() => {
|
|
|
15676
15806
|
}
|
|
15677
15807
|
/** Opens sibling array metadata without selecting or decoding their samples. */
|
|
15678
15808
|
async loadGridMetadata() {
|
|
15679
|
-
const { metadata, group: group2 } = await this.getInitializationPromise();
|
|
15680
|
-
const groupAttributes = metadata.metadata?.groupAttributes;
|
|
15681
|
-
const layout = getSpatialMultiscaleLevels(groupAttributes, metadata.array);
|
|
15809
|
+
const { metadata, group: group2, layout } = await this.getInitializationPromise();
|
|
15682
15810
|
const levels = [];
|
|
15683
15811
|
for (const level of layout) {
|
|
15684
15812
|
if (level.array === metadata.array) {
|
|
@@ -15701,6 +15829,15 @@ var __exports__ = (() => {
|
|
|
15701
15829
|
levels.push({ id: level.id, array: level.array });
|
|
15702
15830
|
}
|
|
15703
15831
|
}
|
|
15832
|
+
const selectedScale = layout.find((level) => level.array === metadata.array)?.scale;
|
|
15833
|
+
if (selectedScale) {
|
|
15834
|
+
for (const [index, level] of levels.entries()) {
|
|
15835
|
+
const scale = layout[index].scale;
|
|
15836
|
+
if (level.metadata && !isConsistentOMELevel(scale, selectedScale, level.metadata, metadata)) {
|
|
15837
|
+
delete level.metadata;
|
|
15838
|
+
}
|
|
15839
|
+
}
|
|
15840
|
+
}
|
|
15704
15841
|
const normalizedLevels = levels.length ? levels : [{ id: metadata.array, array: metadata.array, metadata }];
|
|
15705
15842
|
const matrices = normalizedLevels.map((level) => getSpatialChunkMatrix(level.id, level.metadata));
|
|
15706
15843
|
const commonCoordinateReferenceSystem = typeof metadata.crs === "string" && normalizedLevels.every((level) => level.metadata?.crs === metadata.crs) ? metadata.crs : void 0;
|
|
@@ -15825,11 +15962,25 @@ var __exports__ = (() => {
|
|
|
15825
15962
|
const array2 = await open(group2.resolve(arrayPath), { kind: "array", signal });
|
|
15826
15963
|
const groupAttributes = normalizeAttributes(group2.attrs);
|
|
15827
15964
|
const arrayAttributes = normalizeAttributes(array2.attrs);
|
|
15828
|
-
const
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
)
|
|
15965
|
+
const openGroupAttributes = async (path) => normalizeAttributes((await open(group2.resolve(path), { kind: "group", signal })).attrs);
|
|
15966
|
+
let layout = getSpatialMultiscaleLevels(groupAttributes, arrayPath, {
|
|
15967
|
+
spatialOME: declaresCoordinateReferenceSystem({ ...groupAttributes, ...arrayAttributes })
|
|
15968
|
+
});
|
|
15969
|
+
let level = layout.find((candidate) => candidate.array === arrayPath);
|
|
15970
|
+
let levelGroupAttributes = level?.group ? await openGroupAttributes(level.group) : {};
|
|
15971
|
+
if (!layout.length) {
|
|
15972
|
+
const omeLayout = getOMELevelsOrEmpty(groupAttributes, arrayPath);
|
|
15973
|
+
const omeLevel = omeLayout.find((candidate) => candidate.array === arrayPath);
|
|
15974
|
+
const omeLevelGroupAttributes = omeLevel?.group ? await openGroupAttributes(omeLevel.group).catch((error) => {
|
|
15975
|
+
rethrowUnlessAbsent(error);
|
|
15976
|
+
return {};
|
|
15977
|
+
}) : {};
|
|
15978
|
+
if (declaresCoordinateReferenceSystem(omeLevelGroupAttributes)) {
|
|
15979
|
+
layout = omeLayout;
|
|
15980
|
+
level = omeLevel;
|
|
15981
|
+
levelGroupAttributes = omeLevelGroupAttributes;
|
|
15982
|
+
}
|
|
15983
|
+
}
|
|
15833
15984
|
const attributes = {
|
|
15834
15985
|
...groupAttributes,
|
|
15835
15986
|
...levelGroupAttributes,
|
|
@@ -15863,17 +16014,25 @@ var __exports__ = (() => {
|
|
|
15863
16014
|
const xDimensionIndex = dimensions.indexOf(spatialDimensions[1]);
|
|
15864
16015
|
const width = array2.shape[xDimensionIndex];
|
|
15865
16016
|
const height = array2.shape[yDimensionIndex];
|
|
15866
|
-
|
|
16017
|
+
let gridMappingPromise;
|
|
16018
|
+
const getGridMapping = () => gridMappingPromise ||= loadCFGridMapping(group2, arrayPath, attributes, signal);
|
|
16019
|
+
const coordinateTransform = options?.transform || normalizeAffineTransform(attributes["spatial:transform"]) || // An ancestor grid mapping can be shared by several multiscale levels: it gives the CRS only.
|
|
16020
|
+
normalizeGDALGeoTransform(
|
|
16021
|
+
await getGridMapping().then((mapping) => mapping?.local ? mapping.attributes.GeoTransform : null)
|
|
16022
|
+
) || (!metadataOnly ? await loadCFCoordinateTransform(group2, arrayPath, spatialDimensions, signal) : null);
|
|
15867
16023
|
if (!coordinateTransform) {
|
|
15868
16024
|
throw new Error(
|
|
15869
|
-
"GeoZarrRasterSource requires spatial:transform metadata, explicit geozarr.transform, or regular 1D CF coordinate arrays."
|
|
16025
|
+
"GeoZarrRasterSource requires spatial:transform metadata, explicit geozarr.transform, a CF grid-mapping GeoTransform, or regular 1D CF coordinate arrays."
|
|
15870
16026
|
);
|
|
15871
16027
|
}
|
|
15872
16028
|
const declaredRegistration = normalizeRegistration(attributes["spatial:registration"]);
|
|
15873
16029
|
const transform = declaredRegistration === "node" ? convertNodeTransformToPixelTransform(coordinateTransform) : coordinateTransform;
|
|
15874
16030
|
const declaredBoundingBox = normalizeBoundingBox(attributes["spatial:bbox"]);
|
|
15875
16031
|
const boundingBox = declaredRegistration === "pixel" && declaredBoundingBox ? toRasterBoundingBox(declaredBoundingBox) : getTransformBoundingBox(transform, width, height);
|
|
15876
|
-
const coordinateReferenceSystem = options?.coordinateReferenceSystem || normalizeDeclaredCoordinateReferenceSystem(attributes) ||
|
|
16032
|
+
const coordinateReferenceSystem = options?.coordinateReferenceSystem || normalizeDeclaredCoordinateReferenceSystem(attributes) || getCFCoordinateReferenceSystem(
|
|
16033
|
+
(await getGridMapping())?.attributes || null,
|
|
16034
|
+
spatialDimensions
|
|
16035
|
+
);
|
|
15877
16036
|
const defaultSelection = options?.defaultSelection || {};
|
|
15878
16037
|
const selectionDimensions = dimensions.map((dimensionName, dimensionIndex) => ({
|
|
15879
16038
|
name: dimensionName,
|
|
@@ -15913,7 +16072,7 @@ var __exports__ = (() => {
|
|
|
15913
16072
|
transform,
|
|
15914
16073
|
registration: declaredRegistration
|
|
15915
16074
|
};
|
|
15916
|
-
return { group: group2, array: array2, metadata, xDimensionIndex, yDimensionIndex };
|
|
16075
|
+
return { group: group2, array: array2, metadata, xDimensionIndex, yDimensionIndex, layout };
|
|
15917
16076
|
}
|
|
15918
16077
|
};
|
|
15919
16078
|
function normalizeAttributes(attributes) {
|
|
@@ -15973,12 +16132,19 @@ var __exports__ = (() => {
|
|
|
15973
16132
|
translateY - (rotationY + scaleY) / 2
|
|
15974
16133
|
];
|
|
15975
16134
|
}
|
|
15976
|
-
async function loadCFCoordinateTransform(group2, spatialDimensions, signal) {
|
|
16135
|
+
async function loadCFCoordinateTransform(group2, arrayPath, spatialDimensions, signal) {
|
|
16136
|
+
let coordinates;
|
|
15977
16137
|
try {
|
|
15978
|
-
|
|
15979
|
-
loadCoordinateValues(group2, spatialDimensions[0], signal),
|
|
15980
|
-
loadCoordinateValues(group2, spatialDimensions[1], signal)
|
|
16138
|
+
coordinates = await Promise.all([
|
|
16139
|
+
loadCoordinateValues(group2, arrayPath, spatialDimensions[0], signal),
|
|
16140
|
+
loadCoordinateValues(group2, arrayPath, spatialDimensions[1], signal)
|
|
15981
16141
|
]);
|
|
16142
|
+
} catch (error) {
|
|
16143
|
+
rethrowUnlessAbsent(error);
|
|
16144
|
+
return null;
|
|
16145
|
+
}
|
|
16146
|
+
const [yCoordinates, xCoordinates] = coordinates;
|
|
16147
|
+
try {
|
|
15982
16148
|
const scaleX = getRegularCoordinateSpacing(xCoordinates, spatialDimensions[1]);
|
|
15983
16149
|
const scaleY = getRegularCoordinateSpacing(yCoordinates, spatialDimensions[0]);
|
|
15984
16150
|
return [scaleX, 0, xCoordinates[0] - scaleX / 2, 0, scaleY, yCoordinates[0] - scaleY / 2];
|
|
@@ -15986,11 +16152,8 @@ var __exports__ = (() => {
|
|
|
15986
16152
|
return null;
|
|
15987
16153
|
}
|
|
15988
16154
|
}
|
|
15989
|
-
async function loadCoordinateValues(group2, coordinateName, signal) {
|
|
15990
|
-
const coordinateArray = await
|
|
15991
|
-
kind: "array",
|
|
15992
|
-
signal
|
|
15993
|
-
});
|
|
16155
|
+
async function loadCoordinateValues(group2, arrayPath, coordinateName, signal) {
|
|
16156
|
+
const { array: coordinateArray } = await openNearestArray(group2, arrayPath, coordinateName, signal);
|
|
15994
16157
|
if (coordinateArray.shape.length !== 1 || coordinateArray.shape[0] < 2) {
|
|
15995
16158
|
throw new Error(
|
|
15996
16159
|
`Coordinate ${coordinateName} must be a one-dimensional array with at least two values.`
|
|
@@ -16002,6 +16165,23 @@ var __exports__ = (() => {
|
|
|
16002
16165
|
}
|
|
16003
16166
|
return Array.from(coordinateChunk.data);
|
|
16004
16167
|
}
|
|
16168
|
+
async function openNearestArray(group2, arrayPath, name, signal) {
|
|
16169
|
+
const segments = arrayPath.split("/").slice(0, -1);
|
|
16170
|
+
let lastError;
|
|
16171
|
+
for (let depth = segments.length; depth >= 0; depth--) {
|
|
16172
|
+
const path = [...segments.slice(0, depth), name].join("/");
|
|
16173
|
+
try {
|
|
16174
|
+
const array2 = await open(group2.resolve(path), { kind: "array", signal });
|
|
16175
|
+
return { array: array2, local: depth === segments.length };
|
|
16176
|
+
} catch (error) {
|
|
16177
|
+
if (!isZarritaError(error, "NotFoundError")) {
|
|
16178
|
+
throw error;
|
|
16179
|
+
}
|
|
16180
|
+
lastError = error;
|
|
16181
|
+
}
|
|
16182
|
+
}
|
|
16183
|
+
throw lastError;
|
|
16184
|
+
}
|
|
16005
16185
|
function getRegularCoordinateSpacing(coordinates, coordinateName) {
|
|
16006
16186
|
const spacing = (coordinates.at(-1) - coordinates[0]) / (coordinates.length - 1);
|
|
16007
16187
|
if (!Number.isFinite(spacing) || spacing === 0) {
|
|
@@ -16016,22 +16196,27 @@ var __exports__ = (() => {
|
|
|
16016
16196
|
}
|
|
16017
16197
|
return spacing;
|
|
16018
16198
|
}
|
|
16019
|
-
async function
|
|
16199
|
+
async function loadCFGridMapping(group2, arrayPath, attributes, signal) {
|
|
16020
16200
|
const gridMapping = normalizeString(attributes.grid_mapping);
|
|
16021
|
-
if (gridMapping)
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16201
|
+
if (!gridMapping) return null;
|
|
16202
|
+
const gridMappingName = gridMapping.trim().split(/[\s:]/, 1)[0];
|
|
16203
|
+
try {
|
|
16204
|
+
const { array: array2, local } = await openNearestArray(group2, arrayPath, gridMappingName, signal);
|
|
16205
|
+
return { attributes: normalizeAttributes(array2.attrs), local };
|
|
16206
|
+
} catch (error) {
|
|
16207
|
+
rethrowUnlessAbsent(error);
|
|
16208
|
+
return null;
|
|
16209
|
+
}
|
|
16210
|
+
}
|
|
16211
|
+
function rethrowUnlessAbsent(error) {
|
|
16212
|
+
if (!isZarritaError(error, "NotFoundError")) {
|
|
16213
|
+
throw error;
|
|
16214
|
+
}
|
|
16215
|
+
}
|
|
16216
|
+
function getCFCoordinateReferenceSystem(gridMappingAttributes, spatialDimensions) {
|
|
16217
|
+
const coordinateReferenceSystem = gridMappingAttributes && (normalizeString(gridMappingAttributes.crs_wkt) || normalizeString(gridMappingAttributes.spatial_ref) || normalizeString(gridMappingAttributes["proj:wkt2"]) || normalizeString(gridMappingAttributes["proj:code"]));
|
|
16218
|
+
if (coordinateReferenceSystem) {
|
|
16219
|
+
return coordinateReferenceSystem;
|
|
16035
16220
|
}
|
|
16036
16221
|
const normalizedDimensions = spatialDimensions.map((dimension) => dimension.toLowerCase());
|
|
16037
16222
|
if (["lat", "latitude"].includes(normalizedDimensions[0]) && ["lon", "longitude"].includes(normalizedDimensions[1])) {
|
|
@@ -16039,6 +16224,35 @@ var __exports__ = (() => {
|
|
|
16039
16224
|
}
|
|
16040
16225
|
return void 0;
|
|
16041
16226
|
}
|
|
16227
|
+
function normalizeGDALGeoTransform(value) {
|
|
16228
|
+
const coefficients = typeof value === "string" ? value.trim().split(/\s+/).map(Number) : value;
|
|
16229
|
+
if (!Array.isArray(coefficients) || coefficients.length !== 6 || coefficients.some((coefficient) => typeof coefficient !== "number" || !Number.isFinite(coefficient))) {
|
|
16230
|
+
return null;
|
|
16231
|
+
}
|
|
16232
|
+
const [originX, pixelWidth, rotationX, originY, rotationY, pixelHeight] = coefficients;
|
|
16233
|
+
if (pixelWidth === 0 || pixelHeight === 0) return null;
|
|
16234
|
+
return [pixelWidth, rotationX, originX, rotationY, pixelHeight, originY];
|
|
16235
|
+
}
|
|
16236
|
+
function getOMELevelsOrEmpty(attributes, arrayPath) {
|
|
16237
|
+
try {
|
|
16238
|
+
return getSpatialMultiscaleLevels(attributes, arrayPath, { spatialOME: true });
|
|
16239
|
+
} catch {
|
|
16240
|
+
return [];
|
|
16241
|
+
}
|
|
16242
|
+
}
|
|
16243
|
+
function declaresCoordinateReferenceSystem(attributes) {
|
|
16244
|
+
return Boolean(
|
|
16245
|
+
normalizeDeclaredCoordinateReferenceSystem(attributes) || normalizeString(attributes.grid_mapping)
|
|
16246
|
+
);
|
|
16247
|
+
}
|
|
16248
|
+
function isConsistentOMELevel(scale, selectedScale, level, selected) {
|
|
16249
|
+
return selected.spatialDimensions.every((dimension, index) => {
|
|
16250
|
+
const coefficient = index === 0 ? 4 : 0;
|
|
16251
|
+
const expected = Math.abs(scale[dimension] / selectedScale[dimension]);
|
|
16252
|
+
const actual = Math.abs(level.transform[coefficient] / selected.transform[coefficient]);
|
|
16253
|
+
return Number.isFinite(expected) && Math.abs(actual - expected) <= expected * 1e-6;
|
|
16254
|
+
});
|
|
16255
|
+
}
|
|
16042
16256
|
function getTransformBoundingBox(transform, width, height) {
|
|
16043
16257
|
const corners = [
|
|
16044
16258
|
transformPosition(transform, 0, 0),
|
|
@@ -16228,12 +16442,12 @@ var __exports__ = (() => {
|
|
|
16228
16442
|
return projection && typeof projection === "object" && !Array.isArray(projection) ? projection : void 0;
|
|
16229
16443
|
}
|
|
16230
16444
|
|
|
16231
|
-
// src/zarr/zarr-array-
|
|
16232
|
-
var
|
|
16445
|
+
// src/zarr/zarr-array-loader.ts
|
|
16446
|
+
var ZarrArrayLoaderWithParser = {
|
|
16233
16447
|
dataType: null,
|
|
16234
16448
|
dataSource: null,
|
|
16235
16449
|
batchType: null,
|
|
16236
|
-
name: "
|
|
16450
|
+
name: "ZarrArrayLoader",
|
|
16237
16451
|
id: "zarr-array",
|
|
16238
16452
|
module: "scientific",
|
|
16239
16453
|
version: "latest",
|
|
@@ -16261,7 +16475,7 @@ var __exports__ = (() => {
|
|
|
16261
16475
|
zarrArray: { path: void 0, dimensions: void 0 }
|
|
16262
16476
|
},
|
|
16263
16477
|
testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
|
|
16264
|
-
|
|
16478
|
+
createDataSourceSync: (data, options, coreApi2) => new ZarrArraySource(data, options, coreApi2)
|
|
16265
16479
|
};
|
|
16266
16480
|
var ZarrArraySource = class extends ZarrSource {
|
|
16267
16481
|
/** Cached array initialization. */
|
|
@@ -16353,15 +16567,15 @@ var __exports__ = (() => {
|
|
|
16353
16567
|
return typeof selector === "object" && selector !== null;
|
|
16354
16568
|
}
|
|
16355
16569
|
|
|
16356
|
-
// src/zarr/spatial-data-
|
|
16357
|
-
var
|
|
16570
|
+
// src/zarr/spatial-data-loader.ts
|
|
16571
|
+
var SpatialDataLoaderWithParser = {
|
|
16358
16572
|
dataType: null,
|
|
16359
16573
|
dataSource: null,
|
|
16360
16574
|
batchType: null,
|
|
16361
|
-
name: "
|
|
16575
|
+
name: "SpatialDataLoader",
|
|
16362
16576
|
id: "spatial-data",
|
|
16363
16577
|
module: "scientific",
|
|
16364
|
-
version:
|
|
16578
|
+
version: OMEZarrLoaderWithParser.version,
|
|
16365
16579
|
extensions: ["zarr"],
|
|
16366
16580
|
mimeTypes: [],
|
|
16367
16581
|
type: "spatial-data",
|
|
@@ -16384,7 +16598,7 @@ var __exports__ = (() => {
|
|
|
16384
16598
|
}
|
|
16385
16599
|
},
|
|
16386
16600
|
testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
|
|
16387
|
-
|
|
16601
|
+
createDataSourceSync: (data, options, coreApi2) => new SpatialDataSource(data, options, coreApi2)
|
|
16388
16602
|
};
|
|
16389
16603
|
var SpatialDataSource = class extends ZarrSource {
|
|
16390
16604
|
/** Shared normalized metadata discovery request. */
|