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