Ejemplo n.º 1
0
    return 1


##########################################
if __name__ == '__main__':
    print 'Python - Version ' + sys.version
    print saga_api.SAGA_API_Get_Version()
    print

    if len(sys.argv) != 2:
        print 'Usage: morphometry.py <in: elevation>'
        print '... trying to run with test_data'
        fDEM = './test.sgrd'
    else:
        fDEM = sys.argv[1]
        if os.path.split(fDEM)[0] == '':
            fDEM = './' + fDEM

    saga_api.SG_UI_Msg_Lock(True)
    if os.name == 'nt':  # Windows
        os.environ[
            'PATH'] = os.environ['PATH'] + ';' + os.environ['SAGA_32'] + '/dll'
        saga_api.SG_Get_Tool_Library_Manager().Add_Directory(
            os.environ['SAGA_32'] + '/tools', False)
    else:  # Linux
        saga_api.SG_Get_Tool_Library_Manager().Add_Directory(
            os.environ['SAGA_MLB'], False)
    saga_api.SG_UI_Msg_Lock(False)

    morphometry(fDEM)
Ejemplo n.º 2
0

##########################################
if __name__ == '__main__':
    print 'Python - Version ' + sys.version
    print saga_api.SAGA_API_Get_Version()
    print
    print 'Usage: %s <in: filename>'
    print
    print 'This is a simple template, please edit the script and add the necessary input and output file(s)!'
    print 'We will exit the script for now.'
    sys.exit()  # remove this line once you have edited the script
    # This might look like this:
    # fDEM    = sys.argv[1]
    # if os.path.split(fDEM)[0] == '':
    #    fDEM    = './' + fDEM
    fDEM = './../test_data/test.sgrd'  # remove this line once you have edited the script

    saga_api.SG_UI_Msg_Lock(1)
    if os.name == 'nt':  # Windows
        os.environ['PATH'] = os.environ['PATH'] + ';' + os.environ[
            'SAGA'] + '/bin/saga_vc_Win32/dll'
        saga_api.SG_Get_Module_Library_Manager().Add_Directory(
            os.environ['SAGA'] + '/bin/saga_vc_Win32/modules', 0)
    else:  # Linux
        saga_api.SG_Get_Module_Library_Manager().Add_Directory(
            os.environ['SAGA_MLB'], 0)
    saga_api.SG_UI_Msg_Lock(0)

    Call_SAGA_Module(fDEM)  # pass your input file(s) here
Ejemplo n.º 3
0
def Load_Tool_Libraries(Directory):
    saga_api.SG_UI_Msg_Lock(True)
    saga_api.SG_Get_Tool_Library_Manager().Add_Directory(Directory, False)
    saga_api.SG_UI_Msg_Lock(False)

    return True