@metoceanapi/wxtiles-common 0.0.8 → 0.0.11-0

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.
Files changed (162) hide show
  1. package/.github/workflows/lint.yml +1 -1
  2. package/.github/workflows/validate-pull-request-title.yml +17 -0
  3. package/LICENSE.txt +1 -1
  4. package/biome.json +26 -1
  5. package/controls/WxAPIControl/WxAPIControl-busy.ts +16 -0
  6. package/controls/WxAPIControl/WxAPIControl-datasets.ts +102 -0
  7. package/controls/WxAPIControl/WxAPIControl-filter.ts +66 -0
  8. package/controls/WxAPIControl/WxAPIControl-variables.ts +73 -0
  9. package/controls/WxAPIControl.ts +87 -120
  10. package/controls/WxInfoControl.ts +87 -2
  11. package/controls/WxLegendControl.ts +28 -2
  12. package/controls/WxStyleEditorControl.ts +129 -7
  13. package/controls/WxTimeControl.ts +133 -5
  14. package/docs/docs/.nojekyll +1 -0
  15. package/docs/docs/assets/highlight.css +92 -0
  16. package/docs/docs/assets/icons.svg +1 -0
  17. package/docs/docs/assets/style.css +1610 -0
  18. package/docs/docs/classes/controls_WxAPIControl.WxAPIControl.html +28 -0
  19. package/docs/docs/classes/controls_WxInfoControl.WxInfoControl.html +20 -0
  20. package/docs/docs/classes/controls_WxLegendControl.WxLegendControl.html +19 -0
  21. package/docs/docs/classes/controls_WxStyleEditorControl.WxStyleEditorControl.html +111 -0
  22. package/docs/docs/classes/controls_WxTimeControl.WxTimeControl.html +28 -0
  23. package/docs/docs/classes/managers_BaseDatasetManager.BaseDatasetManager.html +104 -0
  24. package/docs/docs/classes/managers_WxAllDatasetsManager.WxAllDatasetsManager.html +24 -0
  25. package/docs/docs/classes/types.WxRasterDataCache.html +27 -0
  26. package/docs/docs/classes/utils_RawCLUT.RawCLUT.html +18 -0
  27. package/docs/docs/classes/utils_qtree.QTree.html +22 -0
  28. package/docs/docs/classes/utils_wxtools.DataIntegral.html +10 -0
  29. package/docs/docs/classes/wxapi.WxAPI.html +45 -0
  30. package/docs/docs/classes/wxlayer_loader.Loader.html +31 -0
  31. package/docs/docs/classes/wxlayer_painter.Painter.html +20 -0
  32. package/docs/docs/classes/wxlayer_wxlayer.WxLayer.html +57 -0
  33. package/docs/docs/enums/utils_qtree.TileType.html +5 -0
  34. package/docs/docs/functions/utils_RawCLUT.WxCreateLegend.html +5 -0
  35. package/docs/docs/functions/utils_mercator.LatLonToPixels.html +6 -0
  36. package/docs/docs/functions/utils_mercator.PixelsToLatLon.html +6 -0
  37. package/docs/docs/functions/utils_mercator.PixelsToLonLat.html +6 -0
  38. package/docs/docs/functions/utils_mercator.coordToPixel.html +5 -0
  39. package/docs/docs/functions/utils_tests_wxtools.tests.html +1 -0
  40. package/docs/docs/functions/utils_wxtools.HEXtoRGBA.html +3 -0
  41. package/docs/docs/functions/utils_wxtools.HashXYZ.html +4 -0
  42. package/docs/docs/functions/utils_wxtools.RGBAtoHEX.html +3 -0
  43. package/docs/docs/functions/utils_wxtools.RGBtoHEX.html +3 -0
  44. package/docs/docs/functions/utils_wxtools.WXLOG.html +2 -0
  45. package/docs/docs/functions/utils_wxtools.WxGetColorSchemes.html +2 -0
  46. package/docs/docs/functions/utils_wxtools.WxGetColorStyles.html +2 -0
  47. package/docs/docs/functions/utils_wxtools.WxTilesLibSetup.html +3 -0
  48. package/docs/docs/functions/utils_wxtools.WxTilesLogging.html +5 -0
  49. package/docs/docs/functions/utils_wxtools.blurData.html +7 -0
  50. package/docs/docs/functions/utils_wxtools.buildIntegralPare.html +6 -0
  51. package/docs/docs/functions/utils_wxtools.cacheUriPromise.html +2 -0
  52. package/docs/docs/functions/utils_wxtools.create2DContext.html +6 -0
  53. package/docs/docs/functions/utils_wxtools.createEl.html +5 -0
  54. package/docs/docs/functions/utils_wxtools.createLevels.html +6 -0
  55. package/docs/docs/functions/utils_wxtools.fetchJson.html +6 -0
  56. package/docs/docs/functions/utils_wxtools.getClosestTimeString.html +5 -0
  57. package/docs/docs/functions/utils_wxtools.loadDataIntegral.html +5 -0
  58. package/docs/docs/functions/utils_wxtools.loadImage.html +4 -0
  59. package/docs/docs/functions/utils_wxtools.loadImageData.html +5 -0
  60. package/docs/docs/functions/utils_wxtools.makeConverter.html +9 -0
  61. package/docs/docs/functions/utils_wxtools.mixColor.html +3 -0
  62. package/docs/docs/functions/utils_wxtools.refineColor.html +3 -0
  63. package/docs/docs/functions/utils_wxtools.uriXYZ.html +5 -0
  64. package/docs/docs/functions/wxlayer_WxImplementation.WxLayerBaseImplementationMixin.html +4 -0
  65. package/docs/docs/functions/wxlayer_loadertools.applyMask.html +10 -0
  66. package/docs/docs/functions/wxlayer_loadertools.makeBox.html +4 -0
  67. package/docs/docs/functions/wxlayer_loadertools.splitCoords.html +6 -0
  68. package/docs/docs/functions/wxlayer_loadertools.subData.html +5 -0
  69. package/docs/docs/functions/wxlayer_loadertools.subDataDegree.html +5 -0
  70. package/docs/docs/functions/wxlayer_loadertools.subMask.html +5 -0
  71. package/docs/docs/hierarchy.html +1 -0
  72. package/docs/docs/index.html +7 -0
  73. package/docs/docs/interfaces/types.IsoInfo.html +8 -0
  74. package/docs/docs/interfaces/types.SLinePoint.html +4 -0
  75. package/docs/docs/interfaces/types.WxAPIOptions.html +37 -0
  76. package/docs/docs/interfaces/types.WxAllBoundariesMeta.html +8 -0
  77. package/docs/docs/interfaces/types.WxAllDatasetsShortMetas.html +4 -0
  78. package/docs/docs/interfaces/types.WxBoundaryMeta.html +10 -0
  79. package/docs/docs/interfaces/types.WxData.html +10 -0
  80. package/docs/docs/interfaces/types.WxDataSetManagerOptions.html +14 -0
  81. package/docs/docs/interfaces/types.WxDatasetMeta.html +20 -0
  82. package/docs/docs/interfaces/types.WxDatasetShortMeta.html +9 -0
  83. package/docs/docs/interfaces/types.WxLayerAPI.html +24 -0
  84. package/docs/docs/interfaces/types.WxLayerBaseAPI.html +16 -0
  85. package/docs/docs/interfaces/types.WxLayerOptions.html +12 -0
  86. package/docs/docs/interfaces/types.WxLngLat.html +6 -0
  87. package/docs/docs/interfaces/types.WxRasterData.html +13 -0
  88. package/docs/docs/interfaces/types.WxRequestInit.html +3 -0
  89. package/docs/docs/interfaces/types.WxTileInfo.html +18 -0
  90. package/docs/docs/interfaces/types.WxVariableMeta.html +13 -0
  91. package/docs/docs/interfaces/types.WxVariablesMetas.html +4 -0
  92. package/docs/docs/interfaces/utils_RawCLUT.WxLegend.html +14 -0
  93. package/docs/docs/interfaces/utils_RawCLUT.WxTick.html +10 -0
  94. package/docs/docs/interfaces/utils_qtree.Tree.html +7 -0
  95. package/docs/docs/interfaces/utils_wxtools.CachedUriLoaderPromiseFunc.html +2 -0
  96. package/docs/docs/interfaces/utils_wxtools.ColorStylesIncomplete.html +2 -0
  97. package/docs/docs/interfaces/utils_wxtools.Converter.html +5 -0
  98. package/docs/docs/interfaces/utils_wxtools.DataPicture.html +6 -0
  99. package/docs/docs/interfaces/utils_wxtools.IntegralPare.html +6 -0
  100. package/docs/docs/interfaces/utils_wxtools.WxColorSchemes.html +3 -0
  101. package/docs/docs/interfaces/utils_wxtools.WxColorStyleStrict.html +95 -0
  102. package/docs/docs/interfaces/utils_wxtools.WxColorStyleWeak.html +95 -0
  103. package/docs/docs/interfaces/utils_wxtools.WxColorStylesStrict.html +2 -0
  104. package/docs/docs/interfaces/utils_wxtools.WxColorStylesWeakMixed.html +2 -0
  105. package/docs/docs/interfaces/utils_wxtools.WxTilesLibOptions.html +8 -0
  106. package/docs/docs/interfaces/utils_wxtools.WxUnits.html +2 -0
  107. package/docs/docs/interfaces/utils_wxtools.XYZ.html +5 -0
  108. package/docs/docs/modules/controls_WxAPIControl.html +1 -0
  109. package/docs/docs/modules/controls_WxInfoControl.html +1 -0
  110. package/docs/docs/modules/controls_WxLegendControl.html +1 -0
  111. package/docs/docs/modules/controls_WxStyleEditorControl.html +1 -0
  112. package/docs/docs/modules/controls_WxTimeControl.html +1 -0
  113. package/docs/docs/modules/defaults_colorschemes.html +1 -0
  114. package/docs/docs/modules/defaults_styles.html +1 -0
  115. package/docs/docs/modules/defaults_uconv.html +1 -0
  116. package/docs/docs/modules/managers_BaseDatasetManager.html +1 -0
  117. package/docs/docs/modules/managers_WxAllDatasetsManager.html +1 -0
  118. package/docs/docs/modules/types.html +1 -0
  119. package/docs/docs/modules/utils_RawCLUT.html +1 -0
  120. package/docs/docs/modules/utils_mercator.html +1 -0
  121. package/docs/docs/modules/utils_qtree.html +1 -0
  122. package/docs/docs/modules/utils_tests_wxtools.html +1 -0
  123. package/docs/docs/modules/utils_wxtools.html +1 -0
  124. package/docs/docs/modules/wxapi.html +1 -0
  125. package/docs/docs/modules/wxlayer_WxImplementation.html +1 -0
  126. package/docs/docs/modules/wxlayer_loader.html +1 -0
  127. package/docs/docs/modules/wxlayer_loadertools.html +1 -0
  128. package/docs/docs/modules/wxlayer_painter.html +1 -0
  129. package/docs/docs/modules/wxlayer_wxlayer.html +1 -0
  130. package/docs/docs/modules.html +1 -0
  131. package/docs/docs/types/types.ListenerMethod.html +1 -0
  132. package/docs/docs/types/types.SLine.html +2 -0
  133. package/docs/docs/types/types.WxDate.html +9 -0
  134. package/docs/docs/types/types.WxEventType.html +1 -0
  135. package/docs/docs/types/types.WxInstances.html +2 -0
  136. package/docs/docs/types/types.WxLayerVarsNames.html +2 -0
  137. package/docs/docs/types/types.WxURIs.html +2 -0
  138. package/docs/docs/types/utils_qtree.SubTrees.html +2 -0
  139. package/docs/docs/types/utils_qtree.SubTreesN.html +2 -0
  140. package/docs/docs/types/utils_qtree.TreeN.html +2 -0
  141. package/docs/docs/types/utils_wxtools.DataIntegrals.html +2 -0
  142. package/docs/docs/types/utils_wxtools.DataPictures.html +2 -0
  143. package/docs/docs/types/utils_wxtools.WxUnitTuple.html +2 -0
  144. package/docs/docs/types/utils_wxtools.colorMapTuple.html +2 -0
  145. package/docs/docs/variables/defaults_colorschemes.__colorSchemes_default_preset.html +1 -0
  146. package/docs/docs/variables/defaults_styles.__colorStyles_default_preset.html +1 -0
  147. package/docs/docs/variables/defaults_uconv.__units_default_preset.html +1 -0
  148. package/managers/BaseDatasetManager.ts +272 -0
  149. package/managers/WxAllDatasetsManager.ts +60 -0
  150. package/package.json +6 -3
  151. package/tsconfig.json +31 -0
  152. package/typedoc.json +4 -0
  153. package/types.ts +471 -0
  154. package/utils/qtree.ts +2 -1
  155. package/utils/tests_wxtools.ts +10 -10
  156. package/utils/wxtools.ts +1 -0
  157. package/wxapi.ts +222 -0
  158. package/wxlayer/WxImplementation.ts +374 -0
  159. package/wxlayer/loader.ts +305 -0
  160. package/wxlayer/loadertools.ts +380 -0
  161. package/wxlayer/painter.ts +451 -0
  162. package/wxlayer/wxlayer.ts +379 -0
@@ -0,0 +1,2 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WxUnitTuple | @metoceanapi/wxtiles-common</title><meta name="description" content="Documentation for @metoceanapi/wxtiles-common"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@metoceanapi/wxtiles-common</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@metoceanapi/wxtiles-common</a></li><li><a href="../modules/utils_wxtools.html">utils/wxtools</a></li><li><a href="utils_wxtools.WxUnitTuple.html">WxUnitTuple</a></li></ul><h1>Type Alias WxUnitTuple</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">WxUnitTuple</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">]</span></div><div class="tsd-comment tsd-typography"><p>type for unit converter</p>
2
+ </div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/metoceanapi/wxtiles-common/blob/b815568b9334ab8c2405ae085c09aad12678ca1b/utils/wxtools.ts#L13">utils/wxtools.ts:13</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@metoceanapi/wxtiles-common</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,2 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>colorMapTuple | @metoceanapi/wxtiles-common</title><meta name="description" content="Documentation for @metoceanapi/wxtiles-common"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@metoceanapi/wxtiles-common</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@metoceanapi/wxtiles-common</a></li><li><a href="../modules/utils_wxtools.html">utils/wxtools</a></li><li><a href="utils_wxtools.colorMapTuple.html">colorMapTuple</a></li></ul><h1>Type Alias colorMapTuple</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">colorMapTuple</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]</span></div><div class="tsd-comment tsd-typography"><p>A [level,color] tuple</p>
2
+ </div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/metoceanapi/wxtiles-common/blob/b815568b9334ab8c2405ae085c09aad12678ca1b/utils/wxtools.ts#L28">utils/wxtools.ts:28</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@metoceanapi/wxtiles-common</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>__colorSchemes_default_preset | @metoceanapi/wxtiles-common</title><meta name="description" content="Documentation for @metoceanapi/wxtiles-common"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@metoceanapi/wxtiles-common</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@metoceanapi/wxtiles-common</a></li><li><a href="../modules/defaults_colorschemes.html">defaults/colorschemes</a></li><li><a href="defaults_colorschemes.__colorSchemes_default_preset.html">__colorSchemes_default_preset</a></li></ul><h1>Variable __colorSchemes_default_preset<code class="tsd-tag">Const</code></h1></div><div class="tsd-signature"><span class="tsd-kind-variable">__colorSchemes_default_preset</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/utils_wxtools.WxColorSchemes.html" class="tsd-signature-type tsd-kind-interface">WxColorSchemes</a><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/metoceanapi/wxtiles-common/blob/b815568b9334ab8c2405ae085c09aad12678ca1b/defaults/colorschemes.ts#L2">defaults/colorschemes.ts:2</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@metoceanapi/wxtiles-common</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>__colorStyles_default_preset | @metoceanapi/wxtiles-common</title><meta name="description" content="Documentation for @metoceanapi/wxtiles-common"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@metoceanapi/wxtiles-common</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@metoceanapi/wxtiles-common</a></li><li><a href="../modules/defaults_styles.html">defaults/styles</a></li><li><a href="defaults_styles.__colorStyles_default_preset.html">__colorStyles_default_preset</a></li></ul><h1>Variable __colorStyles_default_preset<code class="tsd-tag">Const</code></h1></div><div class="tsd-signature"><span class="tsd-kind-variable">__colorStyles_default_preset</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/utils_wxtools.WxColorStylesStrict.html" class="tsd-signature-type tsd-kind-interface">WxColorStylesStrict</a><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/metoceanapi/wxtiles-common/blob/b815568b9334ab8c2405ae085c09aad12678ca1b/defaults/styles.ts#L3">defaults/styles.ts:3</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@metoceanapi/wxtiles-common</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>__units_default_preset | @metoceanapi/wxtiles-common</title><meta name="description" content="Documentation for @metoceanapi/wxtiles-common"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@metoceanapi/wxtiles-common</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@metoceanapi/wxtiles-common</a></li><li><a href="../modules/defaults_uconv.html">defaults/uconv</a></li><li><a href="defaults_uconv.__units_default_preset.html">__units_default_preset</a></li></ul><h1>Variable __units_default_preset<code class="tsd-tag">Const</code></h1></div><div class="tsd-signature"><span class="tsd-kind-variable">__units_default_preset</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/utils_wxtools.WxUnits.html" class="tsd-signature-type tsd-kind-interface">WxUnits</a><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/metoceanapi/wxtiles-common/blob/b815568b9334ab8c2405ae085c09aad12678ca1b/defaults/uconv.ts#L3">defaults/uconv.ts:3</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@metoceanapi/wxtiles-common</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,272 @@
1
+ import { WXLOG } from "../utils/wxtools";
2
+ import type {
3
+ WxAllBoundariesMeta,
4
+ WxDatasetMeta,
5
+ WxVariableMeta,
6
+ WxDate,
7
+ WxLayerVarsNames,
8
+ WxDataSetManagerOptions,
9
+ } from "../types";
10
+ import type { WxAPI } from "../wxapi";
11
+
12
+ /**
13
+ * Base class for managing a WX dataset and its related operations.
14
+ *
15
+ * Instances of concrete subclasses of this class handle metadata, variables,
16
+ * valid times, zoom levels, and URI construction for WX datasets.
17
+ *
18
+ * **Usage Note:** Do not create instances directly using the constructor.
19
+ * Use {@link WxAPI.createDatasetManager} instead.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const wxapi = new WxAPI({ dataServerURL: "https://example.com" });
24
+ * const wxDatasetManager = await wxapi.createDatasetManager("gfs.global");
25
+ * console.log(wxDatasetManager.getAllVariables());
26
+ * ```
27
+ */
28
+ export abstract class BaseDatasetManager {
29
+ /** The name of the dataset being managed. */
30
+ readonly datasetName: string;
31
+
32
+ /**
33
+ * @internal
34
+ * A reference to the WX API instance that created this manager.
35
+ */
36
+ readonly wxAPI: WxAPI;
37
+
38
+ /** @ignore The current instance name of the dataset (for time-stepped datasets). */
39
+ protected _datasetCurrentInstance: string;
40
+
41
+ /** @ignore The current metadata for the dataset. */
42
+ protected _datasetCurrentMeta: WxDatasetMeta;
43
+
44
+ /** @ignore Array of instances for time-stepped datasets (optional). */
45
+ protected _instanced?: string[];
46
+
47
+ /** @ignore Map of metadata for each dataset instance (optional). */
48
+ protected _metas?: Map<string, WxDatasetMeta>;
49
+
50
+ /**
51
+ * Do not use this constructor directly. Use {@link WxAPI.createDatasetManager} instead.
52
+ *
53
+ * @param {WxDataSetManagerOptions} options - Dataset manager options.
54
+ */
55
+ constructor({
56
+ datasetName,
57
+ datasetCurrentInstance,
58
+ instanced,
59
+ datasetCurrentMeta,
60
+ metas,
61
+ wxAPI,
62
+ }: WxDataSetManagerOptions) {
63
+ this.datasetName = datasetName;
64
+ this._instanced = instanced;
65
+ this._datasetCurrentInstance = datasetCurrentInstance;
66
+ this._datasetCurrentMeta = datasetCurrentMeta;
67
+ this._metas = metas;
68
+ this.wxAPI = wxAPI;
69
+ WXLOG(`WxDataSetManager.constructor: ${this.datasetName}`);
70
+ }
71
+
72
+ /**
73
+ * Finds the nearest valid time in the dataset based on the input.
74
+ *
75
+ * - If `time` is an empty string, the last available time is returned.
76
+ * - If `time` is a string matching a valid time, that time is returned.
77
+ * - If `time` is a number:
78
+ * - Negative: Returns the first time.
79
+ * - Within range: Returns the corresponding indexed time.
80
+ * - Otherwise, finds the closest time in milliseconds.
81
+ *
82
+ * @param {WxDate} [time=Date()] - Input time as a string, number, or Date object.
83
+ * @returns {string} - The nearest valid time from the dataset's time steps.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const nearestTime = wxDatasetManager.getNearestValidTime("2024-06-10T12:00:00Z");
88
+ * console.log(nearestTime); // Closest valid time
89
+ * ```
90
+ */
91
+ getNearestValidTime(time: WxDate = Date()): string {
92
+ WXLOG(`WxDataSetManager.getValidTime: ${this.datasetName}, ${time}`);
93
+ const times = this.getAllTimes();
94
+
95
+ if (time === "") return times[times.length - 1]; // for empty string use last time
96
+
97
+ if (typeof time === "string") {
98
+ const index = times.indexOf(time);
99
+ if (index !== -1) return times[index]; // if found use time from array
100
+ }
101
+
102
+ if (typeof time === "number") {
103
+ if (time <= 0) return times[0]; // for negative numbers use first time
104
+ if (time < times.length) return times[time]; // for numbers in range use time from array
105
+ }
106
+
107
+ const ms = new Date(time).getTime(); // otherwise convert time as milliseconds
108
+ if (Number.isNaN(ms)) return times[times.length - 1]; // if not valid use first time
109
+
110
+ const found = times.find((t) => new Date(t).getTime() >= ms);
111
+ return found || times[times.length - 1];
112
+ }
113
+
114
+ /**
115
+ * Retrieves all available time steps for the dataset.
116
+ *
117
+ * @returns {string[]} - A copy of the dataset's time steps.
118
+ */
119
+ getAllTimes(): string[] {
120
+ WXLOG(`WxDataSetManager.getTimes: ${this.datasetName}`);
121
+ return this._instanced || this._datasetCurrentMeta.times;
122
+ }
123
+
124
+ /**
125
+ * Retrieves all available variables for the dataset.
126
+ *
127
+ * @returns {string[]} - List of all variable names in the dataset.
128
+ */
129
+ getAllVariables(): string[] {
130
+ WXLOG(`WxDataSetManager.getVariables: ${this.datasetName}`);
131
+ return this._datasetCurrentMeta.variables;
132
+ }
133
+
134
+ /**
135
+ * Get the variable's meta from the dataset.
136
+ * @argument {string} variable - variable name
137
+ * @returns {WxVariableMeta | undefined} - dataset variable's meta
138
+ * */
139
+ getVariableCurrentMeta(variable: string): WxVariableMeta | undefined {
140
+ WXLOG(
141
+ `WxDataSetManager.getVariableCurrentMeta: ${this.datasetName}, ${variable}`,
142
+ );
143
+ return this._datasetCurrentMeta.variablesMeta[variable];
144
+ }
145
+
146
+ /**
147
+ * Get the variable meta from the instanced dataset.
148
+ * @argument {string} variable - variable name
149
+ * @argument {string} instance - instance name
150
+ * @returns {WxVariableMeta | undefined} - dataset variable's meta for the given instance
151
+ * */
152
+ getInstanceVariableMeta(
153
+ variable: string,
154
+ instance?: string,
155
+ ): WxVariableMeta | undefined {
156
+ WXLOG(
157
+ `WxDataSetManager.getInstanceVariableMeta: ${this.datasetName}, ${variable}, ${instance}`,
158
+ );
159
+ return this.getInstanceMeta(instance).variablesMeta[variable];
160
+ }
161
+
162
+ /**
163
+ * Get dataset's native maximum zoom level.
164
+ * @returns {number} - maximum zoom level of the dataset
165
+ * */
166
+ getMaxZoom(): number {
167
+ WXLOG(`WxDataSetManager.getMaxZoom: ${this.datasetName}`);
168
+ return this._datasetCurrentMeta.maxZoom;
169
+ }
170
+
171
+ /**
172
+ * Get dataset's boundaries.
173
+ * @returns {WxAllBoundariesMeta | undefined} - dataset's boundaries
174
+ * */
175
+ getBoundaries(): WxAllBoundariesMeta | undefined {
176
+ WXLOG(`WxDataSetManager.getBoundaries: ${this.datasetName}`);
177
+ return this._datasetCurrentMeta.boundaries;
178
+ }
179
+
180
+ /**
181
+ * Get dataset's metadata for the given instance.
182
+ * @param {string} instance
183
+ * @returns {WxDatasetMeta}
184
+ */
185
+ getInstanceMeta(instance?: string): WxDatasetMeta {
186
+ WXLOG(`WxDataSetManager.getInstanceMeta: ${this.datasetName}, ${instance}`);
187
+ return (instance && this._metas?.get(instance)) || this._datasetCurrentMeta;
188
+ }
189
+
190
+ /**
191
+ * Constructs the URI for fetching dataset tiles.
192
+ *
193
+ * @param {string} variable - The variable name (e.g., "temperature").
194
+ * @param {string} validTime - The valid time step for the dataset.
195
+ * @param {'webp'} [ext='webp'] - File extension (must be 'webp').
196
+ * @returns {string} - A URI ready for fetching tiles.
197
+ *
198
+ * @throws {Error} - If the variable is invalid.
199
+ *
200
+ * @example
201
+ * ```ts
202
+ * const uri = wxDatasetManager.createURI("temperature", "2024-06-10T12:00:00Z");
203
+ * console.log(uri);
204
+ * ```
205
+ */
206
+ createURI(variable: string, validTime: string, ext: "webp" = "webp"): string {
207
+ WXLOG(
208
+ `WxDataSetManager.createURI: ${this.datasetName}, ${variable}, ${validTime}`,
209
+ );
210
+ if (!this.isVariableValid(variable))
211
+ throw new Error(
212
+ `in dataset ${this.datasetName} variable ${variable} not found`,
213
+ );
214
+ const instance = this._instanced ? validTime : this._datasetCurrentInstance;
215
+ return `${this.wxAPI.dataServerURL + this.datasetName}/${instance}/${variable}/${validTime}/{z}/{x}/{y}.${ext}`;
216
+ }
217
+
218
+ /**
219
+ * Check if given variable is available in the dataset.
220
+ * @argument {string} variable - variable name
221
+ * @returns {boolean} - true if variable is available in the dataset
222
+ * */
223
+ isVariableValid(variable: string): boolean {
224
+ WXLOG(
225
+ `WxDataSetManager.checkVariableValid: ${this.datasetName}, ${variable}`,
226
+ );
227
+ return this._datasetCurrentMeta.variablesMeta[variable] !== undefined;
228
+ }
229
+
230
+ // TODO FIXME why is this created here?
231
+ // this doesn't reinit the object and has nothing impl specific, we can avoid it by decomposing, right?
232
+ /** @internal Update dataset's meta data. */
233
+ async update() {
234
+ const opts = await this.wxAPI.createDatasetManagerOptions(this.datasetName);
235
+
236
+ this._datasetCurrentInstance = opts.datasetCurrentInstance;
237
+ this._instanced = opts.instanced;
238
+ this._datasetCurrentMeta = opts.datasetCurrentMeta;
239
+ this._metas = opts.metas;
240
+ }
241
+
242
+ /** @internal Get dataset's current instance. @returns {boolean} - true if dataset is instanced */
243
+ isInstanced(): boolean {
244
+ return this._instanced !== undefined;
245
+ }
246
+
247
+ /**
248
+ * @internal
249
+ * Checks if variable is a vector component.
250
+ * @argument {string} variable - variable name
251
+ * @returns {WxLayerVarsNames} - [variable] or [variable.eastward, variable.northward]
252
+ * */
253
+ protected _checkCombineVariableIfVector(variable: string): WxLayerVarsNames {
254
+ WXLOG(
255
+ `WxDataSetManager._checkCombineVariableIfVector: ${this.datasetName}, ${variable}`,
256
+ );
257
+ const variableMeta = this._datasetCurrentMeta.variablesMeta[variable];
258
+ if (!variableMeta)
259
+ throw new Error(
260
+ `in dataset ${this.datasetName} variable ${variable} not found`,
261
+ );
262
+ return variableMeta.vector || [variable]; // check if variable is vector and use vector components if so
263
+ }
264
+
265
+ /**
266
+ * Creates a source layer for this dataset.
267
+ */
268
+ /*abstract createSourceLayer<WxSourceLayerOptionsT extends WxLayerOptions, FrameworkOptionsT, WxTileSourceT>(
269
+ options: WxSourceLayerOptionsT,
270
+ frwOptions: FrameworkOptionsT,
271
+ ): WxTileSourceT;*/
272
+ }
@@ -0,0 +1,60 @@
1
+ import type { WxAllDatasetsShortMetas } from "../types";
2
+ import type { WxAPI } from "../wxapi";
3
+ import { fetchJson } from "../utils/wxtools";
4
+
5
+ /**
6
+ * Base class for managing all datasets metadata.
7
+ * This class provides methods to fetch and manage metadata for all datasets
8
+ * or update metadata for a specific dataset.
9
+ *
10
+ * @internal
11
+ */
12
+ export class WxAllDatasetsManager {
13
+ allDatasetsShortMetas: WxAllDatasetsShortMetas = {};
14
+ ready: Promise<WxAllDatasetsShortMetas>;
15
+
16
+ /**
17
+ * Creates an instance of WxAllDatasetsManager.
18
+ *
19
+ * @param {WxAPI} wxAPI - An instance of WxAPI to interact with the data server.
20
+ * The wxAPI provides the base URL and request configuration for API calls.
21
+ */
22
+ constructor(protected readonly wxAPI: WxAPI) {
23
+ this.ready = this.updateAll(); // init _ready
24
+ }
25
+
26
+ /**
27
+ * Fetches and updates metadata for all datasets.
28
+ *
29
+ * @returns {Promise<WxAllDatasetsShortMetas>} A promise that resolves with
30
+ * the metadata of all datasets once the update is complete.
31
+ */
32
+ updateAll(): Promise<WxAllDatasetsShortMetas> {
33
+ this.ready = fetchJson(
34
+ `${this.wxAPI.dataServerURL}meta.json`,
35
+ this.wxAPI.requestInit,
36
+ );
37
+ this.ready.then((dms) => {this.allDatasetsShortMetas = dms});
38
+ return this.ready;
39
+ }
40
+
41
+ /**
42
+ * Updates the metadata for a specific dataset.
43
+ * If the specified dataset's metadata cannot be fetched (e.g., if the dataset does not exist),
44
+ * it will trigger an update for all datasets instead.
45
+ *
46
+ * @param {string} datasetName - The name of the dataset whose metadata needs to be updated.
47
+ * @returns {Promise<WxAllDatasetsShortMetas>} A promise that resolves with
48
+ * the updated metadata for the dataset or all datasets if the fetch for the specific dataset fails.
49
+ */
50
+ async updateOne(datasetName: string): Promise<WxAllDatasetsShortMetas> {
51
+ try {
52
+ const urlMeta = `${this.wxAPI.dataServerURL + datasetName}/meta.json`;
53
+ const datasetMeta = await fetchJson(urlMeta, this.wxAPI.requestInit);
54
+ return Object.assign(this.allDatasetsShortMetas, datasetMeta);
55
+ } catch {
56
+ // If fetching the specific dataset fails, fetch metadata for all datasets
57
+ return this.updateAll();
58
+ }
59
+ }
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metoceanapi/wxtiles-common",
3
- "version": "0.0.8",
3
+ "version": "0.0.11-0",
4
4
  "description": "Common resources shared by wxtiles mapbox and leaflet packages.",
5
5
  "exports": {
6
6
  "./*": "./*.ts",
@@ -10,13 +10,16 @@
10
10
  "private": false,
11
11
  "scripts": {
12
12
  "test": "echo \"Error: no test specified\" && exit 1",
13
- "prepare": "husky"
13
+ "prepare": "husky",
14
+ "gen-docs": "npx typedoc"
14
15
  },
15
16
  "author": "MetOcean",
16
17
  "license": "ISC",
17
18
  "devDependencies": {
19
+ "@biomejs/biome": "1.9.4",
18
20
  "git-format-staged": "^3.1.1",
19
- "husky": "^9.1.6"
21
+ "husky": "^9.1.7",
22
+ "typedoc": "^0.27.6"
20
23
  },
21
24
  "repository": {
22
25
  "type": "git",
package/tsconfig.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Output configuration
4
+ "outDir": "dist/es",
5
+ "declaration": true,
6
+ "emitDeclarationOnly": true,
7
+ "sourceMap": true,
8
+
9
+ // Module resolution
10
+ "moduleResolution": "node",
11
+ "allowSyntheticDefaultImports": true,
12
+ "esModuleInterop": true,
13
+ "resolveJsonModule": true,
14
+
15
+ // Target and library
16
+ "target": "ES2020",
17
+ "lib": ["ES2020", "DOM"],
18
+
19
+ // Strict type checking (all enabled by "strict")
20
+ "strict": true,
21
+
22
+ // Additional checks
23
+ "noImplicitOverride": true,
24
+ "noImplicitReturns": true,
25
+ "noUnusedLocals": true,
26
+ "noUnusedParameters": true,
27
+ "noFallthroughCasesInSwitch": true,
28
+ "noUncheckedSideEffectImports": true
29
+ },
30
+ "exclude": ["node_modules", "dist"]
31
+ }
package/typedoc.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "out": "docs/docs",
3
+ "exclude": ["node_modules"]
4
+ }