コード例 #1
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=u'Scenic Quality',
            target=scenic_quality.execute,
            validator=scenic_quality.validate,
            localdoc=u'../documentation/scenic_quality.html')

        self.beta_only = inputs.Label(
            text=(
                u"This tool is considered UNSTABLE.  Users may "
                u"experience performance issues and unexpected errors."))
        self.general_tab = inputs.Container(
            interactive=True,
            label=u'General')
        self.add_input(self.general_tab)
        self.aoi_uri = inputs.File(
            args_key=u'aoi_uri',
            helptext=(
                u"An OGR-supported vector file.  This AOI instructs "
                u"the model where to clip the input data and the extent "
                u"of analysis.  Users will create a polygon feature "
                u"layer that defines their area of interest.  The AOI "
                u"must intersect the Digital Elevation Model (DEM)."),
            label=u'Area of Interest (Vector)',
            validator=self.validator)
        self.general_tab.add_input(self.aoi_uri)
        self.cell_size = inputs.Text(
            args_key=u'cell_size',
            helptext=u'Length (in meters) of each side of the (square) cell.',
            label=u'Cell Size (meters)',
            validator=self.validator)
        self.general_tab.add_input(self.cell_size)
        self.structure_uri = inputs.File(
            args_key=u'structure_uri',
            helptext=(
                u"An OGR-supported vector file.  The user must specify "
                u"a point feature layer that indicates locations of "
                u"objects that contribute to negative scenic quality, "
                u"such as aquaculture netpens or wave energy "
                u"facilities.  In order for the viewshed analysis to "
                u"run correctly, the projection of this input must be "
                u"consistent with the project of the DEM input."),
            label=u'Features Impacting Scenic Quality (Vector)',
            validator=self.validator)
        self.general_tab.add_input(self.structure_uri)
        self.dem_uri = inputs.File(
            args_key=u'dem_uri',
            helptext=(
                u"A GDAL-supported raster file.  An elevation raster "
                u"layer is required to conduct viewshed analysis. "
                u"Elevation data allows the model to determine areas "
                u"within the AOI's land-seascape where point features "
                u"contributing to negative scenic quality are visible."),
            label=u'Digital Elevation Model (Raster)',
            validator=self.validator)
        self.general_tab.add_input(self.dem_uri)
        self.refraction = inputs.Text(
            args_key=u'refraction',
            helptext=(
                u"The earth curvature correction option corrects for "
                u"the curvature of the earth and refraction of visible "
                u"light in air.  Changes in air density curve the light "
                u"downward causing an observer to see further and the "
                u"earth to appear less curved.  While the magnitude of "
                u"this effect varies with atmospheric conditions, a "
                u"standard rule of thumb is that refraction of visible "
                u"light reduces the apparent curvature of the earth by "
                u"one-seventh.  By default, this model corrects for the "
                u"curvature of the earth and sets the refractivity "
                u"coefficient to 0.13."),
            label=u'Refractivity Coefficient',
            validator=self.validator)
        self.general_tab.add_input(self.refraction)
        self.pop_uri = inputs.File(
            args_key=u'pop_uri',
            helptext=(
                u"A GDAL-supported raster file.  A population raster "
                u"layer is required to determine population within the "
                u"AOI's land-seascape where point features contributing "
                u"to negative scenic quality are visible and not "
                u"visible."),
            label=u'Population (Raster)',
            validator=self.validator)
        self.general_tab.add_input(self.pop_uri)
        self.overlap_uri = inputs.File(
            args_key=u'overlap_uri',
            helptext=(
                u"An OGR-supported vector file.  The user has the "
                u"option of providing a polygon feature layer where "
                u"they would like to determine the impact of objects on "
                u"visual quality.  This input must be a polygon and "
                u"projected in meters.  The model will use this layer "
                u"to determine what percent of the total area of each "
                u"polygon feature can see at least one of the point "
                u"features impacting scenic quality."),
            label=u'Overlap Analysis Features (Vector)',
            validator=self.validator)
        self.general_tab.add_input(self.overlap_uri)
        self.valuation_tab = inputs.Container(
            interactive=True,
            label=u'Valuation')
        self.add_input(self.valuation_tab)
        self.valuation_function = inputs.Dropdown(
            args_key=u'valuation_function',
            helptext=(
                u"This field indicates the functional form f(x) the "
                u"model will use to value the visual impact for each "
                u"viewpoint.  For distances less than 1 km (x<1), the "
                u"model uses a linear form g(x) where the line passes "
                u"through f(1) (i.e.  g(1) == f(1)) and extends to zero "
                u"with the same slope as f(1) (i.e.  g'(x) == f'(1))."),
            label=u'Valuation Function',
            options=[u'polynomial: a + bx + cx^2 + dx^3',
                     u'logarithmic: a + b ln(x)'])
        self.valuation_tab.add_input(self.valuation_function)
        self.a_coefficient = inputs.Text(
            args_key=u'a_coefficient',
            helptext=(
                u"First coefficient used either by the polynomial or "
                u"by the logarithmic valuation function."),
            label=u"'a' Coefficient (polynomial/logarithmic)",
            validator=self.validator)
        self.valuation_tab.add_input(self.a_coefficient)
        self.b_coefficient = inputs.Text(
            args_key=u'b_coefficient',
            helptext=(
                u"Second coefficient used either by the polynomial or "
                u"by the logarithmic valuation function."),
            label=u"'b' Coefficient (polynomial/logarithmic)",
            validator=self.validator)
        self.valuation_tab.add_input(self.b_coefficient)
        self.c_coefficient = inputs.Text(
            args_key=u'c_coefficient',
            helptext=u"Third coefficient for the polynomial's quadratic term.",
            label=u"'c' Coefficient (polynomial only)",
            validator=self.validator)
        self.valuation_tab.add_input(self.c_coefficient)
        self.d_coefficient = inputs.Text(
            args_key=u'd_coefficient',
            helptext=u"Fourth coefficient for the polynomial's cubic exponent.",
            label=u"'d' Coefficient (polynomial only)",
            validator=self.validator)
        self.valuation_tab.add_input(self.d_coefficient)
        self.max_valuation_radius = inputs.Text(
            args_key=u'max_valuation_radius',
            helptext=(
                u"Radius beyond which the valuation is set to zero. "
                u"The valuation function 'f' cannot be negative at the "
                u"radius 'r' (f(r)>=0)."),
            label=u'Maximum Valuation Radius (meters)',
            validator=self.validator)
        self.valuation_tab.add_input(self.max_valuation_radius)
コード例 #2
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=MODEL_METADATA['fisheries'].model_title,
            target=fisheries.execute,
            validator=fisheries.validate,
            localdoc=MODEL_METADATA['fisheries'].userguide)

        self.alpha_only = inputs.Label(
            text=("This tool is in an ALPHA testing stage and should "
                  "not be used for decision making."))
        self.aoi_vector_path = inputs.File(
            args_key='aoi_vector_path',
            helptext=("An OGR-supported vector file used to display outputs "
                      "within the region(s) of interest.<br><br>The layer "
                      "should contain one feature for every region of "
                      "interest, each feature of which should have a ‘NAME’ "
                      "attribute.  The 'NAME' attribute can be numeric or "
                      "alphabetic, but must be unique within the given file."),
            label='Area of Interest (Vector) (Optional)',
            validator=self.validator)
        self.add_input(self.aoi_vector_path)
        self.total_timesteps = inputs.Text(
            args_key='total_timesteps',
            helptext=("The number of time steps the simulation shall "
                      "execute before completion.<br><br>Must be a positive "
                      "integer."),
            label='Number of Time Steps for Model Run',
            validator=self.validator)
        self.add_input(self.total_timesteps)
        self.popu_cont = inputs.Container(label='Population Parameters')
        self.add_input(self.popu_cont)
        self.population_type = inputs.Dropdown(
            args_key='population_type',
            helptext=("Specifies whether the lifecycle classes provided in "
                      "the Population Parameters CSV file represent ages "
                      "(uniform duration) or stages.<br><br>Age-based models "
                      "(e.g.  Lobster, Dungeness Crab) are separated by "
                      "uniform, fixed-length time steps (usually "
                      "representing a year).<br><br>Stage-based models (e.g. "
                      "White Shrimp) allow lifecycle-classes to have "
                      "nonuniform durations based on the assumed resolution "
                      "of the provided time step.<br><br>If the stage-based "
                      "model is selected, the Population Parameters CSV file "
                      "must include a ‘Duration’ vector alongside the "
                      "survival matrix that contains the number of time "
                      "steps that each stage lasts."),
            label='Population Model Type',
            options=['Age-Based', 'Stage-Based'])
        self.popu_cont.add_input(self.population_type)
        self.sexsp = inputs.Dropdown(
            args_key='sexsp',
            helptext=("Specifies whether or not the lifecycle classes "
                      "provided in the Populaton Parameters CSV file are "
                      "distinguished by sex."),
            label='Population Classes are Sex-Specific',
            options=['No', 'Yes'])
        self.popu_cont.add_input(self.sexsp)
        self.harvest_units = inputs.Dropdown(
            args_key='harvest_units',
            helptext=("Specifies whether the harvest output values are "
                      "calculated in terms of number of individuals or in "
                      "terms of biomass (weight).<br><br>If ‘Weight’ is "
                      "selected, the Population Parameters CSV file must "
                      "include a 'Weight' vector alongside the survival "
                      "matrix that contains the weight of each lifecycle "
                      "class and sex if model is sex-specific."),
            label='Harvest by Individuals or Weight',
            options=['Individuals', 'Weight'])
        self.popu_cont.add_input(self.harvest_units)
        self.do_batch = inputs.Checkbox(
            args_key='do_batch',
            helptext=("Specifies whether program will perform a single "
                      "model run or a batch (set) of model runs.<br><br>For "
                      "single model runs, users submit a filepath pointing "
                      "to a single Population Parameters CSV file.  For "
                      "batch model runs, users submit a directory path "
                      "pointing to a set of Population Parameters CSV files."),
            label='Batch Processing')
        self.popu_cont.add_input(self.do_batch)
        self.population_csv_path = inputs.File(
            args_key='population_csv_path',
            helptext=("The provided CSV file should contain all necessary "
                      "attributes for the sub-populations based on lifecycle "
                      "class, sex, and area - excluding possible migration "
                      "information.<br><br>Please consult the documentation "
                      "to learn more about what content should be provided "
                      "and how the CSV file should be structured."),
            label='Population Parameters File (CSV)',
            validator=self.validator)
        self.popu_cont.add_input(self.population_csv_path)
        self.population_csv_dir = inputs.Folder(
            args_key='population_csv_dir',
            helptext=("The provided CSV folder should contain a set of "
                      "Population Parameters CSV files with all necessary "
                      "attributes for sub-populations based on lifecycle "
                      "class, sex, and area - excluding possible migration "
                      "information.<br><br>The name of each file will serve "
                      "as the prefix of the outputs created by the model "
                      "run.<br><br>Please consult the documentation to learn "
                      "more about what content should be provided and how "
                      "the CSV file should be structured."),
            interactive=False,
            label='Population Parameters CSV Folder',
            validator=self.validator)
        self.popu_cont.add_input(self.population_csv_dir)
        self.recr_cont = inputs.Container(label='Recruitment Parameters')
        self.add_input(self.recr_cont)
        self.total_init_recruits = inputs.Text(
            args_key='total_init_recruits',
            helptext=("The initial number of recruits in the population "
                      "model at time equal to zero.<br><br>If the model "
                      "contains multiple regions of interest or is "
                      "distinguished by sex, this value will be evenly "
                      "divided and distributed into each sub-population."),
            label='Total Initial Recruits',
            validator=self.validator)
        self.recr_cont.add_input(self.total_init_recruits)
        self.recruitment_type = inputs.Dropdown(
            args_key='recruitment_type',
            helptext=("The selected equation is used to calculate "
                      "recruitment into the subregions at the beginning of "
                      "each time step.  Corresponding parameters must be "
                      "specified with each function:<br><br>The Beverton- "
                      "Holt and Ricker functions both require arguments for "
                      "the ‘Alpha’ and ‘Beta’ parameters.<br><br>The "
                      "Fecundity function requires a 'Fecundity' vector "
                      "alongside the survival matrix in the Population "
                      "Parameters CSV file indicating the per-capita "
                      "offspring for each lifecycle class.<br><br>The Fixed "
                      "function requires an argument for the ‘Total Recruits "
                      "per Time Step’ parameter that represents a single "
                      "total recruitment value to be distributed into the "
                      "population model at the beginning of each time step."),
            label='Recruitment Function Type',
            options=['Beverton-Holt', 'Ricker', 'Fecundity', 'Fixed'])
        self.recr_cont.add_input(self.recruitment_type)
        self.spawn_units = inputs.Dropdown(
            args_key='spawn_units',
            helptext=("Specifies whether the spawner abundance used in the "
                      "recruitment function should be calculated in terms of "
                      "number of individuals or in terms of biomass "
                      "(weight).<br><br>If 'Weight' is selected, the user "
                      "must provide a 'Weight' vector alongside the survival "
                      "matrix in the Population Parameters CSV file.  The "
                      "'Alpha' and 'Beta' parameters provided by the user "
                      "should correspond to the selected choice.<br><br>Used "
                      "only for the Beverton-Holt and Ricker recruitment "
                      "functions."),
            label='Spawners by Individuals or Weight (Beverton-Holt / Ricker)',
            options=['Individuals', 'Weight'])
        self.recr_cont.add_input(self.spawn_units)
        self.alpha = inputs.Text(
            args_key='alpha',
            helptext=("Specifies the shape of the stock-recruit curve. "
                      "Used only for the Beverton-Holt and Ricker "
                      "recruitment functions.<br><br>Used only for the "
                      "Beverton-Holt and Ricker recruitment functions."),
            label='Alpha (Beverton-Holt / Ricker)',
            validator=self.validator)
        self.recr_cont.add_input(self.alpha)
        self.beta = inputs.Text(
            args_key='beta',
            helptext=("Specifies the shape of the stock-recruit "
                      "curve.<br><br>Used only for the Beverton-Holt and "
                      "Ricker recruitment functions."),
            label='Beta (Beverton-Holt / Ricker)',
            validator=self.validator)
        self.recr_cont.add_input(self.beta)
        self.total_recur_recruits = inputs.Text(
            args_key='total_recur_recruits',
            helptext=("Specifies the total number of recruits that come "
                      "into the population at each time step (a fixed "
                      "number).<br><br>Used only for the Fixed recruitment "
                      "function."),
            label='Total Recruits per Time Step (Fixed)',
            validator=self.validator)
        self.recr_cont.add_input(self.total_recur_recruits)
        self.migr_cont = inputs.Container(args_key='migr_cont',
                                          expandable=True,
                                          expanded=False,
                                          label='Migration Parameters')
        self.add_input(self.migr_cont)
        self.migration_dir = inputs.Folder(
            args_key='migration_dir',
            helptext=("The selected folder contain CSV migration matrices "
                      "to be used in the simulation.  Each CSV file contains "
                      "a single migration matrix corresponding to an "
                      "lifecycle class that migrates.  The folder should "
                      "contain one CSV file for each lifecycle class that "
                      "migrates.<br><br>The files may be named anything, but "
                      "must end with an underscore followed by the name of "
                      "the age or stage.  The name of the age or stage must "
                      "correspond to an age or stage within the Population "
                      "Parameters CSV file.  For example, a migration file "
                      "might be named 'migration_adult.csv'.<br><br>Each "
                      "matrix cell should contain a decimal fraction "
                      "indicating the percetage of the population that will "
                      "move from one area to another.  Each column should "
                      "sum to one."),
            label='Migration Matrix CSV Folder (Optional)',
            validator=self.validator)
        self.migr_cont.add_input(self.migration_dir)
        self.val_cont = inputs.Container(args_key='val_cont',
                                         expandable=True,
                                         expanded=False,
                                         label='Valuation Parameters')
        self.add_input(self.val_cont)
        self.frac_post_process = inputs.Text(
            args_key='frac_post_process',
            helptext=("Decimal fraction indicating the percentage of "
                      "harvested catch remaining after post-harvest "
                      "processing is complete."),
            label='Fraction of Harvest Kept After Processing',
            validator=self.validator)
        self.val_cont.add_input(self.frac_post_process)
        self.unit_price = inputs.Text(
            args_key='unit_price',
            helptext=("Specifies the price per harvest unit.<br><br>If "
                      "‘Harvest by Individuals or Weight’ was set to "
                      "‘Individuals’, this should be the price per "
                      "individual.  If set to ‘Weight’, this should be the "
                      "price per unit weight."),
            label='Unit Price',
            validator=self.validator)
        self.val_cont.add_input(self.unit_price)

        # Set interactivity, requirement as input sufficiency changes
        self.do_batch.sufficiency_changed.connect(self._toggle_batch_runs)

        # Enable/disable parameters when the recruitment function changes.
        self.recruitment_type.value_changed.connect(
            self._control_recruitment_parameters)
コード例 #3
0
ファイル: recreation.py プロジェクト: dcdenu4/invest
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=MODEL_METADATA['recreation'].model_title,
            target=recmodel_client.execute,
            validator=recmodel_client.validate,
            localdoc=MODEL_METADATA['recreation'].userguide)

        self.internet_warning = inputs.Label(
            text=("Note, this computer must have an Internet connection "
                  "in order to run this model."))
        self.aoi_path = inputs.File(
            args_key='aoi_path',
            helptext=("An OGR-supported vector file representing the area "
                      "of interest where the model will run the analysis."),
            label='Area of Interest (Vector)',
            validator=self.validator)
        self.add_input(self.aoi_path)
        self.start_year = inputs.Text(
            args_key='start_year',
            helptext='Year to start PUD calculations, date starts on Jan 1st.',
            label='Start Year (inclusive, must be >= 2005)',
            validator=self.validator)
        self.add_input(self.start_year)
        self.end_year = inputs.Text(
            args_key='end_year',
            helptext=('Year to end PUD calculations, date ends and includes '
                      'Dec 31st.'),
            label='End Year (inclusive, must be <= 2017)',
            validator=self.validator)
        self.add_input(self.end_year)
        self.regression_container = inputs.Container(
            args_key='compute_regression',
            expandable=True,
            expanded=True,
            label='Compute Regression')
        self.add_input(self.regression_container)
        self.predictor_table_path = inputs.File(
            args_key='predictor_table_path',
            helptext=("A table that maps predictor IDs to files and their "
                      "types with required headers of 'id', 'path', and "
                      "'type'.  The file paths can be absolute, or relative "
                      "to the table."),
            label='Predictor Table',
            validator=self.validator)
        self.regression_container.add_input(self.predictor_table_path)
        self.scenario_predictor_table_path = inputs.File(
            args_key='scenario_predictor_table_path',
            helptext=("A table that maps predictor IDs to files and their "
                      "types with required headers of 'id', 'path', and "
                      "'type'.  The file paths can be absolute, or relative "
                      "to the table."),
            label='Scenario Predictor Table (optional)',
            validator=self.validator)
        self.regression_container.add_input(self.scenario_predictor_table_path)
        self.grid_container = inputs.Container(args_key='grid_aoi',
                                               expandable=True,
                                               expanded=True,
                                               label='Grid the AOI')
        self.add_input(self.grid_container)
        self.grid_type = inputs.Dropdown(args_key='grid_type',
                                         label='Grid Type',
                                         options=['square', 'hexagon'])
        self.grid_container.add_input(self.grid_type)
        self.cell_size = inputs.Text(
            args_key='cell_size',
            helptext=("The size of the grid units measured in the "
                      "projection units of the AOI. For example, UTM "
                      "projections use meters."),
            label='Cell Size',
            validator=self.validator)
        self.grid_container.add_input(self.cell_size)
コード例 #4
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label='Habitat Risk Assessment',
            target=hra.execute,
            validator=hra.validate,
            localdoc='../documentation/habitat_risk_assessment.html')

        self.csv_uri = inputs.Folder(
            args_key='csv_uri',
            helptext=(
                "A folder containing multiple CSV files.  Each file "
                "refers to the overlap between a habitat and a "
                "stressor pulled from habitat and stressor shapefiles "
                "during the run of the HRA Preprocessor."),
            label='Criteria Scores CSV Folder',
            validator=self.validator)
        self.add_input(self.csv_uri)
        self.grid_size = inputs.Text(
            args_key='grid_size',
            helptext=(
                "The size that should be used to grid the given "
                "habitat and stressor shapefiles into rasters.  This "
                "value will be the pixel size of the completed raster "
                "files."),
            label='Resolution of Analysis (meters)',
            validator=self.validator)
        self.add_input(self.grid_size)
        self.risk_eq = inputs.Dropdown(
            args_key='risk_eq',
            helptext=(
                "Each of these represents an option of a risk "
                "calculation equation.  This will determine the "
                "numeric output of risk for every habitat and stressor "
                "overlap area."),
            label='Risk Equation',
            options=['Multiplicative', 'Euclidean'])
        self.add_input(self.risk_eq)
        self.decay_eq = inputs.Dropdown(
            args_key='decay_eq',
            helptext=(
                "Each of these represents an option for decay "
                "equations for the buffered stressors.  If stressor "
                "buffering is desired, these equtions will determine "
                "the rate at which stressor data is reduced."),
            label='Decay Equation',
            options=['None', 'Linear', 'Exponential'])
        self.add_input(self.decay_eq)
        self.max_rating = inputs.Text(
            args_key='max_rating',
            helptext=(
                "This is the highest score that is used to rate a "
                "criteria within this model run.  These values would "
                "be placed within the Rating column of the habitat, "
                "species, and stressor CSVs."),
            label='Maximum Criteria Score',
            validator=self.validator)
        self.add_input(self.max_rating)
        self.max_stress = inputs.Text(
            args_key='max_stress',
            helptext=(
                "This is the largest number of stressors that are "
                "suspected to overlap.  This will be used in order to "
                "make determinations of low, medium, and high risk for "
                "any given habitat."),
            label='Maximum Overlapping Stressors',
            validator=self.validator)
        self.add_input(self.max_stress)
        self.aoi_tables = inputs.File(
            args_key='aoi_tables',
            helptext=(
                "An OGR-supported vector file containing feature "
                "subregions.  The program will create additional "
                "summary outputs across each subregion."),
            label='Subregions (Vector)',
            validator=self.validator)
        self.add_input(self.aoi_tables)
コード例 #5
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=MODEL_METADATA['fisheries_hst'].model_title,
            target=fisheries_hst.execute,
            validator=fisheries_hst.validate,
            localdoc=MODEL_METADATA['fisheries_hst'].userguide)

        self.alpha_only = inputs.Label(
            text=("This tool is in an ALPHA testing stage and should "
                  "not be used for decision making."))
        self.pop_cont = inputs.Container(args_key='pop_cont',
                                         expanded=True,
                                         label='Population Parameters')
        self.add_input(self.pop_cont)
        self.population_csv_path = inputs.File(
            args_key='population_csv_path',
            helptext=("A CSV file containing all necessary attributes for "
                      "population classes based on age/stage, sex, and area "
                      "- excluding possible migration "
                      "information.<br><br>See the 'Running the Model >> "
                      "Core Model >> Population Parameters' section in the "
                      "model's documentation for help on how to format this "
                      "file."),
            label='Population Parameters File (CSV)',
            validator=self.validator)
        self.pop_cont.add_input(self.population_csv_path)
        self.sexsp = inputs.Dropdown(
            args_key='sexsp',
            helptext=("Specifies whether or not the population classes "
                      "provided in the Populaton Parameters CSV file are "
                      "distinguished by sex."),
            label='Population Classes are Sex-Specific',
            options=['No', 'Yes'])
        self.pop_cont.add_input(self.sexsp)
        self.hab_cont = inputs.Container(args_key='hab_cont',
                                         expanded=True,
                                         label='Habitat Parameters')
        self.add_input(self.hab_cont)
        self.habitat_csv_dep_path = inputs.File(
            args_key='habitat_dep_csv_path',
            helptext=("A CSV file containing the habitat dependencies (0-1) "
                      "for each life stage or age and for each habitat type "
                      "included in the Habitat Change CSV File.<br><br>See "
                      "the 'Running the Model >> Habitat Scenario Tool >> "
                      "Habitat Parameters' section in the model's "
                      "documentation for help on how to format this file."),
            label='Habitat Dependency Parameters File (CSV)',
            validator=self.validator)
        self.hab_cont.add_input(self.habitat_csv_dep_path)
        self.habitat_chg_csv_path = inputs.File(
            args_key='habitat_chg_csv_path',
            helptext=("A CSV file containing the percent changes in habitat "
                      "area by subregion (if applicable). The habitats "
                      "included should be those which the population depends "
                      "on at any life stage.<br><br>See the 'Running the "
                      "Model >> Habitat Scenario Tool >> Habitat Parameters' "
                      "section in the model's documentation for help on how "
                      "to format this file."),
            label='Habitat Area Change File (CSV)',
            validator=self.validator)
        self.hab_cont.add_input(self.habitat_chg_csv_path)
        self.gamma = inputs.Text(
            args_key='gamma',
            helptext=("Gamma describes the relationship between a change in "
                      "habitat area and a change in survival of life stages "
                      "dependent on that habitat.  Specify a value between 0 "
                      "and 1.<br><br>See the documentation for advice on "
                      "selecting a gamma value."),
            label='Gamma',
            validator=self.validator)
        self.hab_cont.add_input(self.gamma)
コード例 #6
0
    def __init__(self):
        model.InVESTModel.__init__(self,
                                   label=u'Scenic Quality',
                                   target=scenic_quality.execute,
                                   validator=scenic_quality.validate,
                                   localdoc=u'scenic_quality.html')

        self.general_tab = inputs.Container(interactive=True, label=u'General')
        self.add_input(self.general_tab)
        self.aoi_path = inputs.File(
            args_key=u'aoi_path',
            helptext=(u"An OGR-supported vector file.  This AOI instructs "
                      u"the model where to clip the input data and the extent "
                      u"of analysis.  Users will create a polygon feature "
                      u"layer that defines their area of interest.  The AOI "
                      u"must intersect the Digital Elevation Model (DEM)."),
            label=u'Area of Interest (Vector) (Required)',
            validator=self.validator)
        self.general_tab.add_input(self.aoi_path)
        self.structure_path = inputs.File(
            args_key=u'structure_path',
            helptext=(u"An OGR-supported vector file.  The user must specify "
                      u"a point feature layer that indicates locations of "
                      u"objects that contribute to negative scenic quality, "
                      u"such as aquaculture netpens or wave energy "
                      u"facilities.  In order for the viewshed analysis to "
                      u"run correctly, the projection of this input must be "
                      u"consistent with the project of the DEM input."),
            label=u'Features Impacting Scenic Quality (Vector) (Required)',
            validator=self.validator)
        self.general_tab.add_input(self.structure_path)
        self.dem_path = inputs.File(
            args_key=u'dem_path',
            helptext=(u"A GDAL-supported raster file.  An elevation raster "
                      u"layer is required to conduct viewshed analysis. "
                      u"Elevation data allows the model to determine areas "
                      u"within the AOI's land-seascape where point features "
                      u"contributing to negative scenic quality are visible."),
            label=u'Digital Elevation Model (Raster) (Required)',
            validator=self.validator)
        self.general_tab.add_input(self.dem_path)
        self.refraction = inputs.Text(
            args_key=u'refraction',
            helptext=(u"The earth curvature correction option corrects for "
                      u"the curvature of the earth and refraction of visible "
                      u"light in air.  Changes in air density curve the light "
                      u"downward causing an observer to see further and the "
                      u"earth to appear less curved.  While the magnitude of "
                      u"this effect varies with atmospheric conditions, a "
                      u"standard rule of thumb is that refraction of visible "
                      u"light reduces the apparent curvature of the earth by "
                      u"one-seventh.  By default, this model corrects for the "
                      u"curvature of the earth and sets the refractivity "
                      u"coefficient to 0.13."),
            label=u'Refractivity Coefficient (Required)',
            validator=self.validator)
        self.general_tab.add_input(self.refraction)
        self.valuation_container = inputs.Container(args_key=u'do_valuation',
                                                    expandable=True,
                                                    expanded=False,
                                                    interactive=True,
                                                    label=u'Valuation')
        self.add_input(self.valuation_container)
        self.valuation_function = inputs.Dropdown(
            args_key=u'valuation_function',
            helptext=(u"This field indicates the functional form f(x) the "
                      u"model will use to value the visual impact for each "
                      u"viewpoint."),
            label=u'Valuation Function',
            options=[
                u'linear: a + bx', u'logarithmic: a + b log(x+1)',
                u'exponential: a * e^(-bx)'
            ])
        self.valuation_container.add_input(self.valuation_function)
        self.a_coefficient = inputs.Text(
            args_key=u'a_coef',
            helptext=(u"First coefficient used by the valuation function"),
            label=u"'a' Coefficient (Required)",
            validator=self.validator)
        self.valuation_container.add_input(self.a_coefficient)
        self.b_coefficient = inputs.Text(
            args_key=u'b_coef',
            helptext=(u"Second coefficient used by the valuation function"),
            label=u"'b' Coefficient (Required)",
            validator=self.validator)
        self.valuation_container.add_input(self.b_coefficient)
        self.max_valuation_radius = inputs.Text(
            args_key=u'max_valuation_radius',
            helptext=(u"Radius beyond which the valuation is set to zero. "
                      u"The valuation function 'f' cannot be negative at the "
                      u"radius 'r' (f(r)>=0)."),
            label=u'Maximum Valuation Radius (meters) (Required)',
            validator=self.validator)
        self.valuation_container.add_input(self.max_valuation_radius)
コード例 #7
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label='Scenario Generator',
            target=natcap.invest.scenario_generator.scenario_generator.execute,
            validator=natcap.invest.scenario_generator.scenario_generator.
            validate,
            localdoc='../documentation/scenario_generator.html',
            suffix_args_key='suffix',
        )
        self.landcover = inputs.File(
            args_key='landcover',
            helptext=
            'A GDAL-supported raster file representing land-use/land-cover.',
            label='Land Cover (Raster)',
            validator=self.validator)
        self.add_input(self.landcover)
        self.transition = inputs.File(
            args_key='transition',
            helptext=("This table contains the land-cover transition "
                      "likelihoods, priority of transitions, area change, "
                      "proximity suitiblity, proximity effect distance, seed "
                      "size, short name, and patch size."),
            label='Transition Table (CSV)',
            validator=self.validator)
        self.add_input(self.transition)
        self.calculate_priorities = inputs.Checkbox(
            args_key='calculate_priorities',
            helptext=("This option enables calculation of the land-cover "
                      "priorities using analytical hierarchical processing. "
                      "A matrix table must be entered below.  Optionally, "
                      "the priorities can manually be entered in the "
                      "priority column of the land attributes table."),
            interactive=False,
            label='Calculate Priorities')
        self.add_input(self.calculate_priorities)
        self.priorities_csv_uri = inputs.File(
            args_key='priorities_csv_uri',
            helptext=("This table contains a matrix of land-cover type "
                      "pairwise priorities used to calculate land-cover "
                      "priorities."),
            interactive=False,
            label='Priorities Table (CSV)',
            validator=self.validator)
        self.add_input(self.priorities_csv_uri)
        self.calculate_proximity = inputs.Container(
            args_key='calculate_proximity',
            expandable=True,
            expanded=True,
            label='Proximity')
        self.add_input(self.calculate_proximity)
        self.calculate_transition = inputs.Container(
            args_key='calculate_transition',
            expandable=True,
            expanded=True,
            label='Specify Transitions')
        self.add_input(self.calculate_transition)
        self.calculate_factors = inputs.Container(args_key='calculate_factors',
                                                  expandable=True,
                                                  expanded=True,
                                                  label='Use Factors')
        self.add_input(self.calculate_factors)
        self.suitability_folder = inputs.Folder(args_key='suitability_folder',
                                                label='Factors Folder',
                                                validator=self.validator)
        self.calculate_factors.add_input(self.suitability_folder)
        self.suitability = inputs.File(
            args_key='suitability',
            helptext=("This table lists the factors that determine "
                      "suitability of the land-cover for change, and "
                      "includes: the factor name, layer name, distance of "
                      "influence, suitability value, weight of the factor, "
                      "distance breaks, and applicable land-cover."),
            label='Factors Table',
            validator=self.validator)
        self.calculate_factors.add_input(self.suitability)
        self.weight = inputs.Text(
            args_key='weight',
            helptext=("The factor weight is a value between 0 and 1 which "
                      "determines the weight given to the factors vs.  the "
                      "expert opinion likelihood rasters.  For example, if a "
                      "weight of 0.3 is entered then 30% of the final "
                      "suitability is contributed by the factors and the "
                      "likelihood matrix contributes 70%.  This value is "
                      "entered on the tool interface."),
            label='Factor Weight',
            validator=self.validator)
        self.calculate_factors.add_input(self.weight)
        self.factor_inclusion = inputs.Dropdown(
            args_key='factor_inclusion',
            helptext='',
            interactive=False,
            label='Rasterization Method',
            options=[
                'All touched pixels', 'Only pixels with covered center points'
            ])
        self.calculate_factors.add_input(self.factor_inclusion)
        self.calculate_constraints = inputs.Container(
            args_key='calculate_constraints',
            expandable=True,
            label='Constraints Layer')
        self.add_input(self.calculate_constraints)
        self.constraints = inputs.File(
            args_key='constraints',
            helptext=("An OGR-supported vector file.  This is a vector "
                      "layer which indicates the parts of the landscape that "
                      "are protected of have constraints to land-cover "
                      "change.  The layer should have one field named "
                      "'porosity' with a value between 0 and 1 where 0 means "
                      "its fully protected and 1 means its fully open to "
                      "change."),
            label='Constraints Layer (Vector)',
            validator=self.validator)
        self.calculate_constraints.add_input(self.constraints)
        self.constraints.sufficiency_changed.connect(
            self._load_colnames_constraints)
        self.constraints_field = inputs.Dropdown(
            args_key='constraints_field',
            helptext=("The field from the override table that contains the "
                      "value for the override."),
            interactive=False,
            options=('UNKNOWN', ),
            label='Constraints Field')
        self.calculate_constraints.add_input(self.constraints_field)
        self.override_layer = inputs.Container(args_key='override_layer',
                                               expandable=True,
                                               expanded=True,
                                               label='Override Layer')
        self.add_input(self.override_layer)
        self.override = inputs.File(
            args_key='override',
            helptext=("An OGR-supported vector file.  This is a vector "
                      "(polygon) layer with land-cover types in the same "
                      "scale and projection as the input land-cover.  This "
                      "layer is used to override all the changes and is "
                      "applied after the rule conversion is complete."),
            label='Override Layer (Vector)',
            validator=self.validator)
        self.override_layer.add_input(self.override)
        self.override.sufficiency_changed.connect(self._load_colnames_override)
        self.override_field = inputs.Dropdown(
            args_key='override_field',
            helptext=("The field from the override table that contains the "
                      "value for the override."),
            interactive=False,
            options=('UNKNOWN', ),
            label='Override Field')
        self.override_layer.add_input(self.override_field)
        self.override_inclusion = inputs.Dropdown(
            args_key='override_inclusion',
            helptext='',
            interactive=False,
            label='Rasterization Method',
            options=[
                'All touched pixels', 'Only pixels with covered center points'
            ])
        self.override_layer.add_input(self.override_inclusion)
        self.seed = inputs.Text(
            args_key='seed',
            helptext=("Seed must be an integer or blank.  <br/><br/>Under "
                      "normal conditions, parcels with the same suitability "
                      "are picked in a random order.  Setting the seed value "
                      "allows the scenario generator to randomize the order "
                      "in which parcels are picked, but two runs with the "
                      "same seed will pick parcels in the same order."),
            label='Seed for random parcel selection (optional)',
            validator=self.validator)
        self.add_input(self.seed)

        # Set interactivity, requirement as input sufficiency changes
        self.transition.sufficiency_changed.connect(
            self.calculate_priorities.set_interactive)
        self.calculate_priorities.sufficiency_changed.connect(
            self.priorities_csv_uri.set_interactive)
        self.calculate_factors.sufficiency_changed.connect(
            self.factor_inclusion.set_interactive)
        self.constraints.sufficiency_changed.connect(
            self.constraints_field.set_interactive)
        self.override.sufficiency_changed.connect(
            self.override_field.set_interactive)
        self.override_field.sufficiency_changed.connect(
            self.override_inclusion.set_interactive)
コード例 #8
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=u'Wave Energy',
            target=natcap.invest.wave_energy.execute,
            validator=natcap.invest.wave_energy.validate,
            localdoc=u'wave_energy.html')

        self.wave_base_data = inputs.Folder(
            args_key=u'wave_base_data_path',
            helptext=(u'Select the folder that has the packaged Wave Energy '
                      u'Data.'),
            label=u'Wave Base Data Folder',
            validator=self.validator)
        self.add_input(self.wave_base_data)
        self.analysis_area = inputs.Dropdown(
            args_key=u'analysis_area_path',
            helptext=(u"A list of analysis areas for which the model can "
                      u"currently be run.  All the wave energy data needed "
                      u"for these areas are pre-packaged in the WaveData "
                      u"folder."),
            label=u'Analysis Area',
            options=(u'West Coast of North America and Hawaii',
                     u'East Coast of North America and Puerto Rico',
                     u'North Sea 4 meter resolution',
                     u'North Sea 10 meter resolution', u'Australia',
                     u'Global'))
        self.add_input(self.analysis_area)
        self.aoi = inputs.File(
            args_key=u'aoi_path',
            helptext=(u"An OGR-supported vector file containing a single "
                      u"polygon representing the area of interest.  This "
                      u"input is required for computing valuation and is "
                      u"recommended for biophysical runs as well.  The AOI "
                      u"should be projected in linear units of meters."),
            label=u'Area of Interest (Vector)',
            validator=self.validator)
        self.add_input(self.aoi)
        self.machine_perf_table = inputs.File(
            args_key=u'machine_perf_path',
            helptext=(u"A CSV Table that has the performance of a particular "
                      u"wave energy machine at certain sea state conditions."),
            label=u'Machine Performance Table (CSV)',
            validator=self.validator)
        self.add_input(self.machine_perf_table)
        self.machine_param_table = inputs.File(
            args_key=u'machine_param_path',
            helptext=(u"A CSV Table that has parameter values for a wave "
                      u"energy machine.  This includes information on the "
                      u"maximum capacity of the device and the upper limits "
                      u"for wave height and period."),
            label=u'Machine Parameter Table (CSV)',
            validator=self.validator)
        self.add_input(self.machine_param_table)
        self.dem = inputs.File(
            args_key=u'dem_path',
            helptext=(u"A GDAL-supported raster file containing a digital "
                      u"elevation model dataset that has elevation values in "
                      u"meters.  Used to get the cable distance for wave "
                      u"energy transmission."),
            label=u'Global Digital Elevation Model (Raster)',
            validator=self.validator)
        self.add_input(self.dem)
        self.valuation_container = inputs.Container(
            args_key=u'valuation_container',
            expandable=True,
            expanded=False,
            label=u'Valuation')
        self.add_input(self.valuation_container)
        self.land_grid_points = inputs.File(
            args_key=u'land_gridPts_path',
            helptext=(u"A CSV Table that has the landing points and grid "
                      u"points locations for computing cable distances."),
            label=u'Grid Connection Points File (CSV)',
            validator=self.validator)
        self.valuation_container.add_input(self.land_grid_points)
        self.machine_econ_table = inputs.File(
            args_key=u'machine_econ_path',
            helptext=(u"A CSV Table that has the economic parameters for the "
                      u"wave energy machine."),
            label=u'Machine Economic Table (CSV)',
            validator=self.validator)
        self.valuation_container.add_input(self.machine_econ_table)
        self.number_of_machines = inputs.Text(
            args_key=u'number_of_machines',
            helptext=(u"An integer for how many wave energy machines will be "
                      u"in the wave farm."),
            label=u'Number of Machines',
            validator=self.validator)
        self.valuation_container.add_input(self.number_of_machines)
コード例 #9
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=MODEL_METADATA['coastal_vulnerability'].model_title,
            target=coastal_vulnerability.execute,
            validator=coastal_vulnerability.validate,
            localdoc=MODEL_METADATA['coastal_vulnerability'].userguide)

        self.aoi_vector_path = inputs.File(
            args_key='aoi_vector_path',
            helptext=("Path to a polygon vector that is projected in "
                      "a coordinate system with units of meters. "
                      "Shore points will be created along all landmasses "
                      "within the AOI polygon(s)."),
            label='Area of Interest (Vector)',
            validator=self.validator)
        self.add_input(self.aoi_vector_path)

        self.model_resolution = inputs.Text(
            args_key='model_resolution',
            helptext=("Distance in meters between each shore point, "
                      "as measured along the landmass polygon coastline."),
            label='Model resolution (meters)',
            validator=self.validator)
        self.add_input(self.model_resolution)

        self.landmass_vector_path = inputs.File(
            args_key='landmass_vector_path',
            helptext=("Path to a polygon vector representing landmasses "
                      "in the region of interest."),
            label='Landmass (Vector)',
            validator=self.validator)
        self.add_input(self.landmass_vector_path)

        self.wwiii_vector_path = inputs.File(
            args_key='wwiii_vector_path',
            helptext=("Path to a point vector containing wind and wave "
                      "data. This global dataset is provided with the InVEST "
                      "sample data."),
            label='WaveWatchIII (Vector)',
            validator=self.validator)
        self.add_input(self.wwiii_vector_path)

        self.max_fetch_distance = inputs.Text(
            args_key='max_fetch_distance',
            helptext=(
                "Maximum distance in meters to extend rays from shore points. "
                "Rays extend in 16 compass directions until they intersect "
                "land or reach this maximum distance. Fetch (or ray) length "
                "is a component of wind and wave exposure."),
            label='Maximum Fetch Distance (meters)',
            validator=self.validator)
        self.add_input(self.max_fetch_distance)

        self.bathymetry_raster_path = inputs.File(
            args_key='bathymetry_raster_path',
            helptext=(
                "Path to a raster representing bathymetry. "
                "Bathymetry values should be negative and units of meters. "
                "Positive values will be ignored."),
            label='Bathymetry (Raster)',
            validator=self.validator)
        self.add_input(self.bathymetry_raster_path)

        self.dem_path = inputs.File(
            args_key='dem_path',
            helptext=("Path to a raster representing elevation on land. "
                      "Negative values, if present, are treated as zeros. "
                      "If this input is unprojected, the model will project "
                      "it to match the AOI and resample it to a cell size "
                      "equal to the model resolution."),
            label='Digital Elevation Model (Raster)',
            validator=self.validator)
        self.add_input(self.dem_path)

        self.dem_averaging_radius = inputs.Text(
            args_key='dem_averaging_radius',
            helptext=("A radius around each shore point within which to "
                      "average the elevation values of the DEM raster. "),
            label='Elevation averaging radius (meters)',
            validator=self.validator)
        self.add_input(self.dem_averaging_radius)

        self.shelf_contour_vector_path = inputs.File(
            args_key='shelf_contour_vector_path',
            helptext=(
                "Path to a polyline vector delineating the edge "
                "of the continental shelf or another bathymetry contour. "),
            label='Continental Shelf Contour (Vector)',
            validator=self.validator)
        self.add_input(self.shelf_contour_vector_path)

        self.habitat_table_path = inputs.File(
            args_key='habitat_table_path',
            helptext=(
                "Path to a CSV file that specifies habitat layer input data "
                "and parameters."),
            label='Habitats Table (CSV)',
            validator=self.validator)
        self.add_input(self.habitat_table_path)

        self.geomorphology_vector_path = inputs.File(
            args_key='geomorphology_vector_path',
            helptext=("Path to a polyline vector that has a field called "
                      "'RANK' with values from 1 to 5. "),
            label='Geomorphology (Vector) (optional)',
            validator=self.validator)
        self.add_input(self.geomorphology_vector_path)

        self.geomorphology_fill_value = inputs.Dropdown(
            args_key='geomorphology_fill_value',
            helptext=(
                "A value from 1 to 5 that will be used as a geomorphology "
                "rank for any points not proximate (given the model "
                "resolution) to the geomorphology_vector_path."),
            label='Geomorphology fill value',
            interactive=False,
            options=('1', '2', '3', '4', '5'))
        self.add_input(self.geomorphology_fill_value)

        self.population_raster_path = inputs.File(
            args_key='population_raster_path',
            helptext=(
                "Path to a raster with values representing totals per pixel. "
                "If this input is unprojected, the model will project "
                "it to match the AOI and resample it to a cell size "
                "equal to the model resolution."),
            label='Human Population (Raster) (optional)',
            validator=self.validator)
        self.add_input(self.population_raster_path)

        self.population_radius = inputs.Text(
            args_key='population_radius',
            helptext=("A radius around each shore point within which to "
                      "compute the average population density."),
            label='Population search radius (meters)',
            interactive=False,
            validator=self.validator)
        self.add_input(self.population_radius)

        self.slr_vector_path = inputs.File(
            args_key='slr_vector_path',
            helptext=(
                "Path to a point vector with a field of sea-level-rise rates"
                "or amounts."),
            label='Sea Level Rise (Vector) (optional)',
            validator=self.validator)
        self.add_input(self.slr_vector_path)

        self.slr_field = inputs.Dropdown(
            args_key='slr_field',
            helptext=("The name of a field in the SLR vector table"
                      "from which to load values"),
            label='Sea Level Rise fieldname',
            interactive=False,
            options=(
                'UNKNOWN', ))  # No options until valid OGR vector provided
        self.add_input(self.slr_field)

        # Set interactivity requirement as input sufficiency changes
        self.slr_vector_path.sufficiency_changed.connect(
            self.slr_field.set_interactive)
        self.slr_vector_path.sufficiency_changed.connect(self._load_colnames)
        self.geomorphology_vector_path.sufficiency_changed.connect(
            self.geomorphology_fill_value.set_interactive)
        self.population_raster_path.sufficiency_changed.connect(
            self.population_radius.set_interactive)
コード例 #10
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label='Habitat Risk Assessment',
            target=hra.execute,
            validator=hra.validate,
            localdoc='../documentation/habitat_risk_assessment.html')

        self.info_table_path = inputs.File(
            args_key='info_table_path',
            helptext=(
                "A CSV or Excel file that contains the name of the habitat "
                "(H) or stressor (s) on the `NAME` column that matches the "
                "names in `criteria_table_path`. Each H/S has its "
                "corresponding vector or raster path on the `PATH` column. "
                "The `STRESSOR BUFFER (meters)` column should have a buffer "
                "value if the `TYPE` column is a stressor."),
            label='Habitat Stressor Information CSV or Excel File',
            validator=self.validator)
        self.add_input(self.info_table_path)
        self.criteria_table_path = inputs.File(
            args_key='criteria_table_path',
            helptext=(
                "A CSV or Excel file that contains the set of criteria "
                "ranking  (rating, DQ and weight) of each stressor on each "
                "habitat, as well as the habitat resilience attributes."),
            label='Criteria Scores CSV or Excel File',
            validator=self.validator)
        self.add_input(self.criteria_table_path)
        self.resolution = inputs.Text(
            args_key='resolution',
            helptext=(
                "The size that should be used to grid the given habitat and "
                "stressor files into rasters. This value will be the pixel "
                "size of the completed raster files."),
            label='Resolution of Analysis (meters)',
            validator=self.validator)
        self.add_input(self.resolution)
        self.max_rating = inputs.Text(
            args_key='max_rating',
            helptext=(
                "This is the highest score that is used to rate a criteria "
                "within this model run. This value would be used to compare "
                "with the values within Rating column of the Criteria Scores "
                "table."),
            label='Maximum Criteria Score',
            validator=self.validator)
        self.add_input(self.max_rating)
        self.risk_eq = inputs.Dropdown(
            args_key='risk_eq',
            helptext=(
                "Each of these represents an option of a risk calculation "
                "equation. This will determine the numeric output of risk "
                "for every habitat and stressor overlap area."),
            label='Risk Equation',
            options=['Multiplicative', 'Euclidean'])
        self.add_input(self.risk_eq)
        self.decay_eq = inputs.Dropdown(
            args_key='decay_eq',
            helptext=(
                "Each of these represents an option of a decay equation "
                "for the buffered stressors. If stressor buffering is "
                "desired, this equation will determine the rate at which "
                "stressor data is reduced."),
            label='Decay Equation',
            options=['None', 'Linear', 'Exponential'])
        self.add_input(self.decay_eq)
        self.aoi_vector_path = inputs.File(
            args_key='aoi_vector_path',
            helptext=(
                "An OGR-supported vector file containing feature containing "
                "one or more planning regions. subregions. An optional field "
                "called `name` could be added to compute average risk values "
                "within each subregion."),
            label='Area of Interest (Vector)',
            validator=self.validator)
        self.add_input(self.aoi_vector_path)
        self.visualize_outputs = inputs.Checkbox(
            args_key='visualize_outputs',
            helptext=(
                "Check to enable the generation of GeoJSON outputs. This "
                "could be used to visualize the risk scores on a map in the "
                "HRA visualization web application."),
            label='Generate GeoJSONs for Web Visualization')
        self.add_input(self.visualize_outputs)
コード例 #11
0
ファイル: cv.py プロジェクト: jandrewjohnson/hazelbean
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label='Coastal Vulnerability Assessment Tool',
            target=coastal_vulnerability.execute,
            validator=coastal_vulnerability.validate,
            localdoc='../documentation/coastal_vulnerability.html',
            suffix_args_key='suffix'
        )

        self.general_tab = inputs.Container(
            interactive=True,
            label='General')
        self.add_input(self.general_tab)
        self.area_computed = inputs.Dropdown(
            args_key='area_computed',
            helptext=(
                "Determine if the output data is about all the coast "
                "or about sheltered segments only."),
            label='Output Area: Sheltered/Exposed?',
            options=['both', 'sheltered'])
        self.general_tab.add_input(self.area_computed)
        self.area_of_interest = inputs.File(
            args_key='aoi_uri',
            helptext=(
                "An OGR-supported, single-feature polygon vector "
                "file.  All outputs will be in the AOI's projection."),
            label='Area of Interest (Vector)',
            validator=self.validator)
        self.general_tab.add_input(self.area_of_interest)
        self.landmass_uri = inputs.File(
            args_key='landmass_uri',
            helptext=(
                "An OGR-supported vector file containing a landmass "
                "polygon from where the coastline will be extracted. "
                "The default is the global land polygon."),
            label='Land Polygon (Vector)',
            validator=self.validator)
        self.general_tab.add_input(self.landmass_uri)
        self.bathymetry_layer = inputs.File(
            args_key='bathymetry_uri',
            helptext=(
                "A GDAL-supported raster of the terrain elevation in "
                "the area of interest.  Used to compute depths along "
                "fetch rays, relief and surge potential."),
            label='Bathymetry Layer (Raster)',
            validator=self.validator)
        self.general_tab.add_input(self.bathymetry_layer)
        self.bathymetry_constant = inputs.Text(
            args_key='bathymetry_constant',
            helptext=(
                "Integer value between 1 and 5. If layer associated "
                "to this field is omitted, replace all shore points "
                "for this layer with a constant rank value in the "
                "computation of the coastal vulnerability index.  If "
                "both the file and value for the layer are omitted, "
                "the layer is skipped altogether."),
            label='Layer Value if Path Omitted',
            validator=self.validator)
        self.general_tab.add_input(self.bathymetry_constant)
        self.relief = inputs.File(
            args_key='relief_uri',
            helptext=(
                "A GDAL-supported raster file containing the land "
                "elevation used to compute the average land elevation "
                "within a user-defined radius (see Elevation averaging "
                "radius)."),
            label='Relief (Raster)',
            validator=self.validator)
        self.general_tab.add_input(self.relief)
        self.relief_constant = inputs.Text(
            args_key='relief_constant',
            helptext=(
                "Integer value between 1 and 5. If layer associated "
                "to this field is omitted, replace all shore points "
                "for this layer with a constant rank value in the "
                "computation of the coastal vulnerability index.  If "
                "both the file and value for the layer are omitted, "
                "the layer is skipped altogether."),
            label='Layer Value If Path Omitted',
            validator=self.validator)
        self.general_tab.add_input(self.relief_constant)
        self.cell_size = inputs.Text(
            args_key='cell_size',
            helptext=(
                "Cell size in meters.  The higher the value, the "
                "faster the computation, but the coarser the output "
                "rasters produced by the model."),
            label='Model Resolution (Segment Size)',
            validator=self.validator)
        self.general_tab.add_input(self.cell_size)
        self.depth_threshold = inputs.Text(
            args_key='depth_threshold',
            helptext=(
                "Depth in meters (integer) cutoff to determine if "
                "fetch rays project over deep areas."),
            label='Depth Threshold (meters)',
            validator=self.validator)
        self.general_tab.add_input(self.depth_threshold)
        self.exposure_proportion = inputs.Text(
            args_key='exposure_proportion',
            helptext=(
                "Minimum proportion of rays that project over exposed "
                "and/or deep areas need to classify a shore segment as "
                "exposed."),
            label='Exposure Proportion',
            validator=self.validator)
        self.general_tab.add_input(self.exposure_proportion)
        self.geomorphology_uri = inputs.File(
            args_key='geomorphology_uri',
            helptext=(
                "A OGR-supported polygon vector file that has a field "
                "called 'RANK' with values between 1 and 5 in the "
                "attribute table."),
            label='Geomorphology (Vector)',
            validator=self.validator)
        self.general_tab.add_input(self.geomorphology_uri)
        self.geomorphology_constant = inputs.Text(
            args_key='geomorphology_constant',
            helptext=(
                "Integer value between 1 and 5. If layer associated "
                "to this field is omitted, replace all shore points "
                "for this layer with a constant rank value in the "
                "computation of the coastal vulnerability index.  If "
                "both the file and value for the layer are omitted, "
                "the layer is skipped altogether."),
            label='Layer Value if Path Omitted',
            validator=self.validator)
        self.general_tab.add_input(self.geomorphology_constant)
        self.habitats_directory_uri = inputs.Folder(
            args_key='habitats_directory_uri',
            helptext=(
                "Directory containing OGR-supported polygon vectors "
                "associated with natural habitats.  The name of these "
                "shapefiles should be suffixed with the ID that is "
                "specified in the natural habitats CSV file provided "
                "along with the habitats."),
            label='Natural Habitats Directory',
            validator=self.validator)
        self.general_tab.add_input(self.habitats_directory_uri)
        self.habitats_csv_uri = inputs.File(
            args_key='habitats_csv_uri',
            helptext=(
                "A CSV file listing the attributes for each habitat. "
                "For more information, see 'Habitat Data Layer' "
                "section in the model's documentation.</a>."),
            interactive=False,
            label='Natural Habitats Table (CSV)',
            validator=self.validator)
        self.general_tab.add_input(self.habitats_csv_uri)
        self.habitats_constant = inputs.Text(
            args_key='habitat_constant',
            helptext=(
                "Integer value between 1 and 5. If layer associated "
                "to this field is omitted, replace all shore points "
                "for this layer with a constant rank value in the "
                "computation of the coastal vulnerability index.  If "
                "both the file and value for the layer are omitted, "
                "the layer is skipped altogether."),
            label='Layer Value if Path Omitted',
            validator=self.validator)
        self.general_tab.add_input(self.habitats_constant)
        self.climatic_forcing_uri = inputs.File(
            args_key='climatic_forcing_uri',
            helptext=(
                "An OGR-supported vector containing both wind and "
                "wave information across the region of interest."),
            label='Climatic Forcing Grid (Vector)',
            validator=self.validator)
        self.general_tab.add_input(self.climatic_forcing_uri)
        self.climatic_forcing_constant = inputs.Text(
            args_key='climatic_forcing_constant',
            helptext=(
                "Integer value between 1 and 5. If layer associated "
                "to this field is omitted, replace all shore points "
                "for this layer with a constant rank value in the "
                "computation of the coastal vulnerability index.  If "
                "both the file and value for the layer are omitted, "
                "the layer is skipped altogether."),
            label='Layer Value if Path Omitted',
            validator=self.validator)
        self.general_tab.add_input(self.climatic_forcing_constant)
        self.continental_shelf_uri = inputs.File(
            args_key='continental_shelf_uri',
            helptext=(
                "An OGR-supported polygon vector delineating the "
                "edges of the continental shelf.  Default is global "
                "continental shelf shapefile.  If omitted, the user "
                "can specify depth contour.  See entry below."),
            label='Continental Shelf (Vector)',
            validator=self.validator)
        self.general_tab.add_input(self.continental_shelf_uri)
        self.depth_contour = inputs.Text(
            args_key='depth_contour',
            helptext=(
                "Used to delineate shallow and deep areas. "
                "Continental shelf limit is at about 150 meters."),
            label='Depth Countour Level (meters)',
            validator=self.validator)
        self.general_tab.add_input(self.depth_contour)
        self.sea_level_rise_uri = inputs.File(
            args_key='sea_level_rise_uri',
            helptext=(
                "An OGR-supported point or polygon vector file "
                "containing features with 'Trend' fields in the "
                "attributes table."),
            label='Sea Level Rise (Vector)',
            validator=self.validator)
        self.general_tab.add_input(self.sea_level_rise_uri)
        self.sea_level_rise_constant = inputs.Text(
            args_key='sea_level_rise_constant',
            helptext=(
                "Integer value between 1 and 5. If layer associated "
                "to this field is omitted, replace all shore points "
                "for this layer with a constant rank value in the "
                "computation of the coastal vulnerability index.  If "
                "both the file and value for the layer are omitted, "
                "the layer is skipped altogether."),
            label='Layer Value if Path Omitted',
            validator=self.validator)
        self.general_tab.add_input(self.sea_level_rise_constant)
        self.structures_uri = inputs.File(
            args_key='structures_uri',
            helptext=(
                "An OGR-supported vector file containing rigid "
                "structures used to identify the portions of the coast "
                "that is armored."),
            label='Structures (Vectors)',
            validator=self.validator)
        self.general_tab.add_input(self.structures_uri)
        self.structures_constant = inputs.Text(
            args_key='structures_constant',
            helptext=(
                "Integer value between 1 and 5. If layer associated "
                "to this field is omitted, replace all shore points "
                "for this layer with a constant rank value in the "
                "computation of the coastal vulnerability index.  If "
                "both the file and value for the layer are omitted, "
                "the layer is skipped altogether."),
            label='Layer Value if Path Omitted',
            validator=self.validator)
        self.general_tab.add_input(self.structures_constant)
        self.population_uri = inputs.File(
            args_key='population_uri',
            helptext=(
                'A GDAL-supported raster file representing the population '
                'density.'),
            label='Population Layer (Raster)',
            validator=self.validator)
        self.general_tab.add_input(self.population_uri)
        self.urban_center_threshold = inputs.Text(
            args_key='urban_center_threshold',
            helptext=(
                "Minimum population required to consider the shore "
                "segment a population center."),
            label='Min. Population in Urban Centers',
            validator=self.validator)
        self.general_tab.add_input(self.urban_center_threshold)
        self.additional_layer_uri = inputs.File(
            args_key='additional_layer_uri',
            helptext=(
                "An OGR-supported vector file representing sea level "
                "rise, and will be used in the computation of coastal "
                "vulnerability and coastal vulnerability without "
                "habitat."),
            label='Additional Layer (Vector)',
            validator=self.validator)
        self.general_tab.add_input(self.additional_layer_uri)
        self.additional_layer_constant = inputs.Text(
            args_key='additional_layer_constant',
            helptext=(
                "Integer value between 1 and 5. If layer associated "
                "to this field is omitted, replace all shore points "
                "for this layer with a constant rank value in the "
                "computation of the coastal vulnerability index.  If "
                "both the file and value for the layer are omitted, "
                "the layer is skipped altogether."),
            label='Layer Value if Path Omitted',
            validator=self.validator)
        self.general_tab.add_input(self.additional_layer_constant)
        self.advanced_tab = inputs.Container(
            interactive=True,
            label='Advanced')
        self.add_input(self.advanced_tab)
        self.elevation_averaging_radius = inputs.Text(
            args_key='elevation_averaging_radius',
            helptext=(
                "Distance in meters (integer). Each pixel average "
                "elevation will be computed within this radius."),
            label='Elevation Averaging Radius (meters)',
            validator=self.validator)
        self.advanced_tab.add_input(self.elevation_averaging_radius)
        self.mean_sea_level_datum = inputs.Text(
            args_key='mean_sea_level_datum',
            helptext=(
                "Height in meters (integer). This input is the "
                "elevation of Mean Sea Level (MSL) datum relative to "
                "the datum of the bathymetry layer.  The model "
                "transforms all depths to MSL datum.  A positive value "
                "means the MSL is higher than the bathymetry's zero "
                "(0) elevation, so the value is subtracted from the "
                "bathymetry."),
            label='Mean Sea Level Datum (meters)',
            validator=self.validator)
        self.advanced_tab.add_input(self.mean_sea_level_datum)
        self.rays_per_sector = inputs.Text(
            args_key='rays_per_sector',
            helptext=(
                "Number of rays used to subsample the fetch distance "
                "within each of the 16 sectors."),
            label='Rays per Sector',
            validator=self.validator)
        self.advanced_tab.add_input(self.rays_per_sector)
        self.max_fetch = inputs.Text(
            args_key='max_fetch',
            helptext=(
                'Maximum fetch distance computed by the model '
                '(&gt;=60,000m).'),
            label='Maximum Fetch Distance (meters)',
            validator=self.validator)
        self.advanced_tab.add_input(self.max_fetch)
        self.spread_radius = inputs.Text(
            args_key='spread_radius',
            helptext=(
                "Integer multiple of 'cell size'. The coast from the "
                "geomorphology layer could be of a better resolution "
                "than the global landmass, so the shores do not "
                "necessarily overlap.  To make them coincide, the "
                "shore from the geomorphology layer is widened by 1 or "
                "more pixels.  The value should be a multiple of 'cell "
                "size' that indicates how many pixels the coast from "
                "the geomorphology layer is widened.  The widening "
                "happens on each side of the coast (n pixels landward, "
                "and n pixels seaward)."),
            label='Coastal Overlap (meters)',
            validator=self.validator)
        self.advanced_tab.add_input(self.spread_radius)
        self.population_radius = inputs.Text(
            args_key='population_radius',
            helptext=(
                "Radius length in meters used to count the number of "
                "people leaving close to the coast."),
            label='Coastal Neighborhood (radius in meters)',
            validator=self.validator)
        self.advanced_tab.add_input(self.population_radius)

        # Set interactivity, requirement as input sufficiency changes
        self.habitats_directory_uri.sufficiency_changed.connect(
            self.habitats_csv_uri.set_interactive)
コード例 #12
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=u'Coastal Vulnerability',
            target=coastal_vulnerability.execute,
            validator=coastal_vulnerability.validate,
            localdoc=u'coastal_vulnerability.html')

        self.aoi_vector_path = inputs.File(
            args_key=u'aoi_vector_path',
            helptext=(
                u"path to a polygon vector that is projected in "
                u"a coordinate system with units of meters. "
                u"The polygon should intersect the landmass and "
                u"the shelf contour line"),
            label=u'Area of Interest (Vector)',
            validator=self.validator)
        self.add_input(self.aoi_vector_path)

        self.model_resolution = inputs.Text(
            args_key=u'model_resolution',
            helptext=(
                u"distance in meters at which the coastline "
                u"will be resolved. Coastline features smaller than this "
                u"distance will not be represented by the shoreline points. "
                u"Points will be spaced at intervals of half the model "
                u"resolution."),
            label=u'Model resolution (meters)',
            validator=self.validator)
        self.add_input(self.model_resolution)

        self.landmass_vector_path = inputs.File(
            args_key=u'landmass_vector_path',
            helptext=(
                u"path to a polygon vector representing landmasses "
                u"in the region of interest."),
            label=u'Landmass (Vector)',
            validator=self.validator)
        self.add_input(self.landmass_vector_path)

        self.wwiii_vector_path = inputs.File(
            args_key=u'wwiii_vector_path',
            helptext=(
                u"path to a point vector containing wind and wave "
                u"data. This global dataset is provided with the InVEST "
                u"sample data."),
            label=u'WaveWatchIII (Vector)',
            validator=self.validator)
        self.add_input(self.wwiii_vector_path)

        self.max_fetch_distance = inputs.Text(
            args_key=u'max_fetch_distance',
            helptext=(
                u"maximum distance in meters to extend rays from shore points. "
                u"Points with rays equal to this distance accumulate "
                u"ocean-driven wave exposure along those rays and "
                u"local-wind-driven wave exposure along the shorter rays."),
            label=u'Maximum Fetch Distance (meters)',
            validator=self.validator)
        self.add_input(self.max_fetch_distance)

        self.shelf_contour_vector_path = inputs.File(
            args_key=u'shelf_contour_vector_path',
            helptext=(
                u"path to a polygon or polyline vector delineating the edge "
                u"of the continental shelf or another bathymetry contour. "),
            label=u'Continental Shelf Contour (Vector)',
            validator=self.validator)
        self.add_input(self.shelf_contour_vector_path)

        self.dem_path = inputs.File(
            args_key=u'dem_path',
            helptext=(
                u"path to a raster representing elevation on land. "),
            label=u'Digital Elevation Model (Raster)',
            validator=self.validator)
        self.add_input(self.dem_path)

        self.dem_averaging_radius = inputs.Text(
            args_key=u'dem_averaging_radius',
            helptext=(
                u"a radius around each shore point within which to "
                u"average the elevation values of the DEM raster. "),
            label=u'Elevation averaging radius (meters)',
            validator=self.validator)
        self.add_input(self.dem_averaging_radius)

        self.habitat_table_path = inputs.File(
            args_key=u'habitat_table_path',
            helptext=(
                u"path to a CSV file that specifies habitat layer input data "
                u"and parameters."),
            label=u'Habitats Table (CSV)',
            validator=self.validator)
        self.add_input(self.habitat_table_path)

        self.geomorphology_vector_path = inputs.File(
            args_key=u'geomorphology_vector_path',
            helptext=(
                u"path to a polyline vector that has a field called "
                u"'RANK' with values from 1 to 5. "),
            label=u'Geomorphology (Vector) (optional)',
            validator=self.validator)
        self.add_input(self.geomorphology_vector_path)

        self.geomorphology_fill_value = inputs.Dropdown(
            args_key=u'geomorphology_fill_value',
            helptext=(
                u"a value from 1 to 5 that will be used as a geomorphology "
                u"rank for any points not proximate (given the model "
                u"resolution) to the geomorphology_vector_path."),
            label=u'Geomorphology fill value',
            interactive=False,
            options=('1', '2', '3', '4', '5'))
            # validator=self.validator)
        self.add_input(self.geomorphology_fill_value)

        self.population_raster_path = inputs.File(
            args_key=u'population_raster_path',
            helptext=(
                u"path to a raster with values representing totals per pixel."),
            label=u'Human Population (Raster) (optional)',
            validator=self.validator)
        self.add_input(self.population_raster_path)

        self.population_radius = inputs.Text(
            args_key=u'population_radius',
            helptext=(
                u"a radius around each shore point within which to "
                u"compute the average population density."),
            label=u'Population search radius (meters)',
            interactive=False,
            validator=self.validator)
        self.add_input(self.population_radius)

        self.slr_vector_path = inputs.File(
            args_key=u'slr_vector_path',
            helptext=(
                u"path to a point vector with a field of sea-level-rise rates"
                u"or amounts."),
            label=u'Sea Level Rise (Vector) (optional)',
            validator=self.validator)
        self.add_input(self.slr_vector_path)

        self.slr_field = inputs.Dropdown(
            args_key=u'slr_field',
            helptext=(
                u"the name of a field in the SLR vector table"
                u"from which to load values"),
            label=u'Sea Level Rise fieldname',
            interactive=False,
            options=('UNKNOWN',))  # No options until valid OGR vector provided
            # validator=self.validator)
        self.add_input(self.slr_field)

        # Set interactivity requirement as input sufficiency changes
        self.slr_vector_path.sufficiency_changed.connect(
            self.slr_field.set_interactive)
        self.slr_vector_path.sufficiency_changed.connect(
            self._load_colnames)
        self.geomorphology_vector_path.sufficiency_changed.connect(
            self.geomorphology_fill_value.set_interactive)
        self.population_raster_path.sufficiency_changed.connect(
            self.population_radius.set_interactive)
コード例 #13
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=u'Forest Carbon Edge Effect Model',
            target=natcap.invest.forest_carbon_edge_effect.execute,
            validator=natcap.invest.forest_carbon_edge_effect.validate,
            localdoc=u'forest_carbon_edge_effect.html')

        self.lulc_raster_path = inputs.File(
            args_key=u'lulc_raster_path',
            helptext=(u"A GDAL-supported raster file, with an integer LULC "
                      u"code for each cell."),
            label=u'Land-Use/Land-Cover Map (raster)',
            validator=self.validator)
        self.add_input(self.lulc_raster_path)
        self.biophysical_table_path = inputs.File(
            args_key=u'biophysical_table_path',
            helptext=(u"A CSV table containing model information "
                      u"corresponding to each of the land use classes in the "
                      u"LULC raster input.  It must contain the fields "
                      u"'lucode', 'is_tropical_forest', 'c_above'.  If the "
                      u"user selects 'all carbon pools' the table must also "
                      u"contain entries for 'c_below', 'c_soil', and "
                      u"'c_dead'.  See the InVEST Forest Carbon User's Guide "
                      u"for more information about these fields."),
            label=u'Biophysical Table (csv)',
            validator=self.validator)
        self.add_input(self.biophysical_table_path)
        self.pools_to_calculate = inputs.Dropdown(
            args_key=u'pools_to_calculate',
            helptext=(u"If 'all carbon pools' is selected then the headers "
                      u"'c_above', 'c_below', 'c_dead', 'c_soil' are used in "
                      u"the carbon pool calculation.  Otherwise only "
                      u"'c_above' is considered."),
            label=u'Carbon Pools to Calculate',
            options=[u'all carbon pools', u'above ground only'],
            return_value_map={
                'all carbon pools': 'all',
                'above ground only': 'above_ground'
            })
        self.add_input(self.pools_to_calculate)
        self.compute_forest_edge_effects = inputs.Checkbox(
            args_key=u'compute_forest_edge_effects',
            helptext=(u"If selected, will use the Chaplin-Kramer, et.  al "
                      u"method to account for above ground carbon stocks in "
                      u"tropical forest types indicated by a '1' in the "
                      u"'is_tropical_forest' field in the biophysical table."),
            label=u'Compute forest edge effects')
        self.add_input(self.compute_forest_edge_effects)
        self.tropical_forest_edge_carbon_model_vector_path = inputs.File(
            args_key=u'tropical_forest_edge_carbon_model_vector_path',
            helptext=(u"A shapefile with fields 'method', 'theta1', "
                      u"'theta2', 'theta3' describing the global forest "
                      u"carbon edge models.  Provided as default data for the "
                      u"model."),
            interactive=False,
            label=u'Global forest carbon edge regression models (vector)',
            validator=self.validator)
        self.add_input(self.tropical_forest_edge_carbon_model_vector_path)
        self.n_nearest_model_points = inputs.Text(
            args_key=u'n_nearest_model_points',
            helptext=(u"Used when calculating the biomass in a pixel.  This "
                      u"number determines the number of closest regression "
                      u"models that are used when calculating the total "
                      u"biomass.  Each local model is linearly weighted by "
                      u"distance such that the biomass in the pixel is a "
                      u"function of each of these points with the closest "
                      u"point having the highest effect."),
            interactive=False,
            label=u'Number of nearest model points to average',
            validator=self.validator)
        self.add_input(self.n_nearest_model_points)
        self.biomass_to_carbon_conversion_factor = inputs.Text(
            args_key=u'biomass_to_carbon_conversion_factor',
            helptext=(u"Number by which to scale forest edge biomass to "
                      u"convert to carbon.  Default value is 0.47 (according "
                      u"to IPCC 2006). This pertains to forest classes only; "
                      u"values in the biophysical table for non-forest "
                      u"classes should already be in terms of carbon, not "
                      u"biomass."),
            interactive=False,
            label=u'Forest Edge Biomass to Carbon Conversion Factor',
            validator=self.validator)
        self.add_input(self.biomass_to_carbon_conversion_factor)
        self.aoi_vector_path = inputs.File(
            args_key=u'aoi_vector_path',
            helptext=(u"This is a set of polygons that will be used to "
                      u"aggregate carbon values at the end of the run if "
                      u"provided."),
            label=u'Service areas of interest <em>(optional)</em> (vector)',
            validator=self.validator)
        self.add_input(self.aoi_vector_path)

        # Set interactivity, requirement as input sufficiency changes
        self.compute_forest_edge_effects.sufficiency_changed.connect(
            self.tropical_forest_edge_carbon_model_vector_path.set_interactive)
        self.compute_forest_edge_effects.sufficiency_changed.connect(
            self.n_nearest_model_points.set_interactive)
        self.compute_forest_edge_effects.sufficiency_changed.connect(
            self.biomass_to_carbon_conversion_factor.set_interactive)
コード例 #14
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label='Urban Cooling Model',
            target=natcap.invest.urban_cooling_model.execute,
            validator=natcap.invest.urban_cooling_model.validate,
            localdoc='urban_cooling_model.html')

        self.lulc_raster_path = inputs.File(
            args_key='lulc_raster_path',
            helptext=('Path to landcover raster.'),
            label='Land Use / Land Cover (Raster)',
            validator=self.validator)
        self.add_input(self.lulc_raster_path)

        self.ref_eto_raster_path = inputs.File(
            args_key='ref_eto_raster_path',
            helptext=('Path to evapotranspiration raster.'),
            label='Reference Evapotranspiration (Raster)',
            validator=self.validator)
        self.add_input(self.ref_eto_raster_path)

        self.aoi_vector_path = inputs.File(
            args_key='aoi_vector_path',
            helptext=('Path to desired AOI.'),
            label='Area of Interest (Vector)',
            validator=self.validator)
        self.add_input(self.aoi_vector_path)

        self.biophysical_table_path = inputs.File(
            args_key='biophysical_table_path',
            helptext=(
                "Table to map landcover codes to Shade, Kc, and Albedo "
                "values. Must contain the fields 'lucode', 'shade', 'kc', "
                "and 'albedo'."),
            label='Biophysical Table (CSV)',
            validator=self.validator)
        self.add_input(self.biophysical_table_path)

        self.t_ref = inputs.Text(
            args_key='t_ref',
            helptext=('Reference air temperature (real).'),
            label='Baseline air temperature (°C)',
            validator=self.validator)
        self.t_ref.set_value("21.5")
        self.add_input(self.t_ref)

        self.uhi_max = inputs.Text(
            args_key='uhi_max',
            label='Magnitude of the UHI effect (°C)',
            helptext=(
                "The magnitude of the urban heat island effect, in degrees "
                "C.  Example: the difference between the rural reference "
                "temperature and the maximum temperature observed in the "
                "city."),
            validator=self.validator)
        self.add_input(self.uhi_max)
        self.uhi_max.set_value("3.5")

        self.t_air_average_radius = inputs.Text(
            args_key='t_air_average_radius',
            label='Air Temperature Maximum Blending Distance (m).',
            helptext=(
                "Radius of the averaging filter for turning T_air_nomix "
                "into T_air"),
            validator=self.validator)
        self.add_input(self.t_air_average_radius)
        self.t_air_average_radius.set_value("2000")

        self.green_area_cooling_distance = inputs.Text(
            args_key='green_area_cooling_distance',
            label='Green Area Maximum Cooling Distance (m).',
            helptext=(
                "Distance (in m) over which large green areas (> 2 ha) "
                "will have a cooling effect."),
            validator=self.validator)
        self.add_input(self.green_area_cooling_distance)
        self.green_area_cooling_distance.set_value("1000")

        self.cc_method = inputs.Dropdown(
            label='Cooling Capacity Calculation Method',
            args_key='cc_method',
            helptext=(
                'The method selected here determines the predictor used for '
                'air temperature.  If <b>"Weighted Factors"</b> is '
                'selected, the Cooling Capacity calculations will use the '
                'weighted factors for shade, albedo and ETI as a predictor '
                'for daytime temperatures. <br/>'
                'Alternatively, if <b>"Building Intensity"</b> is selected, '
                'building intensity will be used as a predictor for nighttime '
                'temperature instead of shade, albedo and ETI.'
            ),
            options=('Weighted Factors', 'Building Intensity'),
            return_value_map={
                'Weighted Factors': 'factors',
                'Building Intensity': 'intensity',
            })
        self.cc_method.value_changed.connect(
            self._enable_cc_options)
        self.add_input(self.cc_method)

        self.energy_valuation_container = inputs.Container(
            args_key='do_energy_valuation',
            expandable=True,
            expanded=True,
            interactive=True,
            label='Run Energy Savings Valuation Model')
        self.add_input(self.energy_valuation_container)

        self.productivity_valuation_container = inputs.Container(
            args_key='do_productivity_valuation',
            expandable=True,
            expanded=True,
            interactive=True,
            label='Run Work Productivity Valuation Model')
        self.add_input(self.productivity_valuation_container)

        self.building_vector_path = inputs.File(
            args_key='building_vector_path',
            helptext=(
                "Path to a vector of building footprints that contains at "
                "least the field 'type'."),
            label='Building Footprints (Vector)',
            validator=self.validator)
        self.energy_valuation_container.add_input(self.building_vector_path)

        self.energy_consumption_table_path = inputs.File(
            args_key='energy_consumption_table_path',
            helptext=(
                "Path to a table that maps building types to energy "
                "consumption. Must contain at least the fields 'type' "
                "and 'consumption'."),
            label='Energy Consumption Table (CSV)',
            validator=self.validator)
        self.energy_valuation_container.add_input(self.energy_consumption_table_path)

        self.avg_rel_humidity = inputs.Text(
            args_key='avg_rel_humidity',
            label='Average relative humidity (0-100%)',
            helptext=(
                "The average relative humidity (0-100%)."),
            validator=self.validator)
        self.productivity_valuation_container.add_input(self.avg_rel_humidity)
        self.avg_rel_humidity.set_value("30")

        self.cooling_capacity_container = inputs.Container(
            expandable=True,
            expanded=True,
            interactive=True,
            label='Manually Adjust Cooling Capacity Index Weights'
        )
        self.add_input(self.cooling_capacity_container)

        self.cc_weight_shade = inputs.Text(
            args_key='cc_weight_shade',
            helptext=("Shade weight for cooling capacity index. "
                      "Default: 0.6"),
            label='Shade',
            validator=self.validator)
        self.cooling_capacity_container.add_input(self.cc_weight_shade)
        self.cc_weight_shade.set_value("0.6")

        self.cc_weight_albedo = inputs.Text(
            args_key='cc_weight_albedo',
            helptext=("Albedo weight for cooling capacity index. "
                      "Default: 0.2"),
            label='Albedo',
            validator=self.validator)
        self.cooling_capacity_container.add_input(self.cc_weight_albedo)
        self.cc_weight_albedo.set_value("0.2")

        self.cc_weight_eti = inputs.Text(
            args_key='cc_weight_eti',
            helptext=("Evapotranspiration index weight for cooling capacity. "
                      "Default: 0.2"),
            label='Evapotranspiration Index',
            validator=self.validator)
        self.cooling_capacity_container.add_input(self.cc_weight_eti)
        self.cc_weight_eti.set_value("0.2")
コード例 #15
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=MODEL_METADATA['routedem'].model_title,
            target=routedem.execute,
            validator=routedem.validate,
            localdoc=MODEL_METADATA['routedem'].userguide)

        self.dem_path = inputs.File(
            args_key='dem_path',
            helptext=(
                "A GDAL-supported raster file containing a base "
                "Digital Elevation Model to execute the routing "
                "functionality across."),
            label='Digital Elevation Model (Raster)',
            validator=self.validator)
        self.add_input(self.dem_path)
        self.dem_band_index = inputs.Text(
            args_key='dem_band_index',
            helptext=(
                'The band index to use from the raster. '
                'This positive integer is 1-based.'
                'Default: 1'),
            label='Band Index (optional)',
            validator=self.validator)
        self.dem_band_index.set_value(1)
        self.add_input(self.dem_band_index)
        self.calculate_slope = inputs.Checkbox(
            args_key='calculate_slope',
            helptext='If selected, calculates slope raster.',
            label='Calculate Slope')
        self.add_input(self.calculate_slope)
        self.algorithm = inputs.Dropdown(
            args_key='algorithm',
            label='Routing Algorithm',
            helptext=(
                'The routing algorithm to use. '
                '<ul><li>D8: all water flows directly into the most downhill '
                'of each of the 8 neighbors of a cell.</li>'
                '<li>MFD: Multiple Flow Direction. Fractional flow is '
                'modelled between pixels.</li></ul>'),
            options=('D8', 'MFD'))
        self.add_input(self.algorithm)
        self.calculate_flow_direction = inputs.Checkbox(
            args_key='calculate_flow_direction',
            helptext='Select to calculate flow direction',
            label='Calculate Flow Direction')
        self.add_input(self.calculate_flow_direction)
        self.calculate_flow_accumulation = inputs.Checkbox(
            args_key='calculate_flow_accumulation',
            helptext='Select to calculate flow accumulation.',
            label='Calculate Flow Accumulation',
            interactive=False)
        self.add_input(self.calculate_flow_accumulation)
        self.calculate_stream_threshold = inputs.Checkbox(
            args_key='calculate_stream_threshold',
            helptext='Select to calculate a stream threshold to flow accumulation.',
            interactive=False,
            label='Calculate Stream Thresholds')
        self.add_input(self.calculate_stream_threshold)
        self.threshold_flow_accumulation = inputs.Text(
            args_key='threshold_flow_accumulation',
            helptext=(
                "The number of upslope cells that must flow into a "
                "cell before it's classified as a stream."),
            interactive=False,
            label='Threshold Flow Accumulation Limit',
            validator=self.validator)
        self.add_input(self.threshold_flow_accumulation)
        self.calculate_downslope_distance = inputs.Checkbox(
            args_key='calculate_downslope_distance',
            helptext=(
                "If selected, creates a downslope distance raster "
                "based on the thresholded flow accumulation stream "
                "classification."),
            interactive=False,
            label='Calculate Distance to stream')
        self.add_input(self.calculate_downslope_distance)

        # Set interactivity, requirement as input sufficiency changes
        self.calculate_flow_direction.sufficiency_changed.connect(
            self.calculate_flow_accumulation.set_interactive)
        self.calculate_flow_accumulation.sufficiency_changed.connect(
            self.calculate_stream_threshold.set_interactive)
        self.calculate_stream_threshold.sufficiency_changed.connect(
            self.threshold_flow_accumulation.set_interactive)
        self.calculate_stream_threshold.sufficiency_changed.connect(
            self.calculate_downslope_distance.set_interactive)
コード例 #16
0
    def __init__(self):
        model.InVESTModel.__init__(self,
                                   label=u'Marine Aquaculture: Finfish',
                                   target=finfish_aquaculture.execute,
                                   validator=finfish_aquaculture.validate,
                                   localdoc=u'marine_fish.html')

        self.farm_location = inputs.File(
            args_key=u'ff_farm_loc',
            helptext=(u"An OGR-supported vector file containing polygon or "
                      u"point, with a latitude and longitude value and a "
                      u"numerical identifier for each farm.  File can be "
                      u"named anything, but no spaces in the "
                      u"name.<br><br>File type: polygon shapefile or "
                      u".gdb<br>Rows: each row is a specific netpen or entire "
                      u"aquaculture farm<br>Columns: columns contain "
                      u"attributes about each netpen (area, location, "
                      u"etc.).<br>Sample data set: "
                      u"\InVEST\Aquaculture\Input\Finfish_Netpens.shp"),
            label=u'Finfish Farm Location (Vector)',
            validator=self.validator)
        self.add_input(self.farm_location)
        self.farm_identifier = inputs.Dropdown(
            args_key=u'farm_ID',
            helptext=(u"The name of a column heading used to identify each "
                      u"farm and link the spatial information from the "
                      u"shapefile to subsequent table input data (farm "
                      u"operation and daily water temperature at farm "
                      u"tables). Additionally, the numbers underneath this "
                      u"farm identifier name must be unique integers for all "
                      u"the inputs."),
            interactive=False,
            options=(
                'UNKNOWN', ),  # No options until valid OGR vector provided
            label=u'Farm Identifier Name')
        self.add_input(self.farm_identifier)
        self.param_a = inputs.Text(
            args_key=u'g_param_a',
            helptext=(u"Default a  = (0.038 g/day). If the user chooses to "
                      u"adjust these parameters, we recommend using them in "
                      u"the simple growth model to determine if the time "
                      u"taken for a fish to reach a target harvest weight "
                      u"typical for the region of interest is accurate."),
            label=u'Fish Growth Parameter (a)',
            validator=self.validator)
        self.add_input(self.param_a)
        self.param_b = inputs.Text(
            args_key=u'g_param_b',
            helptext=(u"Default b  = (0.6667 g/day). If the user chooses to "
                      u"adjust these parameters, we recommend using them in "
                      u"the simple growth model to determine if the time "
                      u"taken for a fish to reach a target harvest weight "
                      u"typical for the region of interest is accurate."),
            label=u'Fish Growth Parameter (b)',
            validator=self.validator)
        self.add_input(self.param_b)
        self.param_tau = inputs.Text(
            args_key=u'g_param_tau',
            helptext=(u"Default tau = (0.08 C^-1).  Specifies how sensitive "
                      u"finfish growth is to temperature.  If the user "
                      u"chooses to adjust these parameters, we recommend "
                      u"using them in the simple growth model to determine if "
                      u"the time taken for a fish to reach a target harvest "
                      u"weight typical for the region of interest is "
                      u"accurate."),
            label=u'Fish Growth Parameter (tau)',
            validator=self.validator)
        self.add_input(self.param_tau)
        self.uncertainty_data_container = inputs.Container(
            args_key=u'use_uncertainty',
            expandable=True,
            label=u'Enable Uncertainty Analysis')
        self.add_input(self.uncertainty_data_container)
        self.param_a_sd = inputs.Text(
            args_key=u'g_param_a_sd',
            helptext=(u"Standard deviation for fish growth parameter a. "
                      u"This indicates the level of uncertainty in the "
                      u"estimate for parameter a."),
            label=u'Standard Deviation for Parameter (a)',
            validator=self.validator)
        self.uncertainty_data_container.add_input(self.param_a_sd)
        self.param_b_sd = inputs.Text(
            args_key=u'g_param_b_sd',
            helptext=(u"Standard deviation for fish growth parameter b. "
                      u"This indicates the level of uncertainty in the "
                      u"estimate for parameter b."),
            label=u'Standard Deviation for Parameter (b)',
            validator=self.validator)
        self.uncertainty_data_container.add_input(self.param_b_sd)
        self.num_monte_carlo_runs = inputs.Text(
            args_key=u'num_monte_carlo_runs',
            helptext=(u"Number of runs of the model to perform as part of a "
                      u"Monte Carlo simulation.  A larger number will tend to "
                      u"produce more consistent and reliable output, but will "
                      u"also take longer to run."),
            label=u'Number of Monte Carlo Simulation Runs',
            validator=self.validator)
        self.uncertainty_data_container.add_input(self.num_monte_carlo_runs)
        self.water_temperature = inputs.File(
            args_key=u'water_temp_tbl',
            helptext=(u"Users must provide a time series of daily water "
                      u"temperature (C) for each farm in the shapefile.  When "
                      u"daily temperatures are not available, users can "
                      u"interpolate seasonal or monthly temperatures to a "
                      u"daily resolution.  Water temperatures collected at "
                      u"existing aquaculture facilities are preferable, but "
                      u"if unavailable, users can consult online sources such "
                      u"as NOAAs 4 km AVHRR Pathfinder Data and Canadas "
                      u"Department of Fisheries and Oceans Oceanographic "
                      u"Database.  The most appropriate temperatures to use "
                      u"are those from the upper portion of the water column, "
                      u"which are the temperatures experienced by the fish in "
                      u"the netpens."),
            label=u'Table of Daily Water Temperature at Farm (CSV)',
            validator=self.validator)
        self.add_input(self.water_temperature)
        self.farm_operations = inputs.File(
            args_key=u'farm_op_tbl',
            helptext=(u"A table of general and farm-specific operations "
                      u"parameters.  Please refer to the sample data table "
                      u"for reference to ensure correct incorporation of data "
                      u"in the model.<br><br>The values for 'farm operations' "
                      u"(applied to all farms) and 'add new farms' (beginning "
                      u"with row 32) may be modified according to the user's "
                      u"needs . However, the location of cells in this "
                      u"template must not be modified.  If for example, if "
                      u"the model is to run for three farms only, the farms "
                      u"should be listed in rows 10, 11 and 12 (farms 1, 2, "
                      u"and 3, respectively). Several default values that are "
                      u"applicable to Atlantic salmon farming in British "
                      u"Columbia are also included in the sample data table."),
            label=u'Farm Operations Table (CSV)',
            validator=self.validator)
        self.add_input(self.farm_operations)
        self.outplant_buffer = inputs.Text(
            args_key=u'outplant_buffer',
            helptext=(u"This value will allow the outplant start day to "
                      u"start plus or minus the number of days specified "
                      u"here."),
            label=u'Outplant Date Buffer',
            validator=self.validator)
        self.add_input(self.outplant_buffer)
        self.valuation = inputs.Checkbox(
            args_key=u'do_valuation',
            helptext=(u"By checking this box, a valuation analysis will be "
                      u"run on the model."),
            label=u'Run Valuation?')
        self.add_input(self.valuation)
        self.market_price = inputs.Text(
            args_key=u'p_per_kg',
            helptext=(u"Default value comes from Urner-Berry monthly fresh "
                      u"sheet reports on price of farmed Atlantic salmon."),
            interactive=False,
            label=u'Market Price per Kilogram of Processed Fish',
            validator=self.validator)
        self.add_input(self.market_price)
        self.fraction_price = inputs.Text(
            args_key=u'frac_p',
            helptext=(u"Fraction of market price that accounts for costs "
                      u"rather than profit.  Default value is 0.3 (30%)."),
            interactive=False,
            label=u'Fraction of Price that Accounts to Costs',
            validator=self.validator)
        self.add_input(self.fraction_price)
        self.discount_rate = inputs.Text(
            args_key=u'discount',
            helptext=(u"We use a 7% annual discount rate, adjusted to a "
                      u"daily rate of 0.000192 for 0.0192% (7%/365 days)."),
            interactive=False,
            label=u'Daily Market Discount Rate',
            validator=self.validator)
        self.add_input(self.discount_rate)

        # Set interactivity, requirement as input sufficiency changes
        self.farm_location.sufficiency_changed.connect(
            self.farm_identifier.set_interactive)
        self.farm_location.sufficiency_changed.connect(self._load_colnames)
        self.valuation.sufficiency_changed.connect(
            self.market_price.set_interactive)
        self.valuation.sufficiency_changed.connect(
            self.fraction_price.set_interactive)
        self.valuation.sufficiency_changed.connect(
            self.discount_rate.set_interactive)