Code Monkey home page Code Monkey logo

app-water-mask's Introduction

Water Mask

Development

cd app-water-mask

Create the Python environment with mamba (faster) or conda (slower):

mamba env create -f environment.yml

Activate the Python environment with:

conda activate  env_app_snuggs

Build the Python project

To build and install the project locally:

python setup.py install

Test the CLI with:

s-expression --help

That returns:

$ s-expression --help
Usage: s-expression [OPTIONS]

  Applies s expressions to EO acquisitions

Options:
  -i, --input_reference PATH  Input product reference  [required]
  -s, --s-expression TEXT     s expression  [required]
  -b, --cbn TEXT              Common band name  [required]
  --help                      Show this message and exit.

Building the docker image

Build the docker image with:

docker build -t eoepca/s-expression:dev0.0.2  -f .docker/Dockerfile .

Test the CLI with:

docker run --rm -it eoepca/s-expression:dev0.0.2 s-expression --help

Usage

There are three application packages:

app-s-expression.cwl

This is the configuration exposing all the parameters:

  • input_reference This is the input product reference

  • s-expression This is the s-expression (see below what are s expressions)

  • cbn This is the common band name for the generated band

About the s-expressions:

In computer programming, S-expressions (or symbolic expressions, abbreviated as sexprs) are a notation for nested list (tree-structured) data, invented for and popularized by the programming language Lisp.

Here we use s-expression to express band combination operations on the EO product assets accessed using the common band names.

For instance, to do the normalized difference for the red and nir bands, this is expressed as:

(/ (- nir red) (+ nir red))

Let's break down the components of this s-expression:

  • (- nir red) is the difference between the nir and red assets read as array. This is equivalent to nir - red

  • (+ nir red) is the sum of nir and red assets read as array. This is equivalent to nir + red

  • The difference (- nir red) is divided by (+ nir red) to provide the NDVI with (/ (- nir red) (+ nir red))

So to do the NDVI, the app-s-expression.cwl CWL document can be invoked with:

input_reference: {class: Directory, path: '/workspace/stage-in/1_o28lv8'}
s_expression: '(/ (- nir red) (+ nir red))'
cbn: 'ndvi'

app-ndvi.cwl

The app-ndvi.cwl exposes a single parameter, input_reference and defines the arguments s-expression and cbn in the CWL document:

  • s-expression (/ (- nir red) (+ nir red))

  • cbn ndvi

app-water-mask's People

Contributors

bbrauzzi avatar rconway avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.