Skip to main content

Class: ComputedScalarField<ArrayType, GridType>

Defined in: RawField.ts:293

Extends​

Type Parameters​

Type Parameter
ArrayType extends TypedArray
GridType extends Grid

Constructors​

Constructor​

new ComputedScalarField<ArrayType, GridType>(raw_fields, expression, cpu_func): ComputedScalarField<ArrayType, GridType>

Defined in: RawField.ts:298

Parameters​

ParameterType
raw_fieldsExpressionScalarField<ArrayType, GridType>[]
expressionstring
cpu_func(...arg) => number

Returns​

ComputedScalarField<ArrayType, GridType>

Overrides​

ExpressionScalarField.constructor

Methods​

add()​

add(other): ComputedScalarField<ArrayType, GridType>

Defined in: RawField.ts:91

Add this field to another scalar. The computation occurs on the GPU if the resulting field is used in a plot component or on the CPU if renderCPU() is called on the resulting field.

Parameters​

ParameterTypeDescription
othernumber | ExpressionScalarField<ArrayType, GridType>Scalar to add to this field

Returns​

ComputedScalarField<ArrayType, GridType>

A ComputedScalarField representing the added field

Inherited from​

ExpressionScalarField.add


divide()​

divide(other): ComputedScalarField<ArrayType, GridType>

Defined in: RawField.ts:81

Divide this field by another scalar. The computation occurs on the GPU if the resulting field is used in a plot component or on the CPU if renderCPU() is called on the resulting field.

Parameters​

ParameterTypeDescription
othernumber | ExpressionScalarField<ArrayType, GridType>Scalar to divide this field by

Returns​

ComputedScalarField<ArrayType, GridType>

A ComputedScalarField representing the divided field

Inherited from​

ExpressionScalarField.divide


multiply()​

multiply(other): ComputedScalarField<ArrayType, GridType>

Defined in: RawField.ts:71

Multiply this field by another scalar. The computation occurs on the GPU if the resulting field is used in a plot component or on the CPU if renderCPU() is called on the resulting field.

Parameters​

ParameterTypeDescription
othernumber | ExpressionScalarField<ArrayType, GridType>Scalar to multiply this field by

Returns​

ComputedScalarField<ArrayType, GridType>

A ComputedScalarField representing the multiplied field

Inherited from​

ExpressionScalarField.multiply


renderCPU()​

renderCPU(): RawScalarField<ArrayType, GridType>

Defined in: RawField.ts:398

Run computations on a scalar field on the CPU. The function blocks the main thread, so avoid calling it if possible.

Returns​

RawScalarField<ArrayType, GridType>

The computed grid in a RawScalarField

Overrides​

ExpressionScalarField.renderCPU


sampleField()​

sampleField(lon, lat): number

Defined in: RawField.ts:390

Sample this field at a given latitude and longitude.

Parameters​

ParameterTypeDescription
lonnumberLongitude of the sample in degrees east
latnumberLatitude of the sample in degrees north

Returns​

number

The value of the nearest grid point, or NaN if the point is outside the grid.

Overrides​

ExpressionScalarField.sampleField


sampleFieldWithCoord()​

sampleFieldWithCoord(lon, lat): object

Defined in: RawField.ts:379

Sample this field at a given latitude and longitude.

Parameters​

ParameterTypeDescription
lonnumberLongitude of the sample in degrees east
latnumberLatitude of the sample in degrees north

Returns​

object

The value of the nearest grid point along with the grid point latitude and longitude, or NaNs if the point is outside the grid.

sample​

sample: number

sample_lat​

sample_lat: number

sample_lon​

sample_lon: number

Overrides​

ExpressionScalarField.sampleFieldWithCoord


subtract()​

subtract(other): ComputedScalarField<ArrayType, GridType>

Defined in: RawField.ts:101

Subtract another scalar from this field. The computation occurs on the GPU if the resulting field is used in a plot component or on the CPU if renderCPU() is called on the resulting field.

Parameters​

ParameterTypeDescription
othernumber | ExpressionScalarField<ArrayType, GridType>Scalar to subtract from this field

Returns​

ComputedScalarField<ArrayType, GridType>

A ComputedScalarField representing the subtracted field

Inherited from​

ExpressionScalarField.subtract