Exemple #1
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=u'RouteDEM',
            target=routedem.execute,
            validator=routedem.validate,
            localdoc=u'../documentation/routedem.html')

        self.dem_path = inputs.File(
            args_key=u'dem_path',
            helptext=(
                u"A GDAL-supported raster file containing a base "
                u"Digital Elevation Model to execute the routing "
                u"functionality across."),
            label=u'Digital Elevation Model (Raster)',
            validator=self.validator)
        self.add_input(self.dem_path)
        self.calculate_slope = inputs.Checkbox(
            args_key=u'calculate_slope',
            helptext=u'If selected, calculates slope raster.',
            label=u'Calculate Slope')
        self.add_input(self.calculate_slope)
        self.calculate_flow_accumulation = inputs.Checkbox(
            args_key=u'calculate_flow_accumulation',
            helptext=u'Select to calculate flow accumulation.',
            label=u'Calculate Flow Accumulation')
        self.add_input(self.calculate_flow_accumulation)
        self.calculate_stream_threshold = inputs.Checkbox(
            args_key=u'calculate_stream_threshold',
            helptext=u'Select to calculate a stream threshold to flow accumulation.',
            interactive=False,
            label=u'Calculate Stream Thresholds')
        self.add_input(self.calculate_stream_threshold)
        self.threshold_flow_accumulation = inputs.Text(
            args_key=u'threshold_flow_accumulation',
            helptext=(
                u"The number of upstream cells that must flow into a "
                u"cell before it's classified as a stream."),
            interactive=False,
            label=u'Threshold Flow Accumulation Limit',
            validator=self.validator)
        self.add_input(self.threshold_flow_accumulation)
        self.calculate_downstream_distance = inputs.Checkbox(
            args_key=u'calculate_downstream_distance',
            helptext=(
                u"If selected, creates a downstream distance raster "
                u"based on the thresholded flow accumulation stream "
                u"classification."),
            interactive=False,
            label=u'Calculate Distance to stream')
        self.add_input(self.calculate_downstream_distance)

        # Set interactivity, requirement as input sufficiency changes
        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_downstream_distance.set_interactive)
Exemple #2
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=MODEL_METADATA['coastal_blue_carbon'].model_title,
            target=coastal_blue_carbon.execute,
            validator=coastal_blue_carbon.validate,
            localdoc=MODEL_METADATA['coastal_blue_carbon'].userguide)

        _ui_keys = functools.partial(_create_input_kwargs_from_args_spec,
                                     args_spec=coastal_blue_carbon.ARGS_SPEC,
                                     validator=self.validator)

        self.snapshots_table = inputs.File(
            **_ui_keys('landcover_snapshot_csv'))
        self.add_input(self.snapshots_table)

        self.biophysical_table_path = inputs.File(
            **_ui_keys('biophysical_table_path'))
        self.add_input(self.biophysical_table_path)

        self.landcover_transitions_table = inputs.File(
            **_ui_keys('landcover_transitions_table'))
        self.add_input(self.landcover_transitions_table)

        self.analysis_year = inputs.Text(**_ui_keys('analysis_year'))
        self.add_input(self.analysis_year)

        self.do_economic_analysis = inputs.Container(
            args_key='do_economic_analysis',
            expandable=True,
            expanded=True,
            label='Calculate Net Present Value of Sequestered Carbon')
        self.add_input(self.do_economic_analysis)

        self.use_price_table = inputs.Checkbox(args_key='use_price_table',
                                               helptext='',
                                               label='Use Price Table')
        self.do_economic_analysis.add_input(self.use_price_table)
        self.price = inputs.Text(**_ui_keys('price'))
        self.do_economic_analysis.add_input(self.price)

        self.inflation_rate = inputs.Text(**_ui_keys('inflation_rate'))
        self.do_economic_analysis.add_input(self.inflation_rate)

        self.price_table_path = inputs.File(**_ui_keys('price_table_path'))
        self.do_economic_analysis.add_input(self.price_table_path)

        self.discount_rate = inputs.Text(**_ui_keys('discount_rate'))
        self.do_economic_analysis.add_input(self.discount_rate)

        # Set interactivity, requirement as input sufficiency changes
        self.use_price_table.sufficiency_changed.connect(
            self._price_table_sufficiency_changed)
Exemple #3
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)
Exemple #4
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=u'InVEST Carbon Model',
            target=natcap.invest.carbon.execute,
            validator=natcap.invest.carbon.validate,
            localdoc=u'../documentation/carbonstorage.html')

        self.cur_lulc_raster = inputs.File(
            args_key=u'lulc_cur_path',
            helptext=(u"A GDAL-supported raster representing the land-cover "
                      u"of the current scenario."),
            label=u'Current Land Use/Land Cover (Raster)',
            validator=self.validator)
        self.add_input(self.cur_lulc_raster)
        self.carbon_pools_path = inputs.File(
            args_key=u'carbon_pools_path',
            helptext=(u"A table that maps the land-cover IDs to carbon "
                      u"pools.  The table must contain columns of 'LULC', "
                      u"'C_above', 'C_Below', 'C_Soil', 'C_Dead' as described "
                      u"in the User's Guide.  The values in LULC must at "
                      u"least include the LULC IDs in the land cover maps."),
            label=u'Carbon Pools',
            validator=self.validator)
        self.add_input(self.carbon_pools_path)
        self.cur_lulc_year = inputs.Text(
            args_key=u'lulc_cur_year',
            helptext=u'The calendar year of the current scenario.',
            interactive=False,
            label=u'Current Landcover Calendar Year',
            validator=self.validator)
        self.add_input(self.cur_lulc_year)
        self.calc_sequestration = inputs.Checkbox(
            helptext=(u"Check to enable sequestration analysis.  This "
                      u"requires inputs of Land Use/Land Cover maps for both "
                      u"current and future scenarios."),
            args_key='calc_sequestration',
            label=u'Calculate Sequestration')
        self.add_input(self.calc_sequestration)
        self.fut_lulc_raster = inputs.File(
            args_key=u'lulc_fut_path',
            helptext=(u"A GDAL-supported raster representing the land-cover "
                      u"of the future scenario.  <br><br>If REDD scenario "
                      u"analysis is enabled, this should be the reference, or "
                      u"baseline, future scenario against which to compare "
                      u"the REDD policy scenario."),
            interactive=False,
            label=u'Future Landcover (Raster)',
            validator=self.validator)
        self.add_input(self.fut_lulc_raster)
        self.fut_lulc_year = inputs.Text(
            args_key=u'lulc_fut_year',
            helptext=u'The calendar year of the future scenario.',
            interactive=False,
            label=u'Future Landcover Calendar Year',
            validator=self.validator)
        self.add_input(self.fut_lulc_year)
        self.redd = inputs.Checkbox(
            helptext=(u"Check to enable REDD scenario analysis.  This "
                      u"requires three Land Use/Land Cover maps: one for the "
                      u"current scenario, one for the future baseline "
                      u"scenario, and one for the future REDD policy "
                      u"scenario."),
            interactive=False,
            args_key='do_redd',
            label=u'REDD Scenario Analysis')
        self.add_input(self.redd)
        self.redd_lulc_raster = inputs.File(
            args_key=u'lulc_redd_path',
            helptext=(u"A GDAL-supported raster representing the land-cover "
                      u"of the REDD policy future scenario.  This scenario "
                      u"will be compared to the baseline future scenario."),
            interactive=False,
            label=u'REDD Policy (Raster)',
            validator=self.validator)
        self.add_input(self.redd_lulc_raster)
        self.valuation_container = inputs.Container(
            args_key=u'do_valuation',
            expandable=True,
            expanded=False,
            interactive=False,
            label=u'Run Valuation Model')
        self.add_input(self.valuation_container)
        self.price_per_metric_ton_of_c = inputs.Text(
            args_key=u'price_per_metric_ton_of_c',
            label=u'Price/Metric ton of carbon',
            validator=self.validator)
        self.valuation_container.add_input(self.price_per_metric_ton_of_c)
        self.discount_rate = inputs.Text(
            args_key=u'discount_rate',
            helptext=u'The discount rate as a floating point percent.',
            label=u'Market Discount in Price of Carbon (%)',
            validator=self.validator)
        self.valuation_container.add_input(self.discount_rate)
        self.rate_change = inputs.Text(
            args_key=u'rate_change',
            helptext=(u"The floating point percent increase of the price of "
                      u"carbon per year."),
            label=u'Annual Rate of Change in Price of Carbon (%)',
            validator=self.validator)
        self.valuation_container.add_input(self.rate_change)

        # Set interactivity, requirement as input sufficiency changes
        self.calc_sequestration.sufficiency_changed.connect(
            self.cur_lulc_year.set_interactive)
        self.calc_sequestration.sufficiency_changed.connect(
            self.fut_lulc_raster.set_interactive)
        self.calc_sequestration.sufficiency_changed.connect(
            self.fut_lulc_year.set_interactive)
        self.calc_sequestration.sufficiency_changed.connect(
            self.redd.set_interactive)
        self.redd.sufficiency_changed.connect(
            self.redd_lulc_raster.set_interactive)
        self.calc_sequestration.sufficiency_changed.connect(
            self.valuation_container.set_interactive)
Exemple #5
0
    def __init__(self):
        model.InVESTModel.__init__(self,
                                   label='Wind Energy',
                                   target=wind_energy.execute,
                                   validator=wind_energy.validate,
                                   localdoc='wind_energy.html',
                                   suffix_args_key='suffix')

        self.wind_data = inputs.File(
            args_key='wind_data_path',
            helptext=("A CSV file that represents the wind input data "
                      "(Weibull parameters). Please see the User's Guide for "
                      "a more detailed description of the parameters."),
            label='Wind Data Points (CSV)',
            validator=self.validator)
        self.add_input(self.wind_data)
        self.aoi = inputs.File(
            args_key='aoi_vector_path',
            helptext=("Optional.  An OGR-supported vector file containing a "
                      "single polygon defining the area of interest.  The "
                      "AOI must be projected with linear units equal to "
                      "meters.  If the AOI is provided it will clip and "
                      "project the outputs to that of the AOI. The Distance "
                      "inputs are dependent on the AOI and will only be "
                      "accessible if the AOI is selected.  If the AOI is "
                      "selected and the Distance parameters are selected, "
                      "then the AOI should also cover a portion of the land "
                      "polygon to calculate distances correctly.  An AOI is "
                      "required for valuation."),
            label='Area Of Interest (Vector) (Optional)',
            validator=self.validator)
        self.add_input(self.aoi)
        self.bathymetry = inputs.File(
            args_key='bathymetry_path',
            helptext=("A GDAL-supported raster file containing elevation "
                      "values represented in meters for the area of "
                      "interest.  The DEM should cover at least the entire "
                      "span of the area of interest and if no AOI is "
                      "provided then the default global DEM should be used."),
            label='Bathymetric Digital Elevation Model (Raster)',
            validator=self.validator)
        self.add_input(self.bathymetry)
        self.land_polygon = inputs.File(
            args_key='land_polygon_vector_path',
            helptext=("An OGR-supported polygon vector that represents the "
                      "land and coastline that is of interest.  For this "
                      "input to be selectable the AOI must be selected.  The "
                      "AOI should also cover a portion of this land polygon "
                      "to properly calculate distances.  This coastal "
                      "polygon, and the area covered by the AOI, form the "
                      "basis for distance calculations for wind farm "
                      "electrical transmission.  This input is required for "
                      "masking by distance values and for valuation."),
            interactive=False,
            label='Land Polygon for Distance Calculation (Vector)',
            validator=self.validator)
        self.add_input(self.land_polygon)
        self.global_wind_parameters = inputs.File(
            args_key='global_wind_parameters_path',
            helptext=("A CSV file that holds wind energy model parameters "
                      "for both the biophysical and valuation modules. "
                      "These parameters are defaulted to values that are "
                      "supported and reviewed in the User's Guide.  It is "
                      "recommended that careful consideration be taken "
                      "before changing these values and to make a new CSV "
                      "file so that the default one always remains."),
            label='Global Wind Energy Parameters (CSV)',
            validator=self.validator)
        self.add_input(self.global_wind_parameters)
        self.turbine_group = inputs.Container(label='Turbine Properties')
        self.add_input(self.turbine_group)
        self.turbine_parameters = inputs.File(
            args_key='turbine_parameters_path',
            helptext=("A CSV file that contains parameters corresponding to "
                      "a specific turbine type.  The InVEST package comes "
                      "with two turbine model options, 3.6 MW and 5.0 MW. A "
                      "new turbine class may be created by using the "
                      "existing file format conventions and filling in new "
                      "parameters.  Likewise an existing class may be "
                      "modified according to the user's needs.  It is "
                      "recommended that the existing default CSV files are "
                      "not overwritten."),
            label='Turbine Type Parameters File (CSV)',
            validator=self.validator)
        self.turbine_group.add_input(self.turbine_parameters)
        self.number_of_machines = inputs.Text(
            args_key='number_of_turbines',
            helptext=("An integer value indicating the number of wind "
                      "turbines per wind farm."),
            label='Number Of Turbines',
            validator=self.validator)
        self.turbine_group.add_input(self.number_of_machines)
        self.min_depth = inputs.Text(
            args_key='min_depth',
            helptext=("A floating point value in meters for the minimum "
                      "depth of the offshore wind farm installation."),
            label='Minimum Depth for Offshore Wind Farm Installation (meters)',
            validator=self.validator)
        self.turbine_group.add_input(self.min_depth)
        self.max_depth = inputs.Text(
            args_key='max_depth',
            helptext=("A floating point value in meters for the maximum "
                      "depth of the offshore wind farm installation."),
            label='Maximum Depth for Offshore Wind Farm Installation (meters)',
            validator=self.validator)
        self.turbine_group.add_input(self.max_depth)
        self.min_distance = inputs.Text(
            args_key='min_distance',
            helptext=("A floating point value in meters that represents the "
                      "minimum distance from shore for offshore wind farm "
                      "installation.  Required for valuation."),
            interactive=False,
            label=('Minimum Distance for Offshore Wind Farm Installation '
                   '(meters)'),
            validator=self.validator)
        self.turbine_group.add_input(self.min_distance)
        self.max_distance = inputs.Text(
            args_key='max_distance',
            helptext=("A floating point value in meters that represents the "
                      "maximum distance from shore for offshore wind farm "
                      "installation.  Required for valuation."),
            interactive=False,
            label=('Maximum Distance for Offshore Wind Farm Installation '
                   '(meters)'),
            validator=self.validator)
        self.turbine_group.add_input(self.max_distance)
        self.valuation_container = inputs.Container(
            args_key='valuation_container',
            expandable=True,
            expanded=False,
            label='Valuation')
        self.add_input(self.valuation_container)
        self.foundation_cost = inputs.Text(
            args_key='foundation_cost',
            helptext=("A floating point number for the unit cost of the "
                      "foundation type (in millions of dollars). The cost of "
                      "a foundation will depend on the type selected, which "
                      "itself depends on a variety of factors including "
                      "depth and turbine choice.  Please see the User's "
                      "Guide for guidance on properly selecting this value."),
            label='Cost of the Foundation Type (USD, in Millions)',
            validator=self.validator)
        self.valuation_container.add_input(self.foundation_cost)
        self.discount_rate = inputs.Text(
            args_key='discount_rate',
            helptext=("The discount rate reflects preferences for immediate "
                      "benefits over future benefits (e.g., would an "
                      "individual rather receive $10 today or $10 five years "
                      "from now?). See the User's Guide for guidance on "
                      "selecting this value."),
            label='Discount Rate',
            validator=self.validator)
        self.valuation_container.add_input(self.discount_rate)
        self.grid_points = inputs.File(
            args_key='grid_points_path',
            helptext=("An optional CSV file with grid and land points to "
                      "determine cable distances from.  An example:<br/> "
                      "<table border='1'> <tr> <th>ID</th> <th>TYPE</th> "
                      "<th>LATI</th> <th>LONG</th> </tr> <tr> <td>1</td> "
                      "<td>GRID</td> <td>42.957</td> <td>-70.786</td> </tr> "
                      "<tr> <td>2</td> <td>LAND</td> <td>42.632</td> "
                      "<td>-71.143</td> </tr> <tr> <td>3</td> <td>LAND</td> "
                      "<td>41.839</td> <td>-70.394</td> </tr> </table> "
                      "<br/><br/>Each point location is represented as a "
                      "single row with columns being <b>ID</b>, <b>TYPE</b>, "
                      "<b>LATI</b>, and <b>LONG</b>. The <b>LATI</b> and "
                      "<b>LONG</b> columns indicate the coordinates for the "
                      "point.  The <b>TYPE</b> column relates to whether it "
                      "is a land or grid point.  The <b>ID</b> column is a "
                      "simple unique integer.  The shortest distance between "
                      "respective points is used for calculations.  See the "
                      "User's Guide for more information."),
            label='Grid Connection Points (Optional)',
            validator=self.validator)
        self.valuation_container.add_input(self.grid_points)
        self.avg_grid_dist = inputs.Text(
            args_key='avg_grid_distance',
            helptext=("<b>Always required, but NOT used in the model if "
                      "Grid Points provided</b><br/><br/>A number in "
                      "kilometres that is only used if grid points are NOT "
                      "used in valuation.  When running valuation using the "
                      "land polygon to compute distances, the model uses an "
                      "average distance to the onshore grid from coastal "
                      "cable landing points instead of specific grid "
                      "connection points.  See the User's Guide for a "
                      "description of the approach and the method used to "
                      "calculate the default value."),
            label='Average Shore to Grid Distance (Kilometers)',
            validator=self.validator)
        self.valuation_container.add_input(self.avg_grid_dist)
        self.price_table = inputs.Checkbox(
            args_key='price_table',
            helptext=("When checked the model will use the social cost of "
                      "wind energy table provided in the input below.  If "
                      "not checked the price per year will be determined "
                      "using the price of energy input and the annual rate "
                      "of change."),
            label='Use Price Table')
        self.valuation_container.add_input(self.price_table)
        self.wind_schedule = inputs.File(
            args_key='wind_schedule',
            helptext=("A CSV file that has the price of wind energy per "
                      "kilowatt hour for each year of the wind farms life. "
                      "The CSV file should have the following two "
                      "columns:<br/><br/><b>Year:</b> a set of integers "
                      "indicating each year for the lifespan of the wind "
                      "farm.  They can be in date form such as : 2010, 2011, "
                      "2012... OR simple time step integers such as : 0, 1, "
                      "2... <br/><br/><b>Price:</b> a set of floats "
                      "indicating the price of wind energy per kilowatt hour "
                      "for a particular year or time step in the wind farms "
                      "life.<br/><br/>An example:<br/> <table border='1'> "
                      "<tr><th>Year</th> <th>Price</th></tr><tr><td>0</td><t "
                      "d>.244</td></tr><tr><td>1</td><td>.255</td></tr><tr>< "
                      "td>2</td><td>.270</td></tr><tr><td>3</td><td>.275</td "
                      "></tr><tr><td>4</td><td>.283</td></tr><tr><td>5</td>< "
                      "td>.290</td></tr></table><br/><br/><b>NOTE:</b> The "
                      "number of years or time steps listed must match the "
                      "<b>time</b> parameter in the <b>Global Wind Energy "
                      "Parameters</b> input file above.  In the above "
                      "example we have 6 years for the lifetime of the farm, "
                      "year 0 being a construction year and year 5 being the "
                      "last year."),
            interactive=False,
            label='Wind Energy Price Table (CSV)',
            validator=self.validator)
        self.valuation_container.add_input(self.wind_schedule)
        self.wind_price = inputs.Text(
            args_key='wind_price',
            helptext=("The price of energy per kilowatt hour.  This is the "
                      "price that will be used for year or time step 0 and "
                      "will then be adjusted based on the rate of change "
                      "percentage from the input below.  See the User's "
                      "Guide for guidance about determining this value."),
            label='Price of Energy per Kilowatt Hour ($/kWh)',
            validator=self.validator)
        self.valuation_container.add_input(self.wind_price)
        self.rate_change = inputs.Text(
            args_key='rate_change',
            helptext=("The annual rate of change in the price of wind "
                      "energy.  This should be expressed as a decimal "
                      "percentage.  For example, 0.1 for a 10% annual price "
                      "change."),
            label='Annual Rate of Change in Price of Wind Energy',
            validator=self.validator)
        self.valuation_container.add_input(self.rate_change)

        # Set interactivity, requirement as input sufficiency changes
        self.aoi.sufficiency_changed.connect(self.land_polygon.set_interactive)
        self.land_polygon.sufficiency_changed.connect(
            self.min_distance.set_interactive)
        self.land_polygon.sufficiency_changed.connect(
            self.max_distance.set_interactive)
        self.price_table.sufficiency_changed.connect(
            self._toggle_price_options)
    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)
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label='Scenario Generator: Proximity Based',
            target=natcap.invest.scenario_gen_proximity.execute,
            validator=natcap.invest.scenario_gen_proximity.validate,
            localdoc='../documentation/scenario_gen_proximity.html')

        self.base_lulc_path = inputs.File(args_key='base_lulc_path',
                                          label='Base Land Use/Cover (Raster)',
                                          validator=self.validator)
        self.add_input(self.base_lulc_path)
        self.aoi_path = inputs.File(
            args_key='aoi_path',
            helptext=("This is a set of polygons that will be used to "
                      "aggregate carbon values at the end of the run if "
                      "provided."),
            label='Area of interest (Vector) (optional)',
            validator=self.validator)
        self.add_input(self.aoi_path)
        self.area_to_convert = inputs.Text(args_key='area_to_convert',
                                           label='Max area to convert (Ha)',
                                           validator=self.validator)
        self.add_input(self.area_to_convert)
        self.focal_landcover_codes = inputs.Text(
            args_key='focal_landcover_codes',
            label='Focal Landcover Codes (list)',
            validator=self.validator)
        self.add_input(self.focal_landcover_codes)
        self.convertible_landcover_codes = inputs.Text(
            args_key='convertible_landcover_codes',
            label='Convertible Landcover Codes (list)',
            validator=self.validator)
        self.add_input(self.convertible_landcover_codes)
        self.replacment_lucode = inputs.Text(
            args_key='replacment_lucode',
            label='Replacement Landcover Code (int)',
            validator=self.validator)
        self.add_input(self.replacment_lucode)
        self.convert_farthest_from_edge = inputs.Checkbox(
            args_key='convert_farthest_from_edge',
            helptext=("This scenario converts the convertible landcover "
                      "codes starting at the furthest pixel from the closest "
                      "base landcover codes and moves inward."),
            label='Farthest from edge')
        self.add_input(self.convert_farthest_from_edge)
        self.convert_nearest_to_edge = inputs.Checkbox(
            args_key='convert_nearest_to_edge',
            helptext=("This scenario converts the convertible landcover "
                      "codes starting at the closest pixel in the base "
                      "landcover codes and moves outward."),
            label='Nearest to edge')
        self.add_input(self.convert_nearest_to_edge)
        self.n_fragmentation_steps = inputs.Text(
            args_key='n_fragmentation_steps',
            helptext=("This parameter is used to divide the conversion "
                      "simulation into equal subareas of the requested max "
                      "area.  During each sub-step the distance transform is "
                      "recalculated from the base landcover codes.  This can "
                      "affect the final result if the base types are also "
                      "convertible types."),
            label='Number of Steps in Conversion',
            validator=self.validator)
        self.add_input(self.n_fragmentation_steps)
Exemple #8
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label='Coastal Blue Carbon',
            target=coastal_blue_carbon.execute,
            validator=coastal_blue_carbon.validate,
            localdoc='coastal_blue_carbon.html')

        self.lulc_lookup_uri = inputs.File(
            args_key='lulc_lookup_uri',
            helptext=(
                "A CSV table used to map lulc classes to their values "
                "in a raster and to indicate whether or not the lulc "
                "class is a coastal blue carbon habitat."),
            label='LULC Lookup Table (CSV)',
            validator=self.validator)
        self.add_input(self.lulc_lookup_uri)
        self.lulc_transition_matrix_uri = inputs.File(
            args_key='lulc_transition_matrix_uri',
            helptext=(
                "Generated by the preprocessor.  This file must be "
                "edited before it can be used by the main model.  The "
                "left-most column represents the source lulc class, "
                "and the top row represents the destination lulc "
                "class."),
            label='LULC Transition Effect of Carbon Table (CSV)',
            validator=self.validator)
        self.add_input(self.lulc_transition_matrix_uri)
        self.carbon_pool_initial_uri = inputs.File(
            args_key='carbon_pool_initial_uri',
            helptext=(
                "The provided CSV table contains information related "
                "to the initial conditions of the carbon stock within "
                "each of the three pools of a habitat.  Biomass "
                "includes carbon stored above and below ground.  All "
                "non-coastal blue carbon habitat lulc classes are "
                "assumed to contain no carbon.  The values for "
                "‘biomass’, ‘soil’, and ‘litter’ should be given in "
                "terms of Megatonnes CO2e/ha."),
            label='Carbon Pool Initial Variables Table (CSV)',
            validator=self.validator)
        self.add_input(self.carbon_pool_initial_uri)
        self.carbon_pool_transient_uri = inputs.File(
            args_key='carbon_pool_transient_uri',
            helptext=(
                "The provided CSV table contains information related "
                "to the transition of carbon into and out of coastal "
                "blue carbon pools.  All non-coastal blue carbon "
                "habitat lulc classes are assumed to neither sequester "
                "nor emit carbon as a result of change.  The "
                "‘yearly_accumulation’ values should be given in terms "
                "of Megatonnes of CO2e/ha-yr.  The ‘half-life’ values "
                "must be given in terms of years.  The ‘disturbance’ "
                "values must be given as a decimal percentage of stock "
                "distrubed given a transition occurs away from a lulc- "
                "class."),
            label='Carbon Pool Transient Variables Table (CSV)',
            validator=self.validator)
        self.add_input(self.carbon_pool_transient_uri)
        self.lulc_baseline_map_uri = inputs.File(
            args_key='lulc_baseline_map_uri',
            helptext=(
                "A GDAL-supported raster representing the baseline "
                "landscape/seascape."),
            label='Baseline LULC Raster (GDAL-supported)',
            validator=self.validator)
        self.add_input(self.lulc_baseline_map_uri)
        self.lulc_baseline_year = inputs.Text(
            args_key='lulc_baseline_year',
            label='Year of baseline LULC raster',
            validator=self.validator)
        self.add_input(self.lulc_baseline_year)
        self.lulc_transition_maps_list = inputs.Multi(
            args_key='lulc_transition_maps_list',
            callable_=functools.partial(inputs.File, label="Input"),
            label='LULC Transition ("Snapshot") Rasters (GDAL-supported)',
            link_text='Add Another')
        self.add_input(self.lulc_transition_maps_list)
        self.lulc_transition_years_list = inputs.Multi(
            args_key='lulc_transition_years_list',
            callable_=functools.partial(inputs.Text, label="Input"),
            label='LULC Transition ("Snapshot") Years',
            link_text='Add Another')
        self.add_input(self.lulc_transition_years_list)
        self.analysis_year = inputs.Text(
            args_key='analysis_year',
            helptext=(
                "An analysis year extends the transient analysis "
                "beyond the transition years."),
            label='Analysis Year (Optional)',
            validator=self.validator)
        self.add_input(self.analysis_year)
        self.do_economic_analysis = inputs.Container(
            args_key='do_economic_analysis',
            expandable=True,
            expanded=True,
            label='Calculate Net Present Value of Sequestered Carbon')
        self.add_input(self.do_economic_analysis)
        self.do_price_table = inputs.Checkbox(
            args_key='do_price_table',
            helptext='',
            label='Use Price Table')
        self.do_economic_analysis.add_input(self.do_price_table)
        self.price = inputs.Text(
            args_key='price',
            helptext='The price per Megatonne CO2e at the base year.',
            label='Price',
            validator=self.validator)
        self.do_economic_analysis.add_input(self.price)
        self.inflation_rate = inputs.Text(
            args_key='inflation_rate',
            helptext="Annual change in the price per unit of carbon",
            label='Interest Rate (%)',
            validator=self.validator)
        self.do_economic_analysis.add_input(self.inflation_rate)
        self.price_table_uri = inputs.File(
            args_key='price_table_uri',
            helptext=(
                "Can be used in place of price and interest rate "
                "inputs.  The provided CSV table contains the price "
                "per Megatonne CO2e sequestered for a given year, for "
                "all years from the original snapshot to the analysis "
                "year, if provided."),
            interactive=False,
            label='Price Table (CSV)',
            validator=self.validator)
        self.do_economic_analysis.add_input(self.price_table_uri)
        self.discount_rate = inputs.Text(
            args_key='discount_rate',
            helptext=(
                "The discount rate on future valuations of "
                "sequestered carbon, compounded yearly."),
            label='Discount Rate (%)',
            validator=self.validator)
        self.do_economic_analysis.add_input(self.discount_rate)

        # Set interactivity, requirement as input sufficiency changes
        self.do_price_table.sufficiency_changed.connect(
            self._price_table_sufficiency_changed)
Exemple #9
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)
Exemple #10
0
    def __init__(self):
        model.InVESTModel.__init__(self,
                                   label=MODEL_METADATA['ndr'].model_title,
                                   target=natcap.invest.ndr.ndr.execute,
                                   validator=natcap.invest.ndr.ndr.validate,
                                   localdoc=MODEL_METADATA['ndr'].userguide)

        self.dem_path = inputs.File(
            args_key='dem_path',
            helptext=("A GDAL-supported raster file containing elevation "
                      "values for each cell.  Make sure the DEM is corrected "
                      "by filling in sinks, and if necessary burning "
                      "hydrographic features into the elevation model "
                      "(recommended when unusual streams are observed.) See "
                      "the Working with the DEM section of the InVEST User's "
                      "Guide for more information."),
            label='DEM (Raster)',
            validator=self.validator)
        self.add_input(self.dem_path)
        self.land_use = inputs.File(
            args_key='lulc_path',
            helptext=("A GDAL-supported raster file containing integer "
                      "values representing the LULC code for each cell.  The "
                      "LULC code should be an integer."),
            label='Land Use (Raster)',
            validator=self.validator)
        self.add_input(self.land_use)
        self.runoff_proxy = inputs.File(
            args_key='runoff_proxy_path',
            helptext=("Weighting factor to nutrient loads.  Internally this "
                      "value is normalized by its average values so a "
                      "variety of data can be used including precipitation "
                      "or quickflow."),
            label='Nutrient Runoff Proxy (Raster)',
            validator=self.validator)
        self.add_input(self.runoff_proxy)
        self.watersheds_path = inputs.File(
            args_key='watersheds_path',
            helptext=("An OGR-supported vector file containing watersheds "
                      "such that each watershed contributes to a point of "
                      "interest where water quality will be analyzed.  It "
                      "must have the integer field 'ws_id' where the values "
                      "uniquely identify each watershed."),
            label='Watersheds (Vector)',
            validator=self.validator)
        self.add_input(self.watersheds_path)
        self.biophysical_table_path = inputs.File(
            args_key='biophysical_table_path',
            helptext=("A CSV table containing model information "
                      "corresponding to each of the land use classes in the "
                      "LULC raster input.  It must contain the fields "
                      "'lucode', 'load_n' (or p), 'eff_n' (or p), and "
                      "'crit_len_n' (or p) depending on which nutrients are "
                      "selected."),
            label='Biophysical Table (CSV)',
            validator=self.validator)
        self.add_input(self.biophysical_table_path)
        self.calc_p = inputs.Checkbox(
            args_key='calc_p',
            helptext='Select to calculate phosphorus export.',
            label='Calculate phosphorus retention')
        self.add_input(self.calc_p)
        self.calc_n = inputs.Checkbox(
            args_key='calc_n',
            helptext='Select to calcualte nitrogen export.',
            label='Calculate Nitrogen Retention')
        self.add_input(self.calc_n)
        self.threshold_flow_accumulation = inputs.Text(
            args_key='threshold_flow_accumulation',
            helptext=("The number of upstream cells that must flow into a "
                      "cell before it's considered part of a stream such "
                      "that retention stops and the remaining export is "
                      "exported to the stream.  Used to define streams from "
                      "the DEM."),
            label='Threshold Flow Accumluation',
            validator=self.validator)
        self.add_input(self.threshold_flow_accumulation)
        self.k_param = inputs.Text(args_key='k_param',
                                   helptext='Borselli k parameter.',
                                   label='Borselli k Parameter',
                                   validator=self.validator)
        self.add_input(self.k_param)
        self.subsurface_critical_length_n = inputs.Text(
            args_key='subsurface_critical_length_n',
            helptext='',
            interactive=False,
            label='Subsurface Critical Length (Nitrogen)',
            validator=self.validator)
        self.add_input(self.subsurface_critical_length_n)
        self.subsurface_critical_length_p = inputs.Text(
            args_key='subsurface_critical_length_p',
            helptext='',
            interactive=False,
            label='Subsurface Critical Length (Phosphorus)',
            validator=self.validator)
        self.add_input(self.subsurface_critical_length_p)
        self.subsurface_eff_n = inputs.Text(
            args_key='subsurface_eff_n',
            helptext='',
            interactive=False,
            label='Subsurface Maximum Retention Efficiency (Nitrogen)',
            validator=self.validator)
        self.add_input(self.subsurface_eff_n)
        self.subsurface_eff_p = inputs.Text(
            args_key='subsurface_eff_p',
            helptext='',
            interactive=False,
            label='Subsurface Maximum Retention Efficiency (Phosphorus)',
            validator=self.validator)
        self.add_input(self.subsurface_eff_p)

        # Set interactivity, requirement as input sufficiency changes
        self.calc_n.sufficiency_changed.connect(
            self.subsurface_critical_length_n.set_interactive)
        self.calc_p.sufficiency_changed.connect(
            self.subsurface_critical_length_p.set_interactive)
        self.calc_n.sufficiency_changed.connect(
            self.subsurface_eff_n.set_interactive)
        self.calc_p.sufficiency_changed.connect(
            self.subsurface_eff_p.set_interactive)
Exemple #11
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)
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label='Overlap Analysis Model: Fisheries and Recreation',
            target=overlap_analysis.execute,
            validator=overlap_analysis.validate,
            localdoc='../documentation/overlap_analysis.html')

        self.aoi = inputs.File(
            args_key='zone_layer_uri',
            helptext=(
                "An OGR-supported vector file.  If Management Zones "
                "is being used to analyze overlap data, this should be "
                "a polygon shapefile containing multiple polygons. "
                "If, on the other hand, gridding is being used in "
                "order to separate the area, this can be a single "
                "polygon shapefile."),
            label='Analysis Zones Layer (Vector)',
            validator=self.validator)
        self.add_input(self.aoi)
        self.grid_size = inputs.Text(
            args_key='grid_size',
            helptext=(
                "By specifying a number in the interface, an analysis "
                "grid within the AOI of size x size will be created."),
            label='Analysis Cell Size (meters)',
            validator=self.validator)
        self.add_input(self.grid_size)
        self.data_dir = inputs.Folder(
            args_key='overlap_data_dir_uri',
            helptext=(
                "Users are required to specify the path on their "
                "system to a folder containing only the input data for "
                "the Overlap Analysis model.  Input data can be point, "
                "line or polygon data layers indicating where in the "
                "coastal and marine environment the human use activity "
                "takes place."),
            label='Overlap Analysis Data Directory',
            validator=self.validator)
        self.add_input(self.data_dir)
        self.intra = inputs.Checkbox(
            args_key='do_intra',
            helptext=(
                "Checking this box indicates that intra-activity "
                "valuation of the data should be used.  These weights "
                "will be retrieved from the column in the attribute "
                "table of the shapefile specified in 'Analysis Zones "
                "Layer' that bears the name specified in the 'Intra- "
                "Activity Field Name' field below."),
            label='Intra-Activity Weighting?')
        self.add_input(self.intra)
        self.IS_field_name = inputs.Text(
            args_key='intra_name',
            helptext=(
                "The column heading to look for in the activity "
                "layers' attribute tables that gives intra-activity "
                "weights."),
            interactive=False,
            label='Intra-Activity Attribute Name',
            validator=self.validator)
        self.add_input(self.IS_field_name)
        self.inter = inputs.Checkbox(
            args_key='do_inter',
            helptext=(
                "Checking this box indicates that inter-activity "
                "valuation of the data should be used.  These weights "
                "will be derived from the data included in the CSV "
                "provided in the 'Overlap Analysis Importance Score "
                "Table' field."),
            label='Inter-Activity Weighting?')
        self.add_input(self.inter)
        self.IS_tbl = inputs.File(
            args_key='overlap_layer_tbl',
            helptext=(
                "The name of the CSV table that links each provided "
                "activity layer to the desired inter-activity weight."),
            interactive=False,
            label='Inter-Activity Weight Table (CSV)',
            validator=self.validator)
        self.add_input(self.IS_tbl)
        self.HU_Hubs = inputs.Checkbox(
            args_key='do_hubs',
            helptext=(
                "Checking this box indicates taht a layer of human "
                "use hubs should be used to weight the raster file "
                "output.  This input should be in the form of a point "
                "shapefile."),
            label='Human Use Hubs?')
        self.add_input(self.HU_Hubs)
        self.HU_Hub_URI = inputs.File(
            args_key='hubs_uri',
            helptext=(
                "An OGR-supported vector file.  If human use hubs are "
                "desired, this is the file that shows the hubs "
                "themselves.  This should be a shapefile of points "
                "where each point is a hub."),
            interactive=False,
            label='Points Layer of Human Use Hubs (Vector)',
            validator=self.validator)
        self.add_input(self.HU_Hub_URI)
        self.hub_decay = inputs.Text(
            args_key='decay_amt',
            helptext=(
                "This number is the rate (r) of interest decay from "
                "each of the human use hubs for use in the final "
                "weighted raster for the function exp(-r*d) where d is "
                "the distance from the closest hub."),
            interactive=False,
            label='Distance Decay Rate',
            validator=self.validator)
        self.add_input(self.hub_decay)

        # Set interactivity, requirement as input sufficiency changes
        self.intra.sufficiency_changed.connect(
            self.IS_field_name.set_interactive)
        self.inter.sufficiency_changed.connect(
            self.IS_tbl.set_interactive)
        self.HU_Hubs.sufficiency_changed.connect(
            self.HU_Hub_URI.set_interactive)
        self.HU_Hubs.sufficiency_changed.connect(
            self.hub_decay.set_interactive)
Exemple #13
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=MODEL_METADATA['delineateit'].model_title,
            target=delineateit.execute,
            validator=delineateit.validate,
            localdoc=MODEL_METADATA['delineateit'].userguide)

        self.dem_path = inputs.File(
            label='Digital Elevation Model (Raster)',
            args_key='dem_path',
            helptext=("A GDAL-supported raster file with an elevation value "
                      "for each cell."),
            validator=self.validator)
        self.add_input(self.dem_path)

        self.detect_pour_points = inputs.Checkbox(
            args_key='detect_pour_points',
            helptext=(
                'If this box is checked, run pour point detection algorithm. '
                'Use detected pour points instead of outlet geometries.'),
            label='Detect pour points')
        self.add_input(self.detect_pour_points)
        self.detect_pour_points.sufficiency_changed.connect(
            self.on_detect_pour_points_changed)

        self.outlet_vector_path = inputs.File(
            args_key='outlet_vector_path',
            helptext=("This is a layer of geometries representing watershed "
                      "outlets such as municipal water intakes or lakes."),
            label='Outlet Features (Vector)',
            validator=self.validator)
        self.add_input(self.outlet_vector_path)
        self.skip_invalid_geometry = inputs.Checkbox(
            args_key='skip_invalid_geometry',
            helptext=(
                'If this box is checked, any invalid geometries encountered '
                'in the outlet vector will not be included in the '
                'delineation.  If this box is unchecked, an invalid '
                'geometry will cause DelineateIt to error.'),
            label='Skip invalid geometries')
        self.add_input(self.skip_invalid_geometry)
        self.skip_invalid_geometry.set_value(True)

        self.snap_points_container = inputs.Container(
            label='Snap points to the nearest stream',
            expandable=True,
            expanded=False,
            args_key='snap_points')
        self.add_input(self.snap_points_container)
        self.flow_threshold = inputs.Text(
            args_key='flow_threshold',
            helptext=("The number of upstream cells that must flow into a "
                      "cell before it's considered part of a stream such "
                      "that retention stops and the remaining export is "
                      "exported to the stream.  Used to define streams from "
                      "the DEM."),
            label='Threshold Flow Accumulation',
            validator=self.validator)
        self.snap_points_container.add_input(self.flow_threshold)
        self.snap_distance = inputs.Text(
            args_key='snap_distance',
            label='Pixel Distance to Snap Outlet Points',
            helptext=(
                "If provided, the maximum search radius in pixels to look "
                "for stream pixels.  If a stream pixel is found within the "
                "snap distance, the outflow point will be snapped to the "
                "center of the nearest stream pixel.  Geometries that are "
                "not points (such as Lines and Polygons) will not be "
                "snapped.  MultiPoints will also not be snapped."),
            validator=self.validator)
        self.snap_points_container.add_input(self.snap_distance)
Exemple #14
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)
Exemple #15
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label=MODEL_METADATA['stormwater'].model_title,
            target=stormwater.execute,
            validator=stormwater.validate,
            localdoc=MODEL_METADATA['stormwater'].userguide)

        self.lulc_path = inputs.File(
            args_key='lulc_path',
            helptext=("A GDAL-supported raster representing land-cover."),
            label='Land Use/Land Cover',
            validator=self.validator)
        self.add_input(self.lulc_path)
        self.soil_group_path = inputs.File(
            args_key='soil_group_path',
            helptext=(
                "A GDAL-supported raster representing hydrologic soil groups."
            ),
            label='Soil Groups',
            validator=self.validator)
        self.add_input(self.soil_group_path)
        self.precipitation_path = inputs.File(
            args_key='precipitation_path',
            helptext=(
                "A GDAL-supported raster showing annual precipitation amounts"
            ),
            label='Precipitation',
            validator=self.validator)
        self.add_input(self.precipitation_path)
        self.biophysical_table = inputs.File(
            args_key='biophysical_table',
            helptext=(
                "A CSV file with runoff coefficient (RC), infiltration "
                "coefficient (IR), and pollutant event mean concentration "
                "(EMC) data for each LULC code."),
            label='Biophysical Table',
            validator=self.validator)
        self.add_input(self.biophysical_table)
        self.adjust_retention_ratios = inputs.Checkbox(
            args_key='adjust_retention_ratios',
            helptext=(
                'If checked, adjust retention ratios using road centerlines.'),
            label='Adjust Retention Ratios')
        self.add_input(self.adjust_retention_ratios)
        self.retention_radius = inputs.Text(
            args_key='retention_radius',
            helptext=('Radius within which to adjust retention ratios'),
            label='Retention Radius',
            validator=self.validator)
        self.add_input(self.retention_radius)
        self.road_centerlines_path = inputs.File(
            args_key='road_centerlines_path',
            helptext=('Polyline vector representing centerlines of roads'),
            label='Road Centerlines',
            validator=self.validator)
        self.add_input(self.road_centerlines_path)
        self.aggregate_areas_path = inputs.File(
            args_key='aggregate_areas_path',
            helptext=(
                'Polygon vector outlining area(s) of interest by which to '
                'aggregate results (typically watersheds or sewersheds).'),
            label='Aggregate Areas',
            validator=self.validator)
        self.add_input(self.aggregate_areas_path)
        self.replacement_cost = inputs.Text(
            args_key='replacement_cost',
            helptext=('Replacement cost of retention per cubic meter'),
            label='Replacement Cost',
            validator=self.validator)
        self.add_input(self.replacement_cost)

        # retention_radius is active when adjust_retention_ratios is checked
        self.adjust_retention_ratios.sufficiency_changed.connect(
            self.retention_radius.set_interactive)
        self.adjust_retention_ratios.sufficiency_changed.connect(
            self.road_centerlines_path.set_interactive)
Exemple #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)