Beispiel #1
0
        def updateMessages(self):
            """Modify the messages created by internal validation for each tool parameter.
            This method is called after internal validation."""

            import LUCI_EE.lib.input_validation as input_validation
            refresh_modules(input_validation)

            input_validation.checkFilePaths(self)
Beispiel #2
0
    def execute(self, parameters, messages):

        import LUCI_EE.tools.t_terrestrial_flow as t_terrestrial_flow
        refresh_modules(t_terrestrial_flow)

        t_terrestrial_flow.function(parameters)
Beispiel #3
0
import arcpy
import os

import LUCI_EE.lib.log as log
from LUCI_EE.lib.refresh_modules import refresh_modules
refresh_modules([log])


def function(streams,
             streamNetworks,
             fromNodeField,
             toNodeField,
             streamSegments=[]):
    class StreamSeg:
        def __init__(self, ID, fromNode, toNode, streamNetworkID=None):
            self.ID = ID
            self.fromNode = fromNode
            self.toNode = toNode
            self.streamNetworkID = streamNetworkID

    #############################
    ### Create stream network ###
    #############################

    try:
        # Initialise temporary variables
        prefix = "genStrNet_"
        streamsCopy = os.path.join(arcpy.env.scratchFolder,
                                   prefix + "streamsCopy.shp")

        if streamSegments == []:
import arcpy
import os
import numpy as np
from scipy.ndimage.morphology import binary_dilation

import LUCI_EE.lib.common as common
import LUCI_EE.lib.log as log

from LUCI_EE.lib.refresh_modules import refresh_modules
refresh_modules([log, common])

def function(params):

    try:
        # Get inputs
        pText = common.paramsAsText(params)
        outputRaster = pText[1]
        studyAreaMask = pText[2]
        fdr = pText[3]

        common.runSystemChecks()

        # Snap rasters to flow direction raster grid
        arcpy.env.snapRaster = fdr

        # Set temporary filenames
        prefix = "terrflow_"
        baseTempName = os.path.join(arcpy.env.scratchGDB, prefix)

        fdrClip = baseTempName + "fdrClip"
        studyAreaDissolved = baseTempName + "studyAreaDissolved"
Beispiel #5
0
    def execute(self, parameters, messages):

        import LUCI_EE.tools.t_preprocess_dem as t_preprocess_dem
        refresh_modules(t_preprocess_dem)

        t_preprocess_dem.function(parameters)
'''
Change user settings tool
'''

import arcpy
import os

import configuration
import LUCI_EE.lib.common as common

from LUCI_EE.lib.refresh_modules import refresh_modules
refresh_modules([common])

def function(params):

    common.runSystemChecks() # Run to ensure config.xml is copied across to user_settings.xml if needed. This line can be removed after 31/10/18.

    # Get inputs
    p = common.paramsAsText(params)
    scratchPath = p[1]
    developerMode = common.strToBool(p[2])

    if developerMode == True:
        developerMode = 'Yes'
    else:
        developerMode = 'No'

    # Override the default values from user settings file (if they exist in the file)
    try:
        configValues = [('scratchPath', scratchPath),
                        ('developerMode', developerMode)]
Beispiel #7
0
Preprocessing tool for LUCI_EE. Generates hydrological and topographical files
for use in other LUCI_EE functions.
'''
import arcpy
from arcpy.sa import Int, Reclassify, RemapRange, RemapValue, Raster, Fill, Float
from arcpy.sa import FlowAccumulation, FlowDirection, StreamOrder
import os

import LUCI_EE.lib.progress as progress
import LUCI_EE.lib.log as log
import LUCI_EE.lib.common as common
import LUCI_EE.solo.reconditionDEM as reconditionDEM
import LUCI_EE.lib.baseline as baseline

from LUCI_EE.lib.refresh_modules import refresh_modules
refresh_modules([log, common, reconditionDEM, baseline])


def function(outputFolder,
             DEM,
             studyAreaMask,
             streamInput,
             minAccThresh,
             majAccThresh,
             smoothDropBuffer,
             smoothDrop,
             streamDrop,
             rerun=False):

    try:
        # Set environment variables
Beispiel #8
0
between these inputs and produce files that will be used by the other tools in this toolbox
'''

import arcpy
import os
import sys

import LUCI_EE.lib.log as log
import LUCI_EE.lib.progress as progress
import LUCI_EE.lib.common as common
import LUCI_EE.lib.baseline as baseline
import LUCI_EE.solo.preprocess_dem as preprocess_dem

from LUCI_EE.lib.refresh_modules import refresh_modules
from LUCI_EE.lib.external import six  # Python 2/3 compatibility module
refresh_modules([log, common, baseline, preprocess_dem])


def function(params):

    try:
        ###################
        ### Read inputs ###
        ###################

        pText = common.paramsAsText(params)

        outputFolder = pText[1]
        inputDEM = common.fullPath(pText[2])
        inputStudyAreaMask = pText[3]
        inputStreamNetwork = pText[4]
Beispiel #9
0
    def execute(self, parameters, messages):

        import LUCI_EE.tools.t_change_user_settings as t_change_user_settings
        refresh_modules(t_change_user_settings)

        t_change_user_settings.function(parameters)
Beispiel #10
0
import arcpy
import os

import configuration
import LUCI_EE.lib.common as common

from LUCI_EE.lib.refresh_modules import refresh_modules

refresh_modules(common)


class ChangeUserSettings(object):
    class ToolValidator:
        """Class for validating a tool's parameter values and controlling the behavior of the tool's dialog."""
        def __init__(self, parameters):
            """Setup the Geoprocessor and the list of tool parameters."""
            self.params = parameters

        def initializeParameters(self):
            """Refine the properties of a tool's parameters.
            This method is called when the tool is opened."""
            return

        def updateParameters(self):
            """Modify the values and properties of parameters before internal validation is performed.
            This method is called whenever a parameter has been changed."""

            # Set defaults or override them from user settings file (if the values exist in the file)
            userSettings = configuration.userSettingsFile
            try:
                if os.path.exists(userSettings):
Beispiel #11
0
import arcpy
from arcpy.sa import Watershed, SnapPourPoint, Reclassify, RemapRange
import os
import LUCI_EE.lib.log as log
import LUCI_EE.lib.common as common
import LUCI_EE.lib.assign_stream_network_id as assign_stream_network_id

from LUCI_EE.lib.refresh_modules import refresh_modules
refresh_modules([log, common, assign_stream_network_id])


def function(outputFolder, studyMask, streamNetwork, facRaster):
    '''
    Find stream end points which lie on the boundary of the study area mask.
    The watersheds for each point are also calculated if wanted.
    '''
    class StreamSeg:
        def __init__(self,
                     ID,
                     fromNode,
                     toNode,
                     shape,
                     fromNodePoint,
                     toNodePoint,
                     streamNetworkID=None):
            self.ID = ID
            self.fromNode = fromNode
            self.toNode = toNode
            self.shape = shape
            self.fromNodePoint = fromNodePoint
            self.toNodePoint = toNodePoint