autumnplot-gl 3.1.0 → 4.0.0-beta

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 (56) hide show
  1. package/README.md +6 -11
  2. package/dist/110.autumnplot-gl.js +1 -1
  3. package/dist/110.autumnplot-gl.js.map +1 -1
  4. package/dist/autumnplot-gl.js +1 -1
  5. package/dist/autumnplot-gl.js.map +1 -1
  6. package/dist/marchingsquares.wasm +0 -0
  7. package/lib/AutumnTypes.d.ts +53 -5
  8. package/lib/AutumnTypes.js +25 -1
  9. package/lib/Barbs.d.ts +23 -6
  10. package/lib/Barbs.js +20 -18
  11. package/lib/BillboardCollection.d.ts +16 -8
  12. package/lib/BillboardCollection.js +107 -59
  13. package/lib/Color.d.ts +57 -0
  14. package/lib/Color.js +163 -0
  15. package/lib/ColorBar.d.ts +12 -1
  16. package/lib/ColorBar.js +9 -7
  17. package/lib/Colormap.d.ts +19 -18
  18. package/lib/Colormap.js +84 -23
  19. package/lib/Contour.d.ts +42 -11
  20. package/lib/Contour.js +67 -58
  21. package/lib/ContourCreator.d.ts +4 -0
  22. package/lib/ContourCreator.js +2 -1
  23. package/lib/Fill.d.ts +27 -16
  24. package/lib/Fill.js +105 -83
  25. package/lib/Grid.d.ts +125 -29
  26. package/lib/Grid.js +303 -95
  27. package/lib/Hodographs.d.ts +24 -6
  28. package/lib/Hodographs.js +28 -24
  29. package/lib/Map.js +1 -1
  30. package/lib/Paintball.d.ts +6 -5
  31. package/lib/Paintball.js +38 -32
  32. package/lib/ParticleTracer.d.ts +19 -0
  33. package/lib/ParticleTracer.js +37 -0
  34. package/lib/PlotComponent.d.ts +6 -7
  35. package/lib/PlotComponent.js +17 -7
  36. package/lib/PlotLayer.d.ts +4 -4
  37. package/lib/PlotLayer.worker.d.ts +1 -2
  38. package/lib/PlotLayer.worker.js +22 -57
  39. package/lib/PolylineCollection.d.ts +18 -9
  40. package/lib/PolylineCollection.js +124 -89
  41. package/lib/RawField.d.ts +76 -23
  42. package/lib/RawField.js +138 -29
  43. package/lib/ShaderManager.d.ts +12 -0
  44. package/lib/ShaderManager.js +58 -0
  45. package/lib/StationPlot.d.ts +145 -0
  46. package/lib/StationPlot.js +205 -0
  47. package/lib/TextCollection.d.ts +12 -8
  48. package/lib/TextCollection.js +113 -71
  49. package/lib/cpp/marchingsquares.js +483 -585
  50. package/lib/cpp/marchingsquares.wasm +0 -0
  51. package/lib/cpp/marchingsquares_embind.d.ts +23 -3
  52. package/lib/index.d.ts +7 -4
  53. package/lib/index.js +5 -3
  54. package/lib/utils.d.ts +5 -8
  55. package/lib/utils.js +12 -83
  56. package/package.json +2 -2
Binary file
@@ -1,6 +1,26 @@
1
- export interface MainModule {
2
- makeContoursFloat32(_0: any, _1: any, _2: any, _3: any, _4: any): any;
3
- makeContoursFloat16(_0: any, _1: any, _2: any, _3: any, _4: any): any;
1
+ // TypeScript bindings for emscripten-generated code. Automatically generated at compile time.
2
+ declare namespace RuntimeExports {
3
+ let HEAPF32: any;
4
+ let HEAPF64: any;
5
+ let HEAP_DATA_VIEW: any;
6
+ let HEAP8: any;
7
+ let HEAPU8: any;
8
+ let HEAP16: any;
9
+ let HEAPU16: any;
10
+ let HEAP32: any;
11
+ let HEAPU32: any;
12
+ let HEAP64: any;
13
+ let HEAPU64: any;
14
+ }
15
+ interface WasmModule {
16
+ }
17
+
18
+ interface EmbindModule {
19
+ makeContoursFloat32(_0: any, _1: any, _2: any, _3: any, _4: any, _5: any): any;
20
+ makeContoursFloat16(_0: any, _1: any, _2: any, _3: any, _4: any, _5: any): any;
4
21
  getContourLevelsFloat32(_0: any, _1: number, _2: number, _3: number): any;
5
22
  getContourLevelsFloat16(_0: any, _1: number, _2: number, _3: number): any;
6
23
  }
24
+
25
+ export type MainModule = WasmModule & typeof RuntimeExports & EmbindModule;
26
+ export default function MainModuleFactory (options?: unknown): Promise<MainModule>;
package/lib/index.d.ts CHANGED
@@ -4,13 +4,16 @@ import { ContourFill, Raster, ContourFillOptions, RasterOptions } from "./Fill";
4
4
  import Barbs, { BarbsOptions } from "./Barbs";
5
5
  import Paintball, { PaintballOptions } from "./Paintball";
6
6
  import Hodographs, { HodographOptions } from './Hodographs';
7
+ import StationPlot, { StationPlotOptions, SPPosition, SPNumberConfig, SPStringConfig, SPBarbConfig, SPSymbolConfig, SPConfig, SPDataConfig, SPSymbol } from "./StationPlot";
7
8
  import { PlotLayer, MultiPlotLayer } from './PlotLayer';
8
9
  import { WindProfile, WebGLAnyRenderingContext, TypedArray, ContourData } from "./AutumnTypes";
9
10
  import { MapLikeType } from "./Map";
10
- import { ColorMap, ColorMapOptions, Color } from './Colormap';
11
+ import { ColorMap, ColorMapOptions } from './Colormap';
12
+ import { Color } from "./Color";
11
13
  import { makeColorBar, makePaintballKey, ColorbarOrientation, ColorbarTickDirection, ColorBarOptions, PaintballKeyOptions } from "./ColorBar";
12
- import { RawScalarField, RawVectorField, RawProfileField, VectorRelativeTo, RawVectorFieldOptions } from "./RawField";
13
- import { Grid, GridType, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid } from './Grid';
14
+ import { LineStyle } from "./PolylineCollection";
15
+ import { RawScalarField, RawVectorField, RawProfileField, VectorRelativeTo, RawVectorFieldOptions, RawObsField, ObsRawData } from "./RawField";
16
+ import { Grid, GridType, StructuredGrid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, UnstructuredGrid } from './Grid';
14
17
  import { FieldContourOpts } from './ContourCreator';
15
18
  declare const colormaps: {
16
19
  bluered: (level_min: number, level_max: number, n_colors: number) => ColorMap;
@@ -27,4 +30,4 @@ declare const colormaps: {
27
30
  * first, you can prevent races when you contour a bunch of fields at once.
28
31
  */
29
32
  declare function initAutumnPlot(): void;
30
- export { PlotComponent, Barbs, BarbsOptions, Contour, ContourOptions, ContourLabels, ContourLabelOptions, ContourFill, Raster, ContourFillOptions, RasterOptions, Paintball, PaintballOptions, Hodographs, HodographOptions, WindProfile, PlotLayer, MultiPlotLayer, MapLikeType, ColorMap, ColorMapOptions, colormaps, makeColorBar, makePaintballKey, Color, ColorbarOrientation, ColorbarTickDirection, ColorBarOptions, PaintballKeyOptions, RawScalarField, RawVectorField, RawProfileField, Grid, GridType, VectorRelativeTo, RawVectorFieldOptions, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, WebGLAnyRenderingContext, TypedArray, ContourData, initAutumnPlot, FieldContourOpts };
33
+ export { PlotComponent, Barbs, BarbsOptions, Contour, ContourOptions, ContourLabels, ContourLabelOptions, ContourFill, Raster, ContourFillOptions, RasterOptions, Paintball, PaintballOptions, Hodographs, HodographOptions, WindProfile, StationPlot, StationPlotOptions, SPPosition, SPNumberConfig, SPStringConfig, SPBarbConfig, SPSymbolConfig, SPConfig, SPDataConfig, SPSymbol, PlotLayer, MultiPlotLayer, MapLikeType, LineStyle, ColorMap, ColorMapOptions, colormaps, makeColorBar, makePaintballKey, Color, ColorbarOrientation, ColorbarTickDirection, ColorBarOptions, PaintballKeyOptions, RawScalarField, RawVectorField, RawProfileField, RawObsField, ObsRawData, Grid, GridType, StructuredGrid, VectorRelativeTo, RawVectorFieldOptions, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, UnstructuredGrid, WebGLAnyRenderingContext, TypedArray, ContourData, initAutumnPlot, FieldContourOpts };
package/lib/index.js CHANGED
@@ -4,11 +4,13 @@ import { ContourFill, Raster } from "./Fill";
4
4
  import Barbs from "./Barbs";
5
5
  import Paintball from "./Paintball";
6
6
  import Hodographs from './Hodographs';
7
+ import StationPlot from "./StationPlot";
7
8
  import { PlotLayer, MultiPlotLayer } from './PlotLayer';
8
9
  import { ColorMap, bluered, redblue, pw_speed500mb, pw_speed850mb, pw_cape, pw_t2m, pw_td2m, nws_storm_clear_refl } from './Colormap';
10
+ import { Color } from "./Color";
9
11
  import { makeColorBar, makePaintballKey } from "./ColorBar";
10
- import { RawScalarField, RawVectorField, RawProfileField } from "./RawField";
11
- import { Grid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid } from './Grid';
12
+ import { RawScalarField, RawVectorField, RawProfileField, RawObsField } from "./RawField";
13
+ import { Grid, StructuredGrid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, UnstructuredGrid } from './Grid';
12
14
  import { initMSModule } from './ContourCreator';
13
15
  const colormaps = {
14
16
  bluered: bluered,
@@ -27,4 +29,4 @@ const colormaps = {
27
29
  function initAutumnPlot() {
28
30
  initMSModule();
29
31
  }
30
- export { PlotComponent, Barbs, Contour, ContourLabels, ContourFill, Raster, Paintball, Hodographs, PlotLayer, MultiPlotLayer, ColorMap, colormaps, makeColorBar, makePaintballKey, RawScalarField, RawVectorField, RawProfileField, Grid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, initAutumnPlot };
32
+ export { PlotComponent, Barbs, Contour, ContourLabels, ContourFill, Raster, Paintball, Hodographs, StationPlot, PlotLayer, MultiPlotLayer, ColorMap, colormaps, makeColorBar, makePaintballKey, Color, RawScalarField, RawVectorField, RawProfileField, RawObsField, Grid, StructuredGrid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, UnstructuredGrid, initAutumnPlot };
package/lib/utils.d.ts CHANGED
@@ -1,12 +1,7 @@
1
- declare const hex2rgba: (hexstr: string, out_type?: string) => [number, number, number, number];
2
- declare const rgba2hex: (rgba: [number, number, number, number], in_type?: string) => string;
3
- declare const hex2rgb: (hexstr: string, out_type?: string) => [number, number, number];
4
- declare const rgb2hex: (rgb: [number, number, number], in_type?: string) => string;
5
- declare const rgb2hsv: (rgb: [number, number, number]) => [number, number, number];
6
- declare const hsv2rgb: (hsv: [number, number, number]) => [number, number, number];
1
+ import { TypedArray } from "./AutumnTypes";
7
2
  declare function getMinZoom(jlat: number, ilon: number, thin_fac_base: number): number;
8
3
  declare function zip(...args: any[]): Generator<any[], void, unknown>;
9
- declare function getOS(): string;
4
+ declare function getOS(): string | null;
10
5
  declare class Cache<A extends unknown[], R> {
11
6
  private cached_values;
12
7
  private readonly compute_value;
@@ -15,4 +10,6 @@ declare class Cache<A extends unknown[], R> {
15
10
  getValue(...args: A): R;
16
11
  }
17
12
  declare function normalizeOptions<Type extends Record<string, any>>(opts: Type | undefined, defaults: Required<Type>): Required<Type>;
18
- export { hex2rgba, rgba2hex, hex2rgb, rgb2hex, rgb2hsv, hsv2rgb, zip, getMinZoom, getOS, Cache, normalizeOptions };
13
+ declare function getArrayConstructor<ArrayType extends TypedArray>(ary: ArrayType): new (...args: any[]) => ArrayType;
14
+ declare function mergeShaderCode(snippet: string, main: string): string;
15
+ export { zip, getMinZoom, getOS, Cache, normalizeOptions, getArrayConstructor, mergeShaderCode };
package/lib/utils.js CHANGED
@@ -1,85 +1,3 @@
1
- const hex2rgba = (hexstr, out_type) => {
2
- out_type = out_type === undefined ? 'float' : out_type;
3
- const match = hexstr.match(/#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?/i);
4
- if (match === null) {
5
- throw `Got '${hexstr}' in hex2rgba, which does not look like a hex color`;
6
- }
7
- let rgba = match.slice(1).filter(c => c !== undefined).map(c => parseInt(c, 16));
8
- if (out_type == 'float') {
9
- rgba = rgba.map(c => c / 255);
10
- }
11
- return rgba[3] === undefined ? [rgba[0], rgba[1], rgba[2], 1] : [rgba[0], rgba[1], rgba[2], rgba[3]];
12
- };
13
- const rgba2hex = (rgba, in_type) => {
14
- in_type = in_type === undefined ? 'float' : in_type;
15
- let rgba_ = rgba;
16
- if (in_type == 'float') {
17
- rgba_ = rgba_.map(c => Math.round(c * 255));
18
- }
19
- return '#' + rgba_.map(c => c.toString(16).padStart(2, '0').toUpperCase()).join('');
20
- };
21
- const hex2rgb = (hexstr, out_type) => {
22
- const [r, g, b, a] = hex2rgba(hexstr, out_type);
23
- return [r, g, b];
24
- };
25
- const rgb2hex = (rgb, in_type) => {
26
- const [r, g, b] = rgb;
27
- return rgba2hex([r, g, b, 0], in_type).slice(0, -2);
28
- };
29
- const rgb2hsv = (rgb) => {
30
- const [r, g, b] = rgb;
31
- const Cmax = Math.max(r, g, b);
32
- const Cmin = Math.min(r, g, b);
33
- const Delta = Cmax - Cmin;
34
- let H;
35
- if (Delta == 0) {
36
- H = 0;
37
- }
38
- else if (Cmax == r) {
39
- H = 60 * ((g - b) / Delta) % 6;
40
- }
41
- else if (Cmax == g) {
42
- H = 60 * ((b - r) / Delta + 2);
43
- }
44
- else if (Cmax == b) {
45
- H = 60 * ((r - g) / Delta + 4);
46
- }
47
- let S = Cmax == 0 ? 0 : Delta / Cmax;
48
- let V = Cmax;
49
- return [H, S, V];
50
- };
51
- const hsv2rgb = (hsv) => {
52
- const [H, S, V] = hsv;
53
- const C = V * S;
54
- const X = C * (1 - Math.abs(H / 60 % 2 - 1));
55
- const m = V - C;
56
- let r_prime, g_prime, b_prime;
57
- if (0 <= H && H < 60) {
58
- r_prime = C;
59
- g_prime = X, b_prime = 0;
60
- }
61
- else if (60 <= H && H < 120) {
62
- r_prime = X;
63
- g_prime = C, b_prime = 0;
64
- }
65
- else if (120 <= H && H < 180) {
66
- r_prime = 0;
67
- g_prime = C, b_prime = X;
68
- }
69
- else if (180 <= H && H < 240) {
70
- r_prime = 0;
71
- g_prime = X, b_prime = C;
72
- }
73
- else if (240 <= H && H < 300) {
74
- r_prime = X;
75
- g_prime = 0, b_prime = C;
76
- }
77
- else if (300 <= H && H < 360) {
78
- r_prime = C;
79
- g_prime = 0, b_prime = X;
80
- }
81
- return [r_prime + m, g_prime + m, b_prime + m];
82
- };
83
1
  function getMinZoom(jlat, ilon, thin_fac_base) {
84
2
  const zoom_base = 1;
85
3
  let zoom = zoom_base;
@@ -143,4 +61,15 @@ function normalizeOptions(opts, defaults) {
143
61
  }
144
62
  return ret;
145
63
  }
146
- export { hex2rgba, rgba2hex, hex2rgb, rgb2hex, rgb2hsv, hsv2rgb, zip, getMinZoom, getOS, Cache, normalizeOptions };
64
+ function getArrayConstructor(ary) {
65
+ return ary.constructor;
66
+ }
67
+ function mergeShaderCode(snippet, main) {
68
+ const ES3_SHADER_MAGIC = '#version 300 es\n';
69
+ const is_es3_shader = main.startsWith(ES3_SHADER_MAGIC);
70
+ if (is_es3_shader) {
71
+ return ES3_SHADER_MAGIC + snippet + "\n" + main.slice(ES3_SHADER_MAGIC.length);
72
+ }
73
+ return snippet + "\n" + main;
74
+ }
75
+ export { zip, getMinZoom, getOS, Cache, normalizeOptions, getArrayConstructor, mergeShaderCode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autumnplot-gl",
3
- "version": "3.1.0",
3
+ "version": "4.0.0-beta",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@petamoriken/float16": "^3.8.4",
37
- "autumn-wgl": "^1.4.0",
37
+ "autumn-wgl": "^1.5.3",
38
38
  "comlink": "^4.3.1",
39
39
  "kd-tree-javascript": "^1.0.3",
40
40
  "pbf": "^3.2.1",