@windy/interpolator
Return raw meteorological values for given lat, lon or screen X,Y by interpolation of already loaded data tiles.
Once you get interpolation function, you get your data fast, but they are still interpolated non precise values.
For conversion to your desired metric, use metrics module.
Example
import { getLatLonInterpolator } from '@windy/interpolator';
const interpolator = await getLatLonInterpolator();
if (interpolator) {
const values = interpolator({ lat: 50, lon: 14 });
// --> can be [number, number, number] or null | undefined | number based on given renderer
}
Table of contents
Type Aliases
- CoordsInterpolationFun
- InterpolatorFactory
- InterpolatorPossibleReturns
- PixelInterpolationFun
- RGBNumValues
Functions
Type Aliases
CoordsInterpolationFun
Ƭ CoordsInterpolationFun: <T>(latLon
: T
) => InterpolatorPossibleReturns
Interpolates coordinates to tuple weather values from RGB channels
Type declaration
▸ <T
>(latLon
): InterpolatorPossibleReturns
Type parameters
Name | Type |
---|---|
T | extends LatLon |
Parameters
Name | Type |
---|---|
latLon | T |
Returns
InterpolatorFactory
Ƭ InterpolatorFactory: Object
Type declaration
Name | Type |
---|---|
createFun | (cb : <T>(...args : unknown []) => T | void ) => void |
InterpolatorPossibleReturns
Ƭ InterpolatorPossibleReturns: RGBNumValues
| null
| undefined
| number
Possible returns from interpolator
null
- out of map
NaN
- no data value
-1
- not suitable renderer
[number,number,number]
- computed values
PixelInterpolationFun
Ƭ PixelInterpolationFun: (x
: number
, y
: number
, mercXpx?
: number
, mercYpx?
: number
) => InterpolatorPossibleReturns
Interpolates pixel to tuple weather values from RGB channels
Type declaration
▸ (x
, y
, mercXpx?
, mercYpx?
): InterpolatorPossibleReturns
Parameters
Name | Type |
---|---|
x | number |
y | number |
mercXpx? | number |
mercYpx? | number |
Returns
RGBNumValues
Ƭ RGBNumValues: [NumValue
, NumValue
, NumValue
]
Returned values in data RGB channels as tuple [NumValue, NumValue, NumValue]
Functions
getLatLonInterpolator
▸ getLatLonInterpolator(): Promise
<CoordsInterpolationFun
>
Returns a Promise, that resolves with an lat lon interpolation function for given map view, or null if no suitable renderer with interpolator is found.
Always resolves, never rejects.
Returns
Promise
<CoordsInterpolationFun
>
getXYInterpolator
▸ getXYInterpolator(): Promise
<PixelInterpolationFun
>
Returns a Promise, that resolves with an X,Y interpolation function for given map view, or null if no suitable renderer with interpolator is found.
Always resolves, never rejects.
Returns
Promise
<PixelInterpolationFun
>