actinia-org / actinia-module-plugin

Contains actinia module self-description and process-chain-template management and processing
Apache License 2.0
2 stars 3 forks source link

Fix templates for if variables so that they have not to been set #36

Closed anikaweinmann closed 1 year ago

anikaweinmann commented 1 year ago

There where problems with templates which include if. Here the variables in the if part had to be set. This change should fix this, so that the following template can be used without setting region_union:

{
    "id": "pc_dummy",
    "description": "Placeholder json file",
    "template": {
        "version": "1",
        "list": [
            {
                "module": "r.mapcalc",
                "id": "r.mapcalc_test",
                "inputs": [
                    {% if region_union is defined %}
                    {
                        "param": "region",
                        "value": "{{ region_union }}"
                    },
                    {% endif %}
                    {
                        "param": "expression",
                        "comment": "output = r.mapcalc result, string; value = raster value (default=0.428), float",
                        "value": "{{ output }} = {{ value|default(0.428) }}"
                    }
              ]
            }
        ]
    }
}
anikaweinmann commented 1 year ago

Tests are fixed and linting is done in https://github.com/actinia-org/actinia-module-plugin/pull/37