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