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