Ejemplo n.º 1
0
from heatsource9.ModelSetup.Inputs import Inputs
from os.path import abspath
from os.path import dirname
from os.path import exists
from os.path import join
from os.path import realpath

def getScriptPath():
    """Gets the path to the directory where the script is being executed from."""
    return abspath(join(dirname(realpath(__file__)), '.'))

model_dir = getScriptPath() + '/'
control_file = 'HeatSource_Control.csv'

if not exists(join(model_dir,control_file)):
    raise Exception("HeatSource_Control.csv not found. \
    Move the executable or place the control file in \
    this directory: {0}.".format(model_dir))


inputs = Inputs(model_dir, control_file)

# Control file must already be parameterized
inputs.import_control_file()

# Write blank input files,
inputs.setup(use_timestamp=True, overwrite=False)


    lcdatafile="lcdata.csv",
    lccodefile="lccodes.csv",
    trans_count=8,
    transsample_count=4,
    transsample_distance=8,
    emergent="True",
    lcdatainput="Codes",
    canopy_data="CanopyClosure",
    lcsampmethod="point",
    heatsource8="False")

# imports the control file into input object
inputs.import_control_file()

# write blank inputs
inputs.setup(use_timestamp=False, overwrite=True)

# Parameterize the lcdata and morph inputs directly
# from nodes feature class.
# NOTE this method currently requires use of arcpy and an active
# ArcGIS Desktop license
parameterize_from_nodes_fc(input_file="lcdatafile",
                           nodes_fc=nodes_fc,
                           group_val="Example Model",
                           grouping_field="STREAM_ID",
                           cont_stream_km=False,
                           overwrite=False)

parameterize_from_nodes_fc(input_file="morphfile",
                           nodes_fc=nodes_fc,
                           group_val="Example Model",