The resample tool overwrites the target grid when executing via the gui. In addition, there does not appear to be a method for passing a target grid using the python syntax. I tried a workaround suggested by vokler (passing an empty grid with the correct grid system as the -GRID), but was unsuccessful. The function executes okay, but the resulting grid contains no values.
I am fairly new to SAGA, so I apologize in advance if this but was reported or fixed already. I checked the bug tracker and didn't see an entry even though vokler suggested a bug be added in this thread (http://sourceforge.net/projects/saga-gis/forums/forum/790705/topic/3824315).
Thanks
Anonymous
I don't think this is a bug, see my post in the user forum (https://sourceforge.net/projects/saga-gis/forums/forum/790705/topic/3824315).
The following snippet of python code uses an existing grid to define the output's grid dimensions (i.e. the output grid system) and resamples the input grid to this. The trick is to get the parameters of parameter ('GRID') and to set their parameter 'GRID' to the output grid. The output grid has to be created from the target grid beforehand.
I close this bug, but keep it open for posting. Feel free to re-open it in case you still think there is something buggy.
Volker
*************
import saga_api, sys, os
*************
def resample_grid(fGridIn, fTarget, fGridOut):
print saga_api.SAGA_API_Get_Version()
*************
if name == 'main':
python script
I've attached the script as file to the bug report because the formatting of the code was lost in my previous post.
Volker