Class: RawScalarField<ArrayType, GridType>
Defined in: RawField.ts:23
A class representing a raw 2D field of gridded data, such as height or u wind.
Type Parameters
| Type Parameter |
|---|
ArrayType extends TypedArray |
GridType extends Grid |
Constructors
Constructor
new RawScalarField<
ArrayType,GridType>(grid,data):RawScalarField<ArrayType,GridType>
Defined in: RawField.ts:34
Create a data field.
Parameters
| Parameter | Type | Description |
|---|---|---|
grid | GridType | The grid on which the data are defined |
data | ArrayType | The data, which should be given as a 1D array in row-major order, with the first element being at the lower-left corner of the grid. |
Returns
RawScalarField<ArrayType, GridType>
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
data | readonly | ArrayType | RawField.ts:25 |
grid | readonly | GridType | RawField.ts:24 |
Methods
getContours()
getContours(
opts):Promise<ContourData>
Defined in: RawField.ts:71
Get contour data as an object with each contour level being a separate property.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | FieldContourOpts | Options for doing the contouring |
Returns
Promise<ContourData>
contour data as an object
getWGLTextureSpec()
getWGLTextureSpec(
gl,image_mag_filter):WGLTextureSpec
Defined in: RawField.ts:56
Parameters
| Parameter | Type |
|---|---|
gl | WebGLAnyRenderingContext |
image_mag_filter | number |
Returns
WGLTextureSpec
sampleField()
sampleField(
lon,lat):number
Defined in: RawField.ts:98
Parameters
| Parameter | Type |
|---|---|
lon | number |
lat | number |
Returns
number
aggregateFields()
staticaggregateFields<ArrayType,GridType>(func, ...args):RawScalarField<ArrayType,GridType>
Defined in: RawField.ts:84
Create a new field by aggregating a number of fields using a specific function
Type Parameters
| Type Parameter |
|---|
ArrayType extends TypedArray |
GridType extends Grid |
Parameters
| Parameter | Type | Description |
|---|---|---|
func | (...args) => number | 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. |
...args | RawScalarField<ArrayType, GridType>[] | The RawScalarFields to aggregate |
Returns
RawScalarField<ArrayType, GridType>
a new gridded field
Example
// Compute wind speed from u and v
wind_speed_field = RawScalarField.aggreateFields(Math.hypot, u_field, v_field);