actinia-org / actinia-core

Actinia Core is an open source REST API for scalable, distributed, high performance processing of geographical data that uses mainly GRASS GIS for computational tasks (DOI: https://doi.org/10.5281/zenodo.5879231) | Tutorial: https://actinia-org.github.io/actinia-core/ | Docker: https://hub.docker.com/r/mundialis/actinia-core
https://actinia.mundialis.de/
GNU General Public License v3.0
78 stars 22 forks source link

Add stdin for parameters #501

Closed anikaweinmann closed 4 months ago

anikaweinmann commented 6 months ago

Added stdin from other modules for a GRASS GIS module. E.g. setting the region to raster in the mapset with pattern=l*:

{
    "list": [
        {
            "id": "print_region",
            "module": "g.region",
            "flags": "p"
        },
        {
            "id": "g_list_rasterpattern",
            "module": "g.list",
            "inputs": [
                {
                    "param": "type",
                    "value": "raster"
                },
                {
                    "param": "pattern",
                    "value": "l*"
                },
                {
                    "param": "separator",
                    "value": "comma"
                }
            ]
        },
        {
            "id": "set_region",
            "module": "g.region",
            "inputs": [
                {
                    "param": "raster",
                    "value": "g_list_rasterpattern::stdout"
                }
            ],
            "flags": "g"
        }
    ],
    "version": "1"
}

Or scalling a raster with min and max values from r.univar output:

{
    "list": [
        {
            "id": "set_region_to_raster",
            "module": "g.region",
            "inputs": [
                {
                    "param": "raster",
                    "value": "landuse96_28m"
                }
            ],
            "flags": "g"
        },
        {
            "id": "get_stats",
            "module": "r.univar",
            "inputs": [
                {
                    "param": "map",
                    "value": "landuse96_28m"
                }
            ],
            "flags": "g"
        },
        {
            "id": "calculation_scalling",
            "module": "r.mapcalc",
            "inputs": [
                {
                    "param": "expression",
                    "value": "test = (landuse96_28m - get_stats::stdout::min) / (get_stats::stdout::max - get_stats::stdout::min)"
                }
            ]
        },
        {
            "id": "get_stats_result",
            "module": "r.univar",
            "inputs": [
                {
                    "param": "map",
                    "value": "test"
                }
            ],
            "flags": "g"
        }
    ],
    "version": "1"
}