@metoceanapi/wxtiles-leaflet 2.0.5 → 2.0.7

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 (94) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +132 -305
  3. package/dist/es/controls/WxStyleEditorControl.d.ts +1 -1
  4. package/dist/es/controls/WxTimeControl .d.ts +2 -2
  5. package/dist/es/defaults/styles.d.ts +2 -2
  6. package/dist/es/defaults/uconv.d.ts +2 -2
  7. package/dist/es/index.d.ts +32 -5
  8. package/dist/es/index.js +6 -1
  9. package/dist/es/utils/RawCLUT.d.ts +32 -22
  10. package/dist/es/utils/qtree.d.ts +11 -5
  11. package/dist/es/utils/wxtools.d.ts +243 -33
  12. package/dist/es/wxAPI/WxDataSetManager.d.ts +70 -34
  13. package/dist/es/wxAPI/wxAPI.d.ts +115 -43
  14. package/dist/es/wxlayer/WxImplementation.d.ts +76 -34
  15. package/dist/es/wxlayer/loader.d.ts +27 -3
  16. package/dist/es/wxlayer/loadertools.d.ts +41 -3
  17. package/dist/es/wxlayer/painter.d.ts +39 -0
  18. package/dist/es/wxlayer/wxlayer.d.ts +77 -11
  19. package/dist/es/wxsource/wxsource.d.ts +60 -20
  20. package/dist/es/wxsource/wxsourcetypes.d.ts +16 -0
  21. package/dist/web/index.js +6 -1
  22. package/docs/docs/assets/highlight.css +92 -0
  23. package/docs/docs/assets/main.js +54 -0
  24. package/docs/docs/assets/search.js +1 -0
  25. package/docs/docs/assets/style.css +1257 -0
  26. package/docs/docs/classes/FrameworkParentClass.html +98 -0
  27. package/docs/docs/classes/Loader.html +165 -0
  28. package/docs/docs/classes/Painter.html +161 -0
  29. package/docs/docs/classes/QTree.html +129 -0
  30. package/docs/docs/classes/RawCLUT.html +143 -0
  31. package/docs/docs/classes/WxAPI.html +336 -0
  32. package/docs/docs/classes/WxDataSetManager.html +406 -0
  33. package/docs/docs/classes/WxLayer.html +363 -0
  34. package/docs/docs/classes/WxLayerBaseImplementation.html +371 -0
  35. package/docs/docs/classes/WxTileSource.html +453 -0
  36. package/docs/docs/enums/TileType.html +80 -0
  37. package/docs/docs/functions/WXLOG.html +119 -0
  38. package/docs/docs/functions/WxCreateLegend.html +127 -0
  39. package/docs/docs/functions/WxGetColorSchemes.html +114 -0
  40. package/docs/docs/functions/WxGetColorStyles.html +114 -0
  41. package/docs/docs/functions/WxTilesLogging.html +119 -0
  42. package/docs/docs/index.html +201 -0
  43. package/docs/docs/interfaces/ColorStylesIncomplete.html +117 -0
  44. package/docs/docs/interfaces/Converter.html +81 -0
  45. package/docs/docs/interfaces/DataIntegral.html +112 -0
  46. package/docs/docs/interfaces/DataPicture.html +93 -0
  47. package/docs/docs/interfaces/FrameworkOptions.html +75 -0
  48. package/docs/docs/interfaces/IntegralPare.html +81 -0
  49. package/docs/docs/interfaces/SLinePoint.html +77 -0
  50. package/docs/docs/interfaces/Tree.html +70 -0
  51. package/docs/docs/interfaces/WxAPIOptions.html +164 -0
  52. package/docs/docs/interfaces/WxAllBoundariesMeta.html +85 -0
  53. package/docs/docs/interfaces/WxBoundaryMeta.html +91 -0
  54. package/docs/docs/interfaces/WxColorSchemes.html +118 -0
  55. package/docs/docs/interfaces/WxColorStyleStrict.html +319 -0
  56. package/docs/docs/interfaces/WxColorStyleWeak.html +345 -0
  57. package/docs/docs/interfaces/WxColorStylesStrict.html +74 -0
  58. package/docs/docs/interfaces/WxColorStylesWeakMixed.html +117 -0
  59. package/docs/docs/interfaces/WxData.html +81 -0
  60. package/docs/docs/interfaces/WxDataSetManagerOptions.html +108 -0
  61. package/docs/docs/interfaces/WxDataSetsMetasJSON.html +75 -0
  62. package/docs/docs/interfaces/WxDatasetMeta.html +135 -0
  63. package/docs/docs/interfaces/WxDatasetShortMeta.html +90 -0
  64. package/docs/docs/interfaces/WxLayerAPI.html +313 -0
  65. package/docs/docs/interfaces/WxLayerBaseAPI.html +246 -0
  66. package/docs/docs/interfaces/WxLayerOptions.html +118 -0
  67. package/docs/docs/interfaces/WxLegend.html +117 -0
  68. package/docs/docs/interfaces/WxLngLat.html +81 -0
  69. package/docs/docs/interfaces/WxRasterData.html +99 -0
  70. package/docs/docs/interfaces/WxRequestInit.html +70 -0
  71. package/docs/docs/interfaces/WxSourceLayerOptions.html +109 -0
  72. package/docs/docs/interfaces/WxTick.html +99 -0
  73. package/docs/docs/interfaces/WxTileInfo.html +142 -0
  74. package/docs/docs/interfaces/WxTilesLibOptions.html +92 -0
  75. package/docs/docs/interfaces/WxUnits.html +117 -0
  76. package/docs/docs/interfaces/WxVariableMeta.html +108 -0
  77. package/docs/docs/interfaces/WxVariablesMetas.html +117 -0
  78. package/docs/docs/interfaces/XYZ.html +84 -0
  79. package/docs/docs/modules.html +210 -0
  80. package/docs/docs/types/DataIntegrals.html +110 -0
  81. package/docs/docs/types/DataPictures.html +110 -0
  82. package/docs/docs/types/SLine.html +110 -0
  83. package/docs/docs/types/SubTrees.html +110 -0
  84. package/docs/docs/types/SubTreesN.html +110 -0
  85. package/docs/docs/types/TreeN.html +110 -0
  86. package/docs/docs/types/UriLoaderPromiseFunc.html +130 -0
  87. package/docs/docs/types/WxDate.html +110 -0
  88. package/docs/docs/types/WxURIs.html +110 -0
  89. package/docs/docs/types/WxUnitTuple.html +110 -0
  90. package/docs/docs/types/WxVars.html +110 -0
  91. package/docs/script/script.css +1 -1
  92. package/docs/script/script.js +11 -6
  93. package/package.json +8 -8
  94. package/src_example/index.ts +111 -54
@@ -1,115 +1,325 @@
1
+ /** x,y,z */
1
2
  export interface XYZ {
2
3
  x: number;
3
4
  y: number;
4
5
  z: number;
5
6
  }
6
- export declare type UnitTuple = [string, number, number?];
7
- export interface Units {
8
- [unit: string]: UnitTuple | undefined;
7
+ /** type for unit converter */
8
+ export type WxUnitTuple = [string, number, number?];
9
+ /** Type of an Object with all unit convertion tupels */
10
+ export interface WxUnits {
11
+ [unit: string]: WxUnitTuple | undefined;
9
12
  }
13
+ /**
14
+ * Type of an Object with all color schemes,
15
+ * each color scheme is an array of colors evenly distributed between min and max values in a {@link WxLegend} and {@link RawCLUT}*/
10
16
  export interface WxColorSchemes {
11
17
  [name: string]: string[] | undefined;
12
18
  }
13
- export declare type colorMapTuple = [number, string];
19
+ /** A [level,color] tuple */
20
+ export type colorMapTuple = [number, string];
21
+ /** Weak color style (may not have all fields of {@link WxColorStyleStrict}) */
14
22
  export interface WxColorStyleWeak extends Partial<WxColorStyleStrict> {
15
23
  }
16
- export interface ColorStylesWeakMixed {
24
+ /** interface of an object with all mixed color styles */
25
+ export interface WxColorStylesWeakMixed {
17
26
  [name: string]: WxColorStyleWeak | WxColorStyleWeak[] | undefined;
18
27
  }
28
+ /** interface of an object with all weak color styles */
19
29
  export interface ColorStylesIncomplete {
20
30
  [name: string]: WxColorStyleWeak | undefined;
21
31
  }
32
+ /** Strict style interface */
22
33
  export interface WxColorStyleStrict {
23
- parent?: string;
34
+ /** Name of the style */
24
35
  name: string;
36
+ /** Name of a parent style to inherit from */
37
+ parent?: string;
38
+ /** Tile filling schema.
39
+ * - **'none'** means no fill, leave the tile transparent
40
+ * - **'solid'** means solid fill, no gradient between levels.
41
+ * - **'gradient'** means gradient fill.
42
+ * */
25
43
  fill: 'none' | 'gradient' | 'solid';
44
+ /**
45
+ * Color of isolines.
46
+ * - **'none'** do not render.
47
+ * - **'fill'** using value of {@link fill} in each pixel.
48
+ * - **'inverted'** using *inverted* value of {@link fill} in each pixel.
49
+ * - **'#RGB'** or '**#RRGGBB**' or '**#RRGGBBAA**' - using this WEB-color.
50
+ * */
26
51
  isolineColor: 'none' | 'inverted' | 'fill' | `#${string}`;
52
+ /** if true then render isoline text values */
27
53
  isolineText: boolean;
54
+ /**
55
+ * Representation of the wind/current field.
56
+ * - **'none'** do not render vectors.
57
+ * - **'arrows'** use arrows to represent winds/currents.
58
+ * - **'barbs'** use barbs.
59
+ * */
28
60
  vectorType: 'none' | 'arrows' | 'barbs';
61
+ /**
62
+ * Color of vectors.
63
+ * - **'none'** do not render vectors.
64
+ * - **'fill'** using value of {@link fill} in each pixel.
65
+ * - **'inverted'** using *inverted* value of {@link fill} in each pixel.
66
+ * - **'#RGB'** or '**#RRGGBB**' or '**#RRGGBBAA**' - using this WEB-color.
67
+ * */
29
68
  vectorColor: 'none' | 'inverted' | 'fill' | `#${string}`;
69
+ /** Factor for vectors length */
30
70
  vectorFactor: number;
71
+ /**
72
+ * Draw streamlines:
73
+ * - **'none'** means no streamlines.
74
+ * - **'fill'** using value of {@link fill} in each pixel.
75
+ * - **'inverted'** using *inverted* value of {@link fill} in each pixel.
76
+ * - **'#RGB'** or '**#RRGGBB**' or '**#RRGGBBAA**' - using this WEB-color.
77
+ * */
31
78
  streamLineColor: 'none' | 'inverted' | 'fill' | `#${string}`;
79
+ /** factor to scale streamlines length */
32
80
  streamLineSpeedFactor: number;
81
+ /**
82
+ * Step to seed streamlines. Streamlines spread both ways from seed point.
83
+ * less value means more streamlines.
84
+ * */
33
85
  streamLineGridStep?: number;
86
+ /** steps in each streamline */
34
87
  streamLineSteps?: number;
88
+ /**
89
+ * - if true then render streamlines as static lines.
90
+ * - if false then render streamlines as animated lines.
91
+ * */
35
92
  streamLineStatic: boolean;
93
+ /** If true then fill values below style's minimum. */
36
94
  showBelowMin: boolean;
95
+ /** If true then fill values above style's maximum. */
37
96
  showAboveMax: boolean;
97
+ /** Color scheme name from the default set. May be extended in {@link WxAPI}*/
38
98
  colorScheme: string;
99
+ /** Used if presented instead of colorScheme */
39
100
  colors?: string[];
101
+ /**
102
+ * Used if presented instead of levels, colors, colorScheme.
103
+ * Array of [level,color] tuples. Colors are WEB-colors.
104
+ */
40
105
  colorMap?: [number, string][];
106
+ /** Levels to build legend. Used if presented, otherwise 10 levels are calculated evenly on given data */
41
107
  levels?: number[];
108
+ /** radius for the BOX filter */
42
109
  blurRadius: number;
110
+ /** Additional rotation of all wind or current's vectors or directions by angle in degrees.*/
43
111
  addDegrees: number;
112
+ /** Units of the style (from the default set)*/
44
113
  units: string;
45
- extraUnits?: Units;
114
+ /**
115
+ * Additional extend of default {@link units}.
116
+ * @see {@link WxUnits}
117
+ * */
118
+ extraUnits?: WxUnits;
119
+ /**
120
+ * masking:
121
+ * - **'none'** - no masking.
122
+ * - **'sea'** - make sea transparent.
123
+ * - **'land'** - make land transparent.
124
+ * */
46
125
  mask?: 'land' | 'sea' | 'none';
47
126
  }
48
- export interface ColorStylesStrict {
127
+ /**
128
+ * @typedef {Object} WxColorStylesStrict
129
+ * @property {string} name - name of the style
130
+ */
131
+ export interface WxColorStylesStrict {
49
132
  base: WxColorStyleStrict;
50
133
  [name: string]: WxColorStyleStrict | undefined;
51
134
  }
135
+ /** Options for the wxtiles library */
52
136
  export interface WxTilesLibOptions {
53
- colorStyles?: ColorStylesWeakMixed;
54
- units?: Units;
137
+ /** Additional Color styles to use for the library */
138
+ colorStyles?: WxColorStylesWeakMixed;
139
+ /** Additional color schemes to use for the library */
55
140
  colorSchemes?: WxColorSchemes;
141
+ /** Additional units to use for the library */
142
+ units?: WxUnits;
56
143
  }
144
+ /**
145
+ * Initialize the wxtiles library
146
+ * @param options - options {@link WxTilesLibOptions} to initialize the library
147
+ */
57
148
  export declare function WxTilesLibSetup({ colorStyles, units, colorSchemes }?: WxTilesLibOptions): void;
58
- export declare function WxGetColorStyles(): ColorStylesStrict;
149
+ /**
150
+ * Get all {@link WxColorStylesStrict} used by the library
151
+ * */
152
+ export declare function WxGetColorStyles(): WxColorStylesStrict;
153
+ /**
154
+ * Get all {@link WxColorSchemes} used by the library
155
+ * */
59
156
  export declare function WxGetColorSchemes(): WxColorSchemes;
157
+ /** A function type with extra properties. */
60
158
  export interface Converter {
159
+ /** interface of a function - unit cinverter*/
61
160
  (x: number): number;
161
+ /** true if the converter is a trivial one */
62
162
  trivial?: boolean;
63
163
  }
64
- export declare function makeConverter(from: string, to: string, customUnits?: Units): Converter;
65
- declare type CacheableURILoaderPromiseFunc<T> = (url: string) => Promise<T>;
66
- export declare type UriLoaderPromiseFunc<T> = (url: string, ...props: any) => Promise<T>;
164
+ /**
165
+ * Convert a value from one unit to another
166
+ * @param from - the unit to convert from
167
+ * @param to - the unit to convert to
168
+ * @param customUnits - custom units to use if needed
169
+ * @returns a function that converts a value from one unit to another
170
+ * @example
171
+ * ```ts
172
+ * const convert = makeConverter('m/s', 'km/h');
173
+ * const speed = convert(10); // speed is now 36
174
+ * ```
175
+ * */
176
+ export declare function makeConverter(from: string, to: string, customUnits?: WxUnits): Converter;
177
+ /** Function type to load image from URL, with additional properties */
178
+ export type UriLoaderPromiseFunc<T> = (url: string, ...props: any) => Promise<T>;
179
+ /** Makes a cachable function that loads image from URL, with additional properties */
67
180
  export declare function cacheUriPromise<T>(fn: UriLoaderPromiseFunc<T>): UriLoaderPromiseFunc<T>;
181
+ /**
182
+ * abortable 'loadImage'
183
+ * @param url - image url
184
+ * @param requestInit - fetch requestInit
185
+ * */
68
186
  export declare function loadImage(url: string, requestInit?: RequestInit): Promise<ImageBitmap>;
69
- interface IntegralPare {
187
+ /** integral pare for fast box blur algorithm */
188
+ export interface IntegralPare {
189
+ /** Integral image */
70
190
  integral: Uint32Array;
191
+ /** Integral image of ZEROs */
71
192
  integralNZ: Uint32Array | null;
72
193
  }
194
+ /** interface of a data read from a PNG tile */
73
195
  export interface DataPicture {
74
196
  raw: Uint16Array;
75
197
  dmin: number;
76
198
  dmax: number;
77
199
  dmul: number;
78
200
  }
79
- export declare type DataPictures = [DataPicture] | [DataPicture, DataPicture, DataPicture];
201
+ /** One (scalar) or three (vector components + length component) {@link DataPictures} */
202
+ export type DataPictures = [DataPicture] | [DataPicture, DataPicture, DataPicture];
203
+ /**
204
+ * interface extends {@link DataPictures} with {@link IntegralPare} and current
205
+ * calculated radius of the box-filter
206
+ * */
80
207
  export interface DataIntegral extends DataPicture {
81
208
  integral: IntegralPare;
82
209
  radius: number;
83
210
  }
84
- export declare type DataIntegrals = [DataIntegral] | [DataIntegral, DataIntegral];
211
+ /** One (scalar) or two (vector) {@link DataIntegral} */
212
+ export type DataIntegrals = [DataIntegral] | [DataIntegral, DataIntegral];
213
+ /**
214
+ * Helper function to create a 2D canvas context
215
+ * @param width - width of the context
216
+ * @param height - height of the context
217
+ * @param willReadFrequently - if true, the context will be read frequently (browser will optimize it)
218
+ * @returns canvas context
219
+ */
85
220
  export declare function create2DContext(width: number, height: number, willReadFrequently?: boolean): CanvasRenderingContext2D;
221
+ /**
222
+ * Load ImageData to from URL with RequestInit
223
+ * @param url - image url
224
+ * @param requestInit - fetch requestInit
225
+ * @returns Promise of ImageData
226
+ */
86
227
  export declare function loadImageData(url: string, requestInit?: RequestInit): Promise<ImageData>;
228
+ /**
229
+ * Load {@link DataIntegral} from URL with RequestInit
230
+ * @param url - image url
231
+ * @param requestInit - fetch requestInit
232
+ * @returns Promise of {@link DataIntegral}
233
+ * */
87
234
  export declare function loadDataIntegral(url: string, requestInit?: RequestInit): Promise<DataIntegral>;
88
- interface AbortControllerHolder {
89
- controller: AbortController;
90
- debug: string;
91
- }
92
- export interface AbortableCacheableURILoaderPromiseFunc<T> extends CacheableURILoaderPromiseFunc<T> {
93
- controllerHolder: AbortControllerHolder;
94
- abort: () => void;
95
- }
96
- export declare function loadingFunctionCachedAbortable<T>(F: (url: string, requestInit?: RequestInit) => Promise<T>, requestInit?: RequestInit): AbortableCacheableURILoaderPromiseFunc<T>;
97
- export declare function loadDataIntegralCachedAbortable(requestInit?: RequestInit): AbortableCacheableURILoaderPromiseFunc<DataIntegral>;
98
- export declare function loadImageDataCachedAbortable(requestInit?: RequestInit): AbortableCacheableURILoaderPromiseFunc<ImageData>;
99
- export declare function loadDataIntegralCachedAbortable_old(requestInit?: RequestInit): AbortableCacheableURILoaderPromiseFunc<DataIntegral>;
100
- export declare function loadImageDataCachedAbortable_old(requestInit?: RequestInit): AbortableCacheableURILoaderPromiseFunc<ImageData>;
235
+ /**
236
+ * BoxBlur implementation based on {@link DataIntegral}
237
+ * @param data - {@link DataIntegral}
238
+ * @param radius - radius for the box-blur algorithm
239
+ * */
101
240
  export declare function blurData(im: DataIntegral, radius: number): DataIntegral;
241
+ /**
242
+ * Convert Uin32 RGB color to web color
243
+ * @param color - Uin32 color
244
+ * @returns web color in format '#RRGGBB'
245
+ * */
102
246
  export declare function RGBtoHEX(rgb: number): string;
247
+ /**
248
+ * Convert Uin32 RGBA color to web color
249
+ * @param color - Uin32 color
250
+ * @returns web color in format '#RRGGBBAA'
251
+ * */
103
252
  export declare function RGBAtoHEX(rgba: number): string;
253
+ /**
254
+ * Convert web color to Uin32 RGB color
255
+ * @param color - web color in format '#RGB' or '#RRGGBB' or '#RRGGBBAA'
256
+ * @returns Uin32 color
257
+ * */
104
258
  export declare function HEXtoRGBA(c: string): number;
259
+ /**
260
+ * json loader helper
261
+ * @template {any} T - type of the object to load
262
+ * @param url - url to json file
263
+ * @param requestInit - requestInit for fetch
264
+ * @returns json object
265
+ * */
105
266
  export declare function fetchJson<T = any>(url: RequestInfo, requestInit?: RequestInit): Promise<T>;
267
+ /**
268
+ * Create element helper
269
+ * @param tag - tag name
270
+ * @param className - class name
271
+ * @param container - container to append element
272
+ * @returns created element
273
+ * */
106
274
  export declare function createEl(tagName: string, className?: string, container?: HTMLElement): HTMLElement;
275
+ /**
276
+ * Color linear mixer
277
+ * @param color1 - color1 Uin32 RGBA
278
+ * @param color2 - color2 Uin32 RGBA
279
+ * @param k - koefficient
280
+ * @returns mixed color Uin32 RGBA
281
+ * */
107
282
  export declare function mixColor(c1: number, c2: number, t: number): number;
283
+ /**
284
+ * Helper to create array of levels for a style
285
+ * @param min - min value
286
+ * @param max - max value
287
+ * @param n - number of levels
288
+ * @returns array of levels
289
+ * */
108
290
  export declare function createLevels(min: number, max: number, n: number): number[];
291
+ /**
292
+ * Get closest existing time in array. If time is Date, strings will be converted to number to find closest time
293
+ * @param times - array of times
294
+ * @param time - time to find
295
+ * @returns closest time a value from array
296
+ * */
109
297
  export declare function getClosestTimeString(times: string[], time: Date | string | number): string;
110
- export declare function WxTilesLogging(on: boolean): void;
111
- export declare function WXLOG(...str: any): void;
298
+ /**
299
+ * Logging helper
300
+ * */
301
+ export declare let WXLOG: (...args: any[]) => void;
302
+ /**
303
+ * Set logging on/off
304
+ * @param logging - true to turn on logging
305
+ * */
306
+ export declare function WxTilesLogging(on?: boolean | ((...args: any[]) => void)): void;
307
+ /**
308
+ * Helper to convert short form of web color from '#RGB' to '#RRGGBB'
309
+ * @param color - web color in format '#RGB' or '#RRGGBB' or '#RRGGBBAA'
310
+ * @returns web color in format '#RRGGBB'
311
+ * */
112
312
  export declare function refineColor(c: string): string;
313
+ /**
314
+ * Helper to fill URI template with values
315
+ * @param uri - URI template
316
+ * @param values - {@link XYZ} values to fill template
317
+ * @returns URI with values filled
318
+ * */
113
319
  export declare function uriXYZ(uri: string, { x, y, z }: XYZ): string;
320
+ /**
321
+ * Calculate hash of {@link XYZ}
322
+ * @param xyz - {@link XYZ} to calculate hash
323
+ * @returns string hash
324
+ * */
114
325
  export declare function HashXYZ({ x, y, z }: XYZ): string;
115
- export {};
@@ -1,96 +1,132 @@
1
- import type { WxDate, WxVars } from '../wxlayer/wxlayer';
1
+ import type { WxDate, WxLayerOptions, WxVars } from '../wxlayer/wxlayer';
2
+ import { WxTileSource } from '../wxsource/wxsource';
3
+ import { FrameworkOptions } from '../wxsource/wxsourcetypes';
2
4
  import type { WxDatasetMeta, WxAPI, WxVariableMeta, WxAllBoundariesMeta } from './wxAPI';
5
+ export interface WxSourceLayerOptions extends Omit<WxLayerOptions, 'variables' | 'wxdatasetManager'> {
6
+ variable: string;
7
+ }
8
+ /**
9
+ * Options to pass to the constructor of {@link WxDataSetManager}
10
+ */
11
+ export interface WxDataSetManagerOptions {
12
+ /**
13
+ * @internal
14
+ * Dataset name
15
+ * */
16
+ datasetName: string;
17
+ /**
18
+ * @internal
19
+ * current instance of the dataset
20
+ * */
21
+ instance: string;
22
+ /**
23
+ * @internal
24
+ * Array of instanced time steps
25
+ * */
26
+ instanced?: string[];
27
+ /**
28
+ * @internal
29
+ * Dataset's meta data
30
+ * */
31
+ meta: WxDatasetMeta;
32
+ /**
33
+ * @internal
34
+ * The {@link WxAPI} instance to use to interact with the *WxTiles* API
35
+ * */
36
+ wxapi: WxAPI;
37
+ }
3
38
  /**
39
+ * Class for managing WX datasets.
4
40
  * @class WxDataSetManager
5
- * @description Class for managing WX datasets.
6
- * @param {string} dataSetsName - Name of the dataset.
7
- * @param {string} instance - current instance (instance or data time creataion in NC-file) of the dataset.
8
- * @param {WxDatasetMeta} meta - metadata.
9
- * @param {WxAPI} wxapi - Wx API control object.
41
+ * @example
42
+ * ```ts
43
+ * const wxdatasetManager = await wxapi.createDatasetManager('gfs.global');
44
+ * ```
10
45
  * */
11
46
  export declare class WxDataSetManager {
47
+ /** dataset's name */
12
48
  readonly datasetName: string;
49
+ /** if not empty, returns dataset's instances to be used as time steps in the dataset */
13
50
  readonly instanced?: string[];
51
+ /** Get dataset's current instance. */
14
52
  readonly instance: string;
53
+ /** dataset's meta */
15
54
  readonly meta: WxDatasetMeta;
55
+ /** a reference to the wxAPI object */
16
56
  readonly wxapi: WxAPI;
17
- constructor({ datasetName, instance, instanced, meta, wxapi, }: {
18
- datasetName: string;
19
- instance: string;
20
- instanced?: string[];
21
- meta: WxDatasetMeta;
22
- wxapi: WxAPI;
23
- });
57
+ /** Do not use this constructor directly, use {@link WxAPI.createDatasetManager} instead. */
58
+ constructor({ datasetName, instance, instanced, meta, wxapi }: WxDataSetManagerOptions);
24
59
  /**
25
60
  * Get closets valid time to the given time.
26
- * @memberof WxDataSetManager
27
61
  * @argument {WxDate} time - either a number of a step in dataset's time array or seconds since epoch or a Date object
28
62
  * @returns {string} - closest valid time from the dataset's time array
29
63
  * */
30
64
  getValidTime(time?: WxDate): string;
31
65
  /**
32
66
  * Get dataset's times.
33
- * @memberof WxDataSetManager
34
- * @returns {string[]} - copy of dataset's times
67
+ * @returns {string[]} - copy of dataset's time steps
35
68
  * */
36
69
  getTimes(): string[];
37
70
  /**
38
71
  * Get dataset's variables.
39
- * @memberof WxDataSetManager
40
- * @returns {string[]} - copy of dataset's variables
72
+ * @returns {string[]} - all dataset's variables
41
73
  * */
42
74
  getVariables(): string[];
43
75
  /**
44
76
  * Get dataset's variable meta.
45
- * @memberof WxDataSetManager
46
77
  * @argument {string} variable - variable name
47
- * @returns {units, min, max} - some of dataset's variable meta
48
- * unit - unit of the variable
49
- * min - minimum value of the variable
50
- * max - maximum value of the variable
78
+ * @returns {WxVariableMeta} - some of dataset's variable meta
51
79
  * */
52
80
  getVariableMeta(variable: string): WxVariableMeta | undefined;
53
81
  /**
54
82
  * Get dataset's native maximum zoom level.
55
- * @memberof WxDataSetManager
56
83
  * @returns {number} - maximum zoom level of the dataset
57
84
  * */
58
85
  getMaxZoom(): number;
59
86
  /**
60
87
  * Get dataset's boundaries.
61
- * @memberof WxDataSetManager
62
- * @returns {[west, north, east, south]} - dataset's boundaries
88
+ * @returns {[west, north, east, south] | undefined} - dataset's boundaries
63
89
  * */
64
90
  getBoundaries180(): [number, number, number, number] | undefined;
65
91
  /**
66
92
  * Get dataset's boundaries.
67
- * @memberof WxDataSetManager
68
- * @returns {[west, north, east, south]} - dataset's boundaries
93
+ * @returns {WxAllBoundariesMeta | undefined} - dataset's boundaries
69
94
  * */
70
95
  getBoundaries(): WxAllBoundariesMeta | undefined;
71
96
  /**
72
97
  * Createts dataset's current URI ready for fetching tiles.
73
- * @memberof WxDataSetManager
74
98
  * @argument {string} variable - variable of the dataset
75
- * @argument {WxDate} time - time of the dataset
76
- * @argument {string} ext - zoom level of the dataset
99
+ * @argument {WxDate} time - time step of the dataset
100
+ * @argument {'png'} ext - must be PNG
77
101
  * @returns {string} - dataset's current URI ready for fetching tiles
78
102
  * */
79
- createURI(variable: string, time?: WxDate, ext?: string): string;
103
+ createURI(variable: string, time?: WxDate, ext?: 'png'): string;
80
104
  /**
81
105
  * Check if given variable is available in the dataset.
82
- * @memberof WxDataSetManager
83
106
  * @argument {string} variable - variable name
84
107
  * @returns {boolean} - true if variable is available in the dataset
85
108
  * */
86
109
  checkVariableValid(variable: string): boolean;
110
+ /**
111
+ * Checks if variable is a vector component.
112
+ * @argument {string} variable - variable name
113
+ * @returns {WxVars} - [variable] or [variable.eastward, variable.northward]
114
+ * */
87
115
  checkCombineVariableIfVector(variable: string): WxVars;
116
+ createSourceLayer(options: WxSourceLayerOptions, frwOptions: FrameworkOptions): WxTileSource;
88
117
  /**
89
118
  * Check if dataset's instance updated (fresh data is arrived) since datasset object was created
90
- * @memberof WxDataSetManager
91
119
  * @returns {boolean} - true if dataset's instance updated since datasset object was created
92
120
  * */
93
121
  checkDatasetOutdated(): Promise<boolean>;
122
+ /**
123
+ * Get dataset's instance.
124
+ * @returns {Promise<string>} - dataset's instance
125
+ * */
94
126
  protected getDatasetInstance(): Promise<string>;
127
+ /**
128
+ * Get dataset's instances.
129
+ * @returns {Promise<string[]>} - dataset's all instances
130
+ * */
95
131
  protected getDatasetInstances(): Promise<string[]>;
96
132
  }