autumnplot-gl 3.2.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 (48) hide show
  1. package/lib/AutumnTypes.d.ts +53 -5
  2. package/lib/AutumnTypes.js +25 -1
  3. package/lib/Barbs.d.ts +6 -5
  4. package/lib/BillboardCollection.d.ts +8 -7
  5. package/lib/BillboardCollection.js +69 -58
  6. package/lib/Color.d.ts +1 -0
  7. package/lib/Color.js +3 -0
  8. package/lib/ColorBar.d.ts +10 -0
  9. package/lib/ColorBar.js +4 -2
  10. package/lib/Colormap.js +8 -8
  11. package/lib/Contour.d.ts +18 -8
  12. package/lib/Contour.js +17 -54
  13. package/lib/ContourCreator.d.ts +4 -0
  14. package/lib/ContourCreator.js +2 -1
  15. package/lib/Fill.d.ts +26 -14
  16. package/lib/Fill.js +97 -50
  17. package/lib/Grid.d.ts +124 -29
  18. package/lib/Grid.js +297 -94
  19. package/lib/Hodographs.d.ts +9 -8
  20. package/lib/Hodographs.js +14 -11
  21. package/lib/Map.js +1 -1
  22. package/lib/Paintball.d.ts +6 -5
  23. package/lib/Paintball.js +35 -30
  24. package/lib/ParticleTracer.d.ts +19 -0
  25. package/lib/ParticleTracer.js +37 -0
  26. package/lib/PlotComponent.d.ts +6 -7
  27. package/lib/PlotComponent.js +8 -3
  28. package/lib/PlotLayer.d.ts +3 -3
  29. package/lib/PlotLayer.worker.d.ts +1 -2
  30. package/lib/PlotLayer.worker.js +15 -50
  31. package/lib/PolylineCollection.d.ts +5 -3
  32. package/lib/PolylineCollection.js +60 -37
  33. package/lib/RawField.d.ts +76 -23
  34. package/lib/RawField.js +138 -29
  35. package/lib/ShaderManager.d.ts +12 -0
  36. package/lib/ShaderManager.js +58 -0
  37. package/lib/StationPlot.d.ts +136 -25
  38. package/lib/StationPlot.js +192 -60
  39. package/lib/TextCollection.d.ts +9 -6
  40. package/lib/TextCollection.js +94 -62
  41. package/lib/cpp/marchingsquares.js +483 -585
  42. package/lib/cpp/marchingsquares.wasm +0 -0
  43. package/lib/cpp/marchingsquares_embind.d.ts +23 -3
  44. package/lib/index.d.ts +4 -3
  45. package/lib/index.js +4 -3
  46. package/lib/utils.d.ts +4 -1
  47. package/lib/utils.js +12 -1
  48. package/package.json +2 -2
package/lib/Grid.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WGLBuffer, WGLTexture } from "autumn-wgl";
2
- import { WebGLAnyRenderingContext } from "./AutumnTypes";
2
+ import { TypedArray, WebGLAnyRenderingContext } from "./AutumnTypes";
3
3
  interface EarthCoords {
4
4
  lons: Float32Array;
5
5
  lats: Float32Array;
@@ -8,41 +8,67 @@ interface GridCoords {
8
8
  x: Float32Array;
9
9
  y: Float32Array;
10
10
  }
11
- type GridType = 'latlon' | 'latlonrot' | 'lcc';
11
+ type GridType = 'latlon' | 'latlonrot' | 'lcc' | 'unstructured';
12
12
  declare abstract class Grid {
13
13
  readonly type: GridType;
14
14
  readonly ni: number;
15
15
  readonly nj: number;
16
16
  readonly is_conformal: boolean;
17
- private readonly buffer_cache;
18
17
  private readonly billboard_buffer_cache;
19
18
  private readonly vector_rotation_cache;
20
19
  constructor(type: GridType, is_conformal: boolean, ni: number, nj: number);
21
- abstract copy(opts?: {
22
- ni?: number;
23
- nj?: number;
24
- }): Grid;
25
20
  abstract getEarthCoords(): EarthCoords;
26
21
  abstract getGridCoords(): GridCoords;
27
22
  abstract transform(x: number, y: number, opts?: {
28
23
  inverse?: boolean;
29
24
  }): [number, number];
30
- abstract getThinnedGrid(thin_x: number, thin_y: number): Grid;
31
- getWGLBuffers(gl: WebGLAnyRenderingContext): Promise<{
25
+ abstract sampleNearestGridPoint(lon: number, lat: number, ary: TypedArray): {
26
+ sample: number;
27
+ sample_lon: number;
28
+ sample_lat: number;
29
+ };
30
+ abstract getThinnedGrid(thin_fac: number, map_max_zoom: number): Grid;
31
+ abstract thinDataArray<ArrayType extends TypedArray>(original_grid: Grid, ary: ArrayType): ArrayType;
32
+ abstract getMinVisibleZoom(thin_fac: number): Uint8Array;
33
+ getWGLBillboardBuffers(gl: WebGLAnyRenderingContext, thin_fac: number, max_zoom: number): Promise<{
32
34
  vertices: WGLBuffer;
33
35
  texcoords: WGLBuffer;
34
- cellsize: WGLBuffer;
35
36
  }>;
36
- getWGLBillboardBuffers(gl: WebGLAnyRenderingContext, thin_fac: number, max_zoom: number): Promise<{
37
+ abstract copy(): Grid;
38
+ getVectorRotationAtPoint(lon: number, lat: number): number;
39
+ getVectorRotationTexture(gl: WebGLAnyRenderingContext, data_are_earth_relative: boolean): {
40
+ rotation: WGLTexture;
41
+ };
42
+ }
43
+ /** A structured grid (in this case meaning a cartesian grid with i and j coordinates) */
44
+ declare abstract class StructuredGrid extends Grid {
45
+ private readonly buffer_cache;
46
+ protected readonly thin_x: number;
47
+ protected readonly thin_y: number;
48
+ constructor(type: GridType, is_conformal: boolean, ni: number, nj: number, thin_x?: number, thin_y?: number);
49
+ abstract getEarthCoords(ni?: number, nj?: number): EarthCoords;
50
+ /** @internal */
51
+ protected xyThinFromMaxZoom(thin_fac: number, map_max_zoom: number): [number, number];
52
+ /** @internal */
53
+ getMinVisibleZoom(thin_fac: number): Uint8Array;
54
+ /** @internal */
55
+ thinDataArray<ArrayType extends TypedArray>(original_grid: StructuredGrid, ary: ArrayType): ArrayType;
56
+ abstract copy(opts?: {
57
+ ni?: number;
58
+ nj?: number;
59
+ }): Grid;
60
+ getWGLBuffers(gl: WebGLAnyRenderingContext): Promise<{
37
61
  vertices: WGLBuffer;
38
62
  texcoords: WGLBuffer;
39
63
  }>;
40
- getVectorRotationTexture(gl: WebGLAnyRenderingContext): {
41
- rotation: WGLTexture;
64
+ sampleNearestGridPoint(lon: number, lat: number, ary: TypedArray): {
65
+ sample: number;
66
+ sample_lon: number;
67
+ sample_lat: number;
42
68
  };
43
69
  }
44
70
  /** A plate carree (a.k.a. lat/lon) grid with uniform grid spacing */
45
- declare class PlateCarreeGrid extends Grid {
71
+ declare class PlateCarreeGrid extends StructuredGrid {
46
72
  readonly ll_lon: number;
47
73
  readonly ll_lat: number;
48
74
  readonly ur_lon: number;
@@ -58,7 +84,8 @@ declare class PlateCarreeGrid extends Grid {
58
84
  * @param ur_lon - The longitude of the upper right corner of the grid
59
85
  * @param ur_lat - The latitude of the upper right corner of the grid
60
86
  */
61
- constructor(ni: number, nj: number, ll_lon: number, ll_lat: number, ur_lon: number, ur_lat: number);
87
+ constructor(ni: number, nj: number, ll_lon: number, ll_lat: number, ur_lon: number, ur_lat: number, thin_x?: number, thin_y?: number);
88
+ /** @internal */
62
89
  copy(opts?: {
63
90
  ni?: number;
64
91
  nj?: number;
@@ -68,17 +95,21 @@ declare class PlateCarreeGrid extends Grid {
68
95
  ur_lat?: number;
69
96
  }): PlateCarreeGrid;
70
97
  /**
98
+ * @internal
71
99
  * Get a list of longitudes and latitudes on the grid (internal method)
72
100
  */
73
- getEarthCoords(): EarthCoords;
101
+ getEarthCoords(ni?: number, nj?: number): EarthCoords;
102
+ /** @internal */
74
103
  getGridCoords(): GridCoords;
104
+ /** @internal */
75
105
  transform(x: number, y: number, opts?: {
76
106
  inverse?: boolean;
77
107
  }): [number, number];
78
- getThinnedGrid(thin_x: number, thin_y: number): PlateCarreeGrid;
108
+ /** @internal */
109
+ getThinnedGrid(thin_fac: number, map_max_zoom: number): PlateCarreeGrid;
79
110
  }
80
111
  /** A rotated lat-lon (plate carree) grid with uniform grid spacing */
81
- declare class PlateCarreeRotatedGrid extends Grid {
112
+ declare class PlateCarreeRotatedGrid extends StructuredGrid {
82
113
  readonly np_lon: number;
83
114
  readonly np_lat: number;
84
115
  readonly lon_shift: number;
@@ -101,7 +132,8 @@ declare class PlateCarreeRotatedGrid extends Grid {
101
132
  * @param ur_lon - The longitude of the upper right corner of the grid (on the rotated earth)
102
133
  * @param ur_lat - The latitude of the upper right corner of the grid (on the rotated earth)
103
134
  */
104
- 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);
135
+ 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);
136
+ /** @internal */
105
137
  copy(opts?: {
106
138
  ni?: number;
107
139
  nj?: number;
@@ -111,17 +143,21 @@ declare class PlateCarreeRotatedGrid extends Grid {
111
143
  ur_lat?: number;
112
144
  }): PlateCarreeRotatedGrid;
113
145
  /**
114
- * Get a list of longitudes and latitudes on the grid (internal method)
146
+ * @internal
147
+ * Get a list of longitudes and latitudes on the grid
115
148
  */
116
- getEarthCoords(): EarthCoords;
149
+ getEarthCoords(ni?: number, nj?: number): EarthCoords;
150
+ /** @internal */
117
151
  getGridCoords(): GridCoords;
152
+ /** @internal */
118
153
  transform(x: number, y: number, opts?: {
119
154
  inverse?: boolean;
120
155
  }): [number, number];
121
- getThinnedGrid(thin_x: number, thin_y: number): PlateCarreeRotatedGrid;
156
+ /** @internal */
157
+ getThinnedGrid(thin_fac: number, map_max_zoom: number): PlateCarreeRotatedGrid;
122
158
  }
123
159
  /** A Lambert conformal conic grid with uniform grid spacing */
124
- declare class LambertGrid extends Grid {
160
+ declare class LambertGrid extends StructuredGrid {
125
161
  readonly lon_0: number;
126
162
  readonly lat_0: number;
127
163
  readonly lat_std: [number, number];
@@ -133,7 +169,7 @@ declare class LambertGrid extends Grid {
133
169
  private readonly ll_cache;
134
170
  private readonly gc_cache;
135
171
  /**
136
- * Create a Lambert conformal conic grid
172
+ * Create a Lambert conformal conic grid from the lower-left and upper-right corner x/y values.
137
173
  * @param ni - The number of grid points in the i (longitude) direction
138
174
  * @param nj - The number of grid points in the j (latitude) direction
139
175
  * @param lon_0 - The standard longitude for the projection; this is also the center longitude for the projection
@@ -144,8 +180,22 @@ declare class LambertGrid extends Grid {
144
180
  * @param ur_x - The x coordinate in projection space of the upper-right corner of the grid
145
181
  * @param ur_y - The y coordinate in projection space of the upper-right corner of the grid
146
182
  */
147
- 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);
183
+ 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, thin_x?: number, thin_y?: number);
184
+ /**
185
+ * Create a Lambert conformal conic grid from the lower-left grid point coordinate and a dx and dy.
186
+ * @param ni - The number of grid points in the i (longitude) direction
187
+ * @param nj - The number of grid points in the j (latitude) direction
188
+ * @param lon_0 - The standard longitude for the projection; this is also the center longitude for the projection
189
+ * @param lat_0 - The center latitude for the projection
190
+ * @param lat_std - The standard latitudes for the projection
191
+ * @param ll_lon - The longitude of the lower-left corner of the grid
192
+ * @param ll_lat - The latitude of the lower-left corner of the grid
193
+ * @param dx - The grid dx in meters
194
+ * @param dy - The grid dy in meters
195
+ * @returns
196
+ */
148
197
  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): LambertGrid;
198
+ /** @internal */
149
199
  copy(opts?: {
150
200
  ni?: number;
151
201
  nj?: number;
@@ -155,14 +205,59 @@ declare class LambertGrid extends Grid {
155
205
  ur_y?: number;
156
206
  }): LambertGrid;
157
207
  /**
158
- * Get a list of longitudes and latitudes on the grid (internal method)
208
+ * @internal
209
+ * Get a list of longitudes and latitudes on the grid
159
210
  */
160
- getEarthCoords(): EarthCoords;
211
+ getEarthCoords(ni?: number, nj?: number): EarthCoords;
212
+ /** @internal */
161
213
  getGridCoords(): GridCoords;
214
+ /** @internal */
162
215
  transform(x: number, y: number, opts?: {
163
216
  inverse?: boolean;
164
217
  }): [number, number];
165
- getThinnedGrid(thin_x: number, thin_y: number): LambertGrid;
218
+ /** @internal */
219
+ getThinnedGrid(thin_fac: number, map_max_zoom: number): LambertGrid;
220
+ }
221
+ /** An unstructured grid */
222
+ declare class UnstructuredGrid extends Grid {
223
+ readonly coords: {
224
+ lon: number;
225
+ lat: number;
226
+ }[];
227
+ private readonly zoom_cache;
228
+ private readonly zoom_arg;
229
+ /**
230
+ * Create an unstructured grid
231
+ * @param coords - The lat/lon coordinates of the grid points
232
+ */
233
+ constructor(coords: {
234
+ lon: number;
235
+ lat: number;
236
+ }[], zoom?: Uint8Array);
237
+ /** @internal */
238
+ copy(): UnstructuredGrid;
239
+ /** @internal */
240
+ getEarthCoords(): {
241
+ lons: Float32Array;
242
+ lats: Float32Array;
243
+ };
244
+ /** @internal */
245
+ getGridCoords(): GridCoords;
246
+ /** @internal */
247
+ transform(x: number, y: number, opts?: {
248
+ inverse?: boolean;
249
+ }): [number, number];
250
+ /** @internal */
251
+ getMinVisibleZoom(thin_fac: number): Uint8Array;
252
+ /** @internal */
253
+ getThinnedGrid(thin_fac: number, map_max_zoom: number): UnstructuredGrid;
254
+ /** @internal */
255
+ thinDataArray<ArrayType extends TypedArray>(original_grid: UnstructuredGrid, ary: ArrayType): ArrayType;
256
+ sampleNearestGridPoint(lon: number, lat: number, ary: TypedArray): {
257
+ sample: number;
258
+ sample_lon: number;
259
+ sample_lat: number;
260
+ };
166
261
  }
167
- export { Grid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid };
262
+ export { Grid, StructuredGrid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, UnstructuredGrid };
168
263
  export type { GridType };