actinia-org / ace

ace - actinia command execution tool (for g.extension)
GNU General Public License v3.0
1 stars 0 forks source link

Allow for parsing the output from GRASS #10

Open wenzeslaus opened 2 years ago

wenzeslaus commented 2 years ago

Text messages from ace go to stdout which is where output from the GRASS modules goes as well. This prevents easy parsing of the output.

While locally, I can do:

> eval `r.univar -g elev_state_500m`
> echo $min
-6.684585564

With ace, r.univar output is mixed with ace output:

> ace location=nc_spm_08 grass_command="r.univar -g elev_state_500m"
https://actinia.mundialis.de//api/v3/locations/nc_spm_08/processing_async_export
...
n=546136
null_cells=464464
cells=1010600
min=-6.684585564
max=1952.0009637576
range=1958.6855493216
mean=214.740100188344
mean_of_abs=214.742279455688
stddev=307.296405943419
variance=94431.0811057426
coeff_var=143.101547253585
sum=117277299.356462

{'resources': [],
 'status': 'https://actinia.mundialis.de/api/v3/resources/demouser/resource_id-bb6b1ca9-08cf-4793-b955-7a54e8ab8d17'}

This can be examined, e.g., by redirecting the output to a file:

> ace location=nc_spm_08 grass_command="r.univar -g elev_state_500m" > /tmp/out.txt

This is somewhat similar to #4, but here, the idea is for the command to work in the same way as a command in GRASS shell would work. A similar situation is with grass --exec where parsing in this case would work as for r.univar in a GRASS shell:

> grass ~/grassdata/nc_spm_08/ --tmp-mapset --exec r.univar -g elev_state_500m > /tmp/out.txt