@loaders.gl/scientific 0.0.0-stage → 5.0.0-alpha.13
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 +21 -2
- package/dist/index.cjs +4313 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/netcdf/bundled.cjs +1394 -0
- package/dist/netcdf/bundled.d.ts +2 -0
- package/dist/netcdf/bundled.d.ts.map +1 -0
- package/dist/netcdf/bundled.js +5 -0
- package/dist/netcdf/bundled.js.map +1 -0
- package/dist/netcdf/index.cjs +1394 -0
- package/dist/netcdf/index.cjs.map +6 -0
- package/dist/netcdf/index.d.ts +7 -0
- package/dist/netcdf/index.d.ts.map +1 -0
- package/dist/netcdf/index.js +8 -0
- package/dist/netcdf/index.js.map +1 -0
- package/dist/netcdf/iobuffer/iobuffer.d.ts +253 -0
- package/dist/netcdf/iobuffer/iobuffer.d.ts.map +1 -0
- package/dist/netcdf/iobuffer/iobuffer.js +450 -0
- package/dist/netcdf/iobuffer/iobuffer.js.map +1 -0
- package/dist/netcdf/netcdf-format.cjs +39 -0
- package/dist/netcdf/netcdf-format.d.ts +11 -0
- package/dist/netcdf/netcdf-format.d.ts.map +1 -0
- package/dist/netcdf/netcdf-format.js +14 -0
- package/dist/netcdf/netcdf-format.js.map +1 -0
- package/dist/netcdf/netcdf-loader-with-parser.cjs +995 -0
- package/dist/netcdf/netcdf-loader-with-parser.d.ts +60 -0
- package/dist/netcdf/netcdf-loader-with-parser.d.ts.map +1 -0
- package/dist/netcdf/netcdf-loader-with-parser.js +35 -0
- package/dist/netcdf/netcdf-loader-with-parser.js.map +1 -0
- package/dist/netcdf/netcdf-loader.cjs +84 -0
- package/dist/netcdf/netcdf-loader.d.ts +81 -0
- package/dist/netcdf/netcdf-loader.d.ts.map +1 -0
- package/dist/netcdf/netcdf-loader.js +41 -0
- package/dist/netcdf/netcdf-loader.js.map +1 -0
- package/dist/netcdf/netcdf-source-loader-types.cjs +78 -0
- package/dist/netcdf/netcdf-source-loader-types.d.ts +28 -0
- package/dist/netcdf/netcdf-source-loader-types.d.ts.map +1 -0
- package/dist/netcdf/netcdf-source-loader-types.js +32 -0
- package/dist/netcdf/netcdf-source-loader-types.js.map +1 -0
- package/dist/netcdf/netcdf-source-loader.cjs +1319 -0
- package/dist/netcdf/netcdf-source-loader.d.ts +59 -0
- package/dist/netcdf/netcdf-source-loader.d.ts.map +1 -0
- package/dist/netcdf/netcdf-source-loader.js +421 -0
- package/dist/netcdf/netcdf-source-loader.js.map +1 -0
- package/dist/netcdf/netcdfjs/netcdf-reader.d.ts +68 -0
- package/dist/netcdf/netcdfjs/netcdf-reader.d.ts.map +1 -0
- package/dist/netcdf/netcdfjs/netcdf-reader.js +172 -0
- package/dist/netcdf/netcdfjs/netcdf-reader.js.map +1 -0
- package/dist/netcdf/netcdfjs/netcdf-types.d.ts +70 -0
- package/dist/netcdf/netcdfjs/netcdf-types.d.ts.map +1 -0
- package/dist/netcdf/netcdfjs/netcdf-types.js +3 -0
- package/dist/netcdf/netcdfjs/netcdf-types.js.map +1 -0
- package/dist/netcdf/netcdfjs/read-data.d.ts +19 -0
- package/dist/netcdf/netcdfjs/read-data.d.ts.map +1 -0
- package/dist/netcdf/netcdfjs/read-data.js +51 -0
- package/dist/netcdf/netcdfjs/read-data.js.map +1 -0
- package/dist/netcdf/netcdfjs/read-header.d.ts +16 -0
- package/dist/netcdf/netcdfjs/read-header.d.ts.map +1 -0
- package/dist/netcdf/netcdfjs/read-header.js +227 -0
- package/dist/netcdf/netcdfjs/read-header.js.map +1 -0
- package/dist/netcdf/netcdfjs/read-type.d.ts +36 -0
- package/dist/netcdf/netcdfjs/read-type.d.ts.map +1 -0
- package/dist/netcdf/netcdfjs/read-type.js +135 -0
- package/dist/netcdf/netcdfjs/read-type.js.map +1 -0
- package/dist/netcdf/unbundled.cjs +1394 -0
- package/dist/netcdf/unbundled.d.ts +2 -0
- package/dist/netcdf/unbundled.d.ts.map +1 -0
- package/dist/netcdf/unbundled.js +5 -0
- package/dist/netcdf/unbundled.js.map +1 -0
- package/dist/netcdf.dev.js +3153 -0
- package/dist/netcdf.min.js +12 -0
- package/dist/zarr/bundled.d.ts +2 -0
- package/dist/zarr/bundled.d.ts.map +1 -0
- package/dist/zarr/bundled.js +5 -0
- package/dist/zarr/bundled.js.map +1 -0
- package/dist/zarr/geo-zarr-source-loader.d.ts +121 -0
- package/dist/zarr/geo-zarr-source-loader.d.ts.map +1 -0
- package/dist/zarr/geo-zarr-source-loader.js +692 -0
- package/dist/zarr/geo-zarr-source-loader.js.map +1 -0
- package/dist/zarr/index.cjs +14747 -0
- package/dist/zarr/index.cjs.map +6 -0
- package/dist/zarr/index.d.ts +11 -0
- package/dist/zarr/index.d.ts.map +1 -0
- package/dist/zarr/index.js +10 -0
- package/dist/zarr/index.js.map +1 -0
- package/dist/zarr/lib/consolidated-zarr.d.ts +31 -0
- package/dist/zarr/lib/consolidated-zarr.d.ts.map +1 -0
- package/dist/zarr/lib/consolidated-zarr.js +113 -0
- package/dist/zarr/lib/consolidated-zarr.js.map +1 -0
- package/dist/zarr/lib/load-zarr.d.ts +11 -0
- package/dist/zarr/lib/load-zarr.d.ts.map +1 -0
- package/dist/zarr/lib/load-zarr.js +22 -0
- package/dist/zarr/lib/load-zarr.js.map +1 -0
- package/dist/zarr/lib/spatial-multiscales.d.ts +14 -0
- package/dist/zarr/lib/spatial-multiscales.d.ts.map +1 -0
- package/dist/zarr/lib/spatial-multiscales.js +34 -0
- package/dist/zarr/lib/spatial-multiscales.js.map +1 -0
- package/dist/zarr/lib/utils.d.ts +28 -0
- package/dist/zarr/lib/utils.d.ts.map +1 -0
- package/dist/zarr/lib/utils.js +137 -0
- package/dist/zarr/lib/utils.js.map +1 -0
- package/dist/zarr/lib/zarr-data-cache.d.ts +13 -0
- package/dist/zarr/lib/zarr-data-cache.d.ts.map +1 -0
- package/dist/zarr/lib/zarr-data-cache.js +70 -0
- package/dist/zarr/lib/zarr-data-cache.js.map +1 -0
- package/dist/zarr/lib/zarr-pixel-source.d.ts +41 -0
- package/dist/zarr/lib/zarr-pixel-source.d.ts.map +1 -0
- package/dist/zarr/lib/zarr-pixel-source.js +97 -0
- package/dist/zarr/lib/zarr-pixel-source.js.map +1 -0
- package/dist/zarr/lib/zarrita-pixel-source.d.ts +40 -0
- package/dist/zarr/lib/zarrita-pixel-source.d.ts.map +1 -0
- package/dist/zarr/lib/zarrita-pixel-source.js +96 -0
- package/dist/zarr/lib/zarrita-pixel-source.js.map +1 -0
- package/dist/zarr/ome-zarr-source-loader.d.ts +195 -0
- package/dist/zarr/ome-zarr-source-loader.d.ts.map +1 -0
- package/dist/zarr/ome-zarr-source-loader.js +523 -0
- package/dist/zarr/ome-zarr-source-loader.js.map +1 -0
- package/dist/zarr/spatial-data-source.d.ts +95 -0
- package/dist/zarr/spatial-data-source.d.ts.map +1 -0
- package/dist/zarr/spatial-data-source.js +242 -0
- package/dist/zarr/spatial-data-source.js.map +1 -0
- package/dist/zarr/types.d.ts +105 -0
- package/dist/zarr/types.d.ts.map +1 -0
- package/dist/zarr/types.js +5 -0
- package/dist/zarr/types.js.map +1 -0
- package/dist/zarr/unbundled.d.ts +2 -0
- package/dist/zarr/unbundled.d.ts.map +1 -0
- package/dist/zarr/unbundled.js +5 -0
- package/dist/zarr/unbundled.js.map +1 -0
- package/dist/zarr/zarr-array-source.d.ts +102 -0
- package/dist/zarr/zarr-array-source.d.ts.map +1 -0
- package/dist/zarr/zarr-array-source.js +132 -0
- package/dist/zarr/zarr-array-source.js.map +1 -0
- package/dist/zarr/zarr-loader-types.d.ts +236 -0
- package/dist/zarr/zarr-loader-types.d.ts.map +1 -0
- package/dist/zarr/zarr-loader-types.js +128 -0
- package/dist/zarr/zarr-loader-types.js.map +1 -0
- package/dist/zarr.dev.js +16574 -0
- package/dist/zarr.min.js +79 -0
- package/package.json +62 -4
- package/src/index.ts +52 -0
- package/src/netcdf/bundled.ts +5 -0
- package/src/netcdf/index.ts +14 -0
- package/src/netcdf/iobuffer/iobuffer.ts +510 -0
- package/src/netcdf/netcdf-format.ts +16 -0
- package/src/netcdf/netcdf-loader-with-parser.ts +54 -0
- package/src/netcdf/netcdf-loader.ts +62 -0
- package/src/netcdf/netcdf-source-loader-types.ts +45 -0
- package/src/netcdf/netcdf-source-loader.ts +526 -0
- package/src/netcdf/netcdfjs/LICENSE +24 -0
- package/src/netcdf/netcdfjs/netcdf-reader.ts +196 -0
- package/src/netcdf/netcdfjs/netcdf-types.ts +75 -0
- package/src/netcdf/netcdfjs/read-data.ts +71 -0
- package/src/netcdf/netcdfjs/read-header.ts +277 -0
- package/src/netcdf/netcdfjs/read-type.ts +147 -0
- package/src/netcdf/unbundled.ts +5 -0
- package/src/zarr/bundled.ts +5 -0
- package/src/zarr/geo-zarr-source-loader.ts +998 -0
- package/src/zarr/index.ts +60 -0
- package/src/zarr/lib/consolidated-zarr.ts +190 -0
- package/src/zarr/lib/load-zarr.ts +31 -0
- package/src/zarr/lib/spatial-multiscales.ts +47 -0
- package/src/zarr/lib/utils.ts +162 -0
- package/src/zarr/lib/zarr-data-cache.ts +91 -0
- package/src/zarr/lib/zarr-pixel-source.ts +134 -0
- package/src/zarr/lib/zarrita-pixel-source.ts +141 -0
- package/src/zarr/ome-zarr-source-loader.ts +837 -0
- package/src/zarr/spatial-data-source.ts +370 -0
- package/src/zarr/types.ts +129 -0
- package/src/zarr/unbundled.ts +5 -0
- package/src/zarr/zarr-array-source.ts +225 -0
- package/src/zarr/zarr-loader-types.ts +166 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if (typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
|
+
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
|
+
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
+
"use strict";var __exports__=(()=>{var zt=Object.create;var J=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Qt=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty;var D=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var Zt=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Yt=(t,e)=>{for(var r in e)J(t,r,{get:e[r],enumerable:!0})},nt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Gt(e))!Jt.call(t,s)&&s!==r&&J(t,s,{get:()=>e[s],enumerable:!(n=Vt(e,s))||n.enumerable});return t};var Kt=(t,e,r)=>(r=t!=null?zt(Qt(t)):{},nt(e||!t||!t.__esModule?J(r,"default",{value:t,enumerable:!0}):r,t)),Xt=t=>nt(J({},"__esModule",{value:!0}),t);var ot=Zt((Yr,st)=>{st.exports=globalThis.loaders});var re,It=D(()=>{"use strict";re=class t{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;textDecoder=new TextDecoder;textEncoder=new TextEncoder;constructor(e=8192,r={}){let n=!1;typeof e=="number"?e=new ArrayBuffer(e):(n=!0,this.lastWrittenByte=e.byteLength);let s=r.offset?r.offset>>>0:0,o=e.byteLength-s,c=s;(ArrayBuffer.isView(e)||e instanceof t)&&(e.byteLength!==e.buffer.byteLength&&(c=e.byteOffset+s),e=e.buffer),n?this.lastWrittenByte=o:this.lastWrittenByte=0,this.buffer=e,this.length=o,this.byteLength=o,this.byteOffset=c,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,c,o),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){let e=this._marks.pop();if(e===void 0)throw new Error("Mark stack empty");return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){let n=(this.offset+e)*2,s=new Uint8Array(n);s.set(new Uint8Array(this.buffer)),this.buffer=s.buffer,this.length=this.byteLength=n,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){let r=new Uint8Array(e);for(let n=0;n<e;n++)r[n]=this.readByte();return r}readInt16(){let e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){let e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){let e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){let e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){let e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){let e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let r="";for(let n=0;n<e;n++)r+=this.readChar();return r}readUtf8(e=1){return this.textDecoder.decode(this.readBytes(e))}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let r=0;r<e.length;r++)this._data.setUint8(this.offset++,e[r]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let r=0;r<e.length;r++)this.writeUint8(e.charCodeAt(r));return this}writeUtf8(e){let r=this.textEncoder.encode(e);return this.writeBytes(r)}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}});function G(t,e,r){switch(e){case p.BYTE:return t.readBytes(r);case p.CHAR:return Nr(t.readChars(r));case p.SHORT:return ne(r,t.readInt16.bind(t));case p.INT:return ne(r,t.readInt32.bind(t));case p.FLOAT:return ne(r,t.readFloat32.bind(t));case p.DOUBLE:return ne(r,t.readFloat64.bind(t));default:throw new Error(`NetCDF: non valid type ${e}`)}}function Ge(t){switch(Number(t)){case p.BYTE:return"byte";case p.CHAR:return"char";case p.SHORT:return"short";case p.INT:return"int";case p.FLOAT:return"float";case p.DOUBLE:return"double";default:return"undefined"}}function Ut(t){switch(Number(t)){case p.BYTE:return 1;case p.CHAR:return 1;case p.SHORT:return 2;case p.INT:return 4;case p.FLOAT:return 4;case p.DOUBLE:return 8;default:return-1}}function Qe(t){switch(String(t)){case"byte":return p.BYTE;case"char":return p.CHAR;case"short":return p.SHORT;case"int":return p.INT;case"float":return p.FLOAT;case"double":return p.DOUBLE;default:return-1}}function ne(t,e){if(t!==1){let r=new Array(t);for(let n=0;n<t;n++)r[n]=e();return r}return e()}function Nr(t){return t.charCodeAt(t.length-1)===0?t.substring(0,t.length-1):t}var p,Je=D(()=>{"use strict";p={BYTE:1,CHAR:2,SHORT:3,INT:4,FLOAT:5,DOUBLE:6}});function Pt(t,e){let r=t.readUint32(),n=Ir(t),s=Ot(t),o=Ur(t,n.recordId,e);return{version:e,recordDimension:{length:r,id:n.recordId,name:n.recordName,recordStep:o.recordStep},dimensions:n.dimensions,variables:o.variables,attributes:s}}function Ir(t){let e=t.readUint32();if(e===k){if(t.readUint32()!==k)throw new Error("NetCDF: wrong empty tag for list of dimensions");return{recordId:0,recordName:"",dimensions:[]}}if(e!==Lr)throw new Error("NetCDF: wrong tag for list of dimensions");let r=t.readUint32(),n=new Array(r),s,o;for(let c=0;c<r;c++){let d=Ze(t),h=t.readUint32();h===Dr&&(s=c,o=d),n[c]={name:d,size:h}}return{dimensions:n,recordId:s,recordName:o}}function Ot(t){let e=t.readUint32();if(e===k){if(t.readUint32()!==k)throw new Error("NetCDF: wrong empty tag for list of attributes");return[]}if(e!==Fr)throw new Error("NetCDF: wrong tag for list of attributes");let r=t.readUint32(),n=new Array(r);for(let s=0;s<r;s++){let o=Ze(t),c=t.readUint32();if(c<1||c>6)throw new Error(`NetCDF: non valid type ${c}`);let d=t.readUint32(),h=G(t,c,d);kt(t),n[s]={name:o,type:Ge(c),value:h}}return n}function Ur(t,e,r){let n=t.readUint32(),s=0;if(n===k){if(t.readUint32()!==k)throw new Error("NetCDF: wrong empty tag for list of variables");return{recordStep:s,variables:[]}}if(n!==vr)throw new Error("NetCDF: wrong tag for list of variables");let o=t.readUint32(),c=new Array(o);for(let d=0;d<o;d++){let h=Ze(t),a=t.readUint32(),l=new Array(a);for(let w=0;w<a;w++)l[w]=t.readUint32();let f=Ot(t),u=t.readUint32();if(u<1&&u>6)throw new Error(`NetCDF: non valid type ${u}`);let g=t.readUint32(),m=t.readUint32();if(r===2){if(m>0)throw new Error("NetCDF: offsets larger than 4GB not supported");m=t.readUint32()}let b=!1;typeof e<"u"&&l[0]===e&&(s+=g,b=!0),c[d]={name:h,dimensions:l,attributes:f,type:Ge(u),size:g,offset:m,record:b}}return{variables:c,recordStep:s}}function Ze(t){let e=t.readUint32(),r=t.readChars(e);return kt(t),r}function kt(t){t.offset%4!==0&&t.skip(4-t.offset%4)}var k,Lr,vr,Fr,Dr,jt=D(()=>{"use strict";Je();k=0,Lr=10,vr=11,Fr=12,Dr=0});function $t(t,e){let r=Qe(e.type),n=e.size/Ut(r),s=new Array(n);for(let o=0;o<n;o++)s[o]=G(t,r,1);return s}function Ht(t,e,r,n){let s=Qe(e.type),o=e.dimensions.filter(a=>a!==r.id).reduce((a,l)=>a*n[l].size,1),c=r.length,d=new Array(c),h=r.recordStep;for(let a=0;a<c;a++){let l=t.offset;d[a]=G(t,s,o),t.seek(l+h)}return d}var qt=D(()=>{"use strict";Je()});var A,Ye=D(()=>{"use strict";It();jt();qt();A=class{header;buffer;constructor(e){let r=new re(e);r.setBigEndian();let n=r.readChars(3);if(n!=="CDF")throw new Error(`NetCDF: file should start with 'CDF', found ${n}`);let s=r.readByte();if(s>2)throw new Error(`NetCDF: unsupported version ${s}`);this.header=Pt(r,s),this.buffer=r}get version(){return this.header.version===1?"classic format":"64-bit offset format"}get recordDimension(){return this.header.recordDimension}get dimensions(){return this.header.dimensions}get attributes(){return this.header.attributes}get variables(){return this.header.variables}attributeExists(e){return this.attributes.find(n=>n.name===e)!==void 0}getAttribute(e){let r=this.attributes.find(n=>n.name===e);return r?r.value:null}dataVariableExists(e){return this.header.variables.find(function(n){return n.name===e})!==void 0}getDataVariableAsString(e){let r=this.getDataVariable(e);return r?r.join(""):null}getDataVariable(e){let r;if(typeof e=="string"?r=this.header.variables.find(function(n){return n.name===e}):r=e,r===void 0){let n;throw typeof e=="string"?n=e:typeof e=="object"&&(n=JSON.stringify(e)),new Error(`NetCDF: variable not found: ${n}`)}return this.buffer.seek(r.offset),r.record?Ht(this.buffer,r,this.header.recordDimension,this.header.dimensions):$t(this.buffer,r)}toString(){let e=[];e.push("DIMENSIONS");for(let n of this.dimensions)e.push(` ${n.name.padEnd(30)} = size: ${n.size}`);e.push(""),e.push("GLOBAL ATTRIBUTES");for(let n of this.attributes)e.push(` ${n.name.padEnd(30)} = ${n.value}`);let r=JSON.parse(JSON.stringify(this.variables));e.push(""),e.push("VARIABLES:");for(let n of r){n.value=this.getDataVariable(n);let s=JSON.stringify(n.value);s.length>50&&(s=s.substring(0,50)),Number.isNaN(n.value.length)||(s+=` (length: ${n.value.length})`),e.push(` ${n.name.padEnd(30)} = ${s}`)}return e.join(`
|
|
8
|
+
`)}}});var Q,Ke=D(()=>{"use strict";Q={name:"NetCDF",id:"netcdf",module:"netcdf",encoding:"binary",format:"netcdf",extensions:["cdf","nc"],mimeTypes:["application/x-netcdf"],binary:!0}});var Jr={};Yt(Jr,{FetchError:()=>i.FetchError,JSONLoader:()=>qe,NetCDFFormat:()=>Q,NetCDFReader:()=>A,NetCDFSourceLoader:()=>oe,NullLoader:()=>i.NullLoader,NullWorkerLoader:()=>i.NullWorkerLoader,RequestScheduler:()=>O,_BrowserFileSystem:()=>i._BrowserFileSystem,_fetchProgress:()=>i._fetchProgress,_selectSource:()=>i._selectSource,_unregisterLoaders:()=>i._unregisterLoaders,assert:()=>ce,concatenateArrayBuffersAsync:()=>Ie,coreApi:()=>i.coreApi,createDataSource:()=>i.createDataSource,document:()=>de,encode:()=>i.encode,encodeInBatches:()=>i.encodeInBatches,encodeSync:()=>i.encodeSync,encodeTable:()=>i.encodeTable,encodeTableAsText:()=>i.encodeTableAsText,encodeTableInBatches:()=>i.encodeTableInBatches,encodeText:()=>i.encodeText,encodeTextSync:()=>i.encodeTextSync,encodeURLtoURL:()=>i.encodeURLtoURL,fetchFile:()=>i.fetchFile,forEach:()=>De,getLoaderOptions:()=>i.getLoaderOptions,getPathPrefix:()=>He,global:()=>le,isAsyncIterable:()=>Se,isBrowser:()=>he,isIterable:()=>Ae,isIterator:()=>_e,isPromise:()=>Ee,isPureObject:()=>q,isReadableStream:()=>Ce,isResponse:()=>Re,isWorker:()=>pe,isWritableStream:()=>Be,load:()=>i.load,loadInBatches:()=>i.loadInBatches,makeIterator:()=>i.makeIterator,makeLineIterator:()=>ve,makeNumberedLineIterator:()=>Fe,makeStream:()=>i.makeStream,makeTextDecoderIterator:()=>Ne,makeTextEncoderIterator:()=>Le,parse:()=>i.parse,parseFile:()=>i.parseFile,parseInBatches:()=>i.parseInBatches,parseSync:()=>i.parseSync,preload:()=>i.preload,preloadSync:()=>i.preloadSync,readArrayBuffer:()=>i.readArrayBuffer,registerLoaders:()=>i.registerLoaders,resolvePath:()=>z,selectLoader:()=>i.selectLoader,selectLoaderSync:()=>i.selectLoaderSync,self:()=>ue,setLoaderOptions:()=>i.setLoaderOptions,setPathPrefix:()=>$e,window:()=>fe});var i=Kt(ot(),1);function ce(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var T={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ue=T.self||T.window||T.global||{},fe=T.window||T.self||T.global||{},le=T.global||T.self||T.window||{},de=T.document||{};var he=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),pe=typeof importScripts=="function",it=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),er=it&&parseFloat(it[1])||0;var j=globalThis,tr=globalThis.document||{},Z=globalThis.process||{},rr=globalThis.console,nr=globalThis.navigator||{};function Y(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let e=typeof navigator<"u"&&navigator.userAgent,r=t||e;return!!(r&&r.indexOf("Electron")>=0)}function R(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Y()}var me="5.0.0";function I(t,e){if(!t)throw new Error(e||"Assertion failed")}function K(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return I(Number.isFinite(e)&&e>=0),e}function ge(t){let{logLevel:e,message:r}=t;t.logLevel=K(e);let n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let s=typeof t.message;return I(s==="string"||s==="object"),Object.assign(t,{args:n},t.opts)}var C=()=>{},L=class{constructor({level:e=0}={}){this.userData={},this._onceCache=new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...r){return this._log("warn",0,e,r,{once:!0})}error(e,...r){return this._log("error",0,e,r)}log(e,r,...n){return this._log("log",e,r,n)}info(e,r,...n){return this._log("info",e,r,n)}once(e,r,...n){return this._log("once",e,r,n,{once:!0})}_log(e,r,n,s,o={}){let c=ge({logLevel:r,message:n,args:this._buildArgs(r,n,s),opts:o});return this._createLogFunction(e,c,o)}_buildArgs(e,r,n){return[e,r,...n]}_createLogFunction(e,r,n){if(!this._shouldLog(r.logLevel))return C;let s=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&s!==void 0){if(this._onceCache.has(s))return C;this._onceCache.add(s)}return this._emit(e,r)}_shouldLog(e){return this.getLevel()>=K(e)}_getOnceTag(e){if(e!==void 0)try{return typeof e=="string"?e:String(e)}catch{return}}};function or(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var $=class{constructor(e,r,n="sessionStorage"){this.storage=or(n),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function at(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function ye(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var H;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(H||(H={}));var ir=10;function ct(t){return typeof t!="string"?t:(t=t.toUpperCase(),H[t]||H.WHITE)}function be(t,e,r){return!R&&typeof t=="string"&&(e&&(t=`\x1B[${ct(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${ct(r)+ir}m${t}\x1B[49m`)),t}function we(t,e=["constructor"]){let r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),s=t;for(let o of n){let c=s[o];typeof c=="function"&&(e.find(d=>o===d)||(s[o]=c.bind(t)))}}var X=class{getHighResolutionTimer(){let e;if(R()&&j.performance)e=j?.performance?.now?.();else if("hrtime"in Z){let r=Z?.hrtime?.();e=r[0]*1e3+r[1]/1e6}else e=Date.now();return e}getMemoryUsageMB(){let r=j?.performance?.memory?.usedJSHeapSize;return r==null?null:Math.trunc(r/1024/1024)}},x=new X;globalThis.Probe=X;globalThis.probe=x;var U={debug:R()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},xe={enabled:!0,level:0},E=class extends L{constructor({id:e}={id:""}){super({level:0}),this.VERSION=me,this._startTs=x.getHighResolutionTimer(),this._deltaTs=x.getHighResolutionTimer(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new $(`__probe-${this.id}__`,{[this.id]:xe}),this.timeStamp(`${this.id} started`),we(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((x.getHighResolutionTimer()-this._startTs).toPrecision(10))}getDelta(){return Number((x.getHighResolutionTimer()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,r){this._updateConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e,...r){return this._log("warn",0,e,r,{method:U.warn,once:!0})}error(e,...r){return this._log("error",0,e,r,{method:U.error})}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r,...n){let s=x.getMemoryUsageMB();if(s!==null){let o=`${s}MB `;typeof r=="function"?r=()=>`${o}${r()}`:typeof r=="string"&&(r=`${o}${r}`)}return this._log("log",e,r,n,{method:U.log,time:!0,once:!0})}log(e,r,...n){return this._log("log",e,r,n,{method:U.debug})}info(e,r,...n){return this._log("info",e,r,n,{method:console.info})}once(e,r,...n){return this._log("once",e,r,n,{method:U.debug||U.info,once:!0})}table(e,r,n){return r?this._log("table",e,r,n&&[n]||[],{method:console.table||C,tag:cr(r)}):C}time(e,r){return this._log("time",e,r,[],{method:console.time?console.time:console.info})}timeEnd(e,r){return this._log("time",e,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,r){return this._log("time",e,r,[],{method:console.timeStamp||C})}group(e,r,n={collapsed:!1}){let s=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,r,[],{method:s})}groupCollapsed(e,r,n={}){return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||C})}withGroup(e,r,n){this.group(e,r)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,r){let n=r.method;I(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=x.getHighResolutionTimer();let s=ar(this.id,r.message,r);return n.bind(console,s,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(xe),this._storage.config[this.id]}_updateConfiguration(e){let r=this._storage.config[this.id]||{...xe};this._storage.setConfiguration({[this.id]:{...r,...e}})}};E.VERSION=me;function ar(t,e,r){if(typeof e=="string"){let n=r.time?ye(at(r.total)):"";e=r.time?`${t}: ${n} ${e}`:`${t}: ${e}`,e=be(e,r.color,r.background)}return e}function cr(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe||(globalThis.probe=x);var es=new E({id:"@probe.gl/log"});var Te="5.0.0-alpha.13",ur=Te[0]>="0"&&Te[0]<="9"?`v${Te}`:"";function fr(){let t=new E({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=t,globalThis.loaders.version=ur,globalThis.probe||={},globalThis.probe.loaders=t,t}var ut=fr();var ft=t=>typeof t=="boolean",y=t=>typeof t=="function",B=t=>t!==null&&typeof t=="object",q=t=>B(t)&&t.constructor==={}.constructor;var Ee=t=>B(t)&&"then"in t&&y(t.then),Ae=t=>!!t&&y(t[Symbol.iterator]),Se=t=>!!t&&y(t[Symbol.asyncIterator]),_e=t=>!!t&&y(t.next),Re=t=>typeof Response<"u"&&t instanceof Response||B(t)&&y(t.arrayBuffer)&&y(t.text)&&y(t.json);var lt=t=>B(t)&&y(t.abort)&&y(t.getWriter),dt=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||B(t)&&y(t.tee)&&y(t.cancel)&&y(t.getReader),ht=t=>B(t)&&y(t.end)&&y(t.write)&&ft(t.writable),pt=t=>B(t)&&y(t.read)&&y(t.pipe)&&ft(t.readable),Ce=t=>dt(t)||pt(t),Be=t=>lt(t)||ht(t);function ee(t,e){return mt(t||{},e)}function mt(t,e,r=0){if(r>3)return e;let n={...t};for(let[s,o]of Object.entries(e))q(o)?n[s]=mt(n[s]||{},e[s],r+1):n[s]=e[s];return n}function gt(...t){return lr(t)}function lr(t){let e=t.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=e.reduce((o,c)=>o+c.byteLength,0),n=new Uint8Array(r),s=0;for(let o of e)n.set(o,s),s+=o.byteLength;return n.buffer}async function*Ne(t,e={}){let r=new TextDecoder(void 0,e);for await(let n of t)yield typeof n=="string"?n:r.decode(n,{stream:!0})}async function*Le(t){let e=new TextEncoder;for await(let r of t)yield typeof r=="string"?e.encode(r).buffer:r}async function*ve(t){let e="";for await(let r of t){e+=r;let n;for(n=e.indexOf(`
|
|
9
|
+
`);n>=0;){let s=e.slice(0,n+1);e=e.slice(n+1),yield s,n=e.indexOf(`
|
|
10
|
+
`)}}e.length>0&&(yield e)}async function*Fe(t){let e=1;for await(let r of t)yield{counter:e,line:r},e++}async function De(t,e){let r=hr(t);for(;;){let{done:n,value:s}=await r.next();if(n){r.return&&r.return();return}if(e(s))return}}async function Ie(t){let e=[];for await(let r of t)e.push(dr(r));return gt(...e)}function dr(t){if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t)){let{buffer:e,byteOffset:r,byteLength:n}=t;return yt(e,r,n)}return yt(t)}function yt(t,e=0,r=t.byteLength-e){let n=new Uint8Array(t,e,r),s=new Uint8Array(n.length);return s.set(n),s.buffer}function hr(t){if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t[Symbol.iterator]=="function"){let e=t[Symbol.iterator]();return pr(e)}return t}function pr(t){return{next(e){return Promise.resolve(t.next(e))},return(e){return typeof t.return=="function"?Promise.resolve(t.return(e)):Promise.resolve({done:!0,value:e})},throw(e){return typeof t.throw=="function"?Promise.resolve(t.throw(e)):Promise.reject(e)}}}function M(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var v=class{constructor(e,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=M(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(M()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var P=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:n}=e,s=this.stats[r];return s||(e instanceof v?s=e:s=new v(r,n),this.stats[r]=s),s}};var mr="Queued Requests",gr="Active Requests",yr="Cancelled Requests",br="Queued Requests Ever",wr="Active Requests Ever",xr={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},O=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...xr,...e},this.stats=new P({id:this.props.id}),this.stats.get(mr),this.stats.get(gr),this.stats.get(yr),this.stats.get(br),this.stats.get(wr)}setProps(e){e.throttleRequests!==void 0&&(this.props.throttleRequests=e.throttleRequests),e.maxRequests!==void 0&&(this.props.maxRequests=e.maxRequests),e.debounceTime!==void 0&&(this.props.debounceTime=e.debounceTime)}scheduleRequest(e,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let n={handle:e,priority:0,getPriority:r},s=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(e,s),this._issueNewRequests(),s}_issueRequest(e){let{handle:r,resolve:n}=e,s=!1,o=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this.scheduleRefill())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}scheduleRefill(){this.updateTimer===null&&(this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let n=e[r];this._updateRequest(n)||(e.splice(r,1),this.requestMap.delete(n.handle),r--)}e.sort((r,n)=>r.priority-n.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};function Pe(t,e=[]){return t.every(Ue)?t:t.map((r,n)=>{if(Ue(r))return r;let s=e.find(c=>c.type===r?.type);if(!s)throw new Error(`No authentication class registered for credential at index ${n}.`);let o;try{o=new s(r)}catch{throw new Error(`Invalid authentication configuration at index ${n}.`)}if(!Ue(o))throw new Error(`Authentication class returned an invalid credential at index ${n}.`);return o})}function Oe(t){if(!t.core?.credentials?.length)return t;let e=Pe(t.core.credentials,t.core.authentications);return e===t.core.credentials?t:{...t,core:{...t.core,credentials:e}}}function Ue(t){return!t||typeof t!="object"||typeof t.id!="string"||!Array.isArray(t.origins)?!1:t.type==="request"?typeof t.authenticate=="function":(t.type==="header"||t.type==="query-parameter")&&typeof t.name=="string"&&(typeof t.token=="string"||typeof t.token=="function")&&Array.isArray(t.refreshStatusCodes)}var bt=Symbol("loaders.gl.authenticated-fetch"),ke=new WeakMap;function Tr(t){let e=t.fetch||((f,u)=>fetch(f,u)),r=e[bt],n=new Map(r?.credentialResolutions),s=Pe(t.credentials.map(f=>n.get(f)||f),t.authentications);if(t.credentials.forEach((f,u)=>{n.set(f,s[u])}),!t.fetchOptions&&(!s.length||r?.credentials.length===s.length&&s.every((f,u)=>f===r.credentials[u])))return e;let o=r?.fetch||e,c=r?[...new Set([...s,...r.credentials])]:s,d=wt(r?.fetchOptions||{},t.fetchOptions),h=c.filter(f=>f.type!=="request"),a=c.filter(f=>f.type==="request");for(let f of a)St(f.origins);let l=async(f,u={})=>{if(u=wt(d,u),u.signal?.aborted)throw W();if(!c.length)return o(f,u);let g=Sr(f),m=g?await Tt(g,u,h):{url:f,options:u,credentials:[]},b=await xt(m,a,"request"),w=await o(b.url,b.options),ie=[];for(let N of m.credentials){let{credential:_}=N;typeof _.token=="function"&&(te(u)||_.canReplayRequest?.(f,u))&&(te(b.options)||_.canReplayRequest?.(b.url,b.options))&&(_.refreshStatusCodes.includes(w.status)||await _.shouldRefresh?.(w))&&ie.push(N)}let tt=te(u)&&te(b.options)&&b.credentials.some(N=>N.refreshStatusCodes?.includes(w.status));if(!ie.length&&!tt)return w;if(u.signal?.aborted)throw W();let ae=new Map;if(await Promise.all(ie.map(async({credential:N})=>{let _=await Er(N,f,w);_&&ae.set(N,_)})),!ae.size&&!tt)return w;if(await w.body?.cancel().catch(()=>{}),u.signal?.aborted)throw W();let Wt=g?await Tt(g,u,h,ae,m.credentials):{url:f,options:u},rt=await xt(Wt,a,"retry",w);return o(rt.url,rt.options)};return Object.defineProperty(l,bt,{value:{fetch:o,credentials:c,credentialResolutions:n,fetchOptions:d}}),l}function Et(t={}){let e=t.fetch??t.core?.fetch,r;return typeof e=="function"?r=e:r=(n,s)=>fetch(n,s),Tr({fetch:r,fetchOptions:typeof e=="object"&&e?e:void 0,credentials:t.core?.credentials||[],authentications:t.core?.authentications})}function wt(t,e){let r={...t,...e};if(t.headers||e?.headers){let n=new Headers(t.headers);new Headers(e?.headers).forEach((s,o)=>n.set(o,s)),r.headers=n}return r}async function xt(t,e,r,n){let s=[],o=t.options.signal;for(let c of e){let d=At(t.url);if(!d||!St(c.origins).includes(d))continue;if(o?.aborted)throw W();let h=await c.authenticate({url:t.url,options:{...t.options,headers:new Headers(t.options.headers)},reason:r,response:n?{status:n.status,headers:new Headers(n.headers)}:void 0});if(!h||typeof h.url!="string"||!h.options||typeof h.options!="object")throw new Error("Authentication callback returned an invalid request.");t={url:h.url,options:{...h.options,...o?{signal:o}:{}}},s.push(c)}if(o?.aborted)throw W();return{...t,credentials:s}}function At(t){try{let e=new URL(t);return!e.host||e.username||e.password?null:e.origin!=="null"?e.origin:`${e.protocol}//${e.host}`}catch{return null}}function St(t){if(!t.length)throw new Error("Request authentication requires at least one exact origin.");return t.map(e=>{let r=At(e),n;try{n=new URL(e)}catch{throw new Error("Invalid request authentication origin.")}if(!r||n.pathname&&n.pathname!=="/"||n.search||n.hash)throw new Error("Invalid request authentication origin.");return r})}async function Tt(t,e,r,n=new Map,s=[]){let o=new URL(t),c=new Headers(e.headers),d=[],h=new Map(s.map(({credential:a,token:l})=>[a,l]));for(let a of r){if(!a.origins.includes(o.origin))continue;let l=n.get(a),f=h.get(a),u=a.type==="query-parameter"&&f!==void 0,g=a.type==="header"&&f!==void 0;if(a.type==="query-parameter"&&o.searchParams.has(a.name)&&!u||a.type==="header"&&c.has(a.name)&&!g)continue;let m=l??f??await Ar(a.token,{url:t.toString(),reason:"request"});m&&(a.type==="query-parameter"?o.searchParams.set(a.name,m):c.set(a.name,`${a.prefix||""}${m}`),d.push({credential:a,token:m}))}return{url:o.toString(),options:{...e,headers:c},credentials:d}}async function Er(t,e,r){let n=ke.get(t);if(n)return n;let s=t.token,o=Promise.resolve(s({url:e,reason:"refresh",response:{status:r.status,headers:r.headers}})).finally(()=>ke.delete(t));return ke.set(t,o),o}async function Ar(t,e){return typeof t=="function"?t(e):t}function Sr(t){try{let e=new URL(t);return["http:","https:"].includes(e.protocol)?e:null}catch{return null}}function te(t){let e=(t.method||"GET").toUpperCase();return["GET","HEAD","OPTIONS","PUT","DELETE"].includes(e)?!(t.body&&typeof ReadableStream<"u"&&t.body instanceof ReadableStream):!1}function W(){return new DOMException("The operation was aborted.","AbortError")}var je="",_t={};function $e(t){je=t}function He(){return je}function z(t){for(let e in _t)if(t.startsWith(e)){let r=_t[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${je}${t}`),t}var _r="5.0.0-alpha.13",qe={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:_r,encoding:"json",format:"json",extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:Rt,parse:async t=>Rt(new TextDecoder().decode(t)),options:{}};function Rt(t){return JSON.parse(t)}var Rr={fetchFile:F("fetchFile"),parse:F("parse"),parseFile:F("parseFile"),parseSync:F("parseSync"),parseInBatches:F("parseInBatches"),load:F("load"),loadInBatches:F("loadInBatches")},V=class t{static defaultOptions={core:{type:"auto",attributions:[],loaders:[],onError:void 0}};optionsType;options;data;url;loadOptions;fetch;coreApi;hasCoreApi;_needsRefresh=!0;constructor(e,r,n,s){this.options=ee(ee(t.defaultOptions,n||{}),r),this.data=e,this.url=typeof e=="string"?z(e):"";let o=Oe(Bt(this.options));this.loadOptions=o;let c=Ct(o);this.coreApi=s||Rr,this.hasCoreApi=!!s,this.fetch=c}setProps(e){let r=ee(this.options,e),n=Oe(Bt(r));this.options=r,this.loadOptions=n,this.fetch=Ct(n),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){let r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}reportError(e,r){let n=Cr(e,r),s=this.options.core?.onError;return s?s(n,this):ut.warn(`${this.constructor.name}: ${n.message}`)(),n}};function Ct(t){return Et(t)}function Bt(t){if(t.loadOptions!==void 0||t.core?.loadOptions!==void 0)throw new Error("Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly.");let e={...t};if(t?.core){e.core={...t.core};let s=e.core;for(let o of["type","attributions","loaders","onError","loadOptions"])delete s[o];Object.keys(s).length===0&&delete e.core}let r=typeof e.baseUri=="string"?e.baseUri:void 0,n=typeof e.baseUrl=="string"?e.baseUrl:void 0;return(r!==void 0||n!==void 0)&&(e.core||={},e.core.baseUrl===void 0&&(e.core.baseUrl=n??r),delete e.baseUri,delete e.baseUrl),e}function Cr(t,e){return t instanceof Error?t:typeof t=="string"?new Error(t):new Error(e)}function F(t){return()=>{throw new Error(`CoreAPI.${t} is unavailable. Use @loaders.gl/core.createDataSource().`)}}function We(t={}){if(t.coordinateEpoch!==void 0&&!Number.isFinite(t.coordinateEpoch))throw new Error("Spatial reference coordinate epoch must be a finite decimal year");return Object.freeze({crs:Nt(t.crs||{state:"absent",provenance:"unknown"}),vertical:t.vertical?Nt(t.vertical):void 0,coordinateEpoch:t.coordinateEpoch,coordinateFrame:t.coordinateFrame||"unknown",coordinateOrder:Object.freeze([...t.coordinateOrder||[]]),units:t.units?Object.freeze([...t.units]):void 0})}function Nt(t){return t.state==="explicit"||t.state==="default"?Object.freeze({...t,definition:Lt(t.definition),alternatives:t.alternatives?Object.freeze(t.alternatives.map(e=>Object.freeze({...e,definition:Lt(e.definition)}))):void 0}):Object.freeze({...t})}function Lt(t){return typeof t=="string"?t:Me(t)}function Me(t){return Array.isArray(t)?Object.freeze(t.map(e=>Me(e))):t&&typeof t=="object"?Object.freeze(Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Me(r)]))):t}function ze(t){Br(t.queryType,t.execution);let e=Object.freeze({fields:Object.freeze(t.schema.fields.map(n=>Object.freeze({...n,metadata:Object.freeze({...n.metadata})}))),metadata:Object.freeze({...t.schema.metadata})}),r=e.fields.map(n=>Object.freeze({name:n.name,type:n.type,nullable:n.nullable!==!1,role:t.columnRoles?.[n.name]||"attribute",title:vt(n.metadata,"title"),description:vt(n.metadata,"description"),metadata:n.metadata||Object.freeze({})}));return Object.freeze({sourceType:t.sourceType,queryType:t.queryType,execution:Object.freeze({...t.execution}),name:t.name,description:t.description,schema:e,columns:Object.freeze(r),capabilities:Object.freeze({...t.capabilities}),spatial:t.spatial?Object.freeze({...t.spatial,bounds:t.spatial.bounds?Object.freeze({minimum:Object.freeze([...t.spatial.bounds.minimum]),maximum:Object.freeze([...t.spatial.bounds.maximum])}):void 0,coordinateReferenceSystems:t.spatial.coordinateReferenceSystems?Object.freeze([...t.spatial.coordinateReferenceSystems]):void 0,spatialReference:t.spatial.spatialReference?We(t.spatial.spatialReference):void 0}):void 0,statistics:t.statistics?Object.freeze({...t.statistics}):void 0,levels:t.levels?Object.freeze(t.levels.map(n=>Object.freeze({...n,scale:n.scale?Object.freeze([...n.scale]):void 0}))):void 0})}function Br(t,e){if(e.status==="metadata-only"){if(!e.reason.trim())throw new Error("Metadata-only scan support requires a concrete reason");return}if(!{table:["read","query"],raster:["getRaster"],"point-cloud":["scan"]}[t].includes(e.method))throw new Error(`Scan execution method "${e.method}" is not valid for ${t} queries`)}function vt(t,e){return t?.[e]||void 0}function Ve(t){if(t.width!==void 0&&Ft(t.width,"width"),t.height!==void 0&&Ft(t.height,"height"),t.level!==void 0&&Dt(t.level,"level"),t.bounds)for(let e=0;e<2;e++){let r=t.bounds[0][e],n=t.bounds[1][e];if(!Number.isFinite(r)||!Number.isFinite(n)||r>n)throw new Error("Raster query bounds must contain finite, ordered coordinates.")}for(let e of t.channels||[])Dt(e,"channel");for(let[e,r]of Object.entries(t.slices||{})){if(!e)throw new Error("Raster query slice names must be non-empty.");if(Array.isArray(r)){if(r.length!==2||!r.every(Number.isFinite)||r[0]>r[1])throw new Error(`Raster query slice ${e} must be an ordered finite range.`)}else if(!Number.isFinite(r))throw new Error(`Raster query slice ${e} must be finite.`)}}function Ft(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`Raster query ${e} must be a positive safe integer.`)}function Dt(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Raster query ${e} must be a non-negative safe integer.`)}Ye();Ke();Ke();Ye();var Pr="5.0.0-alpha.13",se=class t extends V{static HEADER_RANGE_SIZE=64*1024;static MAX_HEADER_RANGE_SIZE=4*1024*1024;headerPromise=null;rasterQueryCapabilities=Object.freeze({bounds:"unsupported",level:"unsupported",variables:"pushdown",slices:"residual",streaming:!1,cancellation:!0});constructor(e,r={}){super(e,r)}async getQueryMetadata(e={}){S(e.signal);let{header:r,byteLength:n}=await this.getHeader(e.signal);S(e.signal);let o={fields:r.variables.map(c=>Vr(c,r)),metadata:Gr(r)};return ze({sourceType:"netcdf",queryType:"raster",execution:{status:"supported",method:"getRaster"},name:typeof this.data=="string"?this.data.split("/").pop():void 0,schema:o,capabilities:{bounds:"unsupported",levelOfDetail:"unsupported",raster:this.rasterQueryCapabilities},statistics:{byteLength:n,rowCount:r.recordDimension.length||void 0}})}async getRaster(e={}){Ve(e),kr(e),S(e.signal);let r=await this.loadReader(e.signal);S(e.signal),$r(r.header,e.slices);let s=jr(r.header,e.variables).map(a=>{S(e.signal);let l=a.dimensions.map(b=>r.header.dimensions[b]?.name||`dimension_${b}`),f=a.dimensions.map(b=>et(r.header,b)),u=Mt(r.getDataVariable(a)),g=Hr(u,l,f,e.slices||{},e.signal),m=Xe(a.type);return{variable:a,dimensionNames:g.dimensionNames,shape:g.shape,data:Mr(g.values,m),dtype:m}}),o=s[0];for(let a of s.slice(1))if(a.dtype!==o.dtype||!zr(a.shape,o.shape))throw new Error("NetCDF raster variables must retain the same shape and numeric type after slicing.");let c=o.shape.at(-1)??1,d=o.shape.length<2?1:o.shape.slice(0,-1).reduce((a,l)=>a*l,1),h=Wr(o.variable);return{data:s.length===1?o.data:s.map(a=>a.data),width:c,height:d,bandCount:s.length,dtype:o.dtype,interleaved:!1,noData:h,metadata:{variables:s.map(a=>a.variable.name),dimensions:o.dimensionNames,shape:o.shape,slices:{...e.slices}}}}async loadReader(e){let r;if(typeof this.data=="string"){let n=await this.fetch(this.url,{signal:e});if(!n.ok)throw new Error(`NetCDF request failed with status ${n.status}.`);r=await n.arrayBuffer()}else r=await this.data.arrayBuffer();return S(e),new A(r)}async getHeader(e){S(e),this.headerPromise||(this.headerPromise=this.loadHeader().catch(n=>{throw this.headerPromise=null,n}));let r=await this.headerPromise;return S(e),r}async loadHeader(){if(typeof this.data!="string"){let o=await this.data.arrayBuffer();return{header:new A(o).header,byteLength:o.byteLength}}let e=t.HEADER_RANGE_SIZE,r=null,n=null,s;for(;e<=t.MAX_HEADER_RANGE_SIZE;){if(r=await this.fetch(this.url,{headers:{Range:`bytes=0-${e-1}`}}),!r.ok)throw new Error(`NetCDF request failed with status ${r.status}.`);n=await r.arrayBuffer();let o=Qr(r,n.byteLength);try{return{header:new A(n).header,byteLength:o}}catch(c){if(s=c,r.status!==206||n.byteLength<e)throw c;e*=2}}throw s||new Error("NetCDF header exceeds the maximum metadata range.")}},oe={dataType:null,batchType:null,...Q,module:"scientific",name:"NetCDFSourceLoader",version:Pr,type:"netcdf-source",fromUrl:!0,fromBlob:!0,options:{},defaultOptions:{},testURL:t=>/\.(?:cdf|nc)(?:$|[?#])/i.test(t),createDataSource:(t,e)=>new se(t,e)};function Or(t){switch(t.toLowerCase()){case"byte":return"int8";case"ubyte":return"uint8";case"short":return"int16";case"ushort":return"uint16";case"int":return"int32";case"uint":return"uint32";case"int64":return"int64";case"uint64":return"uint64";case"float":return"float32";case"double":return"float64";case"char":case"string":return"utf8";default:return"binary"}}function kr(t){if(t.bounds)throw new Error("NetCDF raster bounds are not supported.");if(t.level!==void 0)throw new Error("NetCDF raster levels are not supported.");if(t.width!==void 0||t.height!==void 0)throw new Error("NetCDF raster resampling is not supported.");if(t.channels?.length)throw new Error("NetCDF uses named variables instead of numeric channels.")}function jr(t,e){let r=t.variables.find(s=>s.dimensions.length>0&&qr(s.type)),n=e?.length?[...e]:r?[r.name]:[];if(n.length===0)throw new Error("NetCDF contains no numeric variables that can be read as raster data.");if(new Set(n).size!==n.length)throw new Error("NetCDF raster variables must not contain duplicates.");return n.map(s=>{let o=t.variables.find(c=>c.name===s);if(!o)throw new Error(`NetCDF variable not found: ${s}`);return Xe(o.type),o})}function $r(t,e){let r=new Set(t.dimensions.map(n=>n.name));for(let n of Object.keys(e||{}))if(!r.has(n))throw new Error(`NetCDF dimension not found: ${n}`)}function Hr(t,e,r,n,s){let o=e.map((a,l)=>{let f=r[l],u=n[a];if(u===void 0)return{start:0,stop:f,remove:!1};if(typeof u!="number"){let[g,m]=u;if(!Number.isSafeInteger(g)||!Number.isSafeInteger(m)||g<0||m<g||m>f)throw new Error(`NetCDF slice ${a} must be a valid half-open range within 0..${f}.`);return{start:g,stop:m,remove:!1}}if(!Number.isSafeInteger(u)||u<0||u>=f)throw new Error(`NetCDF slice ${a} must be an index within 0..${f-1}.`);return{start:u,stop:u+1,remove:!0}}),c=r.map((a,l)=>r.slice(l+1).reduce((f,u)=>f*u,1)),d=[],h=(a,l)=>{if(S(s),a===o.length){let u=t[l];if(typeof u!="number")throw new Error("NetCDF raster variables must contain numeric values.");d.push(u);return}let f=o[a];for(let u=f.start;u<f.stop;u++)h(a+1,l+u*c[a])};return h(0,0),{values:d,dimensionNames:e.filter((a,l)=>!o[l].remove),shape:o.map(a=>a.stop-a.start).filter((a,l)=>!o[l].remove)}}function Mt(t){return Array.isArray(t)?t.flatMap(Mt):ArrayBuffer.isView(t)?Array.from(t):[t]}function qr(t){try{return Xe(t),!0}catch{return!1}}function Xe(t){switch(t.toLowerCase()){case"byte":return"int8";case"ubyte":return"uint8";case"short":return"int16";case"ushort":return"uint16";case"int":return"int32";case"uint":return"uint32";case"float":return"float32";case"double":return"float64";default:throw new Error(`NetCDF variable type is not supported as raster data: ${t}`)}}function Mr(t,e){switch(e){case"int8":return Int8Array.from(t);case"uint8":return Uint8Array.from(t);case"int16":return Int16Array.from(t);case"uint16":return Uint16Array.from(t);case"int32":return Int32Array.from(t);case"uint32":return Uint32Array.from(t);case"float32":return Float32Array.from(t);case"float64":return Float64Array.from(t)}}function Wr(t){let e=t.attributes.find(n=>n.name==="_FillValue"||n.name==="missing_value"),r=Number(e?.value);return e&&Number.isFinite(r)?r:null}function zr(t,e){return t.length===e.length&&t.every((r,n)=>r===e[n])}function Vr(t,e){let n={dimensions:t.dimensions.map(s=>e.dimensions[s]).filter(Boolean).map((s,o)=>`${s.name}[${et(e,t.dimensions[o])}]`).join(",")};for(let s of t.attributes)n[s.name]=String(s.value);return{name:t.name,type:Or(t.type),nullable:!0,metadata:n}}function Gr(t){let e={};for(let[r,n]of t.dimensions.entries())e[`dimension:${n.name}`]=String(et(t,r));return e}function et(t,e){let r=t.dimensions[e];return e===t.recordDimension.id?t.recordDimension.length:r?.size||0}function Qr(t,e){let n=t.headers.get("content-range")?.match(/\/([0-9]+)$/)?.[1];return Number(n||t.headers.get("content-length")||e)}function S(t){if(t?.aborted)throw new DOMException("The operation was aborted","AbortError")}return Xt(Jr);})();
|
|
11
|
+
return __exports__;
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled.d.ts","sourceRoot":"","sources":["../../src/zarr/bundled.ts"],"names":[],"mappings":"AAIA,2BAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled.js","sourceRoot":"","sources":["../../src/zarr/bundled.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAEpC,2BAAwB"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { CoreAPI, GetRasterParameters, RasterData, RasterSource, RasterSourceMetadata, ScanQueryMetadata, ScanQueryMetadataOptions, ScanQueryMetadataProvider } from '@loaders.gl/core/loader-utils';
|
|
2
|
+
import type { CRSDefinition } from '@math.gl/geospatial/crs';
|
|
3
|
+
import { ZarrSource, type ZarrSourceLoaderOptions } from "./ome-zarr-source-loader.js";
|
|
4
|
+
/** Six Rasterio/Affine coefficients `[scaleX, rotationX, translateX, rotationY, scaleY, translateY]`. */
|
|
5
|
+
export type GeoZarrAffineTransform = [
|
|
6
|
+
scaleX: number,
|
|
7
|
+
rotationX: number,
|
|
8
|
+
translateX: number,
|
|
9
|
+
rotationY: number,
|
|
10
|
+
scaleY: number,
|
|
11
|
+
translateY: number
|
|
12
|
+
];
|
|
13
|
+
/** One non-spatial dimension that can be selected before reading a 2D raster window. */
|
|
14
|
+
export type GeoZarrSelectionDimension = {
|
|
15
|
+
/** Dimension name declared by Zarr or xarray. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Number of indices in this dimension. */
|
|
18
|
+
size: number;
|
|
19
|
+
/** Index used when a raster request omits this dimension. */
|
|
20
|
+
defaultIndex: number;
|
|
21
|
+
};
|
|
22
|
+
/** Native array geometry for one advertised spatial multiscale level. */
|
|
23
|
+
export type GeoZarrLevelMetadata = {
|
|
24
|
+
/** Advertised asset identifier, preserved verbatim. */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Data-array path relative to the selected group. */
|
|
27
|
+
array: string;
|
|
28
|
+
/** Resolved array metadata; absent when this level cannot be normalized. */
|
|
29
|
+
metadata?: Omit<GeoZarrSourceMetadata, 'levels' | 'tileGrid'>;
|
|
30
|
+
};
|
|
31
|
+
/** Normalized metadata exposed by {@link GeoZarrRasterSource}. */
|
|
32
|
+
export type GeoZarrSourceMetadata = RasterSourceMetadata & {
|
|
33
|
+
/** Data-array path relative to the selected Zarr group. */
|
|
34
|
+
array: string;
|
|
35
|
+
/** Advertised spatial multiscales; reads still use the selected `array`. */
|
|
36
|
+
levels?: GeoZarrLevelMetadata[];
|
|
37
|
+
/** Ordered names matching the data array shape. */
|
|
38
|
+
dimensions: string[];
|
|
39
|
+
/** Logical `[y, x]` spatial dimension names. */
|
|
40
|
+
spatialDimensions: [y: string, x: string];
|
|
41
|
+
/** Selectable time, vertical, band, or other non-spatial dimensions. */
|
|
42
|
+
selectionDimensions: GeoZarrSelectionDimension[];
|
|
43
|
+
/** Normalized pixel-corner affine transform used for spatial window reads. */
|
|
44
|
+
transform: GeoZarrAffineTransform;
|
|
45
|
+
/** Registration declared by GeoZarr, or `pixel` for a transform derived from CF coordinates. */
|
|
46
|
+
registration: 'pixel' | 'node';
|
|
47
|
+
};
|
|
48
|
+
/** Options for {@link GeoZarrSourceLoader}. */
|
|
49
|
+
export type GeoZarrSourceLoaderOptions = ZarrSourceLoaderOptions & {
|
|
50
|
+
/** GeoZarr and CF data-variable options. */
|
|
51
|
+
geozarr?: {
|
|
52
|
+
/** Data-array path relative to `zarr.path`. */
|
|
53
|
+
array?: string;
|
|
54
|
+
/** Explicit logical `[y, x]` dimension names. */
|
|
55
|
+
spatialDimensions?: [y: string, x: string];
|
|
56
|
+
/** Explicit affine transform when the store does not provide one. */
|
|
57
|
+
transform?: GeoZarrAffineTransform;
|
|
58
|
+
/** Explicit coordinate reference system definition or identifier. */
|
|
59
|
+
coordinateReferenceSystem?: CRSDefinition;
|
|
60
|
+
/** Default indices for non-spatial dimensions such as `time` or `level`. */
|
|
61
|
+
defaultSelection?: Record<string, number>;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/** Parameters used to request a native-resolution spatial window from a GeoZarr array. */
|
|
65
|
+
export type GetGeoZarrParameters = Omit<GetRasterParameters, 'bands' | 'interleaved'>;
|
|
66
|
+
/** Source factory for GeoZarr and regular CF/xarray Zarr raster arrays. */
|
|
67
|
+
export declare const GeoZarrSourceLoaderWithParser: {
|
|
68
|
+
readonly dataType: GeoZarrRasterSource;
|
|
69
|
+
/** Runtime source type marker used by `createDataSource()` type inference. */
|
|
70
|
+
readonly dataSource: GeoZarrRasterSource;
|
|
71
|
+
readonly batchType: never;
|
|
72
|
+
readonly name: "GeoZarrSourceLoader";
|
|
73
|
+
readonly id: "geozarr";
|
|
74
|
+
readonly module: "scientific";
|
|
75
|
+
readonly version: any;
|
|
76
|
+
readonly extensions: ["zarr"];
|
|
77
|
+
readonly mimeTypes: [];
|
|
78
|
+
readonly type: "geozarr";
|
|
79
|
+
readonly fromUrl: true;
|
|
80
|
+
readonly fromBlob: false;
|
|
81
|
+
readonly options: GeoZarrSourceLoaderOptions;
|
|
82
|
+
readonly defaultOptions: {
|
|
83
|
+
readonly zarr: {
|
|
84
|
+
readonly metadataPath: "auto";
|
|
85
|
+
readonly path: null;
|
|
86
|
+
readonly labels: never;
|
|
87
|
+
readonly requireConsolidatedMetadata: true;
|
|
88
|
+
};
|
|
89
|
+
readonly geozarr: {
|
|
90
|
+
readonly array: never;
|
|
91
|
+
readonly spatialDimensions: never;
|
|
92
|
+
readonly transform: never;
|
|
93
|
+
readonly coordinateReferenceSystem: never;
|
|
94
|
+
readonly defaultSelection: never;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
readonly testURL: (url: string) => boolean;
|
|
98
|
+
readonly createDataSource: (data: string, options: GeoZarrSourceLoaderOptions, coreApi?: CoreAPI) => GeoZarrRasterSource;
|
|
99
|
+
};
|
|
100
|
+
/** Viewport-driven raster source for GeoZarr and regular CF/xarray Zarr data variables. */
|
|
101
|
+
export declare class GeoZarrRasterSource extends ZarrSource implements RasterSource<RasterData, GetGeoZarrParameters, GeoZarrSourceMetadata>, ScanQueryMetadataProvider {
|
|
102
|
+
/** Shared source initialization request. */
|
|
103
|
+
private initializationPromise;
|
|
104
|
+
/** Shared metadata-only multiscale discovery request. */
|
|
105
|
+
private metadataPromise;
|
|
106
|
+
/** Creates a GeoZarr raster source. */
|
|
107
|
+
constructor(data: string, options: GeoZarrSourceLoaderOptions, coreApi?: CoreAPI);
|
|
108
|
+
/** Returns normalized geospatial, array, and selectable-dimension metadata. */
|
|
109
|
+
getMetadata(): Promise<GeoZarrSourceMetadata>;
|
|
110
|
+
/** Opens sibling array metadata without selecting or decoding their samples. */
|
|
111
|
+
private loadGridMetadata;
|
|
112
|
+
/** Discovers GeoZarr variables, spatial bounds, and selectable dimensions. */
|
|
113
|
+
getQueryMetadata(options?: ScanQueryMetadataOptions): Promise<ScanQueryMetadata>;
|
|
114
|
+
/** Loads a clipped native-resolution 2D window for the requested viewport and named selection. */
|
|
115
|
+
getRaster(parameters: GetGeoZarrParameters): Promise<RasterData>;
|
|
116
|
+
/** Returns the shared initialization request for this source. */
|
|
117
|
+
private getInitializationPromise;
|
|
118
|
+
/** Opens the selected data array and resolves GeoZarr or CF/xarray geospatial metadata. */
|
|
119
|
+
private initialize;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=geo-zarr-source-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geo-zarr-source-loader.d.ts","sourceRoot":"","sources":["../../src/zarr/geo-zarr-source-loader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAEV,OAAO,EACP,mBAAmB,EAGnB,UAAU,EACV,YAAY,EACZ,oBAAoB,EAEpB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;AAS3D,OAAO,EAAC,UAAU,EAAE,KAAK,uBAAuB,EAAC,oCAAiC;AAWlF,yGAAyG;AACzG,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,MAAM;CACnB,CAAC;AAEF,wFAAwF;AACxF,MAAM,MAAM,yBAAyB,GAAG;IACtC,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,oBAAoB,GAAG;IACjC,uDAAuD;IACvD,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAC;CAC/D,CAAC;AAEF,kEAAkE;AAClE,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,GAAG;IACzD,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAChC,mDAAmD;IACnD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,gDAAgD;IAChD,iBAAiB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC1C,wEAAwE;IACxE,mBAAmB,EAAE,yBAAyB,EAAE,CAAC;IACjD,8EAA8E;IAC9E,SAAS,EAAE,sBAAsB,CAAC;IAClC,gGAAgG;IAChG,YAAY,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,GAAG;IACjE,4CAA4C;IAC5C,OAAO,CAAC,EAAE;QACR,+CAA+C;QAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,iDAAiD;QACjD,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QAC3C,qEAAqE;QACrE,SAAS,CAAC,EAAE,sBAAsB,CAAC;QACnC,qEAAqE;QACrE,yBAAyB,CAAC,EAAE,aAAa,CAAC;QAC1C,4EAA4E;QAC5E,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC3C,CAAC;CACH,CAAC;AAEF,0FAA0F;AAC1F,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC;AA4BtF,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B;uBACX,mBAAmB;IAChD,8EAA8E;yBAC/C,mBAAmB;wBAC/B,KAAK;;;;;;;;;;sBAyBnB,0BAA0B;;;;;;;;;;;;;;;;4BAkBhB,MAAM,KAAG,OAAO;sCAEvB,MAAM,WACH,0BAA0B,YACzB,OAAO,KAChB,mBAAmB;CAC8B,CAAC;AAEvD,2FAA2F;AAC3F,qBAAa,mBACX,SAAQ,UACR,YACE,YAAY,CAAC,UAAU,EAAE,oBAAoB,EAAE,qBAAqB,CAAC,EACrE,yBAAyB;IAE3B,4CAA4C;IAC5C,OAAO,CAAC,qBAAqB,CAAqC;IAElE,yDAAyD;IACzD,OAAO,CAAC,eAAe,CAA+C;IAEtE,uCAAuC;gBAC3B,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,OAAO;IAIhF,+EAA+E;IACzE,WAAW,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAUnD,gFAAgF;YAClE,gBAAgB;IA2C9B,8EAA8E;IACxE,gBAAgB,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAyB1F,kGAAkG;IAC5F,SAAS,CAAC,UAAU,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;IAqFtE,iEAAiE;YACnD,wBAAwB;IAgBtC,2FAA2F;YAC7E,UAAU;CAgIzB"}
|