Ejemplo n.º 1
0
    def modelsFolder():
        folder = SextanteConfig.getSetting(ModelerUtils.MODELS_FOLDER)
        if folder == None:
            folder = SextanteUtils.userFolder() + os.sep + "models"
        mkdir(folder)

        return folder
Ejemplo n.º 2
0
    def scriptsFolder():
        folder = SextanteConfig.getSetting(ScriptUtils.SCRIPTS_FOLDER)
        if folder == None:
            folder = SextanteUtils.userFolder() + os.sep + "scripts"
        mkdir(folder)

        return folder
Ejemplo n.º 3
0
    def modelsFolder():
        folder = SextanteConfig.getSetting(ModelerUtils.MODELS_FOLDER)
        if folder == None:
            folder = os.path.join(os.path.dirname(__file__), "models")
        mkdir(folder)

        return folder
Ejemplo n.º 4
0
    def scriptsFolder():
        folder = SextanteConfig.getSetting(ScriptUtils.SCRIPTS_FOLDER)
        if folder == None:
            folder = SextanteUtils.userFolder() + os.sep + "scripts"
        mkdir(folder)

        return folder
Ejemplo n.º 5
0
    def modelsFolder():
        folder = SextanteConfig.getSetting(ModelerUtils.MODELS_FOLDER)
        if folder == None:
            folder = unicode(os.path.join(SextanteUtils.userFolder(), "models"))
        mkdir(folder)

        return os.path.abspath(folder)
Ejemplo n.º 6
0
 def WpsDescriptionFolder():
     folder = SextanteConfig.getSetting(
         WpsAlgorithmProvider.WPS_DESCRIPTIONS)
     if folder == None:
         folder = unicode(os.path.join(SextanteUtils.userFolder(), "wps"))
     mkdir(folder)
     return os.path.abspath(folder)
Ejemplo n.º 7
0
    def RScriptsFolder():
        folder = SextanteConfig.getSetting(RUtils.RSCRIPTS_FOLDER)
        if folder == None:
            folder = unicode(os.path.join(SextanteUtils.userFolder(), "rscripts"))
        mkdir(folder)

        return os.path.abspath(folder)
Ejemplo n.º 8
0
    def RScriptsFolder():
        folder = SextanteConfig.getSetting(RUtils.RSCRIPTS_FOLDER)
        if folder == None:
            folder = os.path.join(os.path.dirname(__file__), "scripts")
        mkdir(folder)

        return folder
Ejemplo n.º 9
0
    def RScriptsFolder():
        folder = SextanteConfig.getSetting(RUtils.RSCRIPTS_FOLDER)
        if folder == None:
            folder = os.path.join(os.path.dirname(__file__), "scripts")
        mkdir(folder)

        return folder
Ejemplo n.º 10
0
    def RScriptsFolder():
        folder = SextanteConfig.getSetting(RUtils.RSCRIPTS_FOLDER)
        if folder == None:
            folder = unicode(
                os.path.join(SextanteUtils.userFolder(), "rscripts"))
        mkdir(folder)

        return os.path.abspath(folder)
Ejemplo n.º 11
0
    def modelsFolder():
        folder = SextanteConfig.getSetting(ModelerUtils.MODELS_FOLDER)
        if folder == None:
            folder = unicode(os.path.join(SextanteUtils.userFolder(),
                                          "models"))
        mkdir(folder)

        return os.path.abspath(folder)
Ejemplo n.º 12
0
    def modelsFolder():
        folder = SextanteConfig.getSetting(ModelerUtils.MODELS_FOLDER)
        if folder == None:
            #folder = os.path.join(os.path.dirname(__file__), "models")
            folder = SextanteUtils.userFolder() + os.sep + "models"
        mkdir(folder)

        return folder
Ejemplo n.º 13
0
    def scriptsFolder():
        folder = SextanteConfig.getSetting(ScriptUtils.SCRIPTS_FOLDER)
        if folder == None:
            #folder = os.path.join(os.path.dirname(__file__), "scripts")
            folder = SextanteUtils.userFolder() + os.sep + "scripts"
        mkdir(folder)

        return folder
Ejemplo n.º 14
0
def createBaseHelpFile(alg, folder):
    folder = os.path.join(folder, alg.provider.getName().lower())
    mkdir(folder)
    cmdLineName = alg.commandLineName()[alg.commandLineName().find(":") +
                                        1:].lower()
    validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    safeFilename = ''.join(c for c in cmdLineName if c in validChars)
    filepath = os.path.join(folder, safeFilename + ".rst")
    file = open(filepath, "w")
    file.write(alg.name.upper())
    file.write("\n")
    file.write("=" * len(alg.name))
    file.write("\n\n")
    file.write("Description\n")
    file.write("-----------\n\n")
    file.write("Parameters\n")
    file.write("----------\n\n")
    for param in alg.parameters:
        file.write("- ``" + param.description + "[" +
                   param.parameterName()[9:] + "]``:\n")
    file.write("\nOutputs\n")
    file.write("-------\n\n")
    for out in alg.outputs:
        file.write("- ``" + out.description + "[" + out.outputTypeName()[6:] +
                   "]``:\n")
    file.write("\nSee also\n")
    file.write("---------\n\n")
    file.write("\nConsole usage\n")
    file.write("-------------\n\n")
    file.write("\n::\n\n")
    s = "\tsextante.runalg('" + alg.commandLineName() + "', "
    for param in alg.parameters:
        s += str(param.name.lower().strip()) + ", "
    for out in alg.outputs:
        if not out.hidden:
            s += str(out.name.lower().strip()) + ", "
    s = s[:-2] + ")\n"
    file.write(s)

    s = ""
    hasSelection = False
    for param in alg.parameters:
        if isinstance(param, ParameterSelection):
            hasSelection = True
            s += "\n\t" + param.name.lower() + "(" + param.description + ")\n"
            i = 0
            for option in param.options:
                s += "\t\t" + str(i) + " - " + str(option) + "\n"
                i += 1
    if hasSelection:
        file.write("\n\tAvailable options for selection parameters:\n")
        file.write(s)
    file.close()
Ejemplo n.º 15
0
def createBaseHelpFile(alg, folder):
    folder = os.path.join(folder, alg.provider.getName().lower())
    mkdir(folder)
    cmdLineName = alg.commandLineName()[alg.commandLineName().find(":") + 1:].lower()
    validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    safeFilename = ''.join(c for c in cmdLineName if c in validChars)
    filepath = os.path.join(folder, safeFilename + ".rst")
    file = open(filepath, "w")
    file.write(alg.name.upper())
    file.write("\n")
    file.write("=" * len(alg.name))
    file.write("\n\n")
    file.write("Description\n")
    file.write("-----------\n\n")
    file.write("Parameters\n")
    file.write("----------\n\n")
    for param in alg.parameters:
        file.write("- ``" + param.description + "[" + param.parameterName()[9:] + "]``:\n")
    file.write("\nOutputs\n")
    file.write("-------\n\n")
    for out in alg.outputs:
        file.write("- ``" + out.description + "[" + out.outputTypeName()[6:] + "]``:\n")
    file.write("\nSee also\n")
    file.write("---------\n\n")
    file.write("\nConsole usage\n")
    file.write("-------------\n\n")
    file.write("\n::\n\n")
    s = "\tsextante.runalg('" + alg.commandLineName() + "', "
    for param in alg.parameters:
        s+= str(param.name.lower().strip()) + ", "
    for out in alg.outputs:
        if not out.hidden:
            s+=str(out.name.lower().strip()) + ", "
    s = s[:-2] +")\n"
    file.write(s)

    s =""
    hasSelection = False
    for param in alg.parameters:
        if isinstance(param, ParameterSelection):
            hasSelection = True
            s+="\n\t" + param.name.lower() + "(" + param.description + ")\n"
            i=0
            for option in param.options:
                s+= "\t\t" + str(i) + " - " + str(option) + "\n"
                i+=1
    if hasSelection:
        file.write("\n\tAvailable options for selection parameters:\n")
        file.write(s)
    file.close()
Ejemplo n.º 16
0
    def createTempMapset():
        '''Creates a temporary location and mapset(s) for GRASS data processing. A minimal set of folders and files is created in the
         system's default temporary directory. The settings files are written with sane defaults, so GRASS can do its work. File
        structure and content will vary slightly depending on whether the user wants to process lat/lon or x/y data.'''

        latlon = SextanteConfig.getSetting(GrassUtils.GRASS_LATLON)
        folder = GrassUtils.grassMapsetFolder()
        mkdir(os.path.join(folder, "PERMANENT"))
        mkdir(os.path.join(folder, "user"))
        mkdir(os.path.join(folder, "PERMANENT", ".tmp"))
        GrassUtils.writeGrassWindow(
            os.path.join(folder, "PERMANENT", "DEFAULT_WIND"))
        outfile = open(os.path.join(folder, "PERMANENT", "MYNAME"), "w")
        if not latlon:
            outfile.write(
                "SEXTANTE GRASS interface: temporary x/y data processing location.\n"
            )
        else:
            outfile.write(
                "SEXTANTE GRASS interface: temporary lat/lon data processing location.\n"
            )
        outfile.close()
        if latlon:
            outfile = open(os.path.join(folder, "PERMANENT", "PROJ_INFO"), "w")
            outfile.write("name: Latitude-Longitude\n")
            outfile.write("proj: ll\n")
            outfile.write("ellps: wgs84\n")
            outfile.close()
            outfile = open(os.path.join(folder, "PERMANENT", "PROJ_UNITS"),
                           "w")
            outfile.write("unit: degree\n")
            outfile.write("units: degrees\n")
            outfile.write("meters: 1.0\n")
            outfile.close()
        GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "WIND"))
        mkdir(os.path.join(folder, "user", "dbf"))
        mkdir(os.path.join(folder, "user", ".tmp"))
        outfile = open(os.path.join(folder, "user", "VAR"), "w")
        outfile.write("DB_DRIVER: dbf\n")
        outfile.write("DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n")
        outfile.close()
        GrassUtils.writeGrassWindow(os.path.join(folder, "user", "WIND"))
Ejemplo n.º 17
0
    def createTempMapset():
        '''Creates a temporary location and mapset(s) for GRASS data processing. A minimal set of folders and files is created in the
         system's default temporary directory. The settings files are written with sane defaults, so GRASS can do its work. File
        structure and content will vary slightly depending on whether the user wants to process lat/lon or x/y data.'''

        latlon = SextanteConfig.getSetting(GrassUtils.GRASS_LATLON)
        folder = GrassUtils.grassMapsetFolder()
        mkdir(os.path.join(folder, "PERMANENT"))
        mkdir(os.path.join(folder, "user"))
        mkdir(os.path.join(folder, "PERMANENT", ".tmp"))
        GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "DEFAULT_WIND"));
        outfile = open(os.path.join(folder, "PERMANENT", "MYNAME"), "w")
        if not latlon:
            outfile.write("SEXTANTE GRASS interface: temporary x/y data processing location.\n");
        else:
            outfile.write("SEXTANTE GRASS interface: temporary lat/lon data processing location.\n");
        outfile.close();
        if latlon:
            outfile = open(os.path.join(folder, "PERMANENT", "PROJ_INFO"), "w")
            outfile.write("name: Latitude-Longitude\n")
            outfile.write("proj: ll\n")
            outfile.write("ellps: wgs84\n")
            outfile.close()
            outfile = open(os.path.join(folder, "PERMANENT", "PROJ_UNITS"), "w")
            outfile.write("unit: degree\n");
            outfile.write("units: degrees\n");
            outfile.write("meters: 1.0\n");
            outfile.close();
        GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "WIND"));
        mkdir(os.path.join(folder, "user", "dbf"))
        mkdir(os.path.join(folder, "user", ".tmp"))
        outfile = open(os.path.join(folder, "user", "VAR"), "w")
        outfile.write("DB_DRIVER: dbf\n");
        outfile.write("DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n");
        outfile.close()
        GrassUtils.writeGrassWindow(os.path.join(folder, "user", "WIND"));
Ejemplo n.º 18
0
    def createTempMapset():
        '''Creates a temporary location and mapset(s) for GRASS data processing. A minimal set of folders and files is created in the
         system's default temporary directory. The settings files are written with sane defaults, so GRASS can do its work. The mapset
         projection will be set later, based on the projection of the first input image or vector'''

        folder = GrassUtils.grassMapsetFolder()
        mkdir(os.path.join(folder, "PERMANENT"))
        mkdir(os.path.join(folder, "PERMANENT", ".tmp"))
        GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "DEFAULT_WIND"));
        outfile = open(os.path.join(folder, "PERMANENT", "MYNAME"), "w")
        outfile.write("SEXTANTE GRASS interface: temporary data processing location.\n");
        outfile.close();
        GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "WIND"))
        mkdir(os.path.join(folder, "PERMANENT", "dbf"))
        outfile = open(os.path.join(folder, "PERMANENT", "VAR"), "w")
        outfile.write("DB_DRIVER: dbf\n")
        outfile.write("DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n")
        outfile.close()
Ejemplo n.º 19
0
    def createTempMapset():
        '''Creates a temporary location and mapset(s) for GRASS data processing. A minimal set of folders and files is created in the
         system's default temporary directory. The settings files are written with sane defaults, so GRASS can do its work. The mapset
         projection will be set later, based on the projection of the first input image or vector'''

        folder = GrassUtils.grassMapsetFolder()
        mkdir(os.path.join(folder, "PERMANENT"))
        mkdir(os.path.join(folder, "PERMANENT", ".tmp"))
        GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "DEFAULT_WIND"));
        outfile = open(os.path.join(folder, "PERMANENT", "MYNAME"), "w")
        outfile.write("SEXTANTE GRASS interface: temporary data processing location.\n");
        outfile.close();
        GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "WIND"))
        mkdir(os.path.join(folder, "PERMANENT", "dbf"))
        outfile = open(os.path.join(folder, "PERMANENT", "VAR"), "w")
        outfile.write("DB_DRIVER: dbf\n")
        outfile.write("DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n")
        outfile.close()
 def commandsFolder(self):
     folder = unicode(os.path.join(SextanteUtils.userFolder(), "commander"))
     mkdir(folder)
     return os.path.abspath(folder)
Ejemplo n.º 21
0
 def grassMapsetFolder():
     tempfolder = os.path.join(SextanteUtils.tempFolder(), "grassdata", "temp_location")
     mkdir(tempfolder)
     return tempfolder
Ejemplo n.º 22
0
 def grassDataFolder():
     tempfolder = os.path.join(SextanteUtils.tempFolder(), "grassdata")
     mkdir(tempfolder)
     return tempfolder
Ejemplo n.º 23
0
 def grassMapsetFolder():
     folder = os.path.join(GrassUtils.grassDataFolder(), "temp_location")
     mkdir(folder)
     return folder
Ejemplo n.º 24
0
 def grassDataFolder():
     tempfolder = os.path.join(SextanteUtils.tempFolder(), "grassdata")
     mkdir(tempfolder)
     return tempfolder
Ejemplo n.º 25
0
 def grassMapsetFolder():
     folder = os.path.join(GrassUtils.grassDataFolder(), "temp_location")
     mkdir(folder)
     return folder
Ejemplo n.º 26
0
 def commandsFolder(self):        
     folder = unicode(os.path.join(SextanteUtils.userFolder(), "commander"))
     mkdir(folder)
     return os.path.abspath(folder)
Ejemplo n.º 27
0
 def grassMapsetFolder():
     tempfolder = os.path.join(os.path.expanduser("~"), "sextante", "tempdata", "grassdata", "temp_location")
     mkdir(tempfolder)
     return tempfolder
 def WpsDescriptionFolder():
     folder = SextanteConfig.getSetting(WpsAlgorithmProvider.WPS_DESCRIPTIONS)
     if folder == None:
         folder = unicode(os.path.join(SextanteUtils.userFolder(), "wps"))
     mkdir(folder)
     return os.path.abspath(folder)
Ejemplo n.º 29
0
 def grassMapsetFolder():
     tempfolder = os.path.join(os.path.expanduser("~"), "sextante",
                               "tempdata", "grassdata", "temp_location")
     mkdir(tempfolder)
     return tempfolder
Ejemplo n.º 30
0
 def grassMapsetFolder():
     tempfolder = os.path.join(SextanteUtils.tempFolder(), "grassdata",
                               "temp_location")
     mkdir(tempfolder)
     return tempfolder