autumnplot-gl 2.2.3 → 3.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.
- package/README.md +65 -8
- package/dist/110.autumnplot-gl.js +2 -0
- package/dist/110.autumnplot-gl.js.map +1 -0
- package/dist/autumnplot-gl.js +3 -0
- package/dist/autumnplot-gl.js.LICENSE.txt +12 -0
- package/dist/autumnplot-gl.js.map +1 -0
- package/dist/marchingsquares.wasm +0 -0
- package/lib/AutumnTypes.d.ts +14 -13
- package/lib/Barbs.d.ts +10 -5
- package/lib/Barbs.js +22 -5
- package/lib/BillboardCollection.d.ts +11 -7
- package/lib/BillboardCollection.js +52 -30
- package/lib/ColorBar.js +51 -7
- package/lib/Colormap.d.ts +14 -3
- package/lib/Colormap.js +63 -12
- package/lib/Contour.d.ts +73 -18
- package/lib/Contour.js +180 -148
- package/lib/ContourCreator.d.ts +18 -0
- package/lib/ContourCreator.js +23 -0
- package/lib/Fill.d.ts +18 -7
- package/lib/Fill.js +73 -41
- package/lib/Grid.d.ts +167 -0
- package/lib/Grid.js +339 -0
- package/lib/Hodographs.d.ts +13 -6
- package/lib/Hodographs.js +58 -71
- package/lib/Map.d.ts +14 -3
- package/lib/Map.js +9 -0
- package/lib/Paintball.d.ts +11 -5
- package/lib/Paintball.js +35 -15
- package/lib/PlotComponent.d.ts +5 -5
- package/lib/PlotLayer.d.ts +12 -12
- package/lib/PlotLayer.js +16 -14
- package/lib/PlotLayer.worker.d.ts +2 -2
- package/lib/PlotLayer.worker.js +105 -66
- package/lib/PolylineCollection.d.ts +20 -9
- package/lib/PolylineCollection.js +158 -32
- package/lib/RawField.d.ts +11 -167
- package/lib/RawField.js +37 -383
- package/lib/TextCollection.d.ts +31 -0
- package/lib/TextCollection.js +295 -0
- package/lib/cpp/marchingsquares.d.ts +6 -0
- package/lib/cpp/marchingsquares.js +3449 -0
- package/lib/cpp/marchingsquares.wasm +0 -0
- package/lib/cpp/marchingsquares_embind.d.ts +6 -0
- package/lib/index.d.ts +13 -6
- package/lib/index.js +12 -3
- package/lib/utils.d.ts +5 -3
- package/lib/utils.js +17 -6
- package/package.json +14 -9
|
@@ -1,20 +1,39 @@
|
|
|
1
|
+
import { Float16Array } from "@petamoriken/float16";
|
|
1
2
|
import { WGLBuffer, WGLProgram, WGLTexture } from "autumn-wgl";
|
|
3
|
+
import { makeIndexMap, makeTextureImage } from "./Colormap";
|
|
4
|
+
import { getGLFormatTypeAlignment, layer_worker } from "./PlotComponent";
|
|
5
|
+
import { hex2rgba } from "./utils";
|
|
2
6
|
const polyline_vertex_src = `uniform mat4 u_matrix;
|
|
3
7
|
uniform int u_offset;
|
|
4
8
|
|
|
5
9
|
attribute vec2 a_pos;
|
|
6
|
-
attribute float a_min_zoom;
|
|
7
10
|
attribute vec2 a_extrusion;
|
|
11
|
+
attribute float a_data;
|
|
12
|
+
|
|
13
|
+
#ifdef ZOOM
|
|
14
|
+
attribute float a_min_zoom;
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#ifdef OFFSET
|
|
8
18
|
attribute vec2 a_offset;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
uniform lowp float u_map_aspect;
|
|
12
|
-
uniform lowp float u_zoom;
|
|
19
|
+
#endif
|
|
20
|
+
|
|
13
21
|
uniform lowp float u_line_width;
|
|
22
|
+
uniform lowp float u_map_width;
|
|
23
|
+
uniform lowp float u_map_height;
|
|
14
24
|
uniform highp float u_map_bearing;
|
|
15
25
|
|
|
26
|
+
#ifdef ZOOM
|
|
27
|
+
uniform lowp float u_zoom;
|
|
28
|
+
#endif
|
|
16
29
|
|
|
17
|
-
|
|
30
|
+
#ifdef OFFSET
|
|
31
|
+
uniform lowp float u_offset_scale;
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#ifdef DATA
|
|
35
|
+
varying highp float v_data;
|
|
36
|
+
#endif
|
|
18
37
|
|
|
19
38
|
mat4 scalingMatrix(float x_scale, float y_scale, float z_scale) {
|
|
20
39
|
return mat4(x_scale, 0.0, 0.0, 0.0,
|
|
@@ -29,8 +48,8 @@ mat4 rotationZMatrix(float angle) {
|
|
|
29
48
|
|
|
30
49
|
return mat4( c, s, 0., 0.,
|
|
31
50
|
-s, c, 0., 0.,
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
0., 0., 1., 0.,
|
|
52
|
+
0., 0., 0., 1.);
|
|
34
53
|
}
|
|
35
54
|
|
|
36
55
|
mat4 rotationXMatrix(float angle) {
|
|
@@ -38,9 +57,9 @@ mat4 rotationXMatrix(float angle) {
|
|
|
38
57
|
float c = cos(angle);
|
|
39
58
|
|
|
40
59
|
return mat4( 1., 0., 0., 0.,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
60
|
+
0., c, s, 0.,
|
|
61
|
+
0., -s, c, 0.,
|
|
62
|
+
0., 0., 0., 1.);
|
|
44
63
|
}
|
|
45
64
|
|
|
46
65
|
void main() {
|
|
@@ -49,47 +68,154 @@ void main() {
|
|
|
49
68
|
|
|
50
69
|
vec4 center_pos = u_matrix * vec4(a_pos.xy + globe_offset, 0.0, 1.0);
|
|
51
70
|
vec4 offset = vec4(0.0, 0.0, 0.0, 0.0);
|
|
52
|
-
|
|
71
|
+
|
|
72
|
+
#ifdef ZOOM
|
|
53
73
|
if (u_zoom >= a_min_zoom) {
|
|
54
|
-
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
vec2 offset_ext = u_line_width * 1.5 * a_extrusion;
|
|
77
|
+
|
|
78
|
+
mat4 map_stretch_matrix = scalingMatrix(u_map_height / u_map_width, 1., 1.);
|
|
79
|
+
mat4 rotation_matrix = rotationZMatrix(radians(u_map_bearing));
|
|
80
|
+
offset = map_stretch_matrix * rotation_matrix * vec4(offset_ext, 0., 0.);
|
|
55
81
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
82
|
+
#ifdef OFFSET
|
|
83
|
+
map_stretch_matrix = scalingMatrix(1., u_map_width / u_map_height, 1.);
|
|
84
|
+
vec2 offset_offset = u_offset_scale * a_offset;
|
|
85
|
+
offset += map_stretch_matrix * rotation_matrix * vec4(offset_offset, 0., 0.);
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
#ifdef ZOOM
|
|
59
89
|
}
|
|
90
|
+
#endif
|
|
60
91
|
|
|
61
92
|
gl_Position = center_pos + offset;
|
|
62
|
-
|
|
93
|
+
|
|
94
|
+
#ifdef DATA
|
|
95
|
+
v_data = a_data;
|
|
96
|
+
#endif
|
|
63
97
|
}`
|
|
64
|
-
const polyline_fragment_src =
|
|
98
|
+
const polyline_fragment_src = `#ifdef DATA
|
|
99
|
+
varying highp float v_data;
|
|
65
100
|
|
|
66
|
-
uniform sampler2D
|
|
101
|
+
uniform sampler2D u_cmap_sampler;
|
|
102
|
+
uniform sampler2D u_cmap_nonlin_sampler;
|
|
103
|
+
uniform highp float u_cmap_min;
|
|
104
|
+
uniform highp float u_cmap_max;
|
|
105
|
+
uniform int u_n_index;
|
|
106
|
+
#else
|
|
107
|
+
uniform lowp vec4 u_color;
|
|
108
|
+
#endif
|
|
67
109
|
|
|
68
110
|
void main() {
|
|
69
|
-
|
|
111
|
+
lowp vec4 color;
|
|
112
|
+
#ifdef DATA
|
|
113
|
+
lowp float index_buffer = 1. / (2. * float(u_n_index));
|
|
114
|
+
lowp float normed_val = (v_data - u_cmap_min) / (u_cmap_max - u_cmap_min);
|
|
115
|
+
|
|
116
|
+
if (normed_val < 0.0 || normed_val > 1.0) {
|
|
70
117
|
discard;
|
|
71
118
|
}
|
|
72
119
|
|
|
73
|
-
|
|
74
|
-
|
|
120
|
+
normed_val = index_buffer + normed_val * (1. - 2. * index_buffer);
|
|
121
|
+
highp float nonlin_val = texture2D(u_cmap_nonlin_sampler, vec2(normed_val, 0.5)).r;
|
|
122
|
+
color = texture2D(u_cmap_sampler, vec2(nonlin_val, 0.5));
|
|
123
|
+
#else
|
|
124
|
+
color = u_color;
|
|
125
|
+
#endif
|
|
126
|
+
gl_FragColor = color;
|
|
75
127
|
}`
|
|
76
128
|
class PolylineCollection {
|
|
77
|
-
constructor(gl, polyline,
|
|
129
|
+
constructor(gl, polyline, opts) {
|
|
130
|
+
opts = opts === undefined ? {} : opts;
|
|
131
|
+
this.color = opts.color === undefined ? [0., 0., 0., 1.] : hex2rgba(opts.color);
|
|
132
|
+
const line_width = opts.line_width === undefined ? 1 : opts.line_width;
|
|
78
133
|
this.width = line_width;
|
|
79
|
-
|
|
80
|
-
this.
|
|
81
|
-
this.origin = new WGLBuffer(gl, polyline['origin'], 2, gl.TRIANGLE_STRIP);
|
|
82
|
-
this.offset = new WGLBuffer(gl, polyline['verts'], 2, gl.TRIANGLE_STRIP);
|
|
134
|
+
const shader_defines = [];
|
|
135
|
+
this.vertices = new WGLBuffer(gl, polyline['vertices'], 3, gl.TRIANGLE_STRIP);
|
|
83
136
|
this.extrusion = new WGLBuffer(gl, polyline['extrusion'], 2, gl.TRIANGLE_STRIP);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
137
|
+
if (polyline.offsets !== undefined) {
|
|
138
|
+
this.offset = new WGLBuffer(gl, polyline.offsets, 2, gl.TRIANGLE_STRIP);
|
|
139
|
+
this.scale = opts.offset_scale === undefined ? 1 : opts.offset_scale;
|
|
140
|
+
shader_defines.push('OFFSET');
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
this.offset = null;
|
|
144
|
+
this.scale = null;
|
|
145
|
+
}
|
|
146
|
+
if (polyline.zoom !== undefined) {
|
|
147
|
+
this.min_zoom = new WGLBuffer(gl, polyline.zoom, 1, gl.TRIANGLE_STRIP);
|
|
148
|
+
shader_defines.push('ZOOM');
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.min_zoom = null;
|
|
152
|
+
}
|
|
153
|
+
this.cmap_min = -3.40282347e+38;
|
|
154
|
+
this.cmap_max = 3.40282347e+38;
|
|
155
|
+
if (polyline.data !== undefined) {
|
|
156
|
+
// TAS: this needs some cleanup (there's some repated code between here and the contour fills that should be combined?)
|
|
157
|
+
this.min_zoom = new WGLBuffer(gl, polyline.zoom, 1, gl.TRIANGLE_STRIP);
|
|
158
|
+
shader_defines.push('DATA');
|
|
159
|
+
const { format: format_nonlin, type: type_nonlin, row_alignment: row_alignment_nonlin } = getGLFormatTypeAlignment(gl, true);
|
|
160
|
+
let tex_image;
|
|
161
|
+
if (opts.cmap === undefined) {
|
|
162
|
+
tex_image = { 'format': gl.RGBA, 'type': gl.UNSIGNED_BYTE, 'width': 1, 'height': 1, 'image': new Uint8Array(this.color), 'mag_filter': gl.NEAREST };
|
|
163
|
+
this.index_map = new Float16Array([0., 1.]);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
tex_image = { 'format': gl.RGBA, 'type': gl.UNSIGNED_BYTE, 'image': makeTextureImage(opts.cmap), 'mag_filter': gl.NEAREST };
|
|
167
|
+
this.cmap_min = opts.cmap.levels[0];
|
|
168
|
+
this.cmap_max = opts.cmap.levels[opts.cmap.levels.length - 1];
|
|
169
|
+
this.index_map = makeIndexMap(opts.cmap);
|
|
170
|
+
}
|
|
171
|
+
const cmap_nonlin_image = { 'format': format_nonlin, 'type': type_nonlin,
|
|
172
|
+
'width': this.index_map.length, 'height': 1,
|
|
173
|
+
'image': new Uint16Array(this.index_map.buffer),
|
|
174
|
+
'mag_filter': gl.LINEAR, 'row_alignment': row_alignment_nonlin,
|
|
175
|
+
};
|
|
176
|
+
this.cmap_nonlin_texture = new WGLTexture(gl, cmap_nonlin_image);
|
|
177
|
+
this.line_texture = new WGLTexture(gl, tex_image);
|
|
178
|
+
this.line_data = new WGLBuffer(gl, polyline['data'], 1, gl.TRIANGLE_STRIP);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
this.line_texture = null;
|
|
182
|
+
this.line_data = null;
|
|
183
|
+
this.index_map = null;
|
|
184
|
+
}
|
|
185
|
+
this.program = new WGLProgram(gl, polyline_vertex_src, polyline_fragment_src, { define: shader_defines });
|
|
186
|
+
}
|
|
187
|
+
static async make(gl, lines, opts) {
|
|
188
|
+
const polylines = await layer_worker.makePolyLines(lines);
|
|
189
|
+
return new PolylineCollection(gl, polylines, opts);
|
|
87
190
|
}
|
|
88
191
|
render(gl, matrix, [map_width, map_height], map_zoom, map_bearing, map_pitch) {
|
|
89
192
|
if (matrix instanceof Float32Array)
|
|
90
193
|
matrix = [...matrix];
|
|
91
|
-
|
|
92
|
-
|
|
194
|
+
const attributes = { 'a_pos': this.vertices, 'a_extrusion': this.extrusion };
|
|
195
|
+
const uniforms = {
|
|
196
|
+
'u_matrix': matrix, 'u_line_width': this.width, 'u_map_width': map_width, 'u_map_height': map_height, 'u_map_bearing': map_bearing, 'u_offset': 0
|
|
197
|
+
};
|
|
198
|
+
const textures = {};
|
|
199
|
+
if (this.offset !== null) {
|
|
200
|
+
attributes['a_offset'] = this.offset;
|
|
201
|
+
uniforms['u_offset_scale'] = this.scale * (map_height / map_width);
|
|
202
|
+
}
|
|
203
|
+
if (this.min_zoom !== null) {
|
|
204
|
+
attributes['a_min_zoom'] = this.min_zoom;
|
|
205
|
+
uniforms['u_zoom'] = map_zoom;
|
|
206
|
+
}
|
|
207
|
+
if (this.line_data !== null && this.line_texture !== null) {
|
|
208
|
+
attributes['a_data'] = this.line_data;
|
|
209
|
+
textures['u_cmap_sampler'] = this.line_texture;
|
|
210
|
+
textures['u_cmap_nonlin_sampler'] = this.cmap_nonlin_texture;
|
|
211
|
+
uniforms['u_cmap_min'] = this.cmap_min;
|
|
212
|
+
uniforms['u_cmap_max'] = this.cmap_max;
|
|
213
|
+
uniforms['u_n_index'] = this.index_map.length;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
uniforms['u_color'] = this.color;
|
|
217
|
+
}
|
|
218
|
+
this.program.use(attributes, uniforms, textures);
|
|
93
219
|
gl.enable(gl.BLEND);
|
|
94
220
|
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
|
|
95
221
|
this.program.draw();
|
package/lib/RawField.d.ts
CHANGED
|
@@ -1,170 +1,13 @@
|
|
|
1
1
|
import { Float16Array } from "@petamoriken/float16";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
lons: Float32Array;
|
|
6
|
-
lats: Float32Array;
|
|
7
|
-
}
|
|
8
|
-
interface GridCoords {
|
|
9
|
-
x: Float32Array;
|
|
10
|
-
y: Float32Array;
|
|
11
|
-
}
|
|
12
|
-
type GridType = 'latlon' | 'latlonrot' | 'lcc';
|
|
13
|
-
declare abstract class Grid {
|
|
14
|
-
readonly type: GridType;
|
|
15
|
-
readonly ni: number;
|
|
16
|
-
readonly nj: number;
|
|
17
|
-
readonly is_conformal: boolean;
|
|
18
|
-
private readonly buffer_cache;
|
|
19
|
-
private readonly billboard_buffer_cache;
|
|
20
|
-
constructor(type: GridType, is_conformal: boolean, ni: number, nj: number);
|
|
21
|
-
abstract copy(opts?: {
|
|
22
|
-
ni?: number;
|
|
23
|
-
nj?: number;
|
|
24
|
-
}): Grid;
|
|
25
|
-
abstract getEarthCoords(): EarthCoords;
|
|
26
|
-
abstract getGridCoords(): GridCoords;
|
|
27
|
-
abstract transform(x: number, y: number, opts?: {
|
|
28
|
-
inverse?: boolean;
|
|
29
|
-
}): [number, number];
|
|
30
|
-
abstract getThinnedGrid(thin_x: number, thin_y: number): Grid;
|
|
31
|
-
getWGLBuffers(gl: WebGLAnyRenderingContext): Promise<{
|
|
32
|
-
vertices: WGLBuffer;
|
|
33
|
-
texcoords: WGLBuffer;
|
|
34
|
-
cellsize: WGLBuffer;
|
|
35
|
-
}>;
|
|
36
|
-
getWGLBillboardBuffers(gl: WebGLAnyRenderingContext, thin_fac: number, max_zoom: number): Promise<{
|
|
37
|
-
vertices: WGLBuffer;
|
|
38
|
-
texcoords: WGLBuffer;
|
|
39
|
-
}>;
|
|
40
|
-
}
|
|
41
|
-
/** A plate carree (a.k.a. lat/lon) grid with uniform grid spacing */
|
|
42
|
-
declare class PlateCarreeGrid extends Grid {
|
|
43
|
-
readonly ll_lon: number;
|
|
44
|
-
readonly ll_lat: number;
|
|
45
|
-
readonly ur_lon: number;
|
|
46
|
-
readonly ur_lat: number;
|
|
47
|
-
private readonly ll_cache;
|
|
48
|
-
private readonly gc_cache;
|
|
49
|
-
/**
|
|
50
|
-
* Create a plate carree grid
|
|
51
|
-
* @param ni - The number of grid points in the i (longitude) direction
|
|
52
|
-
* @param nj - The number of grid points in the j (latitude) direction
|
|
53
|
-
* @param ll_lon - The longitude of the lower left corner of the grid
|
|
54
|
-
* @param ll_lat - The latitude of the lower left corner of the grid
|
|
55
|
-
* @param ur_lon - The longitude of the upper right corner of the grid
|
|
56
|
-
* @param ur_lat - The latitude of the upper right corner of the grid
|
|
57
|
-
*/
|
|
58
|
-
constructor(ni: number, nj: number, ll_lon: number, ll_lat: number, ur_lon: number, ur_lat: number);
|
|
59
|
-
copy(opts?: {
|
|
60
|
-
ni?: number;
|
|
61
|
-
nj?: number;
|
|
62
|
-
ll_lon?: number;
|
|
63
|
-
ll_lat?: number;
|
|
64
|
-
ur_lon?: number;
|
|
65
|
-
ur_lat?: number;
|
|
66
|
-
}): PlateCarreeGrid;
|
|
67
|
-
/**
|
|
68
|
-
* Get a list of longitudes and latitudes on the grid (internal method)
|
|
69
|
-
*/
|
|
70
|
-
getEarthCoords(): EarthCoords;
|
|
71
|
-
getGridCoords(): GridCoords;
|
|
72
|
-
transform(x: number, y: number, opts?: {
|
|
73
|
-
inverse?: boolean;
|
|
74
|
-
}): [number, number];
|
|
75
|
-
getThinnedGrid(thin_x: number, thin_y: number): PlateCarreeGrid;
|
|
76
|
-
}
|
|
77
|
-
/** A rotated lat-lon (plate carree) grid with uniform grid spacing */
|
|
78
|
-
declare class PlateCarreeRotatedGrid extends Grid {
|
|
79
|
-
readonly np_lon: number;
|
|
80
|
-
readonly np_lat: number;
|
|
81
|
-
readonly lon_shift: number;
|
|
82
|
-
readonly ll_lon: number;
|
|
83
|
-
readonly ll_lat: number;
|
|
84
|
-
readonly ur_lon: number;
|
|
85
|
-
readonly ur_lat: number;
|
|
86
|
-
private readonly llrot;
|
|
87
|
-
private readonly ll_cache;
|
|
88
|
-
private readonly gc_cache;
|
|
89
|
-
/**
|
|
90
|
-
* Create a Lambert conformal conic grid
|
|
91
|
-
* @param ni - The number of grid points in the i (longitude) direction
|
|
92
|
-
* @param nj - The number of grid points in the j (latitude) direction
|
|
93
|
-
* @param np_lon - The longitude of the north pole for the rotated grid
|
|
94
|
-
* @param np_lat - The latitude of the north pole for the rotated grid
|
|
95
|
-
* @param lon_shift - The angle around the rotated north pole to shift the central meridian
|
|
96
|
-
* @param ll_lon - The longitude of the lower left corner of the grid (on the rotated earth)
|
|
97
|
-
* @param ll_lat - The latitude of the lower left corner of the grid (on the rotated earth)
|
|
98
|
-
* @param ur_lon - The longitude of the upper right corner of the grid (on the rotated earth)
|
|
99
|
-
* @param ur_lat - The latitude of the upper right corner of the grid (on the rotated earth)
|
|
100
|
-
*/
|
|
101
|
-
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);
|
|
102
|
-
copy(opts?: {
|
|
103
|
-
ni?: number;
|
|
104
|
-
nj?: number;
|
|
105
|
-
ll_lon?: number;
|
|
106
|
-
ll_lat?: number;
|
|
107
|
-
ur_lon?: number;
|
|
108
|
-
ur_lat?: number;
|
|
109
|
-
}): PlateCarreeRotatedGrid;
|
|
110
|
-
/**
|
|
111
|
-
* Get a list of longitudes and latitudes on the grid (internal method)
|
|
112
|
-
*/
|
|
113
|
-
getEarthCoords(): EarthCoords;
|
|
114
|
-
getGridCoords(): GridCoords;
|
|
115
|
-
transform(x: number, y: number, opts?: {
|
|
116
|
-
inverse?: boolean;
|
|
117
|
-
}): [number, number];
|
|
118
|
-
getThinnedGrid(thin_x: number, thin_y: number): PlateCarreeRotatedGrid;
|
|
119
|
-
}
|
|
120
|
-
/** A Lambert conformal conic grid with uniform grid spacing */
|
|
121
|
-
declare class LambertGrid extends Grid {
|
|
122
|
-
readonly lon_0: number;
|
|
123
|
-
readonly lat_0: number;
|
|
124
|
-
readonly lat_std: [number, number];
|
|
125
|
-
readonly ll_x: number;
|
|
126
|
-
readonly ll_y: number;
|
|
127
|
-
readonly ur_x: number;
|
|
128
|
-
readonly ur_y: number;
|
|
129
|
-
private readonly lcc;
|
|
130
|
-
private readonly ll_cache;
|
|
131
|
-
private readonly gc_cache;
|
|
132
|
-
/**
|
|
133
|
-
* Create a Lambert conformal conic grid
|
|
134
|
-
* @param ni - The number of grid points in the i (longitude) direction
|
|
135
|
-
* @param nj - The number of grid points in the j (latitude) direction
|
|
136
|
-
* @param lon_0 - The standard longitude for the projection; this is also the center longitude for the projection
|
|
137
|
-
* @param lat_0 - The center latitude for the projection
|
|
138
|
-
* @param lat_std - The standard latitudes for the projection
|
|
139
|
-
* @param ll_x - The x coordinate in projection space of the lower-left corner of the grid
|
|
140
|
-
* @param ll_y - The y coordinate in projection space of the lower-left corner of the grid
|
|
141
|
-
* @param ur_x - The x coordinate in projection space of the upper-right corner of the grid
|
|
142
|
-
* @param ur_y - The y coordinate in projection space of the upper-right corner of the grid
|
|
143
|
-
*/
|
|
144
|
-
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);
|
|
145
|
-
copy(opts?: {
|
|
146
|
-
ni?: number;
|
|
147
|
-
nj?: number;
|
|
148
|
-
ll_x?: number;
|
|
149
|
-
ll_y?: number;
|
|
150
|
-
ur_x?: number;
|
|
151
|
-
ur_y?: number;
|
|
152
|
-
}): LambertGrid;
|
|
153
|
-
/**
|
|
154
|
-
* Get a list of longitudes and latitudes on the grid (internal method)
|
|
155
|
-
*/
|
|
156
|
-
getEarthCoords(): EarthCoords;
|
|
157
|
-
getGridCoords(): GridCoords;
|
|
158
|
-
transform(x: number, y: number, opts?: {
|
|
159
|
-
inverse?: boolean;
|
|
160
|
-
}): [number, number];
|
|
161
|
-
getThinnedGrid(thin_x: number, thin_y: number): LambertGrid;
|
|
162
|
-
}
|
|
2
|
+
import { ContourData, TypedArray, WindProfile } from "./AutumnTypes";
|
|
3
|
+
import { FieldContourOpts } from "./ContourCreator";
|
|
4
|
+
import { Grid } from "./Grid";
|
|
163
5
|
type TextureDataType<ArrayType> = ArrayType extends Float32Array ? Float32Array : Uint16Array;
|
|
164
6
|
/** A class representing a raw 2D field of gridded data, such as height or u wind. */
|
|
165
7
|
declare class RawScalarField<ArrayType extends TypedArray> {
|
|
166
8
|
readonly grid: Grid;
|
|
167
9
|
readonly data: ArrayType;
|
|
10
|
+
private readonly contour_cache;
|
|
168
11
|
/**
|
|
169
12
|
* Create a data field.
|
|
170
13
|
* @param grid - The grid on which the data are defined
|
|
@@ -173,8 +16,7 @@ declare class RawScalarField<ArrayType extends TypedArray> {
|
|
|
173
16
|
constructor(grid: Grid, data: ArrayType);
|
|
174
17
|
/** @internal */
|
|
175
18
|
getTextureData(): TextureDataType<ArrayType>;
|
|
176
|
-
|
|
177
|
-
getThinnedField(thin_x: number, thin_y: number): RawScalarField<ArrayType>;
|
|
19
|
+
getContours(opts: FieldContourOpts): Promise<ContourData>;
|
|
178
20
|
/**
|
|
179
21
|
* Create a new field by aggregating a number of fields using a specific function
|
|
180
22
|
* @param func - A function that will be applied each element of the field. It should take the same number of arguments as fields you have and return a single number.
|
|
@@ -199,7 +41,6 @@ declare class RawVectorField<ArrayType extends TypedArray> {
|
|
|
199
41
|
readonly u: RawScalarField<ArrayType>;
|
|
200
42
|
readonly v: RawScalarField<ArrayType>;
|
|
201
43
|
readonly relative_to: VectorRelativeTo;
|
|
202
|
-
private readonly rotate_cache;
|
|
203
44
|
/**
|
|
204
45
|
* Create a vector field.
|
|
205
46
|
* @param grid - The grid on which the vector components are defined
|
|
@@ -208,9 +49,12 @@ declare class RawVectorField<ArrayType extends TypedArray> {
|
|
|
208
49
|
* @param opts - Options for creating the vector field.
|
|
209
50
|
*/
|
|
210
51
|
constructor(grid: Grid, u: ArrayType, v: ArrayType, opts?: RawVectorFieldOptions);
|
|
52
|
+
getTextureData(): {
|
|
53
|
+
u: TextureDataType<ArrayType>;
|
|
54
|
+
v: TextureDataType<ArrayType>;
|
|
55
|
+
};
|
|
211
56
|
getThinnedField(thin_x: number, thin_y: number): RawVectorField<ArrayType>;
|
|
212
57
|
get grid(): Grid;
|
|
213
|
-
toEarthRelative(): RawVectorField<ArrayType>;
|
|
214
58
|
}
|
|
215
59
|
/** A class grid of wind profiles */
|
|
216
60
|
declare class RawProfileField {
|
|
@@ -225,5 +69,5 @@ declare class RawProfileField {
|
|
|
225
69
|
/** Get the gridded storm motion vector field (internal method) */
|
|
226
70
|
getStormMotionGrid(): RawVectorField<Float16Array>;
|
|
227
71
|
}
|
|
228
|
-
export { RawScalarField, RawVectorField, RawProfileField
|
|
229
|
-
export type {
|
|
72
|
+
export { RawScalarField, RawVectorField, RawProfileField };
|
|
73
|
+
export type { RawVectorFieldOptions, VectorRelativeTo, TextureDataType };
|