autumnplot-gl 4.0.0-beta → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +13 -207
  2. package/dist/812.autumnplot-gl.js +2 -0
  3. package/dist/812.autumnplot-gl.js.map +1 -0
  4. package/dist/983.autumnplot-gl.js +2 -0
  5. package/dist/983.autumnplot-gl.js.map +1 -0
  6. package/dist/autumnplot-gl.js +1 -1
  7. package/dist/autumnplot-gl.js.map +1 -1
  8. package/dist/marchingsquares.wasm +0 -0
  9. package/lib/AutumnTypes.d.ts +38 -5
  10. package/lib/AutumnTypes.js +7 -1
  11. package/lib/Barbs.d.ts +12 -2
  12. package/lib/Barbs.js +9 -0
  13. package/lib/BillboardCollection.d.ts +2 -2
  14. package/lib/BillboardCollection.js +14 -14
  15. package/lib/Color.d.ts +1 -0
  16. package/lib/Color.js +1 -0
  17. package/lib/ColorBar.d.ts +14 -0
  18. package/lib/ColorBar.js +15 -8
  19. package/lib/Colormap.d.ts +9 -1
  20. package/lib/Colormap.js +24 -1
  21. package/lib/Contour.d.ts +26 -1
  22. package/lib/Contour.js +24 -2
  23. package/lib/ContourCreator.worker.d.ts +25 -0
  24. package/lib/{ContourCreator.js → ContourCreator.worker.js} +15 -14
  25. package/lib/Fill.d.ts +31 -11
  26. package/lib/Fill.js +38 -18
  27. package/lib/Hodographs.d.ts +19 -3
  28. package/lib/Hodographs.js +45 -20
  29. package/lib/Map.d.ts +13 -1
  30. package/lib/Map.js +62 -8
  31. package/lib/Paintball.d.ts +14 -5
  32. package/lib/Paintball.js +96 -46
  33. package/lib/PlotComponent.d.ts +9 -3
  34. package/lib/PlotComponent.js +36 -1
  35. package/lib/PlotLayer.d.ts +2 -2
  36. package/lib/PlotLayer.js +2 -2
  37. package/lib/PlotLayer.worker.js +9 -3
  38. package/lib/RawField.d.ts +223 -27
  39. package/lib/RawField.js +413 -59
  40. package/lib/StationPlot.d.ts +78 -11
  41. package/lib/StationPlot.js +113 -30
  42. package/lib/TextCollection.d.ts +5 -0
  43. package/lib/TextCollection.js +82 -9
  44. package/lib/WasmInterface.d.ts +7 -0
  45. package/lib/WasmInterface.js +11 -0
  46. package/lib/WorkerPool.d.ts +8 -0
  47. package/lib/WorkerPool.js +77 -0
  48. package/lib/cpp/marchingsquares.js +127 -13
  49. package/lib/cpp/marchingsquares.wasm +0 -0
  50. package/lib/cpp/marchingsquares_embind.d.ts +16 -3
  51. package/lib/grids/AutoZoom.d.ts +21 -0
  52. package/lib/grids/AutoZoom.js +63 -0
  53. package/lib/grids/DomainBuffer.d.ts +14 -0
  54. package/lib/grids/DomainBuffer.js +16 -0
  55. package/lib/grids/Geostationary.d.ts +35 -0
  56. package/lib/grids/Geostationary.js +47 -0
  57. package/lib/grids/Grid.d.ts +36 -0
  58. package/lib/grids/Grid.js +12 -0
  59. package/lib/grids/GridCoordinates.d.ts +10 -0
  60. package/lib/grids/GridCoordinates.js +64 -0
  61. package/lib/grids/LambertGrid.d.ts +73 -0
  62. package/lib/grids/LambertGrid.js +92 -0
  63. package/lib/grids/PlateCarreeGrid.d.ts +46 -0
  64. package/lib/grids/PlateCarreeGrid.js +55 -0
  65. package/lib/grids/PlateCarreeRotatedGrid.d.ts +53 -0
  66. package/lib/grids/PlateCarreeRotatedGrid.js +65 -0
  67. package/lib/grids/RadarSweepGrid.d.ts +46 -0
  68. package/lib/grids/RadarSweepGrid.js +74 -0
  69. package/lib/grids/StructuredGrid.d.ts +49 -0
  70. package/lib/grids/StructuredGrid.js +103 -0
  71. package/lib/grids/UnstructuredGrid.d.ts +56 -0
  72. package/lib/grids/UnstructuredGrid.js +102 -0
  73. package/lib/index.d.ts +23 -6
  74. package/lib/index.js +18 -8
  75. package/lib/utils.d.ts +11 -2
  76. package/lib/utils.js +63 -1
  77. package/package.json +4 -3
  78. package/dist/110.autumnplot-gl.js +0 -2
  79. package/dist/110.autumnplot-gl.js.map +0 -1
  80. package/lib/ContourCreator.d.ts +0 -22
  81. package/lib/Grid.d.ts +0 -263
  82. package/lib/Grid.js +0 -547
  83. package/lib/ParticleTracer.d.ts +0 -19
  84. package/lib/ParticleTracer.js +0 -37
@@ -0,0 +1,73 @@
1
+ import { StructuredGrid } from "./StructuredGrid";
2
+ declare const LambertGrid_base: import("./Grid").AbstractConstructor<import("./AutoZoom").AutoZoomGridIntf> & import("./Grid").AbstractConstructor<import("./GridCoordinates").GridCoordinateIntf> & typeof StructuredGrid;
3
+ /**
4
+ * A Lambert conformal conic grid with uniform grid spacing
5
+ *
6
+ * ## Plot Component Compatibility
7
+ * - :white_check_mark: `Fill`
8
+ * - :white_check_mark: `Raster`
9
+ * - :white_check_mark: `Contour`
10
+ * - :white_check_mark: `Paintball`
11
+ * - :white_check_mark: `Barbs`
12
+ * - :white_check_mark: `Hodographs`
13
+ * - :white_check_mark: `StationPlot`
14
+ */
15
+ declare class LambertGrid extends LambertGrid_base {
16
+ readonly lon_0: number;
17
+ readonly lat_0: number;
18
+ readonly lat_std: [number, number];
19
+ readonly ll_x: number;
20
+ readonly ll_y: number;
21
+ readonly ur_x: number;
22
+ readonly ur_y: number;
23
+ readonly a: number;
24
+ readonly b: number;
25
+ private readonly lcc;
26
+ /**
27
+ * Create a Lambert conformal conic grid from the lower-left and upper-right corner x/y values.
28
+ * @param ni - The number of grid points in the i (longitude) direction
29
+ * @param nj - The number of grid points in the j (latitude) direction
30
+ * @param lon_0 - The standard longitude for the projection; this is also the center longitude for the projection
31
+ * @param lat_0 - The center latitude for the projection
32
+ * @param lat_std - The standard latitudes for the projection
33
+ * @param ll_x - The x coordinate in projection space of the lower-left corner of the grid
34
+ * @param ll_y - The y coordinate in projection space of the lower-left corner of the grid
35
+ * @param ur_x - The x coordinate in projection space of the upper-right corner of the grid
36
+ * @param ur_y - The y coordinate in projection space of the upper-right corner of the grid
37
+ * @param a - The semimajor axis of the assumed shape of Earth in meters
38
+ * @param b - The semiminor axis of the assumed shape of Earth in meters
39
+ */
40
+ constructor(ni: number, nj: number, lon_0: number, lat_0: number, lat_std: [number, number], ll_x: number, ll_y: number, ur_x: number, ur_y: number, a?: number, b?: number, thin_x?: number, thin_y?: number);
41
+ /**
42
+ * Create a Lambert conformal conic grid from the lower-left grid point coordinate and a dx and dy.
43
+ * @param ni - The number of grid points in the i (longitude) direction
44
+ * @param nj - The number of grid points in the j (latitude) direction
45
+ * @param lon_0 - The standard longitude for the projection; this is also the center longitude for the projection
46
+ * @param lat_0 - The center latitude for the projection
47
+ * @param lat_std - The standard latitudes for the projection
48
+ * @param ll_lon - The longitude of the lower-left corner of the grid
49
+ * @param ll_lat - The latitude of the lower-left corner of the grid
50
+ * @param dx - The grid dx in meters
51
+ * @param dy - The grid dy in meters
52
+ * @param a - The semimajor axis of the assumed shape of Earth in meters
53
+ * @param b - The semiminor axis of the assumed shape of Earth in meters
54
+ * @returns
55
+ */
56
+ static fromLLCornerLonLat(ni: number, nj: number, lon_0: number, lat_0: number, lat_std: [number, number], ll_lon: number, ll_lat: number, dx: number, dy: number, a?: number, b?: number): LambertGrid;
57
+ /** @internal */
58
+ copy(opts?: {
59
+ ni?: number;
60
+ nj?: number;
61
+ ll_x?: number;
62
+ ll_y?: number;
63
+ ur_x?: number;
64
+ ur_y?: number;
65
+ }): LambertGrid;
66
+ /** @internal */
67
+ transform(x: number, y: number, opts?: {
68
+ inverse?: boolean;
69
+ }): [number, number];
70
+ /** @internal */
71
+ getThinnedGrid(thin_fac: number, map_max_zoom: number): this;
72
+ }
73
+ export { LambertGrid };
@@ -0,0 +1,92 @@
1
+ import { lambertConformalConic } from "../Map";
2
+ import { autoZoomGridMixin } from "./AutoZoom";
3
+ import { WGS84_SEMIMAJOR, WGS84_SEMIMINOR } from "./Grid";
4
+ import { gridCoordinateMixin } from "./GridCoordinates";
5
+ import { StructuredGrid } from "./StructuredGrid";
6
+ /**
7
+ * A Lambert conformal conic grid with uniform grid spacing
8
+ *
9
+ * ## Plot Component Compatibility
10
+ * - :white_check_mark: `Fill`
11
+ * - :white_check_mark: `Raster`
12
+ * - :white_check_mark: `Contour`
13
+ * - :white_check_mark: `Paintball`
14
+ * - :white_check_mark: `Barbs`
15
+ * - :white_check_mark: `Hodographs`
16
+ * - :white_check_mark: `StationPlot`
17
+ */
18
+ class LambertGrid extends autoZoomGridMixin(gridCoordinateMixin(StructuredGrid)) {
19
+ /**
20
+ * Create a Lambert conformal conic grid from the lower-left and upper-right corner x/y values.
21
+ * @param ni - The number of grid points in the i (longitude) direction
22
+ * @param nj - The number of grid points in the j (latitude) direction
23
+ * @param lon_0 - The standard longitude for the projection; this is also the center longitude for the projection
24
+ * @param lat_0 - The center latitude for the projection
25
+ * @param lat_std - The standard latitudes for the projection
26
+ * @param ll_x - The x coordinate in projection space of the lower-left corner of the grid
27
+ * @param ll_y - The y coordinate in projection space of the lower-left corner of the grid
28
+ * @param ur_x - The x coordinate in projection space of the upper-right corner of the grid
29
+ * @param ur_y - The y coordinate in projection space of the upper-right corner of the grid
30
+ * @param a - The semimajor axis of the assumed shape of Earth in meters
31
+ * @param b - The semiminor axis of the assumed shape of Earth in meters
32
+ */
33
+ constructor(ni, nj, lon_0, lat_0, lat_std, ll_x, ll_y, ur_x, ur_y, a, b, thin_x, thin_y) {
34
+ super('lcc', true, ni, nj, thin_x, thin_y);
35
+ this.lon_0 = lon_0;
36
+ this.lat_0 = lat_0;
37
+ this.lat_std = lat_std;
38
+ this.ll_x = ll_x;
39
+ this.ll_y = ll_y;
40
+ this.ur_x = ur_x;
41
+ this.ur_y = ur_y;
42
+ this.a = a === undefined ? WGS84_SEMIMAJOR : a;
43
+ this.b = b === undefined ? WGS84_SEMIMINOR : b;
44
+ this.lcc = lambertConformalConic({ lon_0: lon_0, lat_0: lat_0, lat_std: lat_std, a: this.a, b: this.b });
45
+ this.setupCoordinateCaches(ll_x, ur_x, ll_y, ur_y);
46
+ }
47
+ /**
48
+ * Create a Lambert conformal conic grid from the lower-left grid point coordinate and a dx and dy.
49
+ * @param ni - The number of grid points in the i (longitude) direction
50
+ * @param nj - The number of grid points in the j (latitude) direction
51
+ * @param lon_0 - The standard longitude for the projection; this is also the center longitude for the projection
52
+ * @param lat_0 - The center latitude for the projection
53
+ * @param lat_std - The standard latitudes for the projection
54
+ * @param ll_lon - The longitude of the lower-left corner of the grid
55
+ * @param ll_lat - The latitude of the lower-left corner of the grid
56
+ * @param dx - The grid dx in meters
57
+ * @param dy - The grid dy in meters
58
+ * @param a - The semimajor axis of the assumed shape of Earth in meters
59
+ * @param b - The semiminor axis of the assumed shape of Earth in meters
60
+ * @returns
61
+ */
62
+ static fromLLCornerLonLat(ni, nj, lon_0, lat_0, lat_std, ll_lon, ll_lat, dx, dy, a, b) {
63
+ a = a === undefined ? WGS84_SEMIMAJOR : a;
64
+ b = b === undefined ? WGS84_SEMIMINOR : b;
65
+ const lcc = lambertConformalConic({ lon_0: lon_0, lat_0: lat_0, lat_std: lat_std, a: a, b: b });
66
+ const [ll_x, ll_y] = lcc(ll_lon, ll_lat);
67
+ return new LambertGrid(ni, nj, lon_0, lat_0, lat_std, ll_x, ll_y, ll_x + ni * dx, ll_y + nj * dy, a, b);
68
+ }
69
+ /** @internal */
70
+ copy(opts) {
71
+ opts = opts !== undefined ? opts : {};
72
+ const ni = opts.ni !== undefined ? opts.ni : this.ni;
73
+ const nj = opts.nj !== undefined ? opts.nj : this.nj;
74
+ const ll_x = opts.ll_x !== undefined ? opts.ll_x : this.ll_x;
75
+ const ll_y = opts.ll_y !== undefined ? opts.ll_y : this.ll_y;
76
+ const ur_x = opts.ur_x !== undefined ? opts.ur_x : this.ur_x;
77
+ const ur_y = opts.ur_y !== undefined ? opts.ur_y : this.ur_y;
78
+ return new LambertGrid(ni, nj, this.lon_0, this.lat_0, this.lat_std, ll_x, ll_y, ur_x, ur_y, this.a, this.b);
79
+ }
80
+ /** @internal */
81
+ transform(x, y, opts) {
82
+ opts = opts === undefined ? {} : opts;
83
+ const inverse = opts.inverse === undefined ? false : opts.inverse;
84
+ return this.lcc(x, y, { inverse: inverse });
85
+ }
86
+ /** @internal */
87
+ getThinnedGrid(thin_fac, map_max_zoom) {
88
+ const { ni, nj, thin_x, thin_y, ll_x, ll_y, ur_x, ur_y } = this.thinnedGridParameters(thin_fac, map_max_zoom, this.ll_x, this.ll_y, this.ur_x, this.ur_y);
89
+ return new LambertGrid(ni, nj, this.lon_0, this.lat_0, this.lat_std, ll_x, ll_y, ur_x, ur_y, this.a, this.b, this.thin_x * thin_x, this.thin_y * thin_y);
90
+ }
91
+ }
92
+ export { LambertGrid };
@@ -0,0 +1,46 @@
1
+ import { StructuredGrid } from "./StructuredGrid";
2
+ declare const PlateCarreeGrid_base: import("./Grid").AbstractConstructor<import("./AutoZoom").AutoZoomGridIntf> & import("./Grid").AbstractConstructor<import("./GridCoordinates").GridCoordinateIntf> & typeof StructuredGrid;
3
+ /**
4
+ * A plate carree (a.k.a. lat/lon) grid with uniform grid spacing
5
+ *
6
+ * ## Plot Component Compatibility
7
+ * - :white_check_mark: `Fill`
8
+ * - :white_check_mark: `Raster`
9
+ * - :white_check_mark: `Contour`
10
+ * - :white_check_mark: `Paintball`
11
+ * - :white_check_mark: `Barbs`
12
+ * - :white_check_mark: `Hodographs`
13
+ * - :white_check_mark: `StationPlot`
14
+ */
15
+ declare class PlateCarreeGrid extends PlateCarreeGrid_base {
16
+ readonly ll_lon: number;
17
+ readonly ll_lat: number;
18
+ readonly ur_lon: number;
19
+ readonly ur_lat: number;
20
+ /**
21
+ * Create a plate carree grid
22
+ * @param ni - The number of grid points in the i (longitude) direction
23
+ * @param nj - The number of grid points in the j (latitude) direction
24
+ * @param ll_lon - The longitude of the lower left corner of the grid
25
+ * @param ll_lat - The latitude of the lower left corner of the grid
26
+ * @param ur_lon - The longitude of the upper right corner of the grid
27
+ * @param ur_lat - The latitude of the upper right corner of the grid
28
+ */
29
+ constructor(ni: number, nj: number, ll_lon: number, ll_lat: number, ur_lon: number, ur_lat: number, thin_x?: number, thin_y?: number);
30
+ /** @internal */
31
+ copy(opts?: {
32
+ ni?: number;
33
+ nj?: number;
34
+ ll_lon?: number;
35
+ ll_lat?: number;
36
+ ur_lon?: number;
37
+ ur_lat?: number;
38
+ }): PlateCarreeGrid;
39
+ /** @internal */
40
+ transform(x: number, y: number, opts?: {
41
+ inverse?: boolean;
42
+ }): [number, number];
43
+ /** @internal */
44
+ getThinnedGrid(thin_fac: number, map_max_zoom: number): this;
45
+ }
46
+ export { PlateCarreeGrid };
@@ -0,0 +1,55 @@
1
+ import { autoZoomGridMixin } from "./AutoZoom";
2
+ import { gridCoordinateMixin } from "./GridCoordinates";
3
+ import { StructuredGrid } from "./StructuredGrid";
4
+ /**
5
+ * A plate carree (a.k.a. lat/lon) grid with uniform grid spacing
6
+ *
7
+ * ## Plot Component Compatibility
8
+ * - :white_check_mark: `Fill`
9
+ * - :white_check_mark: `Raster`
10
+ * - :white_check_mark: `Contour`
11
+ * - :white_check_mark: `Paintball`
12
+ * - :white_check_mark: `Barbs`
13
+ * - :white_check_mark: `Hodographs`
14
+ * - :white_check_mark: `StationPlot`
15
+ */
16
+ class PlateCarreeGrid extends autoZoomGridMixin(gridCoordinateMixin(StructuredGrid)) {
17
+ /**
18
+ * Create a plate carree grid
19
+ * @param ni - The number of grid points in the i (longitude) direction
20
+ * @param nj - The number of grid points in the j (latitude) direction
21
+ * @param ll_lon - The longitude of the lower left corner of the grid
22
+ * @param ll_lat - The latitude of the lower left corner of the grid
23
+ * @param ur_lon - The longitude of the upper right corner of the grid
24
+ * @param ur_lat - The latitude of the upper right corner of the grid
25
+ */
26
+ constructor(ni, nj, ll_lon, ll_lat, ur_lon, ur_lat, thin_x, thin_y) {
27
+ super('latlon', true, ni, nj, thin_x, thin_y);
28
+ this.ll_lon = ll_lon;
29
+ this.ll_lat = ll_lat;
30
+ this.ur_lon = ur_lon;
31
+ this.ur_lat = ur_lat;
32
+ this.setupCoordinateCaches(ll_lon, ur_lon, ll_lat, ur_lat);
33
+ }
34
+ /** @internal */
35
+ copy(opts) {
36
+ opts = opts !== undefined ? opts : {};
37
+ const ni = opts.ni !== undefined ? opts.ni : this.ni;
38
+ const nj = opts.nj !== undefined ? opts.nj : this.nj;
39
+ const ll_lon = opts.ll_lon !== undefined ? opts.ll_lon : this.ll_lon;
40
+ const ll_lat = opts.ll_lat !== undefined ? opts.ll_lat : this.ll_lat;
41
+ const ur_lon = opts.ur_lon !== undefined ? opts.ur_lon : this.ur_lon;
42
+ const ur_lat = opts.ur_lat !== undefined ? opts.ur_lat : this.ur_lat;
43
+ return new PlateCarreeGrid(ni, nj, ll_lon, ll_lat, ur_lon, ur_lat);
44
+ }
45
+ /** @internal */
46
+ transform(x, y, opts) {
47
+ return [x, y];
48
+ }
49
+ /** @internal */
50
+ getThinnedGrid(thin_fac, map_max_zoom) {
51
+ const { ni, nj, thin_x, thin_y, ll_x: ll_lon, ll_y: ll_lat, ur_x: ur_lon, ur_y: ur_lat } = this.thinnedGridParameters(thin_fac, map_max_zoom, this.ll_lon, this.ll_lat, this.ur_lon, this.ur_lat);
52
+ return new PlateCarreeGrid(ni, nj, ll_lon, ll_lat, ur_lon, ur_lat, this.thin_x * thin_x, this.thin_y * thin_y);
53
+ }
54
+ }
55
+ export { PlateCarreeGrid };
@@ -0,0 +1,53 @@
1
+ import { StructuredGrid } from "./StructuredGrid";
2
+ declare const PlateCarreeRotatedGrid_base: import("./Grid").AbstractConstructor<import("./AutoZoom").AutoZoomGridIntf> & import("./Grid").AbstractConstructor<import("./GridCoordinates").GridCoordinateIntf> & typeof StructuredGrid;
3
+ /**
4
+ * A rotated lat-lon (plate carree) grid with uniform grid spacing
5
+ *
6
+ * ## Plot Component Compatibility
7
+ * - :white_check_mark: `Fill`
8
+ * - :white_check_mark: `Raster`
9
+ * - :white_check_mark: `Contour`
10
+ * - :white_check_mark: `Paintball`
11
+ * - :white_check_mark: `Barbs`
12
+ * - :white_check_mark: `Hodographs`
13
+ * - :white_check_mark: `StationPlot`
14
+ */
15
+ declare class PlateCarreeRotatedGrid extends PlateCarreeRotatedGrid_base {
16
+ readonly np_lon: number;
17
+ readonly np_lat: number;
18
+ readonly lon_shift: number;
19
+ readonly ll_lon: number;
20
+ readonly ll_lat: number;
21
+ readonly ur_lon: number;
22
+ readonly ur_lat: number;
23
+ private readonly llrot;
24
+ /**
25
+ * Create a Lambert conformal conic grid
26
+ * @param ni - The number of grid points in the i (longitude) direction
27
+ * @param nj - The number of grid points in the j (latitude) direction
28
+ * @param np_lon - The longitude of the north pole for the rotated grid
29
+ * @param np_lat - The latitude of the north pole for the rotated grid
30
+ * @param lon_shift - The angle around the rotated north pole to shift the central meridian
31
+ * @param ll_lon - The longitude of the lower left corner of the grid (on the rotated earth)
32
+ * @param ll_lat - The latitude of the lower left corner of the grid (on the rotated earth)
33
+ * @param ur_lon - The longitude of the upper right corner of the grid (on the rotated earth)
34
+ * @param ur_lat - The latitude of the upper right corner of the grid (on the rotated earth)
35
+ */
36
+ constructor(ni: number, nj: number, np_lon: number, np_lat: number, lon_shift: number, ll_lon: number, ll_lat: number, ur_lon: number, ur_lat: number, thin_x?: number, thin_y?: number);
37
+ /** @internal */
38
+ copy(opts?: {
39
+ ni?: number;
40
+ nj?: number;
41
+ ll_lon?: number;
42
+ ll_lat?: number;
43
+ ur_lon?: number;
44
+ ur_lat?: number;
45
+ }): PlateCarreeRotatedGrid;
46
+ /** @internal */
47
+ transform(x: number, y: number, opts?: {
48
+ inverse?: boolean;
49
+ }): [number, number];
50
+ /** @internal */
51
+ getThinnedGrid(thin_fac: number, map_max_zoom: number): this;
52
+ }
53
+ export { PlateCarreeRotatedGrid };
@@ -0,0 +1,65 @@
1
+ import { rotateSphere } from "../Map";
2
+ import { autoZoomGridMixin } from "./AutoZoom";
3
+ import { gridCoordinateMixin } from "./GridCoordinates";
4
+ import { StructuredGrid } from "./StructuredGrid";
5
+ /**
6
+ * A rotated lat-lon (plate carree) grid with uniform grid spacing
7
+ *
8
+ * ## Plot Component Compatibility
9
+ * - :white_check_mark: `Fill`
10
+ * - :white_check_mark: `Raster`
11
+ * - :white_check_mark: `Contour`
12
+ * - :white_check_mark: `Paintball`
13
+ * - :white_check_mark: `Barbs`
14
+ * - :white_check_mark: `Hodographs`
15
+ * - :white_check_mark: `StationPlot`
16
+ */
17
+ class PlateCarreeRotatedGrid extends autoZoomGridMixin(gridCoordinateMixin(StructuredGrid)) {
18
+ /**
19
+ * Create a Lambert conformal conic grid
20
+ * @param ni - The number of grid points in the i (longitude) direction
21
+ * @param nj - The number of grid points in the j (latitude) direction
22
+ * @param np_lon - The longitude of the north pole for the rotated grid
23
+ * @param np_lat - The latitude of the north pole for the rotated grid
24
+ * @param lon_shift - The angle around the rotated north pole to shift the central meridian
25
+ * @param ll_lon - The longitude of the lower left corner of the grid (on the rotated earth)
26
+ * @param ll_lat - The latitude of the lower left corner of the grid (on the rotated earth)
27
+ * @param ur_lon - The longitude of the upper right corner of the grid (on the rotated earth)
28
+ * @param ur_lat - The latitude of the upper right corner of the grid (on the rotated earth)
29
+ */
30
+ constructor(ni, nj, np_lon, np_lat, lon_shift, ll_lon, ll_lat, ur_lon, ur_lat, thin_x, thin_y) {
31
+ super('latlonrot', true, ni, nj, thin_x, thin_y);
32
+ this.np_lon = np_lon;
33
+ this.np_lat = np_lat;
34
+ this.lon_shift = lon_shift;
35
+ this.ll_lon = ll_lon;
36
+ this.ll_lat = ll_lat;
37
+ this.ur_lon = ur_lon;
38
+ this.ur_lat = ur_lat;
39
+ this.llrot = rotateSphere({ np_lon: np_lon, np_lat: np_lat, lon_shift: lon_shift });
40
+ this.setupCoordinateCaches(ll_lon, ur_lon, ll_lat, ur_lat);
41
+ }
42
+ /** @internal */
43
+ copy(opts) {
44
+ opts = opts !== undefined ? opts : {};
45
+ const ni = opts.ni !== undefined ? opts.ni : this.ni;
46
+ const nj = opts.nj !== undefined ? opts.nj : this.nj;
47
+ const ll_lon = opts.ll_lon !== undefined ? opts.ll_lon : this.ll_lon;
48
+ const ll_lat = opts.ll_lat !== undefined ? opts.ll_lat : this.ll_lat;
49
+ const ur_lon = opts.ur_lon !== undefined ? opts.ur_lon : this.ur_lon;
50
+ const ur_lat = opts.ur_lat !== undefined ? opts.ur_lat : this.ur_lat;
51
+ return new PlateCarreeRotatedGrid(ni, nj, this.np_lon, this.np_lat, this.lon_shift, ll_lon, ll_lat, ur_lon, ur_lat);
52
+ }
53
+ /** @internal */
54
+ transform(x, y, opts) {
55
+ opts = opts === undefined ? {} : opts;
56
+ const inverse = 'inverse' in opts ? opts.inverse : false;
57
+ return this.llrot(x, y, { inverse: !inverse });
58
+ }
59
+ /** @internal */
60
+ getThinnedGrid(thin_fac, map_max_zoom) {
61
+ const { ni, nj, thin_x, thin_y, ll_x: ll_lon, ll_y: ll_lat, ur_x: ur_lon, ur_y: ur_lat } = this.thinnedGridParameters(thin_fac, map_max_zoom, this.ll_lon, this.ll_lat, this.ur_lon, this.ur_lat);
62
+ return new PlateCarreeRotatedGrid(ni, nj, this.np_lon, this.np_lat, this.lon_shift, ll_lon, ll_lat, ur_lon, ur_lat, this.thin_x * thin_x, this.thin_y * thin_y);
63
+ }
64
+ }
65
+ export { PlateCarreeRotatedGrid };
@@ -0,0 +1,46 @@
1
+ import { GeodesicClass } from "geographiclib-geodesic";
2
+ import { StructuredGrid } from "./StructuredGrid";
3
+ import { WebGLAnyRenderingContext } from "../AutumnTypes";
4
+ declare const RadarSweepGrid_base: import("./Grid").AbstractConstructor<import("./GridCoordinates").GridCoordinateIntf> & typeof StructuredGrid;
5
+ /**
6
+ * A grid for a radar sweep centered at a certain latitude and longitude.
7
+ *
8
+ * ## Plot Component Compatibility
9
+ * - :white_check_mark: `Fill`
10
+ * - :white_check_mark: `Raster`
11
+ * - :white_check_mark: `Contour`
12
+ * - :white_check_mark: `Paintball`
13
+ * - :x: `Barbs`
14
+ * - :x: `Hodographs`
15
+ * - :x: `StationPlot`
16
+ */
17
+ declare class RadarSweepGrid extends RadarSweepGrid_base {
18
+ readonly longitude: number;
19
+ readonly latitude: number;
20
+ readonly start_rn: number;
21
+ readonly end_rn: number;
22
+ readonly start_az: number;
23
+ readonly end_az: number;
24
+ readonly geod: GeodesicClass;
25
+ constructor(nr: number, nt: number, start_rn: number, end_rn: number, start_az: number, end_az: number, longitude: number, latitude: number, thin_x?: number, thin_y?: number);
26
+ copy(opts?: {
27
+ ni?: number;
28
+ nj?: number;
29
+ start_rn?: number;
30
+ end_rn?: number;
31
+ start_az?: number;
32
+ end_az?: number;
33
+ longitude?: number;
34
+ latitude?: number;
35
+ }): RadarSweepGrid;
36
+ protected makeDomainBuffers(gl: WebGLAnyRenderingContext): Promise<{
37
+ vertices: import("autumn-wgl").WGLBuffer;
38
+ texcoords: import("autumn-wgl").WGLBuffer;
39
+ }>;
40
+ transform(a: number, b: number, opts?: {
41
+ inverse?: boolean | undefined;
42
+ } | undefined): [number, number];
43
+ /** @internal */
44
+ getThinnedGrid(thin_fac: number, map_max_zoom: number): this;
45
+ }
46
+ export { RadarSweepGrid };
@@ -0,0 +1,74 @@
1
+ import { Geodesic } from "geographiclib-geodesic";
2
+ import { gridCoordinateMixin } from "./GridCoordinates";
3
+ import { StructuredGrid, makeCartesianDomainBuffers } from "./StructuredGrid";
4
+ /**
5
+ * A grid for a radar sweep centered at a certain latitude and longitude.
6
+ *
7
+ * ## Plot Component Compatibility
8
+ * - :white_check_mark: `Fill`
9
+ * - :white_check_mark: `Raster`
10
+ * - :white_check_mark: `Contour`
11
+ * - :white_check_mark: `Paintball`
12
+ * - :x: `Barbs`
13
+ * - :x: `Hodographs`
14
+ * - :x: `StationPlot`
15
+ */
16
+ class RadarSweepGrid extends gridCoordinateMixin(StructuredGrid) {
17
+ constructor(nr, nt, start_rn, end_rn, start_az, end_az, longitude, latitude, thin_x, thin_y) {
18
+ super('radar', true, nr, nt, thin_x, thin_y);
19
+ this.longitude = longitude;
20
+ this.latitude = latitude;
21
+ this.start_rn = start_rn;
22
+ this.end_rn = end_rn;
23
+ this.start_az = start_az;
24
+ this.end_az = end_az;
25
+ this.geod = Geodesic.WGS84;
26
+ this.setupCoordinateCaches(start_rn, end_rn, start_az, end_az);
27
+ }
28
+ copy(opts) {
29
+ opts = opts === undefined ? {} : opts;
30
+ const nr = opts.ni === undefined ? this.ni : opts.ni;
31
+ const nt = opts.nj === undefined ? this.nj : opts.nj;
32
+ const longitude = opts.longitude === undefined ? this.longitude : opts.longitude;
33
+ const latitude = opts.latitude === undefined ? this.latitude : opts.latitude;
34
+ const start_rn = opts.start_rn === undefined ? this.start_rn : opts.start_rn;
35
+ const end_rn = opts.end_rn === undefined ? this.end_rn : opts.end_rn;
36
+ const start_az = opts.start_az === undefined ? this.start_az : opts.start_az;
37
+ const end_az = opts.end_az === undefined ? this.end_az : opts.end_az;
38
+ return new RadarSweepGrid(nr, nt, start_rn, end_rn, start_az, end_az, longitude, latitude);
39
+ }
40
+ async makeDomainBuffers(gl) {
41
+ return await makeCartesianDomainBuffers(gl, this, 16, this.nj, { margin_r: false, margin_s: false });
42
+ }
43
+ transform(a, b, opts) {
44
+ opts = opts === undefined ? {} : opts;
45
+ const inverse = opts.inverse === undefined ? false : opts.inverse;
46
+ // geographiclib calls the "forward" transformation what the rest of my code calls the "inverse" transformation and vice versa
47
+ if (inverse) {
48
+ const ret = this.geod.Direct(this.latitude, this.longitude, b, a);
49
+ if (ret.lon2 === undefined || ret.lat2 === undefined)
50
+ throw "Why are lon2 and lat2 not in the return value?";
51
+ return [ret.lon2, ret.lat2];
52
+ }
53
+ else {
54
+ const ret = this.geod.Inverse(this.latitude, this.longitude, b, a);
55
+ if (ret.azi1 === undefined || ret.s12 === undefined)
56
+ throw "Why are azi1 and s12 not in the return value?";
57
+ if (!Number.isFinite(ret.azi1) || !Number.isFinite(ret.s12))
58
+ return [NaN, NaN];
59
+ const half_dt = 0.5 * (this.end_az - this.start_az) / this.ni;
60
+ let az1 = ret.azi1;
61
+ while (az1 < this.start_az - half_dt)
62
+ az1 += 360;
63
+ while (az1 >= this.end_az + half_dt)
64
+ az1 -= 360;
65
+ return [ret.s12, az1];
66
+ }
67
+ }
68
+ /** @internal */
69
+ getThinnedGrid(thin_fac, map_max_zoom) {
70
+ const { ni: nr, nj: nt, thin_x, thin_y, ll_x: start_az, ll_y: start_rn, ur_x: end_az, ur_y: end_rn } = this.thinnedGridParameters(thin_fac, map_max_zoom, this.end_az, this.end_rn, this.start_az, this.start_rn);
71
+ return new RadarSweepGrid(nr, nt, start_rn, end_rn, start_az, end_az, this.longitude, this.latitude, thin_x * this.thin_x, thin_y * this.thin_y);
72
+ }
73
+ }
74
+ export { RadarSweepGrid };
@@ -0,0 +1,49 @@
1
+ import { WGLBuffer } from "autumn-wgl";
2
+ import { TypedArray, WebGLAnyRenderingContext } from "../AutumnTypes";
3
+ import { EarthCoords, Grid, GridType } from "./Grid";
4
+ import { GridElement } from "./GridCoordinates";
5
+ declare function makeCartesianDomainBuffers(gl: WebGLAnyRenderingContext, grid: StructuredGrid, simplify_ni: number, simplify_nj: number, opts?: {
6
+ margin_r?: boolean;
7
+ margin_s?: boolean;
8
+ }): Promise<{
9
+ vertices: WGLBuffer;
10
+ texcoords: WGLBuffer;
11
+ }>;
12
+ declare const StructuredGrid_base: import("./Grid").AbstractConstructor<import("./DomainBuffer").DomainBufferIntf> & typeof Grid;
13
+ /** A structured grid (in this case meaning a cartesian grid with i and j coordinates) */
14
+ declare abstract class StructuredGrid extends StructuredGrid_base {
15
+ protected readonly thin_x: number;
16
+ protected readonly thin_y: number;
17
+ constructor(type: GridType, is_conformal: boolean, ni: number, nj: number, thin_x?: number, thin_y?: number);
18
+ abstract getEarthCoords(ni?: number, nj?: number, which_i?: GridElement, which_j?: GridElement): EarthCoords;
19
+ /** @internal */
20
+ protected xyThinFromMaxZoom(thin_fac: number, map_max_zoom: number): [number, number];
21
+ protected thinnedGridParameters(thin_fac: number, map_max_zoom: number, ll_x: number, ll_y: number, ur_x: number, ur_y: number): {
22
+ ni: number;
23
+ nj: number;
24
+ thin_x: number;
25
+ thin_y: number;
26
+ ll_x: number;
27
+ ll_y: number;
28
+ ur_x: number;
29
+ ur_y: number;
30
+ };
31
+ /** @internal */
32
+ getMinVisibleZoom(thin_fac: number): Uint8Array;
33
+ /** @internal */
34
+ thinDataArray<ArrayType extends TypedArray>(original_grid: StructuredGrid, ary: ArrayType): ArrayType;
35
+ abstract copy(opts?: {
36
+ ni?: number;
37
+ nj?: number;
38
+ }): Grid;
39
+ protected makeDomainBuffers(gl: WebGLAnyRenderingContext): Promise<{
40
+ vertices: WGLBuffer;
41
+ texcoords: WGLBuffer;
42
+ }>;
43
+ sampleNearestGridPoint(lon: number, lat: number, ary: TypedArray): {
44
+ sample: number;
45
+ sample_lon: number;
46
+ sample_lat: number;
47
+ };
48
+ }
49
+ export { StructuredGrid, makeCartesianDomainBuffers };
@@ -0,0 +1,103 @@
1
+ import { WGLBuffer } from "autumn-wgl";
2
+ import { argMin, getArrayConstructor, getMinZoom } from "../utils";
3
+ import { Grid } from "./Grid";
4
+ import { layer_worker } from "../PlotComponent";
5
+ import { domainBufferMixin } from "./DomainBuffer";
6
+ async function makeCartesianDomainBuffers(gl, grid, simplify_ni, simplify_nj, opts) {
7
+ opts = opts === undefined ? {} : opts;
8
+ const use_margin_r = opts.margin_r === undefined ? true : opts.margin_r;
9
+ const use_margin_s = opts.margin_s === undefined ? true : opts.margin_s;
10
+ const texcoord_margin_r = use_margin_r ? 1 / (2 * grid.ni) : 0;
11
+ const texcoord_margin_s = use_margin_s ? 1 / (2 * grid.nj) : 0;
12
+ const grid_element_i = use_margin_r ? 'center' : 'edge';
13
+ const grid_element_j = use_margin_s ? 'center' : 'edge';
14
+ const domain_ni = use_margin_r ? simplify_ni : simplify_ni + 1;
15
+ const domain_nj = use_margin_s ? simplify_nj : simplify_nj + 1;
16
+ const { lats: field_lats, lons: field_lons } = grid.getEarthCoords(simplify_ni, simplify_nj, grid_element_i, grid_element_j);
17
+ const domain_coords = await layer_worker.makeDomainVerticesAndTexCoords(field_lats, field_lons, domain_ni, domain_nj, texcoord_margin_r, texcoord_margin_s);
18
+ const vertices = new WGLBuffer(gl, domain_coords['vertices'], 2, gl.TRIANGLE_STRIP);
19
+ const texcoords = new WGLBuffer(gl, domain_coords['tex_coords'], 2, gl.TRIANGLE_STRIP);
20
+ return { 'vertices': vertices, 'texcoords': texcoords };
21
+ }
22
+ /** A structured grid (in this case meaning a cartesian grid with i and j coordinates) */
23
+ class StructuredGrid extends domainBufferMixin(Grid) {
24
+ constructor(type, is_conformal, ni, nj, thin_x, thin_y) {
25
+ super(type, is_conformal, ni, nj);
26
+ this.thin_x = thin_x === undefined ? 1 : thin_x;
27
+ this.thin_y = thin_y === undefined ? 1 : thin_y;
28
+ }
29
+ /** @internal */
30
+ xyThinFromMaxZoom(thin_fac, map_max_zoom) {
31
+ const n_density_tiers = Math.log2(thin_fac);
32
+ const n_inaccessible_tiers = Math.max(n_density_tiers + 1 - map_max_zoom, 0);
33
+ const xy_thin = Math.pow(2, n_inaccessible_tiers);
34
+ return [xy_thin, xy_thin];
35
+ }
36
+ thinnedGridParameters(thin_fac, map_max_zoom, ll_x, ll_y, ur_x, ur_y) {
37
+ const [thin_x, thin_y] = this.xyThinFromMaxZoom(thin_fac, map_max_zoom);
38
+ const dx = (ur_x - ll_x) / this.ni;
39
+ const dy = (ur_y - ll_y) / this.nj;
40
+ const ni = Math.ceil(this.ni / thin_x);
41
+ const nj = Math.ceil(this.nj / thin_y);
42
+ const ni_remove = (this.ni - 1) % thin_x;
43
+ const nj_remove = (this.nj - 1) % thin_y;
44
+ const new_ll_x = ll_x;
45
+ const new_ll_y = ll_y;
46
+ const new_ur_x = ur_x - ni_remove * dx;
47
+ const new_ur_y = ur_y - nj_remove * dy;
48
+ return { ni, nj, thin_x, thin_y, ll_x: new_ll_x, ll_y: new_ll_y, ur_x: new_ur_x, ur_y: new_ur_y };
49
+ }
50
+ /** @internal */
51
+ getMinVisibleZoom(thin_fac) {
52
+ const min_zoom = new Uint8Array(this.ni * this.nj);
53
+ const zoom_thin_fac = thin_fac / Math.max(this.thin_x, this.thin_y);
54
+ for (let ilat = 0; ilat < this.nj * this.thin_y; ilat++) {
55
+ for (let ilon = 0; ilon < this.ni * this.thin_x; ilon++) {
56
+ const idx = ilat * this.ni + ilon;
57
+ min_zoom[idx] = getMinZoom(ilat, ilon, zoom_thin_fac);
58
+ }
59
+ }
60
+ return min_zoom;
61
+ }
62
+ /** @internal */
63
+ thinDataArray(original_grid, ary) {
64
+ const arrayType = getArrayConstructor(ary);
65
+ const new_data = new arrayType(this.ni * this.nj);
66
+ for (let i = 0; i < this.ni; i++) {
67
+ for (let j = 0; j < this.nj; j++) {
68
+ const idx_old = i * this.thin_x + original_grid.ni * j * this.thin_y;
69
+ const idx = i + this.ni * j;
70
+ new_data[idx] = ary[idx_old];
71
+ }
72
+ }
73
+ return new_data;
74
+ }
75
+ async makeDomainBuffers(gl) {
76
+ const simplify_ni = Math.max(Math.floor(this.ni / 20), 20);
77
+ const simplify_nj = Math.max(Math.floor(this.nj / 20), 20);
78
+ return makeCartesianDomainBuffers(gl, this, simplify_ni, simplify_nj);
79
+ }
80
+ sampleNearestGridPoint(lon, lat, ary) {
81
+ const [x, y] = this.transform(lon, lat);
82
+ const { x: xs, y: ys } = this.getGridCoords();
83
+ let ll_x = xs[0];
84
+ let ur_x = xs[xs.length - 1];
85
+ const dx = xs[1] - xs[0];
86
+ let ll_y = ys[0];
87
+ let ur_y = ys[ys.length - 1];
88
+ const dy = ys[1] - ys[0];
89
+ if (dx < 0)
90
+ [ll_x, ur_x] = [ur_x, ll_x];
91
+ if (dy < 0)
92
+ [ll_y, ur_y] = [ur_y, ll_y];
93
+ if (x < ll_x - 0.5 * dx || x > ur_x + 0.5 * dx || y < ll_y - 0.5 * dy || y > ur_y + 0.5 * dy) {
94
+ return { sample: NaN, sample_lon: NaN, sample_lat: NaN };
95
+ }
96
+ const i_min = argMin(xs.map(xv => Math.abs(xv - x)));
97
+ const j_min = argMin(ys.map(yv => Math.abs(yv - y)));
98
+ const idx = i_min + j_min * this.ni;
99
+ const [lon_min, lat_min] = this.transform(xs[i_min], ys[j_min], { inverse: true });
100
+ return { sample: ary[idx], sample_lon: lon_min, sample_lat: lat_min };
101
+ }
102
+ }
103
+ export { StructuredGrid, makeCartesianDomainBuffers };