[gdal-dev] gdal_calc.js

Momtchil Momtchev momtchil at momtchev.com
Wed Feb 16 08:02:04 PST 2022


Hello,


Just a heads up that the JS bindings for GDAL now have an /ExprTk.js 
/plugin that comes with a stand-alone CLI alternative of /gdal_calc.py/ 
- /gdal_calc.js/.


While it is geared mostly towards the Node.js GDAL user and it lacks 
many of the features of /gdal_calc.py/, it has a number of interesting 
advantages for everyone who is using it for Earth sciences:

    * As Earth sciences datasets always have blank spots, when working
    with floating-point data types, it automatically converts /NoData/
    values to /NaN/ before applying the expression and then /NaN/ to
    /NoData/ when writing the output - so you don't have to handle it in
    any special way - any expression that uses at least one /NaN/ input
    automatically produces a /NaN/ output that gets written as /NoData/
    - and this is smart enough to let pass an unused input in an if/else
    statement

    * It is fully multithreaded, each input band and each output band
    run in separate threads, and the expression evaluation can even use
    fork to evaluate series of pixels in separate threads - though this
    requires very complex expressions to be of any use - /gdal_calc/ is
    mostly I/O bound

    * It supports both JS functions and /ExprTk.js/ expressions that
    allow for natural if/else expressions and complex control blocks

         * It can write multi-band files applying a separate expression 
on each band


https://www.npmjs.com/package/gdal-exprtk


-- 
Momtchil Momtchev<momtchil at momtchev.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220216/c729bba6/attachment.html>


More information about the gdal-dev mailing list