Skip to main content

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

ParameterTypeDescription
gridGridTypeThe grid on which the data are defined
dataArrayTypeThe 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

PropertyModifierTypeDefined in
datareadonlyArrayTypeRawField.ts:25
gridreadonlyGridTypeRawField.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

ParameterTypeDescription
optsFieldContourOptsOptions 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

ParameterType
glWebGLAnyRenderingContext
image_mag_filternumber

Returns

WGLTextureSpec


sampleField()

sampleField(lon, lat): number

Defined in: RawField.ts:98

Parameters

ParameterType
lonnumber
latnumber

Returns

number


aggregateFields()

static aggregateFields<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

ParameterTypeDescription
func(...args) => numberA 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.
...argsRawScalarField<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);