Show:
Extends stream.Transform

A raster Transform stream

Applies a function on all data elements

Input must be a RasterMuxStream

Table of Contents

Constructor

gdal.RasterTransform
(
  • options
)

Parameters:

  • [options] RasterTransformOptions optional
    • fn Function

      Function to be applied on all data

    • type New (len: number) => TypedArray

      Typed array constructor

Example:

const dsT2m = gdal.open('AROME_T2m_10.tiff'));
const dsD2m = gdal.open('AROME_D2m_10.tiff'));

const dsCloudBase = gdal.open('CLOUDBASE.tiff', 'w', 'GTiff',
  dsT2m.rasterSize.x, dsT2m.rasterSize.y, 1, gdal.GDT_Float64);

const mux = new gdal.RasterMuxStream({
  T2m: dsT2m.bands.get(1).pixels.createReadStream(),
  D2m: dsD2m.bands.get(1).pixels.createReadStream()
});
const ws = dsCloudBase.bands.get(1).pixels.createWriteStream();

// Espy's estimation for cloud base height (lifted condensation level)
// LCL = 125 * (T2m - Td2m)
// where T2m is the temperature at 2m and Td2m is the dew point at 2m
const fn = (t,td) => 125 * (t - td);
const espyEstimation = new RasterTransform({ type: Float64Array, fn });

mux.pipe(espyEstimation).pipe(ws);