@kepler.gl/table 3.3.0-alpha.22 → 3.3.0-alpha.23

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.
@@ -55,6 +55,9 @@ var CF_UNIT_MS = {
55
55
  /** Guard against walking an unbounded hierarchy when a store lists thousands of nodes. */
56
56
  var MAX_VARIABLE_CANDIDATES = 200;
57
57
 
58
+ /** Optional zoom bounds must not leave dataset loading waiting on the CRS service. */
59
+ var CRS_LOOKUP_TIMEOUT_MS = 5000;
60
+
58
61
  /**
59
62
  * Axis labels `@developmentseed/geozarr` accepts for the spatial dimensions.
60
63
  * Anything else cannot be rendered, so it is not worth deriving metadata for.
@@ -258,7 +261,7 @@ export function getZarrVariable(metadata, variablePath) {
258
261
  * the layer can react to the variable dropdown without refetching the store.
259
262
  */
260
263
  export function selectZarrVariable(metadata, variablePath) {
261
- var _variable$spatialMeta;
264
+ var _variable$spatialMeta, _variable$spatialMeta2, _metadata$bounds;
262
265
  var variable = getZarrVariable(metadata, variablePath);
263
266
  if (!variable) {
264
267
  return metadata;
@@ -271,6 +274,7 @@ export function selectZarrVariable(metadata, variablePath) {
271
274
  levels: [],
272
275
  webMercatorPyramid: false
273
276
  }), {}, {
277
+ bounds: variable.spatialMetadata ? (_variable$spatialMeta2 = variable.spatialMetadata.bounds) !== null && _variable$spatialMeta2 !== void 0 ? _variable$spatialMeta2 : null : variable.path === metadata.variable ? (_metadata$bounds = metadata.bounds) !== null && _metadata$bounds !== void 0 ? _metadata$bounds : null : null,
274
278
  variable: variable.path,
275
279
  nonSpatialDims: variable.nonSpatialDims,
276
280
  timeDimension: variable.timeDimension,
@@ -1424,14 +1428,7 @@ function isTimeDimension(dimension, decodedFromCf) {
1424
1428
  function buildVariableInfo(_x34, _x35, _x36, _x37, _x38) {
1425
1429
  return _buildVariableInfo.apply(this, arguments);
1426
1430
  }
1427
- /**
1428
- * Build one variable per data array of an OME-NGFF style pyramid.
1429
- *
1430
- * Each level holds the same arrays at a lower resolution, so a variable's
1431
- * identity is the group plus the array name while the node handed to the
1432
- * renderer is the group itself. A level whose grid cannot be derived ends the
1433
- * pyramid rather than discarding it, leaving the finer levels usable.
1434
- */
1431
+ /** Reuse the renderer's CRS cache, but keep network lookups bounded and cancellable. */
1435
1432
  function _buildVariableInfo() {
1436
1433
  _buildVariableInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(store, index, path, geoAttrs, cache) {
1437
1434
  var _options$nodePath, _options$preopened, _options$webMercatorP, _readDataRange, _readNumber;
@@ -1529,40 +1526,65 @@ function _buildVariableInfo() {
1529
1526
  arrayAttrs = getAttrs(arr);
1530
1527
  fillValue = arr.fillValue;
1531
1528
  name = path.split('/').filter(Boolean).pop() || path || 'data';
1532
- return _context11.abrupt("return", _objectSpread(_objectSpread({
1529
+ _context11.t1 = _objectSpread;
1530
+ _context11.t2 = _objectSpread({
1533
1531
  path: path
1534
1532
  }, options.nodePath !== undefined && {
1535
1533
  nodePath: options.nodePath
1536
- }), {}, {
1537
- name: name,
1538
- // Qualified later, once every sibling variable is known.
1539
- displayName: name,
1540
- geoAttrs: geoAttrs,
1541
- spatialMetadata: {
1542
- crs: geo.crs,
1543
- axes: geo.axes,
1544
- xAxisIndex: geo.xAxisIndex,
1545
- yAxisIndex: geo.yAxisIndex,
1546
- levels: geo.levels.map(function (level) {
1547
- return {
1548
- path: level.path,
1549
- shape: [level.arrayHeight, level.arrayWidth],
1550
- chunks: arr.chunks.slice(-2)
1551
- };
1552
- }),
1553
- webMercatorPyramid: (_options$webMercatorP = options.webMercatorPyramid) !== null && _options$webMercatorP !== void 0 ? _options$webMercatorP : false
1554
- },
1555
- shape: _toConsumableArray(arr.shape),
1556
- chunks: _toConsumableArray(arr.chunks),
1557
- dtype: String(arr.dtype),
1558
- nonSpatialDims: nonSpatialDims,
1559
- timeDimension: timeDimension,
1560
- dataRange: (_readDataRange = readDataRange(arrayAttrs)) !== null && _readDataRange !== void 0 ? _readDataRange : readDataRange(geoAttrs),
1561
- nodataValue: (_readNumber = readNumber(arrayAttrs, ['_FillValue', 'missing_value', 'nodata'])) !== null && _readNumber !== void 0 ? _readNumber : readNumber({
1562
- fillValue: fillValue
1563
- }, ['fillValue'])
1564
- }));
1565
- case 43:
1534
+ });
1535
+ _context11.t3 = {};
1536
+ _context11.t4 = name;
1537
+ _context11.t5 = name;
1538
+ _context11.t6 = geoAttrs;
1539
+ _context11.t7 = geo.crs;
1540
+ _context11.next = 51;
1541
+ return getZarrBounds(geo, store.signal);
1542
+ case 51:
1543
+ _context11.t8 = _context11.sent;
1544
+ _context11.t9 = geo.axes;
1545
+ _context11.t10 = geo.xAxisIndex;
1546
+ _context11.t11 = geo.yAxisIndex;
1547
+ _context11.t12 = geo.levels.map(function (level) {
1548
+ return {
1549
+ path: level.path,
1550
+ shape: [level.arrayHeight, level.arrayWidth],
1551
+ chunks: arr.chunks.slice(-2)
1552
+ };
1553
+ });
1554
+ _context11.t13 = (_options$webMercatorP = options.webMercatorPyramid) !== null && _options$webMercatorP !== void 0 ? _options$webMercatorP : false;
1555
+ _context11.t14 = {
1556
+ crs: _context11.t7,
1557
+ bounds: _context11.t8,
1558
+ axes: _context11.t9,
1559
+ xAxisIndex: _context11.t10,
1560
+ yAxisIndex: _context11.t11,
1561
+ levels: _context11.t12,
1562
+ webMercatorPyramid: _context11.t13
1563
+ };
1564
+ _context11.t15 = _toConsumableArray(arr.shape);
1565
+ _context11.t16 = _toConsumableArray(arr.chunks);
1566
+ _context11.t17 = String(arr.dtype);
1567
+ _context11.t18 = nonSpatialDims;
1568
+ _context11.t19 = timeDimension;
1569
+ _context11.t20 = (_readDataRange = readDataRange(arrayAttrs)) !== null && _readDataRange !== void 0 ? _readDataRange : readDataRange(geoAttrs);
1570
+ _context11.t21 = (_readNumber = readNumber(arrayAttrs, ['_FillValue', 'missing_value', 'nodata'])) !== null && _readNumber !== void 0 ? _readNumber : readNumber({
1571
+ fillValue: fillValue
1572
+ }, ['fillValue']);
1573
+ _context11.t22 = {
1574
+ name: _context11.t4,
1575
+ displayName: _context11.t5,
1576
+ geoAttrs: _context11.t6,
1577
+ spatialMetadata: _context11.t14,
1578
+ shape: _context11.t15,
1579
+ chunks: _context11.t16,
1580
+ dtype: _context11.t17,
1581
+ nonSpatialDims: _context11.t18,
1582
+ timeDimension: _context11.t19,
1583
+ dataRange: _context11.t20,
1584
+ nodataValue: _context11.t21
1585
+ };
1586
+ return _context11.abrupt("return", (0, _context11.t1)(_context11.t2, _context11.t3, _context11.t22));
1587
+ case 67:
1566
1588
  case "end":
1567
1589
  return _context11.stop();
1568
1590
  }
@@ -1570,19 +1592,202 @@ function _buildVariableInfo() {
1570
1592
  }));
1571
1593
  return _buildVariableInfo.apply(this, arguments);
1572
1594
  }
1573
- function buildPyramidVariables(_x39, _x40, _x41, _x42, _x43, _x44) {
1595
+ function resolveZarrEpsg(_x39, _x40) {
1596
+ return _resolveZarrEpsg.apply(this, arguments);
1597
+ }
1598
+ /** Derive the same coarsest-level footprint used by the raster tileset, in map coordinates. */
1599
+ function _resolveZarrEpsg() {
1600
+ _resolveZarrEpsg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(epsg, signal) {
1601
+ var _yield$import, PROJECTION_REGISTRY, parseWkt, code, cached, controller, abort, timeout, response, definition;
1602
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
1603
+ while (1) switch (_context12.prev = _context12.next) {
1604
+ case 0:
1605
+ _context12.next = 2;
1606
+ return import('@developmentseed/proj');
1607
+ case 2:
1608
+ _yield$import = _context12.sent;
1609
+ PROJECTION_REGISTRY = _yield$import.PROJECTION_REGISTRY;
1610
+ parseWkt = _yield$import.parseWkt;
1611
+ throwIfAborted(signal);
1612
+ code = "EPSG:".concat(epsg);
1613
+ cached = PROJECTION_REGISTRY.get(code);
1614
+ if (!cached) {
1615
+ _context12.next = 10;
1616
+ break;
1617
+ }
1618
+ return _context12.abrupt("return", cached);
1619
+ case 10:
1620
+ // The library resolver does not accept a signal. Fetch the same definition
1621
+ // here so cancelling a dataset also cancels the request and response body.
1622
+ controller = new AbortController();
1623
+ abort = function abort() {
1624
+ return controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
1625
+ };
1626
+ signal === null || signal === void 0 || signal.addEventListener('abort', abort, {
1627
+ once: true
1628
+ });
1629
+ timeout = setTimeout(function () {
1630
+ return controller.abort(new DOMException('CRS lookup timed out', 'TimeoutError'));
1631
+ }, CRS_LOOKUP_TIMEOUT_MS);
1632
+ _context12.prev = 14;
1633
+ _context12.next = 17;
1634
+ return fetch("https://epsg.io/".concat(epsg, ".json"), {
1635
+ signal: controller.signal
1636
+ });
1637
+ case 17:
1638
+ response = _context12.sent;
1639
+ if (response.ok) {
1640
+ _context12.next = 20;
1641
+ break;
1642
+ }
1643
+ throw new Error("Failed to resolve ".concat(code));
1644
+ case 20:
1645
+ _context12.t0 = parseWkt;
1646
+ _context12.next = 23;
1647
+ return response.json();
1648
+ case 23:
1649
+ _context12.t1 = _context12.sent;
1650
+ definition = (0, _context12.t0)(_context12.t1);
1651
+ throwIfAborted(controller.signal);
1652
+ PROJECTION_REGISTRY.set(code, definition);
1653
+ return _context12.abrupt("return", definition);
1654
+ case 28:
1655
+ _context12.prev = 28;
1656
+ clearTimeout(timeout);
1657
+ signal === null || signal === void 0 || signal.removeEventListener('abort', abort);
1658
+ return _context12.finish(28);
1659
+ case 32:
1660
+ case "end":
1661
+ return _context12.stop();
1662
+ }
1663
+ }, _callee12, null, [[14,, 28, 32]]);
1664
+ }));
1665
+ return _resolveZarrEpsg.apply(this, arguments);
1666
+ }
1667
+ function getZarrBounds(_x41, _x42) {
1668
+ return _getZarrBounds.apply(this, arguments);
1669
+ }
1670
+ /**
1671
+ * Build one variable per data array of an OME-NGFF style pyramid.
1672
+ *
1673
+ * Each level holds the same arrays at a lower resolution, so a variable's
1674
+ * identity is the group plus the array name while the node handed to the
1675
+ * renderer is the group itself. A level whose grid cannot be derived ends the
1676
+ * pyramid rather than discarding it, leaving the finer levels usable.
1677
+ */
1678
+ function _getZarrBounds() {
1679
+ _getZarrBounds = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(geo, signal) {
1680
+ var level, _crs$code, _yield$Promise$all5, _yield$Promise$all6, apply, _yield$Promise$all6$, parseWkt, transformBounds, proj4, crs, epsg, definition, projection, converter, valid, bounds, _bounds, west, south, east, north, shift, fullLongitude;
1681
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1682
+ while (1) switch (_context13.prev = _context13.next) {
1683
+ case 0:
1684
+ level = geo.levels[geo.levels.length - 1];
1685
+ if (!(!level || !(level.arrayWidth > 0) || !(level.arrayHeight > 0))) {
1686
+ _context13.next = 3;
1687
+ break;
1688
+ }
1689
+ return _context13.abrupt("return", null);
1690
+ case 3:
1691
+ _context13.prev = 3;
1692
+ _context13.next = 6;
1693
+ return Promise.all([import('@developmentseed/affine'), import('@developmentseed/proj'), import('proj4')]);
1694
+ case 6:
1695
+ _yield$Promise$all5 = _context13.sent;
1696
+ _yield$Promise$all6 = _slicedToArray(_yield$Promise$all5, 3);
1697
+ apply = _yield$Promise$all6[0].apply;
1698
+ _yield$Promise$all6$ = _yield$Promise$all6[1];
1699
+ parseWkt = _yield$Promise$all6$.parseWkt;
1700
+ transformBounds = _yield$Promise$all6$.transformBounds;
1701
+ proj4 = _yield$Promise$all6[2]["default"];
1702
+ crs = geo.crs;
1703
+ epsg = (_crs$code = crs.code) === null || _crs$code === void 0 ? void 0 : _crs$code.match(/^EPSG:(\d+)$/);
1704
+ if (!crs.code) {
1705
+ _context13.next = 27;
1706
+ break;
1707
+ }
1708
+ _context13.t1 = epsg;
1709
+ if (!_context13.t1) {
1710
+ _context13.next = 24;
1711
+ break;
1712
+ }
1713
+ _context13.t2 = proj4.defs(crs.code);
1714
+ if (_context13.t2) {
1715
+ _context13.next = 23;
1716
+ break;
1717
+ }
1718
+ _context13.next = 22;
1719
+ return resolveZarrEpsg(Number(epsg[1]), signal);
1720
+ case 22:
1721
+ _context13.t2 = _context13.sent;
1722
+ case 23:
1723
+ _context13.t1 = _context13.t2;
1724
+ case 24:
1725
+ _context13.t0 = _context13.t1;
1726
+ _context13.next = 28;
1727
+ break;
1728
+ case 27:
1729
+ _context13.t0 = crs.wkt2 || crs.projjson ? parseWkt(crs.wkt2 || crs.projjson) : null;
1730
+ case 28:
1731
+ definition = _context13.t0;
1732
+ if (definition) {
1733
+ _context13.next = 31;
1734
+ break;
1735
+ }
1736
+ return _context13.abrupt("return", null);
1737
+ case 31:
1738
+ projection = new proj4.Proj(definition);
1739
+ converter = proj4(projection, 'EPSG:4326');
1740
+ valid = true;
1741
+ bounds = transformBounds(function (col, row) {
1742
+ var point = converter.forward(apply(level.affine, col, row));
1743
+ valid = valid && point.every(Number.isFinite);
1744
+ return point;
1745
+ }, 0, 0, level.arrayWidth, level.arrayHeight);
1746
+ if (!(!valid || !bounds.every(Number.isFinite))) {
1747
+ _context13.next = 37;
1748
+ break;
1749
+ }
1750
+ return _context13.abrupt("return", null);
1751
+ case 37:
1752
+ _bounds = _slicedToArray(bounds, 4), west = _bounds[0], south = _bounds[1], east = _bounds[2], north = _bounds[3];
1753
+ if (!(south > 90 || north < -90 || west > east || south > north)) {
1754
+ _context13.next = 40;
1755
+ break;
1756
+ }
1757
+ return _context13.abrupt("return", null);
1758
+ case 40:
1759
+ // CF longitude axes often use 0–360. Fit-bounds requires both endpoints
1760
+ // within ±180, so use a full-world envelope for antimeridian crossings.
1761
+ shift = 360 * Math.floor((west + 180) / 360);
1762
+ fullLongitude = east - west >= 360 - 1e-6 || east - shift > 180;
1763
+ return _context13.abrupt("return", [fullLongitude ? -180 : west - shift, Math.max(-90, south), fullLongitude ? 180 : east - shift, Math.min(90, north)]);
1764
+ case 45:
1765
+ _context13.prev = 45;
1766
+ _context13.t3 = _context13["catch"](3);
1767
+ throwIfAborted(signal);
1768
+ // An unavailable CRS definition must not prevent the dataset from loading.
1769
+ return _context13.abrupt("return", null);
1770
+ case 49:
1771
+ case "end":
1772
+ return _context13.stop();
1773
+ }
1774
+ }, _callee13, null, [[3, 45]]);
1775
+ }));
1776
+ return _getZarrBounds.apply(this, arguments);
1777
+ }
1778
+ function buildPyramidVariables(_x43, _x44, _x45, _x46, _x47, _x48) {
1574
1779
  return _buildPyramidVariables.apply(this, arguments);
1575
1780
  }
1576
1781
  function _buildPyramidVariables() {
1577
- _buildPyramidVariables = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(store, index, groupPath, levelPaths, cache, webMercatorPyramid) {
1782
+ _buildPyramidVariables = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(store, index, groupPath, levelPaths, cache, webMercatorPyramid) {
1578
1783
  var _yield$loadZarrRuntim9, zarr, base, resolve, names, variables, _iterator11, _step11, _loop2;
1579
- return _regeneratorRuntime.wrap(function _callee12$(_context13) {
1580
- while (1) switch (_context13.prev = _context13.next) {
1784
+ return _regeneratorRuntime.wrap(function _callee14$(_context15) {
1785
+ while (1) switch (_context15.prev = _context15.next) {
1581
1786
  case 0:
1582
- _context13.next = 2;
1787
+ _context15.next = 2;
1583
1788
  return loadZarrRuntime();
1584
1789
  case 2:
1585
- _yield$loadZarrRuntim9 = _context13.sent;
1790
+ _yield$loadZarrRuntim9 = _context15.sent;
1586
1791
  zarr = _yield$loadZarrRuntim9.zarr;
1587
1792
  base = normalizePath(groupPath);
1588
1793
  resolve = function resolve(rest) {
@@ -1591,11 +1796,11 @@ function _buildPyramidVariables() {
1591
1796
  names = multiscaleVariableNames(index, resolve(levelPaths[0]));
1592
1797
  variables = [];
1593
1798
  _iterator11 = _createForOfIteratorHelper(names.slice(0, MAX_VARIABLE_CANDIDATES));
1594
- _context13.prev = 9;
1799
+ _context15.prev = 9;
1595
1800
  _loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2() {
1596
1801
  var name, asset, collected, _iterator12, _step12, level, levelPath, arr, dimensionNames, attrs, ordered, finest, variable;
1597
- return _regeneratorRuntime.wrap(function _loop2$(_context12) {
1598
- while (1) switch (_context12.prev = _context12.next) {
1802
+ return _regeneratorRuntime.wrap(function _loop2$(_context14) {
1803
+ while (1) switch (_context14.prev = _context14.next) {
1599
1804
  case 0:
1600
1805
  name = _step11.value;
1601
1806
  asset = function asset(level) {
@@ -1603,57 +1808,57 @@ function _buildPyramidVariables() {
1603
1808
  };
1604
1809
  collected = [];
1605
1810
  _iterator12 = _createForOfIteratorHelper(levelPaths);
1606
- _context12.prev = 4;
1811
+ _context14.prev = 4;
1607
1812
  _iterator12.s();
1608
1813
  case 6:
1609
1814
  if ((_step12 = _iterator12.n()).done) {
1610
- _context12.next = 36;
1815
+ _context14.next = 36;
1611
1816
  break;
1612
1817
  }
1613
1818
  level = _step12.value;
1614
1819
  levelPath = resolve(asset(level));
1615
1820
  if (!isKnownMissing(index, levelPath, 'array')) {
1616
- _context12.next = 11;
1821
+ _context14.next = 11;
1617
1822
  break;
1618
1823
  }
1619
- return _context12.abrupt("break", 36);
1824
+ return _context14.abrupt("break", 36);
1620
1825
  case 11:
1621
1826
  arr = void 0;
1622
- _context12.prev = 12;
1623
- _context12.next = 15;
1827
+ _context14.prev = 12;
1828
+ _context14.next = 15;
1624
1829
  return zarr.open(new zarr.Location(store, toAbsolutePath(levelPath)), {
1625
1830
  kind: 'array'
1626
1831
  });
1627
1832
  case 15:
1628
- arr = _context12.sent;
1629
- _context12.next = 22;
1833
+ arr = _context14.sent;
1834
+ _context14.next = 22;
1630
1835
  break;
1631
1836
  case 18:
1632
- _context12.prev = 18;
1633
- _context12.t0 = _context12["catch"](12);
1837
+ _context14.prev = 18;
1838
+ _context14.t0 = _context14["catch"](12);
1634
1839
  throwIfAborted(store.signal);
1635
- return _context12.abrupt("break", 36);
1840
+ return _context14.abrupt("break", 36);
1636
1841
  case 22:
1637
1842
  dimensionNames = getZarrDimensionNames(arr);
1638
1843
  if (!dimensionNames) {
1639
- _context12.next = 29;
1844
+ _context14.next = 29;
1640
1845
  break;
1641
1846
  }
1642
- _context12.next = 26;
1847
+ _context14.next = 26;
1643
1848
  return deriveGeoZarrAttrs(store, index, levelPath, arr, dimensionNames, cache);
1644
1849
  case 26:
1645
- _context12.t1 = _context12.sent;
1646
- _context12.next = 30;
1850
+ _context14.t1 = _context14.sent;
1851
+ _context14.next = 30;
1647
1852
  break;
1648
1853
  case 29:
1649
- _context12.t1 = null;
1854
+ _context14.t1 = null;
1650
1855
  case 30:
1651
- attrs = _context12.t1;
1856
+ attrs = _context14.t1;
1652
1857
  if (attrs) {
1653
- _context12.next = 33;
1858
+ _context14.next = 33;
1654
1859
  break;
1655
1860
  }
1656
- return _context12.abrupt("break", 36);
1861
+ return _context14.abrupt("break", 36);
1657
1862
  case 33:
1658
1863
  collected.push({
1659
1864
  asset: asset(level),
@@ -1663,29 +1868,29 @@ function _buildPyramidVariables() {
1663
1868
  attrs: attrs
1664
1869
  });
1665
1870
  case 34:
1666
- _context12.next = 6;
1871
+ _context14.next = 6;
1667
1872
  break;
1668
1873
  case 36:
1669
- _context12.next = 41;
1874
+ _context14.next = 41;
1670
1875
  break;
1671
1876
  case 38:
1672
- _context12.prev = 38;
1673
- _context12.t2 = _context12["catch"](4);
1674
- _iterator12.e(_context12.t2);
1877
+ _context14.prev = 38;
1878
+ _context14.t2 = _context14["catch"](4);
1879
+ _iterator12.e(_context14.t2);
1675
1880
  case 41:
1676
- _context12.prev = 41;
1881
+ _context14.prev = 41;
1677
1882
  _iterator12.f();
1678
- return _context12.finish(41);
1883
+ return _context14.finish(41);
1679
1884
  case 44:
1680
1885
  if (collected.length) {
1681
- _context12.next = 46;
1886
+ _context14.next = 46;
1682
1887
  break;
1683
1888
  }
1684
- return _context12.abrupt("return", 1);
1889
+ return _context14.abrupt("return", 1);
1685
1890
  case 46:
1686
1891
  ordered = orderLevelsFinestFirst(collected);
1687
1892
  finest = ordered[0];
1688
- _context12.next = 50;
1893
+ _context14.next = 50;
1689
1894
  return buildVariableInfo(store, index, name ? resolve(name) : base, buildMultiscaleAttrs(finest.attrs, ordered.map(function (_ref5) {
1690
1895
  var a = _ref5.asset,
1691
1896
  transform = _ref5.transform,
@@ -1701,50 +1906,50 @@ function _buildPyramidVariables() {
1701
1906
  webMercatorPyramid: webMercatorPyramid
1702
1907
  });
1703
1908
  case 50:
1704
- variable = _context12.sent;
1909
+ variable = _context14.sent;
1705
1910
  if (variable) {
1706
1911
  variables.push(variable);
1707
1912
  }
1708
1913
  case 52:
1709
1914
  case "end":
1710
- return _context12.stop();
1915
+ return _context14.stop();
1711
1916
  }
1712
1917
  }, _loop2, null, [[4, 38, 41, 44], [12, 18]]);
1713
1918
  });
1714
1919
  _iterator11.s();
1715
1920
  case 12:
1716
1921
  if ((_step11 = _iterator11.n()).done) {
1717
- _context13.next = 18;
1922
+ _context15.next = 18;
1718
1923
  break;
1719
1924
  }
1720
- return _context13.delegateYield(_loop2(), "t0", 14);
1925
+ return _context15.delegateYield(_loop2(), "t0", 14);
1721
1926
  case 14:
1722
- if (!_context13.t0) {
1723
- _context13.next = 16;
1927
+ if (!_context15.t0) {
1928
+ _context15.next = 16;
1724
1929
  break;
1725
1930
  }
1726
- return _context13.abrupt("continue", 16);
1931
+ return _context15.abrupt("continue", 16);
1727
1932
  case 16:
1728
- _context13.next = 12;
1933
+ _context15.next = 12;
1729
1934
  break;
1730
1935
  case 18:
1731
- _context13.next = 23;
1936
+ _context15.next = 23;
1732
1937
  break;
1733
1938
  case 20:
1734
- _context13.prev = 20;
1735
- _context13.t1 = _context13["catch"](9);
1736
- _iterator11.e(_context13.t1);
1939
+ _context15.prev = 20;
1940
+ _context15.t1 = _context15["catch"](9);
1941
+ _iterator11.e(_context15.t1);
1737
1942
  case 23:
1738
- _context13.prev = 23;
1943
+ _context15.prev = 23;
1739
1944
  _iterator11.f();
1740
- return _context13.finish(23);
1945
+ return _context15.finish(23);
1741
1946
  case 26:
1742
- return _context13.abrupt("return", variables);
1947
+ return _context15.abrupt("return", variables);
1743
1948
  case 27:
1744
1949
  case "end":
1745
- return _context13.stop();
1950
+ return _context15.stop();
1746
1951
  }
1747
- }, _callee12, null, [[9, 20, 23, 26]]);
1952
+ }, _callee14, null, [[9, 20, 23, 26]]);
1748
1953
  }));
1749
1954
  return _buildPyramidVariables.apply(this, arguments);
1750
1955
  }
@@ -1828,7 +2033,7 @@ export function childPrefix(path) {
1828
2033
  var normalized = normalizePath(path);
1829
2034
  return normalized ? "".concat(normalized, "/") : '';
1830
2035
  }
1831
- function listCandidatePaths(_x45) {
2036
+ function listCandidatePaths(_x49) {
1832
2037
  return _listCandidatePaths.apply(this, arguments);
1833
2038
  }
1834
2039
  /**
@@ -1841,16 +2046,16 @@ function listCandidatePaths(_x45) {
1841
2046
  * not offered as separate variables.
1842
2047
  */
1843
2048
  function _listCandidatePaths() {
1844
- _listCandidatePaths = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(store) {
2049
+ _listCandidatePaths = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(store) {
1845
2050
  var contents, paths;
1846
- return _regeneratorRuntime.wrap(function _callee13$(_context14) {
1847
- while (1) switch (_context14.prev = _context14.next) {
2051
+ return _regeneratorRuntime.wrap(function _callee15$(_context16) {
2052
+ while (1) switch (_context16.prev = _context16.next) {
1848
2053
  case 0:
1849
2054
  if (!(typeof store.contents !== 'function')) {
1850
- _context14.next = 2;
2055
+ _context16.next = 2;
1851
2056
  break;
1852
2057
  }
1853
- return _context14.abrupt("return", ['']);
2058
+ return _context16.abrupt("return", ['']);
1854
2059
  case 2:
1855
2060
  contents = store.contents();
1856
2061
  paths = contents.filter(function (entry) {
@@ -1862,20 +2067,20 @@ function _listCandidatePaths() {
1862
2067
  .sort(function (a, b) {
1863
2068
  return a.split('/').length - b.split('/').length || a.localeCompare(b);
1864
2069
  });
1865
- return _context14.abrupt("return", paths.length ? paths : ['']);
2070
+ return _context16.abrupt("return", paths.length ? paths : ['']);
1866
2071
  case 5:
1867
2072
  case "end":
1868
- return _context14.stop();
2073
+ return _context16.stop();
1869
2074
  }
1870
- }, _callee13);
2075
+ }, _callee15);
1871
2076
  }));
1872
2077
  return _listCandidatePaths.apply(this, arguments);
1873
2078
  }
1874
- export function getZarrMetadata(_x46) {
2079
+ export function getZarrMetadata(_x50) {
1875
2080
  return _getZarrMetadata.apply(this, arguments);
1876
2081
  }
1877
2082
  function _getZarrMetadata() {
1878
- _getZarrMetadata = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(url) {
2083
+ _getZarrMetadata = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(url) {
1879
2084
  var _labeled$find;
1880
2085
  var options,
1881
2086
  signal,
@@ -1896,32 +2101,32 @@ function _getZarrMetadata() {
1896
2101
  _ret,
1897
2102
  labeled,
1898
2103
  active,
1899
- _args16 = arguments;
1900
- return _regeneratorRuntime.wrap(function _callee14$(_context16) {
1901
- while (1) switch (_context16.prev = _context16.next) {
2104
+ _args18 = arguments;
2105
+ return _regeneratorRuntime.wrap(function _callee16$(_context18) {
2106
+ while (1) switch (_context18.prev = _context18.next) {
1902
2107
  case 0:
1903
- options = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {};
2108
+ options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
1904
2109
  signal = options.signal, onProgress = options.onProgress;
1905
2110
  throwIfAborted(signal);
1906
2111
  onProgress === null || onProgress === void 0 || onProgress({
1907
2112
  phase: 'connecting',
1908
2113
  loadedBytes: 0
1909
2114
  });
1910
- _context16.next = 6;
2115
+ _context18.next = 6;
1911
2116
  return loadZarrRuntime();
1912
2117
  case 6:
1913
- _yield$loadZarrRuntim0 = _context16.sent;
2118
+ _yield$loadZarrRuntim0 = _context18.sent;
1914
2119
  zarr = _yield$loadZarrRuntim0.zarr;
1915
2120
  parseGeoZarrMetadata = _yield$loadZarrRuntim0.parseGeoZarrMetadata;
1916
2121
  throwIfAborted(signal);
1917
2122
  // Keep the signal out of the shared cache. All reads, including coordinate
1918
2123
  // chunks and range requests, go through this request-scoped fetch function.
1919
2124
  if (!(signal || onProgress)) {
1920
- _context16.next = 19;
2125
+ _context18.next = 19;
1921
2126
  break;
1922
2127
  }
1923
- _context16.t1 = Object;
1924
- _context16.next = 14;
2128
+ _context18.t1 = Object;
2129
+ _context18.next = 14;
1925
2130
  return withDetectedZarrMetadata(new zarr.FetchStore(url, {
1926
2131
  fetch: onProgress ? createMetadataFetch(signal, onProgress) : function (request) {
1927
2132
  return fetch(request, {
@@ -1930,26 +2135,26 @@ function _getZarrMetadata() {
1930
2135
  }
1931
2136
  }));
1932
2137
  case 14:
1933
- _context16.t2 = _context16.sent;
1934
- _context16.t3 = {
2138
+ _context18.t2 = _context18.sent;
2139
+ _context18.t3 = {
1935
2140
  signal: signal
1936
2141
  };
1937
- _context16.t0 = _context16.t1.assign.call(_context16.t1, _context16.t2, _context16.t3);
1938
- _context16.next = 22;
2142
+ _context18.t0 = _context18.t1.assign.call(_context18.t1, _context18.t2, _context18.t3);
2143
+ _context18.next = 22;
1939
2144
  break;
1940
2145
  case 19:
1941
- _context16.next = 21;
2146
+ _context18.next = 21;
1942
2147
  return openZarrStore(url);
1943
2148
  case 21:
1944
- _context16.t0 = _context16.sent;
2149
+ _context18.t0 = _context18.sent;
1945
2150
  case 22:
1946
- store = _context16.t0;
2151
+ store = _context18.t0;
1947
2152
  throwIfAborted(signal);
1948
2153
  index = buildStoreIndex(store);
1949
- _context16.next = 27;
2154
+ _context18.next = 27;
1950
2155
  return listCandidatePaths(store);
1951
2156
  case 27:
1952
- paths = _context16.sent;
2157
+ paths = _context18.sent;
1953
2158
  variables = [];
1954
2159
  coordinateCache = {
1955
2160
  dimensions: new Map(),
@@ -1958,162 +2163,162 @@ function _getZarrMetadata() {
1958
2163
  matchedPrefixes = [];
1959
2164
  errors = [];
1960
2165
  _iterator13 = _createForOfIteratorHelper(paths.slice(0, MAX_VARIABLE_CANDIDATES));
1961
- _context16.prev = 33;
2166
+ _context18.prev = 33;
1962
2167
  _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3() {
1963
2168
  var path, node, declared, levelPaths, pyramid, geoAttrs, preopened, arr, dimensionNames, variable;
1964
- return _regeneratorRuntime.wrap(function _loop3$(_context15) {
1965
- while (1) switch (_context15.prev = _context15.next) {
2169
+ return _regeneratorRuntime.wrap(function _loop3$(_context17) {
2170
+ while (1) switch (_context17.prev = _context17.next) {
1966
2171
  case 0:
1967
2172
  path = _step13.value;
1968
2173
  throwIfAborted(signal);
1969
2174
  if (!matchedPrefixes.some(function (prefix) {
1970
2175
  return path.startsWith(prefix);
1971
2176
  })) {
1972
- _context15.next = 4;
2177
+ _context17.next = 4;
1973
2178
  break;
1974
2179
  }
1975
- return _context15.abrupt("return", 0);
2180
+ return _context17.abrupt("return", 0);
1976
2181
  case 4:
1977
- _context15.prev = 4;
1978
- _context15.next = 7;
2182
+ _context17.prev = 4;
2183
+ _context17.next = 7;
1979
2184
  return zarr.open(new zarr.Location(store, toAbsolutePath(path)), {
1980
2185
  kind: index === null || index === void 0 ? void 0 : index.get(normalizePath(path))
1981
2186
  });
1982
2187
  case 7:
1983
- node = _context15.sent;
1984
- _context15.next = 14;
2188
+ node = _context17.sent;
2189
+ _context17.next = 14;
1985
2190
  break;
1986
2191
  case 10:
1987
- _context15.prev = 10;
1988
- _context15.t0 = _context15["catch"](4);
2192
+ _context17.prev = 10;
2193
+ _context17.t0 = _context17["catch"](4);
1989
2194
  throwIfAborted(signal);
1990
- return _context15.abrupt("return", 0);
2195
+ return _context17.abrupt("return", 0);
1991
2196
  case 14:
1992
2197
  declared = getAttrs(node); // A pyramid written in the OME-NGFF style has to be rewritten before the
1993
2198
  // GeoZarr parser can read it, and yields one variable per array in a level.
1994
2199
  levelPaths = 'shape' in node ? null : parseOmeMultiscaleLevels(declared);
1995
2200
  if (!levelPaths) {
1996
- _context15.next = 31;
2201
+ _context17.next = 31;
1997
2202
  break;
1998
2203
  }
1999
- _context15.prev = 17;
2000
- _context15.next = 20;
2204
+ _context17.prev = 17;
2205
+ _context17.next = 20;
2001
2206
  return buildPyramidVariables(store, index, path, levelPaths, coordinateCache, isWebMercatorPyramid(declared));
2002
2207
  case 20:
2003
- pyramid = _context15.sent;
2208
+ pyramid = _context17.sent;
2004
2209
  if (!pyramid.length) {
2005
- _context15.next = 25;
2210
+ _context17.next = 25;
2006
2211
  break;
2007
2212
  }
2008
2213
  variables.push.apply(variables, _toConsumableArray(pyramid));
2009
2214
  matchedPrefixes.push(childPrefix(path));
2010
- return _context15.abrupt("return", 0);
2215
+ return _context17.abrupt("return", 0);
2011
2216
  case 25:
2012
- _context15.next = 31;
2217
+ _context17.next = 31;
2013
2218
  break;
2014
2219
  case 27:
2015
- _context15.prev = 27;
2016
- _context15.t1 = _context15["catch"](17);
2220
+ _context17.prev = 27;
2221
+ _context17.t1 = _context17["catch"](17);
2017
2222
  throwIfAborted(signal);
2018
- errors.push(_context15.t1 instanceof Error ? _context15.t1.message : String(_context15.t1));
2223
+ errors.push(_context17.t1 instanceof Error ? _context17.t1.message : String(_context17.t1));
2019
2224
  case 31:
2020
2225
  geoAttrs = null;
2021
- _context15.prev = 32;
2226
+ _context17.prev = 32;
2022
2227
  parseGeoZarrMetadata(declared);
2023
2228
  geoAttrs = declared;
2024
- _context15.next = 51;
2229
+ _context17.next = 51;
2025
2230
  break;
2026
2231
  case 37:
2027
- _context15.prev = 37;
2028
- _context15.t2 = _context15["catch"](32);
2232
+ _context17.prev = 37;
2233
+ _context17.t2 = _context17["catch"](32);
2029
2234
  if (!('shape' in node)) {
2030
- _context15.next = 51;
2235
+ _context17.next = 51;
2031
2236
  break;
2032
2237
  }
2033
2238
  arr = node;
2034
2239
  dimensionNames = getZarrDimensionNames(arr);
2035
2240
  if (!dimensionNames) {
2036
- _context15.next = 48;
2241
+ _context17.next = 48;
2037
2242
  break;
2038
2243
  }
2039
- _context15.next = 45;
2244
+ _context17.next = 45;
2040
2245
  return deriveGeoZarrAttrs(store, index, path, arr, dimensionNames, coordinateCache);
2041
2246
  case 45:
2042
- _context15.t3 = _context15.sent;
2043
- _context15.next = 49;
2247
+ _context17.t3 = _context17.sent;
2248
+ _context17.next = 49;
2044
2249
  break;
2045
2250
  case 48:
2046
- _context15.t3 = null;
2251
+ _context17.t3 = null;
2047
2252
  case 49:
2048
- geoAttrs = _context15.t3;
2253
+ geoAttrs = _context17.t3;
2049
2254
  preopened = arr;
2050
2255
  case 51:
2051
2256
  if (geoAttrs) {
2052
- _context15.next = 53;
2257
+ _context17.next = 53;
2053
2258
  break;
2054
2259
  }
2055
- return _context15.abrupt("return", 0);
2260
+ return _context17.abrupt("return", 0);
2056
2261
  case 53:
2057
- _context15.prev = 53;
2058
- _context15.next = 56;
2262
+ _context17.prev = 53;
2263
+ _context17.next = 56;
2059
2264
  return buildVariableInfo(store, index, path, geoAttrs, coordinateCache, {
2060
2265
  preopened: preopened
2061
2266
  });
2062
2267
  case 56:
2063
- variable = _context15.sent;
2268
+ variable = _context17.sent;
2064
2269
  if (variable) {
2065
2270
  variables.push(variable);
2066
2271
  matchedPrefixes.push(childPrefix(path));
2067
2272
  }
2068
- _context15.next = 64;
2273
+ _context17.next = 64;
2069
2274
  break;
2070
2275
  case 60:
2071
- _context15.prev = 60;
2072
- _context15.t4 = _context15["catch"](53);
2276
+ _context17.prev = 60;
2277
+ _context17.t4 = _context17["catch"](53);
2073
2278
  throwIfAborted(signal);
2074
- errors.push(_context15.t4 instanceof Error ? _context15.t4.message : String(_context15.t4));
2279
+ errors.push(_context17.t4 instanceof Error ? _context17.t4.message : String(_context17.t4));
2075
2280
  case 64:
2076
2281
  case "end":
2077
- return _context15.stop();
2282
+ return _context17.stop();
2078
2283
  }
2079
2284
  }, _loop3, null, [[4, 10], [17, 27], [32, 37], [53, 60]]);
2080
2285
  });
2081
2286
  _iterator13.s();
2082
2287
  case 36:
2083
2288
  if ((_step13 = _iterator13.n()).done) {
2084
- _context16.next = 43;
2289
+ _context18.next = 43;
2085
2290
  break;
2086
2291
  }
2087
- return _context16.delegateYield(_loop3(), "t4", 38);
2292
+ return _context18.delegateYield(_loop3(), "t4", 38);
2088
2293
  case 38:
2089
- _ret = _context16.t4;
2294
+ _ret = _context18.t4;
2090
2295
  if (!(_ret === 0)) {
2091
- _context16.next = 41;
2296
+ _context18.next = 41;
2092
2297
  break;
2093
2298
  }
2094
- return _context16.abrupt("continue", 41);
2299
+ return _context18.abrupt("continue", 41);
2095
2300
  case 41:
2096
- _context16.next = 36;
2301
+ _context18.next = 36;
2097
2302
  break;
2098
2303
  case 43:
2099
- _context16.next = 48;
2304
+ _context18.next = 48;
2100
2305
  break;
2101
2306
  case 45:
2102
- _context16.prev = 45;
2103
- _context16.t5 = _context16["catch"](33);
2104
- _iterator13.e(_context16.t5);
2307
+ _context18.prev = 45;
2308
+ _context18.t5 = _context18["catch"](33);
2309
+ _iterator13.e(_context18.t5);
2105
2310
  case 48:
2106
- _context16.prev = 48;
2311
+ _context18.prev = 48;
2107
2312
  _iterator13.f();
2108
- return _context16.finish(48);
2313
+ return _context18.finish(48);
2109
2314
  case 51:
2110
2315
  throwIfAborted(signal);
2111
2316
  if (!(variables.length === 0)) {
2112
- _context16.next = 56;
2317
+ _context18.next = 56;
2113
2318
  break;
2114
2319
  }
2115
2320
  if (!errors.length) {
2116
- _context16.next = 55;
2321
+ _context18.next = 55;
2117
2322
  break;
2118
2323
  }
2119
2324
  throw new Error(errors[0]);
@@ -2124,7 +2329,7 @@ function _getZarrMetadata() {
2124
2329
  active = (_labeled$find = labeled.find(function (variable) {
2125
2330
  return variable.path === options.variable;
2126
2331
  })) !== null && _labeled$find !== void 0 ? _labeled$find : labeled[0];
2127
- return _context16.abrupt("return", selectZarrVariable({
2332
+ return _context18.abrupt("return", selectZarrVariable({
2128
2333
  url: url,
2129
2334
  axes: [],
2130
2335
  xAxisIndex: -1,
@@ -2135,9 +2340,9 @@ function _getZarrMetadata() {
2135
2340
  }, active.path));
2136
2341
  case 59:
2137
2342
  case "end":
2138
- return _context16.stop();
2343
+ return _context18.stop();
2139
2344
  }
2140
- }, _callee14, null, [[33, 45, 48, 51]]);
2345
+ }, _callee16, null, [[33, 45, 48, 51]]);
2141
2346
  }));
2142
2347
  return _getZarrMetadata.apply(this, arguments);
2143
2348
  }