Exemple #1
0
    def __init__(self):
        model.InVESTModel.__init__(self,
                                   label=u'Coastal Blue Carbon Preprocessor',
                                   target=preprocessor.execute,
                                   validator=preprocessor.validate,
                                   localdoc=u'coastal_blue_carbon.html')

        self.lulc_lookup_uri = inputs.File(
            args_key=u'lulc_lookup_uri',
            helptext=(u"A CSV table used to map lulc classes to their values "
                      u"in a raster, as well as to indicate whether or not "
                      u"the lulc class is a coastal blue carbon habitat."),
            label=u'LULC Lookup Table (CSV)',
            validator=self.validator)
        self.add_input(self.lulc_lookup_uri)
        self.lulc_snapshot_list = inputs.Multi(
            args_key=u'lulc_snapshot_list',
            callable_=functools.partial(inputs.File, label="Input"),
            label=u'Land Use/Land Cover Rasters (GDAL-supported)',
            link_text=u'Add Another')
        self.add_input(self.lulc_snapshot_list)
Exemple #2
0
    def __init__(self):
        model.InVESTModel.__init__(
            self,
            label='Habitat Risk Assessment Preprocessor',
            target=hra_preprocessor.execute,
            validator=hra_preprocessor.validate,
            localdoc='../documentation/habitat_risk_assessment.html')

        self.habs_dir = inputs.File(
            args_key='habitats_dir',
            helptext=(
                "Checking this box indicates that habitats should be "
                "used as a base for overlap with provided stressors. "
                "If checked, the path to the habitat layers folder "
                "must be provided."),
            hideable=True,
            label='Calculate Risk to Habitats?',
            validator=self.validator)
        self.add_input(self.habs_dir)
        self.species_dir = inputs.File(
            args_key='species_dir',
            helptext=(
                "Checking this box indicates that species should be "
                "used as a base for overlap with provided stressors. "
                "If checked, the path to the species layers folder "
                "must be provided."),
            hideable=True,
            label='Calculate Risk to Species?',
            validator=self.validator)
        self.add_input(self.species_dir)
        self.stressor_dir = inputs.Folder(
            args_key='stressors_dir',
            helptext='This is the path to the stressors layers folder.',
            label='Stressors Layers Folder',
            validator=self.validator)
        self.add_input(self.stressor_dir)
        self.cur_lulc_box = inputs.Container(
            expandable=False,
            label='Criteria')
        self.add_input(self.cur_lulc_box)
        self.help_label = inputs.Label(
            text=(
                "(Choose at least 1 criteria for each category below, "
                "and at least 4 total.)"))
        self.exp_crit = inputs.Multi(
            args_key='exposure_crits',
            callable_=functools.partial(inputs.Text, label="Input Criteria"),
            label='Exposure',
            link_text='Add Another')
        self.cur_lulc_box.add_input(self.exp_crit)
        self.sens_crit = inputs.Multi(
            args_key='sensitivity_crits',
            callable_=functools.partial(inputs.Text, label="Input Criteria"),
            label='Consequence: Sensitivity',
            link_text='Add Another')
        self.cur_lulc_box.add_input(self.sens_crit)
        self.res_crit = inputs.Multi(
            args_key='resilience_crits',
            callable_=functools.partial(inputs.Text, label="Input Criteria"),
            label='Consequence: Resilience',
            link_text='Add Another')
        self.cur_lulc_box.add_input(self.res_crit)
        self.crit_dir = inputs.File(
            args_key='criteria_dir',
            helptext=(
                "Checking this box indicates that model should use "
                "criteria from provided shapefiles.  Each shapefile in "
                "the folder directories will need to contain a "
                "'Rating' attribute to be used for calculations in the "
                "HRA model.  Refer to the HRA User's Guide for "
                "information about the MANDATORY layout of the "
                "shapefile directories."),
            hideable=True,
            label='Use Spatially Explicit Risk Score in Shapefiles',
            validator=self.validator)
        self.add_input(self.crit_dir)
Exemple #3
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)