Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stdin for parameters #501

Merged
merged 7 commits into from
Feb 23, 2024
Merged

Add stdin for parameters #501

merged 7 commits into from
Feb 23, 2024

Conversation

anikaweinmann
Copy link
Member

@anikaweinmann anikaweinmann commented Jan 18, 2024

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"
}

@anikaweinmann anikaweinmann marked this pull request as ready for review January 22, 2024 13:50
anikaweinmann added 2 commits February 23, 2024 10:20
@anikaweinmann anikaweinmann merged commit 19cc57f into main Feb 23, 2024
8 checks passed
@mmacata mmacata added this to the 4.13.0 milestone Feb 23, 2024
@mmacata mmacata deleted the stdin_for_params branch August 15, 2024 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants