@metoceanapi/wxtiles-common 0.0.8 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +1 -1
- package/biome.json +12 -0
- package/controls/WxAPIControl/WxAPIControl-busy.ts +16 -0
- package/controls/WxAPIControl/WxAPIControl-datasets.ts +102 -0
- package/controls/WxAPIControl/WxAPIControl-filter.ts +66 -0
- package/controls/WxAPIControl/WxAPIControl-variables.ts +73 -0
- package/controls/WxAPIControl.ts +91 -120
- package/controls/WxInfoControl.ts +87 -2
- package/controls/WxLegendControl.ts +28 -2
- package/controls/WxStyleEditorControl.ts +123 -6
- package/controls/WxTimeControl.ts +132 -4
- package/docs/docs/.nojekyll +1 -0
- package/docs/docs/assets/highlight.css +92 -0
- package/docs/docs/assets/icons.svg +1 -0
- package/docs/docs/assets/style.css +1610 -0
- package/docs/docs/classes/controls_WxAPIControl.WxAPIControl.html +28 -0
- package/docs/docs/classes/controls_WxInfoControl.WxInfoControl.html +20 -0
- package/docs/docs/classes/controls_WxLegendControl.WxLegendControl.html +19 -0
- package/docs/docs/classes/controls_WxStyleEditorControl.WxStyleEditorControl.html +111 -0
- package/docs/docs/classes/controls_WxTimeControl.WxTimeControl.html +28 -0
- package/docs/docs/classes/managers_BaseDatasetManager.BaseDatasetManager.html +104 -0
- package/docs/docs/classes/managers_WxAllDatasetsManager.WxAllDatasetsManager.html +24 -0
- package/docs/docs/classes/types.WxRasterDataCache.html +27 -0
- package/docs/docs/classes/utils_RawCLUT.RawCLUT.html +18 -0
- package/docs/docs/classes/utils_qtree.QTree.html +22 -0
- package/docs/docs/classes/utils_wxtools.DataIntegral.html +10 -0
- package/docs/docs/classes/wxapi.WxAPI.html +45 -0
- package/docs/docs/classes/wxlayer_loader.Loader.html +31 -0
- package/docs/docs/classes/wxlayer_painter.Painter.html +20 -0
- package/docs/docs/classes/wxlayer_wxlayer.WxLayer.html +57 -0
- package/docs/docs/enums/utils_qtree.TileType.html +5 -0
- package/docs/docs/functions/utils_RawCLUT.WxCreateLegend.html +5 -0
- package/docs/docs/functions/utils_mercator.LatLonToPixels.html +6 -0
- package/docs/docs/functions/utils_mercator.PixelsToLatLon.html +6 -0
- package/docs/docs/functions/utils_mercator.PixelsToLonLat.html +6 -0
- package/docs/docs/functions/utils_mercator.coordToPixel.html +5 -0
- package/docs/docs/functions/utils_tests_wxtools.tests.html +1 -0
- package/docs/docs/functions/utils_wxtools.HEXtoRGBA.html +3 -0
- package/docs/docs/functions/utils_wxtools.HashXYZ.html +4 -0
- package/docs/docs/functions/utils_wxtools.RGBAtoHEX.html +3 -0
- package/docs/docs/functions/utils_wxtools.RGBtoHEX.html +3 -0
- package/docs/docs/functions/utils_wxtools.WXLOG.html +2 -0
- package/docs/docs/functions/utils_wxtools.WxGetColorSchemes.html +2 -0
- package/docs/docs/functions/utils_wxtools.WxGetColorStyles.html +2 -0
- package/docs/docs/functions/utils_wxtools.WxTilesLibSetup.html +3 -0
- package/docs/docs/functions/utils_wxtools.WxTilesLogging.html +5 -0
- package/docs/docs/functions/utils_wxtools.blurData.html +7 -0
- package/docs/docs/functions/utils_wxtools.buildIntegralPare.html +6 -0
- package/docs/docs/functions/utils_wxtools.cacheUriPromise.html +2 -0
- package/docs/docs/functions/utils_wxtools.create2DContext.html +6 -0
- package/docs/docs/functions/utils_wxtools.createEl.html +5 -0
- package/docs/docs/functions/utils_wxtools.createLevels.html +6 -0
- package/docs/docs/functions/utils_wxtools.fetchJson.html +6 -0
- package/docs/docs/functions/utils_wxtools.getClosestTimeString.html +5 -0
- package/docs/docs/functions/utils_wxtools.loadDataIntegral.html +5 -0
- package/docs/docs/functions/utils_wxtools.loadImage.html +4 -0
- package/docs/docs/functions/utils_wxtools.loadImageData.html +5 -0
- package/docs/docs/functions/utils_wxtools.makeConverter.html +9 -0
- package/docs/docs/functions/utils_wxtools.mixColor.html +3 -0
- package/docs/docs/functions/utils_wxtools.refineColor.html +3 -0
- package/docs/docs/functions/utils_wxtools.uriXYZ.html +5 -0
- package/docs/docs/functions/wxlayer_WxImplementation.WxLayerBaseImplementationMixin.html +4 -0
- package/docs/docs/functions/wxlayer_loadertools.applyMask.html +10 -0
- package/docs/docs/functions/wxlayer_loadertools.makeBox.html +4 -0
- package/docs/docs/functions/wxlayer_loadertools.splitCoords.html +6 -0
- package/docs/docs/functions/wxlayer_loadertools.subData.html +5 -0
- package/docs/docs/functions/wxlayer_loadertools.subDataDegree.html +5 -0
- package/docs/docs/functions/wxlayer_loadertools.subMask.html +5 -0
- package/docs/docs/hierarchy.html +1 -0
- package/docs/docs/index.html +7 -0
- package/docs/docs/interfaces/types.IsoInfo.html +8 -0
- package/docs/docs/interfaces/types.SLinePoint.html +4 -0
- package/docs/docs/interfaces/types.WxAPIOptions.html +37 -0
- package/docs/docs/interfaces/types.WxAllBoundariesMeta.html +8 -0
- package/docs/docs/interfaces/types.WxAllDatasetsShortMetas.html +4 -0
- package/docs/docs/interfaces/types.WxBoundaryMeta.html +10 -0
- package/docs/docs/interfaces/types.WxData.html +10 -0
- package/docs/docs/interfaces/types.WxDataSetManagerOptions.html +14 -0
- package/docs/docs/interfaces/types.WxDatasetMeta.html +20 -0
- package/docs/docs/interfaces/types.WxDatasetShortMeta.html +9 -0
- package/docs/docs/interfaces/types.WxLayerAPI.html +24 -0
- package/docs/docs/interfaces/types.WxLayerBaseAPI.html +16 -0
- package/docs/docs/interfaces/types.WxLayerOptions.html +12 -0
- package/docs/docs/interfaces/types.WxLngLat.html +6 -0
- package/docs/docs/interfaces/types.WxRasterData.html +13 -0
- package/docs/docs/interfaces/types.WxRequestInit.html +3 -0
- package/docs/docs/interfaces/types.WxTileInfo.html +18 -0
- package/docs/docs/interfaces/types.WxVariableMeta.html +13 -0
- package/docs/docs/interfaces/types.WxVariablesMetas.html +4 -0
- package/docs/docs/interfaces/utils_RawCLUT.WxLegend.html +14 -0
- package/docs/docs/interfaces/utils_RawCLUT.WxTick.html +10 -0
- package/docs/docs/interfaces/utils_qtree.Tree.html +7 -0
- package/docs/docs/interfaces/utils_wxtools.CachedUriLoaderPromiseFunc.html +2 -0
- package/docs/docs/interfaces/utils_wxtools.ColorStylesIncomplete.html +2 -0
- package/docs/docs/interfaces/utils_wxtools.Converter.html +5 -0
- package/docs/docs/interfaces/utils_wxtools.DataPicture.html +6 -0
- package/docs/docs/interfaces/utils_wxtools.IntegralPare.html +6 -0
- package/docs/docs/interfaces/utils_wxtools.WxColorSchemes.html +3 -0
- package/docs/docs/interfaces/utils_wxtools.WxColorStyleStrict.html +95 -0
- package/docs/docs/interfaces/utils_wxtools.WxColorStyleWeak.html +95 -0
- package/docs/docs/interfaces/utils_wxtools.WxColorStylesStrict.html +2 -0
- package/docs/docs/interfaces/utils_wxtools.WxColorStylesWeakMixed.html +2 -0
- package/docs/docs/interfaces/utils_wxtools.WxTilesLibOptions.html +8 -0
- package/docs/docs/interfaces/utils_wxtools.WxUnits.html +2 -0
- package/docs/docs/interfaces/utils_wxtools.XYZ.html +5 -0
- package/docs/docs/modules/controls_WxAPIControl.html +1 -0
- package/docs/docs/modules/controls_WxInfoControl.html +1 -0
- package/docs/docs/modules/controls_WxLegendControl.html +1 -0
- package/docs/docs/modules/controls_WxStyleEditorControl.html +1 -0
- package/docs/docs/modules/controls_WxTimeControl.html +1 -0
- package/docs/docs/modules/defaults_colorschemes.html +1 -0
- package/docs/docs/modules/defaults_styles.html +1 -0
- package/docs/docs/modules/defaults_uconv.html +1 -0
- package/docs/docs/modules/managers_BaseDatasetManager.html +1 -0
- package/docs/docs/modules/managers_WxAllDatasetsManager.html +1 -0
- package/docs/docs/modules/types.html +1 -0
- package/docs/docs/modules/utils_RawCLUT.html +1 -0
- package/docs/docs/modules/utils_mercator.html +1 -0
- package/docs/docs/modules/utils_qtree.html +1 -0
- package/docs/docs/modules/utils_tests_wxtools.html +1 -0
- package/docs/docs/modules/utils_wxtools.html +1 -0
- package/docs/docs/modules/wxapi.html +1 -0
- package/docs/docs/modules/wxlayer_WxImplementation.html +1 -0
- package/docs/docs/modules/wxlayer_loader.html +1 -0
- package/docs/docs/modules/wxlayer_loadertools.html +1 -0
- package/docs/docs/modules/wxlayer_painter.html +1 -0
- package/docs/docs/modules/wxlayer_wxlayer.html +1 -0
- package/docs/docs/modules.html +1 -0
- package/docs/docs/types/types.ListenerMethod.html +1 -0
- package/docs/docs/types/types.SLine.html +2 -0
- package/docs/docs/types/types.WxDate.html +9 -0
- package/docs/docs/types/types.WxEventType.html +1 -0
- package/docs/docs/types/types.WxInstances.html +2 -0
- package/docs/docs/types/types.WxLayerVarsNames.html +2 -0
- package/docs/docs/types/types.WxURIs.html +2 -0
- package/docs/docs/types/utils_qtree.SubTrees.html +2 -0
- package/docs/docs/types/utils_qtree.SubTreesN.html +2 -0
- package/docs/docs/types/utils_qtree.TreeN.html +2 -0
- package/docs/docs/types/utils_wxtools.DataIntegrals.html +2 -0
- package/docs/docs/types/utils_wxtools.DataPictures.html +2 -0
- package/docs/docs/types/utils_wxtools.WxUnitTuple.html +2 -0
- package/docs/docs/types/utils_wxtools.colorMapTuple.html +2 -0
- package/docs/docs/variables/defaults_colorschemes.__colorSchemes_default_preset.html +1 -0
- package/docs/docs/variables/defaults_styles.__colorStyles_default_preset.html +1 -0
- package/docs/docs/variables/defaults_uconv.__units_default_preset.html +1 -0
- package/managers/BaseDatasetManager.ts +274 -0
- package/managers/WxAllDatasetsManager.ts +60 -0
- package/package.json +6 -3
- package/tsconfig.json +19 -0
- package/typedoc.json +4 -0
- package/types.ts +471 -0
- package/wxapi.ts +223 -0
- package/wxlayer/WxImplementation.ts +372 -0
- package/wxlayer/loader.ts +305 -0
- package/wxlayer/loadertools.ts +380 -0
- package/wxlayer/painter.ts +451 -0
- 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,274 @@
|
|
|
1
|
+
import { WXLOG, fetchJson } from "../utils/wxtools";
|
|
2
|
+
import type {
|
|
3
|
+
WxAllBoundariesMeta,
|
|
4
|
+
WxAllDatasetsShortMetas,
|
|
5
|
+
WxDatasetMeta,
|
|
6
|
+
WxVariableMeta,
|
|
7
|
+
WxDate,
|
|
8
|
+
WxLayerVarsNames,
|
|
9
|
+
WxLayerOptions,
|
|
10
|
+
WxDataSetManagerOptions,
|
|
11
|
+
} from "../types";
|
|
12
|
+
import type { WxAPI } from "../wxapi";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Base class for managing a WX dataset and its related operations.
|
|
16
|
+
*
|
|
17
|
+
* Instances of concrete subclasses of this class handle metadata, variables,
|
|
18
|
+
* valid times, zoom levels, and URI construction for WX datasets.
|
|
19
|
+
*
|
|
20
|
+
* **Usage Note:** Do not create instances directly using the constructor.
|
|
21
|
+
* Use {@link WxAPI.createDatasetManager} instead.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const wxapi = new WxAPI({ dataServerURL: "https://example.com" });
|
|
26
|
+
* const wxDatasetManager = await wxapi.createDatasetManager("gfs.global");
|
|
27
|
+
* console.log(wxDatasetManager.getAllVariables());
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export abstract class BaseDatasetManager {
|
|
31
|
+
/** The name of the dataset being managed. */
|
|
32
|
+
readonly datasetName: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
* A reference to the WX API instance that created this manager.
|
|
37
|
+
*/
|
|
38
|
+
readonly wxAPI: WxAPI;
|
|
39
|
+
|
|
40
|
+
/** @ignore The current instance name of the dataset (for time-stepped datasets). */
|
|
41
|
+
protected _datasetCurrentInstance: string;
|
|
42
|
+
|
|
43
|
+
/** @ignore The current metadata for the dataset. */
|
|
44
|
+
protected _datasetCurrentMeta: WxDatasetMeta;
|
|
45
|
+
|
|
46
|
+
/** @ignore Array of instances for time-stepped datasets (optional). */
|
|
47
|
+
protected _instanced?: string[];
|
|
48
|
+
|
|
49
|
+
/** @ignore Map of metadata for each dataset instance (optional). */
|
|
50
|
+
protected _metas?: Map<string, WxDatasetMeta>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Do not use this constructor directly. Use {@link WxAPI.createDatasetManager} instead.
|
|
54
|
+
*
|
|
55
|
+
* @param {WxDataSetManagerOptions} options - Dataset manager options.
|
|
56
|
+
*/
|
|
57
|
+
constructor({
|
|
58
|
+
datasetName,
|
|
59
|
+
datasetCurrentInstance,
|
|
60
|
+
instanced,
|
|
61
|
+
datasetCurrentMeta,
|
|
62
|
+
metas,
|
|
63
|
+
wxAPI,
|
|
64
|
+
}: WxDataSetManagerOptions) {
|
|
65
|
+
this.datasetName = datasetName;
|
|
66
|
+
this._instanced = instanced;
|
|
67
|
+
this._datasetCurrentInstance = datasetCurrentInstance;
|
|
68
|
+
this._datasetCurrentMeta = datasetCurrentMeta;
|
|
69
|
+
this._metas = metas;
|
|
70
|
+
this.wxAPI = wxAPI;
|
|
71
|
+
WXLOG(`WxDataSetManager.constructor: ${this.datasetName}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Finds the nearest valid time in the dataset based on the input.
|
|
76
|
+
*
|
|
77
|
+
* - If `time` is an empty string, the last available time is returned.
|
|
78
|
+
* - If `time` is a string matching a valid time, that time is returned.
|
|
79
|
+
* - If `time` is a number:
|
|
80
|
+
* - Negative: Returns the first time.
|
|
81
|
+
* - Within range: Returns the corresponding indexed time.
|
|
82
|
+
* - Otherwise, finds the closest time in milliseconds.
|
|
83
|
+
*
|
|
84
|
+
* @param {WxDate} [time=Date()] - Input time as a string, number, or Date object.
|
|
85
|
+
* @returns {string} - The nearest valid time from the dataset's time steps.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const nearestTime = wxDatasetManager.getNearestValidTime("2024-06-10T12:00:00Z");
|
|
90
|
+
* console.log(nearestTime); // Closest valid time
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
getNearestValidTime(time: WxDate = Date()): string {
|
|
94
|
+
WXLOG(`WxDataSetManager.getValidTime: ${this.datasetName}, ${time}`);
|
|
95
|
+
const times = this.getAllTimes();
|
|
96
|
+
|
|
97
|
+
if (time === "") return times[times.length - 1]; // for empty string use last time
|
|
98
|
+
|
|
99
|
+
if (typeof time === "string") {
|
|
100
|
+
const index = times.indexOf(time);
|
|
101
|
+
if (index !== -1) return times[index]; // if found use time from array
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (typeof time === "number") {
|
|
105
|
+
if (time <= 0) return times[0]; // for negative numbers use first time
|
|
106
|
+
if (time < times.length) return times[time]; // for numbers in range use time from array
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const ms = new Date(time).getTime(); // otherwise convert time as milliseconds
|
|
110
|
+
if (Number.isNaN(ms)) return times[times.length - 1]; // if not valid use first time
|
|
111
|
+
|
|
112
|
+
const found = times.find((t) => new Date(t).getTime() >= ms);
|
|
113
|
+
return found || times[times.length - 1];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Retrieves all available time steps for the dataset.
|
|
118
|
+
*
|
|
119
|
+
* @returns {string[]} - A copy of the dataset's time steps.
|
|
120
|
+
*/
|
|
121
|
+
getAllTimes(): string[] {
|
|
122
|
+
WXLOG(`WxDataSetManager.getTimes: ${this.datasetName}`);
|
|
123
|
+
return this._instanced || this._datasetCurrentMeta.times;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Retrieves all available variables for the dataset.
|
|
128
|
+
*
|
|
129
|
+
* @returns {string[]} - List of all variable names in the dataset.
|
|
130
|
+
*/
|
|
131
|
+
getAllVariables(): string[] {
|
|
132
|
+
WXLOG(`WxDataSetManager.getVariables: ${this.datasetName}`);
|
|
133
|
+
return this._datasetCurrentMeta.variables;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Get the variable's meta from the dataset.
|
|
138
|
+
* @argument {string} variable - variable name
|
|
139
|
+
* @returns {WxVariableMeta | undefined} - dataset variable's meta
|
|
140
|
+
* */
|
|
141
|
+
getVariableCurrentMeta(variable: string): WxVariableMeta | undefined {
|
|
142
|
+
WXLOG(
|
|
143
|
+
`WxDataSetManager.getVariableCurrentMeta: ${this.datasetName}, ${variable}`,
|
|
144
|
+
);
|
|
145
|
+
return this._datasetCurrentMeta.variablesMeta[variable];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Get the variable meta from the instanced dataset.
|
|
150
|
+
* @argument {string} variable - variable name
|
|
151
|
+
* @argument {string} instance - instance name
|
|
152
|
+
* @returns {WxVariableMeta | undefined} - dataset variable's meta for the given instance
|
|
153
|
+
* */
|
|
154
|
+
getInstanceVariableMeta(
|
|
155
|
+
variable: string,
|
|
156
|
+
instance?: string,
|
|
157
|
+
): WxVariableMeta | undefined {
|
|
158
|
+
WXLOG(
|
|
159
|
+
`WxDataSetManager.getInstanceVariableMeta: ${this.datasetName}, ${variable}, ${instance}`,
|
|
160
|
+
);
|
|
161
|
+
return this.getInstanceMeta(instance).variablesMeta[variable];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Get dataset's native maximum zoom level.
|
|
166
|
+
* @returns {number} - maximum zoom level of the dataset
|
|
167
|
+
* */
|
|
168
|
+
getMaxZoom(): number {
|
|
169
|
+
WXLOG(`WxDataSetManager.getMaxZoom: ${this.datasetName}`);
|
|
170
|
+
return this._datasetCurrentMeta.maxZoom;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Get dataset's boundaries.
|
|
175
|
+
* @returns {WxAllBoundariesMeta | undefined} - dataset's boundaries
|
|
176
|
+
* */
|
|
177
|
+
getBoundaries(): WxAllBoundariesMeta | undefined {
|
|
178
|
+
WXLOG(`WxDataSetManager.getBoundaries: ${this.datasetName}`);
|
|
179
|
+
return this._datasetCurrentMeta.boundaries;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Get dataset's metadata for the given instance.
|
|
184
|
+
* @param {string} instance
|
|
185
|
+
* @returns {WxDatasetMeta}
|
|
186
|
+
*/
|
|
187
|
+
getInstanceMeta(instance?: string): WxDatasetMeta {
|
|
188
|
+
WXLOG(`WxDataSetManager.getInstanceMeta: ${this.datasetName}, ${instance}`);
|
|
189
|
+
return (instance && this._metas?.get(instance)) || this._datasetCurrentMeta;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Constructs the URI for fetching dataset tiles.
|
|
194
|
+
*
|
|
195
|
+
* @param {string} variable - The variable name (e.g., "temperature").
|
|
196
|
+
* @param {string} validTime - The valid time step for the dataset.
|
|
197
|
+
* @param {'webp'} [ext='webp'] - File extension (must be 'webp').
|
|
198
|
+
* @returns {string} - A URI ready for fetching tiles.
|
|
199
|
+
*
|
|
200
|
+
* @throws {Error} - If the variable is invalid.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* const uri = wxDatasetManager.createURI("temperature", "2024-06-10T12:00:00Z");
|
|
205
|
+
* console.log(uri);
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
createURI(variable: string, validTime: string, ext: "webp" = "webp"): string {
|
|
209
|
+
WXLOG(
|
|
210
|
+
`WxDataSetManager.createURI: ${this.datasetName}, ${variable}, ${validTime}`,
|
|
211
|
+
);
|
|
212
|
+
if (!this.isVariableValid(variable))
|
|
213
|
+
throw new Error(
|
|
214
|
+
`in dataset ${this.datasetName} variable ${variable} not found`,
|
|
215
|
+
);
|
|
216
|
+
const instance = this._instanced ? validTime : this._datasetCurrentInstance;
|
|
217
|
+
return `${this.wxAPI.dataServerURL + this.datasetName}/${instance}/${variable}/${validTime}/{z}/{x}/{y}.${ext}`;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Check if given variable is available in the dataset.
|
|
222
|
+
* @argument {string} variable - variable name
|
|
223
|
+
* @returns {boolean} - true if variable is available in the dataset
|
|
224
|
+
* */
|
|
225
|
+
isVariableValid(variable: string): boolean {
|
|
226
|
+
WXLOG(
|
|
227
|
+
`WxDataSetManager.checkVariableValid: ${this.datasetName}, ${variable}`,
|
|
228
|
+
);
|
|
229
|
+
return this._datasetCurrentMeta.variablesMeta[variable] !== undefined;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// TODO FIXME why is this created here?
|
|
233
|
+
// this doesn't reinit the object and has nothing impl specific, we can avoid it by decomposing, right?
|
|
234
|
+
/** @internal Update dataset's meta data. */
|
|
235
|
+
async update() {
|
|
236
|
+
const opts = await this.wxAPI.createDatasetManagerOptions(this.datasetName);
|
|
237
|
+
|
|
238
|
+
this._datasetCurrentInstance = opts.datasetCurrentInstance;
|
|
239
|
+
this._instanced = opts.instanced;
|
|
240
|
+
this._datasetCurrentMeta = opts.datasetCurrentMeta;
|
|
241
|
+
this._metas = opts.metas;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** @internal Get dataset's current instance. @returns {boolean} - true if dataset is instanced */
|
|
245
|
+
isInstanced(): boolean {
|
|
246
|
+
return this._instanced !== undefined;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @internal
|
|
251
|
+
* Checks if variable is a vector component.
|
|
252
|
+
* @argument {string} variable - variable name
|
|
253
|
+
* @returns {WxLayerVarsNames} - [variable] or [variable.eastward, variable.northward]
|
|
254
|
+
* */
|
|
255
|
+
protected _checkCombineVariableIfVector(variable: string): WxLayerVarsNames {
|
|
256
|
+
WXLOG(
|
|
257
|
+
`WxDataSetManager._checkCombineVariableIfVector: ${this.datasetName}, ${variable}`,
|
|
258
|
+
);
|
|
259
|
+
const variableMeta = this._datasetCurrentMeta.variablesMeta[variable];
|
|
260
|
+
if (!variableMeta)
|
|
261
|
+
throw new Error(
|
|
262
|
+
`in dataset ${this.datasetName} variable ${variable} not found`,
|
|
263
|
+
);
|
|
264
|
+
return variableMeta.vector || [variable]; // check if variable is vector and use vector components if so
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Creates a source layer for this dataset.
|
|
269
|
+
*/
|
|
270
|
+
/*abstract createSourceLayer<WxSourceLayerOptionsT extends WxLayerOptions, FrameworkOptionsT, WxTileSourceT>(
|
|
271
|
+
options: WxSourceLayerOptionsT,
|
|
272
|
+
frwOptions: FrameworkOptionsT,
|
|
273
|
+
): WxTileSourceT;*/
|
|
274
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { WxAllDatasetsShortMetas } from "../types";
|
|
2
|
+
import type { WxAPI } from "../wxapi";
|
|
3
|
+
import { WXLOG, 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.
|
|
3
|
+
"version": "0.0.11",
|
|
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.
|
|
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,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "dist/es",
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"noImplicitThis": true,
|
|
8
|
+
"emitDeclarationOnly": true,
|
|
9
|
+
"noImplicitReturns": true,
|
|
10
|
+
"strictNullChecks": true,
|
|
11
|
+
"strictFunctionTypes": true,
|
|
12
|
+
"strictPropertyInitialization": true,
|
|
13
|
+
"lib": ["ES2020", "DOM"],
|
|
14
|
+
"target": "ES2020",
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"resolveJsonModule": true
|
|
17
|
+
},
|
|
18
|
+
"exclude": ["node_modules"]
|
|
19
|
+
}
|
package/typedoc.json
ADDED