Class: RawScalarField<ArrayType, GridType>
Defined in: RawField.ts:112
A class representing a raw 2D field of gridded data, such as height or u wind.
Extends
ExpressionScalarField<ArrayType,GridType>
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:123
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>
Overrides
ExpressionScalarField.constructor
Properties
| Property | Modifier | Type | Overrides | Defined in |
|---|---|---|---|---|
data | readonly | ArrayType | - | RawField.ts:114 |
grid | readonly | GridType | ExpressionScalarField.grid | RawField.ts:113 |
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
| Parameter | Type | Description |
|---|---|---|
other | number | ExpressionScalarField<ArrayType, GridType> | Scalar to add to this field |
Returns
ComputedScalarField<ArrayType, GridType>
A ComputedScalarField representing the added field
Inherited from
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
| Parameter | Type | Description |
|---|---|---|
other | number | ExpressionScalarField<ArrayType, GridType> | Scalar to divide this field by |
Returns
ComputedScalarField<ArrayType, GridType>
A ComputedScalarField representing the divided field
Inherited from
getContours()
getContours(
opts):Promise<ContourData>
Defined in: RawField.ts:230
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
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
| Parameter | Type | Description |
|---|---|---|
other | number | 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:251
Run computations on a scalar field on the CPU (for a RawScalarField, this is a no-op). 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:286
Sample this field at a given latitude and longitude.
Parameters
| Parameter | Type | Description |
|---|---|---|
lon | number | Longitude of the sample in degrees east |
lat | number | Latitude 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:276
Sample this field at a given latitude and longitude.
Parameters
| Parameter | Type | Description |
|---|---|---|
lon | number | Longitude of the sample in degrees east |
lat | number | Latitude 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
| Parameter | Type | Description |
|---|---|---|
other | number | ExpressionScalarField<ArrayType, GridType> | Scalar to subtract from this field |
Returns
ComputedScalarField<ArrayType, GridType>
A ComputedScalarField representing the subtracted field
Inherited from
ExpressionScalarField.subtract
updateTexImageData()
updateTexImageData(
gl,image_mag_filter,fill_textures):Map<string,WGLTexture>
Defined in: RawField.ts:185
Parameters
| Parameter | Type |
|---|---|
gl | WebGLAnyRenderingContext |
image_mag_filter | number |
fill_textures | Map<string, WGLTexture> | null |
Returns
Map<string, WGLTexture>
Overrides
ExpressionScalarField.updateTexImageData
aggregateFields()
staticaggregateFields<ArrayType,GridType>(func, ...args):RawScalarField<ArrayType,GridType>
Defined in: RawField.ts:243
Create a new field by aggregating a number of fields using a specific function. This computation occurs on the CPU.
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);