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)
def __init__(self): model.InVESTModel.__init__( self, label=MODEL_METADATA['fisheries_hst'].model_title, target=fisheries_hst.execute, validator=fisheries_hst.validate, localdoc=MODEL_METADATA['fisheries_hst'].userguide) self.alpha_only = inputs.Label( text=("This tool is in an ALPHA testing stage and should " "not be used for decision making.")) self.pop_cont = inputs.Container(args_key='pop_cont', expanded=True, label='Population Parameters') self.add_input(self.pop_cont) self.population_csv_path = inputs.File( args_key='population_csv_path', helptext=("A CSV file containing all necessary attributes for " "population classes based on age/stage, sex, and area " "- excluding possible migration " "information.<br><br>See the 'Running the Model >> " "Core Model >> Population Parameters' section in the " "model's documentation for help on how to format this " "file."), label='Population Parameters File (CSV)', validator=self.validator) self.pop_cont.add_input(self.population_csv_path) self.sexsp = inputs.Dropdown( args_key='sexsp', helptext=("Specifies whether or not the population classes " "provided in the Populaton Parameters CSV file are " "distinguished by sex."), label='Population Classes are Sex-Specific', options=['No', 'Yes']) self.pop_cont.add_input(self.sexsp) self.hab_cont = inputs.Container(args_key='hab_cont', expanded=True, label='Habitat Parameters') self.add_input(self.hab_cont) self.habitat_csv_dep_path = inputs.File( args_key='habitat_dep_csv_path', helptext=("A CSV file containing the habitat dependencies (0-1) " "for each life stage or age and for each habitat type " "included in the Habitat Change CSV File.<br><br>See " "the 'Running the Model >> Habitat Scenario Tool >> " "Habitat Parameters' section in the model's " "documentation for help on how to format this file."), label='Habitat Dependency Parameters File (CSV)', validator=self.validator) self.hab_cont.add_input(self.habitat_csv_dep_path) self.habitat_chg_csv_path = inputs.File( args_key='habitat_chg_csv_path', helptext=("A CSV file containing the percent changes in habitat " "area by subregion (if applicable). The habitats " "included should be those which the population depends " "on at any life stage.<br><br>See the 'Running the " "Model >> Habitat Scenario Tool >> Habitat Parameters' " "section in the model's documentation for help on how " "to format this file."), label='Habitat Area Change File (CSV)', validator=self.validator) self.hab_cont.add_input(self.habitat_chg_csv_path) self.gamma = inputs.Text( args_key='gamma', helptext=("Gamma describes the relationship between a change in " "habitat area and a change in survival of life stages " "dependent on that habitat. Specify a value between 0 " "and 1.<br><br>See the documentation for advice on " "selecting a gamma value."), label='Gamma', validator=self.validator) self.hab_cont.add_input(self.gamma)
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)
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)
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=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)
def __init__(self): model.InVESTModel.__init__( self, label='Seasonal Water Yield', target=seasonal_water_yield.execute, validator=seasonal_water_yield.validate, localdoc='../documentation/seasonalwateryield.html') 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 Accumulation', validator=self.validator) self.add_input(self.threshold_flow_accumulation) self.et0_dir = inputs.Folder( args_key='et0_dir', helptext=("The selected folder has a list of ET0 files with a " "specified format."), label='ET0 Directory', validator=self.validator) self.add_input(self.et0_dir) self.precip_dir = inputs.Folder( args_key='precip_dir', helptext=("The selected folder has a list of monthly " "precipitation files with a specified format."), label='Precipitation Directory', validator=self.validator) self.add_input(self.precip_dir) self.dem_raster_path = inputs.File( args_key='dem_raster_path', helptext=("A GDAL-supported raster file with an elevation value " "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='Digital Elevation Model (Raster)', validator=self.validator) self.add_input(self.dem_raster_path) self.lulc_raster_path = inputs.File( args_key='lulc_raster_path', helptext=("A GDAL-supported raster file, with an integer LULC " "code for each cell."), label='Land-Use/Land-Cover (Raster)', validator=self.validator) self.add_input(self.lulc_raster_path) self.soil_group_path = inputs.File( args_key='soil_group_path', helptext=("Map of SCS soil groups (A, B, C, or D) mapped to " "integer values (1, 2, 3, or 4) used in combination of " "the LULC map to compute the CN map."), label='Soil Group (Raster)', validator=self.validator) self.add_input(self.soil_group_path) self.aoi_path = inputs.File(args_key='aoi_path', label='AOI/Watershed (Vector)', validator=self.validator) self.add_input(self.aoi_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', and 'Kc'."), label='Biophysical Table (CSV)', validator=self.validator) self.add_input(self.biophysical_table_path) self.rain_events_table_path = inputs.File( args_key='rain_events_table_path', label='Rain Events Table (CSV)', validator=self.validator) self.add_input(self.rain_events_table_path) self.alpha_m = inputs.Text(args_key='alpha_m', label='alpha_m Parameter', validator=self.validator) self.add_input(self.alpha_m) self.beta_i = inputs.Text(args_key='beta_i', label='beta_i Parameter', validator=self.validator) self.add_input(self.beta_i) self.gamma = inputs.Text(args_key='gamma', label='gamma Parameter', validator=self.validator) self.add_input(self.gamma) self.climate_zone_container = inputs.Container( args_key='user_defined_climate_zones', expandable=True, label='Climate Zones (Advanced)') self.add_input(self.climate_zone_container) self.climate_zone_table_path = inputs.File( args_key='climate_zone_table_path', label='Climate Zone Table (CSV)', validator=self.validator) self.climate_zone_container.add_input(self.climate_zone_table_path) self.climate_zone_raster_path = inputs.File( args_key='climate_zone_raster_path', helptext=("Map of climate zones that are found in the Climate " "Zone Table input. Pixel values correspond to cz_id."), label='Climate Zone (Raster)', validator=self.validator) self.climate_zone_container.add_input(self.climate_zone_raster_path) self.user_defined_local_recharge_container = inputs.Container( args_key='user_defined_local_recharge', expandable=True, label='User Defined Recharge Layer (Advanced)') self.add_input(self.user_defined_local_recharge_container) self.l_path = inputs.File(args_key='l_path', label='Local Recharge (Raster)', validator=self.validator) self.user_defined_local_recharge_container.add_input(self.l_path) self.monthly_alpha_container = inputs.Container( args_key='monthly_alpha', expandable=True, label='Monthly Alpha Table (Advanced)') self.add_input(self.monthly_alpha_container) self.monthly_alpha_path = inputs.File( args_key='monthly_alpha_path', label='Monthly Alpha Table (csv)', validator=self.validator) self.monthly_alpha_container.add_input(self.monthly_alpha_path) # Set interactivity, requirement as input sufficiency changes self.user_defined_local_recharge_container.sufficiency_changed.connect( self._toggle_user_defined_local_recharge) self.monthly_alpha_container.sufficiency_changed.connect( self._toggle_monthly_alpha)
def __init__(self): model.InVESTModel.__init__(self, label=u'GLOBIO', target=natcap.invest.globio.execute, validator=natcap.invest.globio.validate, localdoc=u'../documentation/globio.html') self.lulc_to_globio_table_path = inputs.File( args_key=u'lulc_to_globio_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', 'usle_c', and 'usle_p'. See the InVEST " u"Sediment User's Guide for more information about " u"these fields."), label=u'Landcover to GLOBIO Landcover Table (CSV)', validator=self.validator) self.add_input(self.lulc_to_globio_table_path) self.aoi_path = inputs.File( args_key=u'aoi_path', helptext=(u"This is a set of polygons that can be used to " u"aggregate MSA sum and mean to a polygon."), label=u'AOI (Vector) (optional)', validator=self.validator) self.add_input(self.aoi_path) self.land_use = inputs.File(args_key=u'lulc_path', label=u'Land Use/Cover (Raster)', validator=self.validator) self.add_input(self.land_use) self.infrastructure_dir = inputs.Folder( args_key=u'infrastructure_dir', label=u'Infrastructure Directory', validator=self.validator) self.add_input(self.infrastructure_dir) self.pasture_path = inputs.File(args_key=u'pasture_path', label=u'Pasture (Raster)', validator=self.validator) self.add_input(self.pasture_path) self.potential_vegetation_path = inputs.File( args_key=u'potential_vegetation_path', label=u'Potential Vegetation (Raster)', validator=self.validator) self.add_input(self.potential_vegetation_path) self.primary_threshold = inputs.Text(args_key=u'primary_threshold', label=u'Primary Threshold', validator=self.validator) self.add_input(self.primary_threshold) self.pasture_threshold = inputs.Text(args_key=u'pasture_threshold', label=u'Pasture Threshold', validator=self.validator) self.add_input(self.pasture_threshold) self.intensification_fraction = inputs.Text( args_key=u'intensification_fraction', helptext=(u"A value between 0 and 1 denoting proportion of total " u"agriculture that should be classified as 'high " u"input'."), label=u'Proportion of of Agriculture Intensified', validator=self.validator) self.add_input(self.intensification_fraction) self.msa_parameters_path = inputs.File( args_key=u'msa_parameters_path', helptext=(u"A CSV table containing MSA threshold values as " u"defined in the user's guide. Provided for advanced " u"users that may wish to change those values."), label=u'MSA Parameter Table (CSV)', validator=self.validator) self.add_input(self.msa_parameters_path) self.predefined_globio = inputs.Container( args_key=u'predefined_globio', expandable=True, expanded=False, label=u'Predefined land use map for GLOBIO') self.add_input(self.predefined_globio) self.globio_land_use = inputs.File( args_key=u'globio_lulc_path', label=u'GLOBIO Classified Land Use (Raster)', validator=self.validator) self.predefined_globio.add_input(self.globio_land_use) # Set interactivity, requirement as input sufficiency changes self.predefined_globio.sufficiency_changed.connect( self._predefined_globio_toggled)
def __init__(self): model.InVESTModel.__init__( self, label='Coastal Vulnerability Assessment Tool', target=coastal_vulnerability.execute, validator=coastal_vulnerability.validate, localdoc='../documentation/coastal_vulnerability.html', suffix_args_key='suffix' ) self.general_tab = inputs.Container( interactive=True, label='General') self.add_input(self.general_tab) self.area_computed = inputs.Dropdown( args_key='area_computed', helptext=( "Determine if the output data is about all the coast " "or about sheltered segments only."), label='Output Area: Sheltered/Exposed?', options=['both', 'sheltered']) self.general_tab.add_input(self.area_computed) self.area_of_interest = inputs.File( args_key='aoi_uri', helptext=( "An OGR-supported, single-feature polygon vector " "file. All outputs will be in the AOI's projection."), label='Area of Interest (Vector)', validator=self.validator) self.general_tab.add_input(self.area_of_interest) self.landmass_uri = inputs.File( args_key='landmass_uri', helptext=( "An OGR-supported vector file containing a landmass " "polygon from where the coastline will be extracted. " "The default is the global land polygon."), label='Land Polygon (Vector)', validator=self.validator) self.general_tab.add_input(self.landmass_uri) self.bathymetry_layer = inputs.File( args_key='bathymetry_uri', helptext=( "A GDAL-supported raster of the terrain elevation in " "the area of interest. Used to compute depths along " "fetch rays, relief and surge potential."), label='Bathymetry Layer (Raster)', validator=self.validator) self.general_tab.add_input(self.bathymetry_layer) self.bathymetry_constant = inputs.Text( args_key='bathymetry_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.bathymetry_constant) self.relief = inputs.File( args_key='relief_uri', helptext=( "A GDAL-supported raster file containing the land " "elevation used to compute the average land elevation " "within a user-defined radius (see Elevation averaging " "radius)."), label='Relief (Raster)', validator=self.validator) self.general_tab.add_input(self.relief) self.relief_constant = inputs.Text( args_key='relief_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value If Path Omitted', validator=self.validator) self.general_tab.add_input(self.relief_constant) self.cell_size = inputs.Text( args_key='cell_size', helptext=( "Cell size in meters. The higher the value, the " "faster the computation, but the coarser the output " "rasters produced by the model."), label='Model Resolution (Segment Size)', validator=self.validator) self.general_tab.add_input(self.cell_size) self.depth_threshold = inputs.Text( args_key='depth_threshold', helptext=( "Depth in meters (integer) cutoff to determine if " "fetch rays project over deep areas."), label='Depth Threshold (meters)', validator=self.validator) self.general_tab.add_input(self.depth_threshold) self.exposure_proportion = inputs.Text( args_key='exposure_proportion', helptext=( "Minimum proportion of rays that project over exposed " "and/or deep areas need to classify a shore segment as " "exposed."), label='Exposure Proportion', validator=self.validator) self.general_tab.add_input(self.exposure_proportion) self.geomorphology_uri = inputs.File( args_key='geomorphology_uri', helptext=( "A OGR-supported polygon vector file that has a field " "called 'RANK' with values between 1 and 5 in the " "attribute table."), label='Geomorphology (Vector)', validator=self.validator) self.general_tab.add_input(self.geomorphology_uri) self.geomorphology_constant = inputs.Text( args_key='geomorphology_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.geomorphology_constant) self.habitats_directory_uri = inputs.Folder( args_key='habitats_directory_uri', helptext=( "Directory containing OGR-supported polygon vectors " "associated with natural habitats. The name of these " "shapefiles should be suffixed with the ID that is " "specified in the natural habitats CSV file provided " "along with the habitats."), label='Natural Habitats Directory', validator=self.validator) self.general_tab.add_input(self.habitats_directory_uri) self.habitats_csv_uri = inputs.File( args_key='habitats_csv_uri', helptext=( "A CSV file listing the attributes for each habitat. " "For more information, see 'Habitat Data Layer' " "section in the model's documentation.</a>."), interactive=False, label='Natural Habitats Table (CSV)', validator=self.validator) self.general_tab.add_input(self.habitats_csv_uri) self.habitats_constant = inputs.Text( args_key='habitat_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.habitats_constant) self.climatic_forcing_uri = inputs.File( args_key='climatic_forcing_uri', helptext=( "An OGR-supported vector containing both wind and " "wave information across the region of interest."), label='Climatic Forcing Grid (Vector)', validator=self.validator) self.general_tab.add_input(self.climatic_forcing_uri) self.climatic_forcing_constant = inputs.Text( args_key='climatic_forcing_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.climatic_forcing_constant) self.continental_shelf_uri = inputs.File( args_key='continental_shelf_uri', helptext=( "An OGR-supported polygon vector delineating the " "edges of the continental shelf. Default is global " "continental shelf shapefile. If omitted, the user " "can specify depth contour. See entry below."), label='Continental Shelf (Vector)', validator=self.validator) self.general_tab.add_input(self.continental_shelf_uri) self.depth_contour = inputs.Text( args_key='depth_contour', helptext=( "Used to delineate shallow and deep areas. " "Continental shelf limit is at about 150 meters."), label='Depth Countour Level (meters)', validator=self.validator) self.general_tab.add_input(self.depth_contour) self.sea_level_rise_uri = inputs.File( args_key='sea_level_rise_uri', helptext=( "An OGR-supported point or polygon vector file " "containing features with 'Trend' fields in the " "attributes table."), label='Sea Level Rise (Vector)', validator=self.validator) self.general_tab.add_input(self.sea_level_rise_uri) self.sea_level_rise_constant = inputs.Text( args_key='sea_level_rise_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.sea_level_rise_constant) self.structures_uri = inputs.File( args_key='structures_uri', helptext=( "An OGR-supported vector file containing rigid " "structures used to identify the portions of the coast " "that is armored."), label='Structures (Vectors)', validator=self.validator) self.general_tab.add_input(self.structures_uri) self.structures_constant = inputs.Text( args_key='structures_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.structures_constant) self.population_uri = inputs.File( args_key='population_uri', helptext=( 'A GDAL-supported raster file representing the population ' 'density.'), label='Population Layer (Raster)', validator=self.validator) self.general_tab.add_input(self.population_uri) self.urban_center_threshold = inputs.Text( args_key='urban_center_threshold', helptext=( "Minimum population required to consider the shore " "segment a population center."), label='Min. Population in Urban Centers', validator=self.validator) self.general_tab.add_input(self.urban_center_threshold) self.additional_layer_uri = inputs.File( args_key='additional_layer_uri', helptext=( "An OGR-supported vector file representing sea level " "rise, and will be used in the computation of coastal " "vulnerability and coastal vulnerability without " "habitat."), label='Additional Layer (Vector)', validator=self.validator) self.general_tab.add_input(self.additional_layer_uri) self.additional_layer_constant = inputs.Text( args_key='additional_layer_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.additional_layer_constant) self.advanced_tab = inputs.Container( interactive=True, label='Advanced') self.add_input(self.advanced_tab) self.elevation_averaging_radius = inputs.Text( args_key='elevation_averaging_radius', helptext=( "Distance in meters (integer). Each pixel average " "elevation will be computed within this radius."), label='Elevation Averaging Radius (meters)', validator=self.validator) self.advanced_tab.add_input(self.elevation_averaging_radius) self.mean_sea_level_datum = inputs.Text( args_key='mean_sea_level_datum', helptext=( "Height in meters (integer). This input is the " "elevation of Mean Sea Level (MSL) datum relative to " "the datum of the bathymetry layer. The model " "transforms all depths to MSL datum. A positive value " "means the MSL is higher than the bathymetry's zero " "(0) elevation, so the value is subtracted from the " "bathymetry."), label='Mean Sea Level Datum (meters)', validator=self.validator) self.advanced_tab.add_input(self.mean_sea_level_datum) self.rays_per_sector = inputs.Text( args_key='rays_per_sector', helptext=( "Number of rays used to subsample the fetch distance " "within each of the 16 sectors."), label='Rays per Sector', validator=self.validator) self.advanced_tab.add_input(self.rays_per_sector) self.max_fetch = inputs.Text( args_key='max_fetch', helptext=( 'Maximum fetch distance computed by the model ' '(>=60,000m).'), label='Maximum Fetch Distance (meters)', validator=self.validator) self.advanced_tab.add_input(self.max_fetch) self.spread_radius = inputs.Text( args_key='spread_radius', helptext=( "Integer multiple of 'cell size'. The coast from the " "geomorphology layer could be of a better resolution " "than the global landmass, so the shores do not " "necessarily overlap. To make them coincide, the " "shore from the geomorphology layer is widened by 1 or " "more pixels. The value should be a multiple of 'cell " "size' that indicates how many pixels the coast from " "the geomorphology layer is widened. The widening " "happens on each side of the coast (n pixels landward, " "and n pixels seaward)."), label='Coastal Overlap (meters)', validator=self.validator) self.advanced_tab.add_input(self.spread_radius) self.population_radius = inputs.Text( args_key='population_radius', helptext=( "Radius length in meters used to count the number of " "people leaving close to the coast."), label='Coastal Neighborhood (radius in meters)', validator=self.validator) self.advanced_tab.add_input(self.population_radius) # Set interactivity, requirement as input sufficiency changes self.habitats_directory_uri.sufficiency_changed.connect( self.habitats_csv_uri.set_interactive)
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)
def __init__(self): model.InVESTModel.__init__( self, label=MODEL_METADATA['annual_water_yield'].model_title, target=annual_water_yield.execute, validator=annual_water_yield.validate, localdoc=MODEL_METADATA['annual_water_yield'].userguide) self.precipitation = inputs.File( args_key='precipitation_path', helptext=("A GDAL-supported raster file containing non-zero, " "average annual precipitation values for each cell. " "The precipitation values should be in millimeters " "(mm)."), label='Precipitation (Raster)', validator=self.validator) self.add_input(self.precipitation) self.potential_evapotranspiration = inputs.File( args_key='eto_path', helptext=("A GDAL-supported raster file containing annual " "average reference evapotranspiration values for each " "cell. The reference evapotranspiration values should " "be in millimeters (mm)."), label='Reference Evapotranspiration (Raster)', validator=self.validator) self.add_input(self.potential_evapotranspiration) self.depth_to_root_rest_layer = inputs.File( args_key='depth_to_root_rest_layer_path', helptext=("A GDAL-supported raster file containing an average " "root restricting layer depth value for each cell. " "The root restricting layer depth value should be in " "millimeters (mm)."), label='Depth To Root Restricting Layer (Raster)', validator=self.validator) self.add_input(self.depth_to_root_rest_layer) self.plant_available_water_fraction = inputs.File( args_key='pawc_path', helptext=("A GDAL-supported raster file containing plant " "available water content values for each cell. The " "plant available water content fraction should be a " "value between 0 and 1."), label='Plant Available Water Fraction (Raster)', validator=self.validator) self.add_input(self.plant_available_water_fraction) self.land_use = inputs.File( args_key='lulc_path', helptext=("A GDAL-supported raster file containing LULC code " "(expressed as integers) for each cell."), label='Land Use (Raster)', validator=self.validator) self.add_input(self.land_use) self.watersheds = inputs.File( args_key='watersheds_path', helptext=("An OGR-supported vector file containing one polygon " "per watershed. Each polygon that represents a " "watershed is required to have a field 'ws_id' that is " "a unique integer which identifies that watershed."), label='Watersheds (Vector)', validator=self.validator) self.add_input(self.watersheds) self.sub_watersheds = inputs.File( args_key='sub_watersheds_path', helptext=("An OGR-supported vector file with one polygon per " "sub-watershed within the main watersheds specified in " "the Watersheds shapefile. Each polygon that " "represents a sub-watershed is required to have a " "field 'subws_id' that is a unique integer which " "identifies that sub-watershed."), label='Sub-Watersheds (Vector) (Optional)', validator=self.validator) self.add_input(self.sub_watersheds) self.biophysical_table = inputs.File( args_key='biophysical_table_path', helptext=("A CSV table of land use/land cover (LULC) classes, " "containing data on biophysical coefficients used in " "this model. The following columns are required: " "'lucode' (integer), 'root_depth' (mm), 'Kc' " "(coefficient)."), label='Biophysical Table (CSV)', validator=self.validator) self.add_input(self.biophysical_table) self.seasonality_constant = inputs.Text( args_key='seasonality_constant', helptext=("Floating point value on the order of 1 to 30 " "corresponding to the seasonal distribution of " "precipitation."), label='Z parameter', validator=self.validator) self.add_input(self.seasonality_constant) self.scarcity_valuation_container = inputs.Container( args_key='do_scarcity_and_valuation', expandable=True, expanded=False, label='Water Scarcity and Valuation') self.add_input(self.scarcity_valuation_container) self.demand_table = inputs.File( args_key='demand_table_path', helptext=("A CSV table of LULC classes, showing consumptive " "water use for each land-use/land-cover type. The " "table requires two column fields: 'lucode' and " "'demand'. The demand values should be the estimated " "average consumptive water use for each land-use/land- " "cover type. Water use should be given in cubic " "meters per year for a pixel in the land-use/land- " "cover map. NOTE: the accounting for pixel area is " "important since larger areas will consume more water " "for the same land-cover type."), label='Water Demand Table (CSV)', validator=self.validator) self.scarcity_valuation_container.add_input(self.demand_table) self.hydropower_valuation_table = inputs.File( args_key='valuation_table_path', helptext=("A CSV table of hydropower stations with associated " "model values. The table should have the following " "column fields: 'ws_id', 'efficiency', 'fraction', " "'height', 'kw_price', 'cost', 'time_span', and " "'discount'."), label='Hydropower Valuation Table (CSV) (Optional)', validator=self.validator) self.scarcity_valuation_container.add_input( self.hydropower_valuation_table)
def __init__(self): model.InVESTModel.__init__( self, label='Urban Cooling Model', target=natcap.invest.urban_cooling_model.execute, validator=natcap.invest.urban_cooling_model.validate, localdoc='urban_cooling_model.html') self.lulc_raster_path = inputs.File( args_key='lulc_raster_path', helptext=('Path to landcover raster.'), label='Land Use / Land Cover (Raster)', validator=self.validator) self.add_input(self.lulc_raster_path) self.ref_eto_raster_path = inputs.File( args_key='ref_eto_raster_path', helptext=('Path to evapotranspiration raster.'), label='Reference Evapotranspiration (Raster)', validator=self.validator) self.add_input(self.ref_eto_raster_path) self.aoi_vector_path = inputs.File( args_key='aoi_vector_path', helptext=('Path to desired AOI.'), label='Area of Interest (Vector)', validator=self.validator) self.add_input(self.aoi_vector_path) self.biophysical_table_path = inputs.File( args_key='biophysical_table_path', helptext=( "Table to map landcover codes to Shade, Kc, and Albedo " "values. Must contain the fields 'lucode', 'shade', 'kc', " "and 'albedo'."), label='Biophysical Table (CSV)', validator=self.validator) self.add_input(self.biophysical_table_path) self.t_ref = inputs.Text( args_key='t_ref', helptext=('Reference air temperature (real).'), label='Baseline air temperature (°C)', validator=self.validator) self.t_ref.set_value("21.5") self.add_input(self.t_ref) self.uhi_max = inputs.Text( args_key='uhi_max', label='Magnitude of the UHI effect (°C)', helptext=( "The magnitude of the urban heat island effect, in degrees " "C. Example: the difference between the rural reference " "temperature and the maximum temperature observed in the " "city."), validator=self.validator) self.add_input(self.uhi_max) self.uhi_max.set_value("3.5") self.t_air_average_radius = inputs.Text( args_key='t_air_average_radius', label='Air Temperature Maximum Blending Distance (m).', helptext=( "Radius of the averaging filter for turning T_air_nomix " "into T_air"), validator=self.validator) self.add_input(self.t_air_average_radius) self.t_air_average_radius.set_value("2000") self.green_area_cooling_distance = inputs.Text( args_key='green_area_cooling_distance', label='Green Area Maximum Cooling Distance (m).', helptext=( "Distance (in m) over which large green areas (> 2 ha) " "will have a cooling effect."), validator=self.validator) self.add_input(self.green_area_cooling_distance) self.green_area_cooling_distance.set_value("1000") self.cc_method = inputs.Dropdown( label='Cooling Capacity Calculation Method', args_key='cc_method', helptext=( 'The method selected here determines the predictor used for ' 'air temperature. If <b>"Weighted Factors"</b> is ' 'selected, the Cooling Capacity calculations will use the ' 'weighted factors for shade, albedo and ETI as a predictor ' 'for daytime temperatures. <br/>' 'Alternatively, if <b>"Building Intensity"</b> is selected, ' 'building intensity will be used as a predictor for nighttime ' 'temperature instead of shade, albedo and ETI.' ), options=('Weighted Factors', 'Building Intensity'), return_value_map={ 'Weighted Factors': 'factors', 'Building Intensity': 'intensity', }) self.cc_method.value_changed.connect( self._enable_cc_options) self.add_input(self.cc_method) self.energy_valuation_container = inputs.Container( args_key='do_energy_valuation', expandable=True, expanded=True, interactive=True, label='Run Energy Savings Valuation Model') self.add_input(self.energy_valuation_container) self.productivity_valuation_container = inputs.Container( args_key='do_productivity_valuation', expandable=True, expanded=True, interactive=True, label='Run Work Productivity Valuation Model') self.add_input(self.productivity_valuation_container) self.building_vector_path = inputs.File( args_key='building_vector_path', helptext=( "Path to a vector of building footprints that contains at " "least the field 'type'."), label='Building Footprints (Vector)', validator=self.validator) self.energy_valuation_container.add_input(self.building_vector_path) self.energy_consumption_table_path = inputs.File( args_key='energy_consumption_table_path', helptext=( "Path to a table that maps building types to energy " "consumption. Must contain at least the fields 'type' " "and 'consumption'."), label='Energy Consumption Table (CSV)', validator=self.validator) self.energy_valuation_container.add_input(self.energy_consumption_table_path) self.avg_rel_humidity = inputs.Text( args_key='avg_rel_humidity', label='Average relative humidity (0-100%)', helptext=( "The average relative humidity (0-100%)."), validator=self.validator) self.productivity_valuation_container.add_input(self.avg_rel_humidity) self.avg_rel_humidity.set_value("30") self.cooling_capacity_container = inputs.Container( expandable=True, expanded=True, interactive=True, label='Manually Adjust Cooling Capacity Index Weights' ) self.add_input(self.cooling_capacity_container) self.cc_weight_shade = inputs.Text( args_key='cc_weight_shade', helptext=("Shade weight for cooling capacity index. " "Default: 0.6"), label='Shade', validator=self.validator) self.cooling_capacity_container.add_input(self.cc_weight_shade) self.cc_weight_shade.set_value("0.6") self.cc_weight_albedo = inputs.Text( args_key='cc_weight_albedo', helptext=("Albedo weight for cooling capacity index. " "Default: 0.2"), label='Albedo', validator=self.validator) self.cooling_capacity_container.add_input(self.cc_weight_albedo) self.cc_weight_albedo.set_value("0.2") self.cc_weight_eti = inputs.Text( args_key='cc_weight_eti', helptext=("Evapotranspiration index weight for cooling capacity. " "Default: 0.2"), label='Evapotranspiration Index', validator=self.validator) self.cooling_capacity_container.add_input(self.cc_weight_eti) self.cc_weight_eti.set_value("0.2")
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)
def __init__(self): model.InVESTModel.__init__( self, label=u'Wave Energy', target=natcap.invest.wave_energy.execute, validator=natcap.invest.wave_energy.validate, localdoc=u'wave_energy.html') self.wave_base_data = inputs.Folder( args_key=u'wave_base_data_path', helptext=(u'Select the folder that has the packaged Wave Energy ' u'Data.'), label=u'Wave Base Data Folder', validator=self.validator) self.add_input(self.wave_base_data) self.analysis_area = inputs.Dropdown( args_key=u'analysis_area_path', helptext=(u"A list of analysis areas for which the model can " u"currently be run. All the wave energy data needed " u"for these areas are pre-packaged in the WaveData " u"folder."), label=u'Analysis Area', options=(u'West Coast of North America and Hawaii', u'East Coast of North America and Puerto Rico', u'North Sea 4 meter resolution', u'North Sea 10 meter resolution', u'Australia', u'Global')) self.add_input(self.analysis_area) self.aoi = inputs.File( args_key=u'aoi_path', helptext=(u"An OGR-supported vector file containing a single " u"polygon representing the area of interest. This " u"input is required for computing valuation and is " u"recommended for biophysical runs as well. The AOI " u"should be projected in linear units of meters."), label=u'Area of Interest (Vector)', validator=self.validator) self.add_input(self.aoi) self.machine_perf_table = inputs.File( args_key=u'machine_perf_path', helptext=(u"A CSV Table that has the performance of a particular " u"wave energy machine at certain sea state conditions."), label=u'Machine Performance Table (CSV)', validator=self.validator) self.add_input(self.machine_perf_table) self.machine_param_table = inputs.File( args_key=u'machine_param_path', helptext=(u"A CSV Table that has parameter values for a wave " u"energy machine. This includes information on the " u"maximum capacity of the device and the upper limits " u"for wave height and period."), label=u'Machine Parameter Table (CSV)', validator=self.validator) self.add_input(self.machine_param_table) self.dem = inputs.File( args_key=u'dem_path', helptext=(u"A GDAL-supported raster file containing a digital " u"elevation model dataset that has elevation values in " u"meters. Used to get the cable distance for wave " u"energy transmission."), label=u'Global Digital Elevation Model (Raster)', validator=self.validator) self.add_input(self.dem) self.valuation_container = inputs.Container( args_key=u'valuation_container', expandable=True, expanded=False, label=u'Valuation') self.add_input(self.valuation_container) self.land_grid_points = inputs.File( args_key=u'land_gridPts_path', helptext=(u"A CSV Table that has the landing points and grid " u"points locations for computing cable distances."), label=u'Grid Connection Points File (CSV)', validator=self.validator) self.valuation_container.add_input(self.land_grid_points) self.machine_econ_table = inputs.File( args_key=u'machine_econ_path', helptext=(u"A CSV Table that has the economic parameters for the " u"wave energy machine."), label=u'Machine Economic Table (CSV)', validator=self.validator) self.valuation_container.add_input(self.machine_econ_table) self.number_of_machines = inputs.Text( args_key=u'number_of_machines', helptext=(u"An integer for how many wave energy machines will be " u"in the wave farm."), label=u'Number of Machines', validator=self.validator) self.valuation_container.add_input(self.number_of_machines)
def __init__(self): model.InVESTModel.__init__( self, label=MODEL_METADATA['recreation'].model_title, target=recmodel_client.execute, validator=recmodel_client.validate, localdoc=MODEL_METADATA['recreation'].userguide) self.internet_warning = inputs.Label( text=("Note, this computer must have an Internet connection " "in order to run this model.")) self.aoi_path = inputs.File( args_key='aoi_path', helptext=("An OGR-supported vector file representing the area " "of interest where the model will run the analysis."), label='Area of Interest (Vector)', validator=self.validator) self.add_input(self.aoi_path) self.start_year = inputs.Text( args_key='start_year', helptext='Year to start PUD calculations, date starts on Jan 1st.', label='Start Year (inclusive, must be >= 2005)', validator=self.validator) self.add_input(self.start_year) self.end_year = inputs.Text( args_key='end_year', helptext=('Year to end PUD calculations, date ends and includes ' 'Dec 31st.'), label='End Year (inclusive, must be <= 2017)', validator=self.validator) self.add_input(self.end_year) self.regression_container = inputs.Container( args_key='compute_regression', expandable=True, expanded=True, label='Compute Regression') self.add_input(self.regression_container) self.predictor_table_path = inputs.File( args_key='predictor_table_path', helptext=("A table that maps predictor IDs to files and their " "types with required headers of 'id', 'path', and " "'type'. The file paths can be absolute, or relative " "to the table."), label='Predictor Table', validator=self.validator) self.regression_container.add_input(self.predictor_table_path) self.scenario_predictor_table_path = inputs.File( args_key='scenario_predictor_table_path', helptext=("A table that maps predictor IDs to files and their " "types with required headers of 'id', 'path', and " "'type'. The file paths can be absolute, or relative " "to the table."), label='Scenario Predictor Table (optional)', validator=self.validator) self.regression_container.add_input(self.scenario_predictor_table_path) self.grid_container = inputs.Container(args_key='grid_aoi', expandable=True, expanded=True, label='Grid the AOI') self.add_input(self.grid_container) self.grid_type = inputs.Dropdown(args_key='grid_type', label='Grid Type', options=['square', 'hexagon']) self.grid_container.add_input(self.grid_type) self.cell_size = inputs.Text( args_key='cell_size', helptext=("The size of the grid units measured in the " "projection units of the AOI. For example, UTM " "projections use meters."), label='Cell Size', validator=self.validator) self.grid_container.add_input(self.cell_size)
def __init__(self): model.InVESTModel.__init__(self, label=u'Scenic Quality', target=scenic_quality.execute, validator=scenic_quality.validate, localdoc=u'scenic_quality.html') self.general_tab = inputs.Container(interactive=True, label=u'General') self.add_input(self.general_tab) self.aoi_path = inputs.File( args_key=u'aoi_path', helptext=(u"An OGR-supported vector file. This AOI instructs " u"the model where to clip the input data and the extent " u"of analysis. Users will create a polygon feature " u"layer that defines their area of interest. The AOI " u"must intersect the Digital Elevation Model (DEM)."), label=u'Area of Interest (Vector) (Required)', validator=self.validator) self.general_tab.add_input(self.aoi_path) self.structure_path = inputs.File( args_key=u'structure_path', helptext=(u"An OGR-supported vector file. The user must specify " u"a point feature layer that indicates locations of " u"objects that contribute to negative scenic quality, " u"such as aquaculture netpens or wave energy " u"facilities. In order for the viewshed analysis to " u"run correctly, the projection of this input must be " u"consistent with the project of the DEM input."), label=u'Features Impacting Scenic Quality (Vector) (Required)', validator=self.validator) self.general_tab.add_input(self.structure_path) self.dem_path = inputs.File( args_key=u'dem_path', helptext=(u"A GDAL-supported raster file. An elevation raster " u"layer is required to conduct viewshed analysis. " u"Elevation data allows the model to determine areas " u"within the AOI's land-seascape where point features " u"contributing to negative scenic quality are visible."), label=u'Digital Elevation Model (Raster) (Required)', validator=self.validator) self.general_tab.add_input(self.dem_path) self.refraction = inputs.Text( args_key=u'refraction', helptext=(u"The earth curvature correction option corrects for " u"the curvature of the earth and refraction of visible " u"light in air. Changes in air density curve the light " u"downward causing an observer to see further and the " u"earth to appear less curved. While the magnitude of " u"this effect varies with atmospheric conditions, a " u"standard rule of thumb is that refraction of visible " u"light reduces the apparent curvature of the earth by " u"one-seventh. By default, this model corrects for the " u"curvature of the earth and sets the refractivity " u"coefficient to 0.13."), label=u'Refractivity Coefficient (Required)', validator=self.validator) self.general_tab.add_input(self.refraction) self.valuation_container = inputs.Container(args_key=u'do_valuation', expandable=True, expanded=False, interactive=True, label=u'Valuation') self.add_input(self.valuation_container) self.valuation_function = inputs.Dropdown( args_key=u'valuation_function', helptext=(u"This field indicates the functional form f(x) the " u"model will use to value the visual impact for each " u"viewpoint."), label=u'Valuation Function', options=[ u'linear: a + bx', u'logarithmic: a + b log(x+1)', u'exponential: a * e^(-bx)' ]) self.valuation_container.add_input(self.valuation_function) self.a_coefficient = inputs.Text( args_key=u'a_coef', helptext=(u"First coefficient used by the valuation function"), label=u"'a' Coefficient (Required)", validator=self.validator) self.valuation_container.add_input(self.a_coefficient) self.b_coefficient = inputs.Text( args_key=u'b_coef', helptext=(u"Second coefficient used by the valuation function"), label=u"'b' Coefficient (Required)", validator=self.validator) self.valuation_container.add_input(self.b_coefficient) self.max_valuation_radius = inputs.Text( args_key=u'max_valuation_radius', helptext=(u"Radius beyond which the valuation is set to zero. " u"The valuation function 'f' cannot be negative at the " u"radius 'r' (f(r)>=0)."), label=u'Maximum Valuation Radius (meters) (Required)', validator=self.validator) self.valuation_container.add_input(self.max_valuation_radius)
def __init__(self): model.InVESTModel.__init__( self, label=u'Scenic Quality', target=scenic_quality.execute, validator=scenic_quality.validate, localdoc=u'../documentation/scenic_quality.html') self.beta_only = inputs.Label( text=( u"This tool is considered UNSTABLE. Users may " u"experience performance issues and unexpected errors.")) self.general_tab = inputs.Container( interactive=True, label=u'General') self.add_input(self.general_tab) self.aoi_uri = inputs.File( args_key=u'aoi_uri', helptext=( u"An OGR-supported vector file. This AOI instructs " u"the model where to clip the input data and the extent " u"of analysis. Users will create a polygon feature " u"layer that defines their area of interest. The AOI " u"must intersect the Digital Elevation Model (DEM)."), label=u'Area of Interest (Vector)', validator=self.validator) self.general_tab.add_input(self.aoi_uri) self.cell_size = inputs.Text( args_key=u'cell_size', helptext=u'Length (in meters) of each side of the (square) cell.', label=u'Cell Size (meters)', validator=self.validator) self.general_tab.add_input(self.cell_size) self.structure_uri = inputs.File( args_key=u'structure_uri', helptext=( u"An OGR-supported vector file. The user must specify " u"a point feature layer that indicates locations of " u"objects that contribute to negative scenic quality, " u"such as aquaculture netpens or wave energy " u"facilities. In order for the viewshed analysis to " u"run correctly, the projection of this input must be " u"consistent with the project of the DEM input."), label=u'Features Impacting Scenic Quality (Vector)', validator=self.validator) self.general_tab.add_input(self.structure_uri) self.dem_uri = inputs.File( args_key=u'dem_uri', helptext=( u"A GDAL-supported raster file. An elevation raster " u"layer is required to conduct viewshed analysis. " u"Elevation data allows the model to determine areas " u"within the AOI's land-seascape where point features " u"contributing to negative scenic quality are visible."), label=u'Digital Elevation Model (Raster)', validator=self.validator) self.general_tab.add_input(self.dem_uri) self.refraction = inputs.Text( args_key=u'refraction', helptext=( u"The earth curvature correction option corrects for " u"the curvature of the earth and refraction of visible " u"light in air. Changes in air density curve the light " u"downward causing an observer to see further and the " u"earth to appear less curved. While the magnitude of " u"this effect varies with atmospheric conditions, a " u"standard rule of thumb is that refraction of visible " u"light reduces the apparent curvature of the earth by " u"one-seventh. By default, this model corrects for the " u"curvature of the earth and sets the refractivity " u"coefficient to 0.13."), label=u'Refractivity Coefficient', validator=self.validator) self.general_tab.add_input(self.refraction) self.pop_uri = inputs.File( args_key=u'pop_uri', helptext=( u"A GDAL-supported raster file. A population raster " u"layer is required to determine population within the " u"AOI's land-seascape where point features contributing " u"to negative scenic quality are visible and not " u"visible."), label=u'Population (Raster)', validator=self.validator) self.general_tab.add_input(self.pop_uri) self.overlap_uri = inputs.File( args_key=u'overlap_uri', helptext=( u"An OGR-supported vector file. The user has the " u"option of providing a polygon feature layer where " u"they would like to determine the impact of objects on " u"visual quality. This input must be a polygon and " u"projected in meters. The model will use this layer " u"to determine what percent of the total area of each " u"polygon feature can see at least one of the point " u"features impacting scenic quality."), label=u'Overlap Analysis Features (Vector)', validator=self.validator) self.general_tab.add_input(self.overlap_uri) self.valuation_tab = inputs.Container( interactive=True, label=u'Valuation') self.add_input(self.valuation_tab) self.valuation_function = inputs.Dropdown( args_key=u'valuation_function', helptext=( u"This field indicates the functional form f(x) the " u"model will use to value the visual impact for each " u"viewpoint. For distances less than 1 km (x<1), the " u"model uses a linear form g(x) where the line passes " u"through f(1) (i.e. g(1) == f(1)) and extends to zero " u"with the same slope as f(1) (i.e. g'(x) == f'(1))."), label=u'Valuation Function', options=[u'polynomial: a + bx + cx^2 + dx^3', u'logarithmic: a + b ln(x)']) self.valuation_tab.add_input(self.valuation_function) self.a_coefficient = inputs.Text( args_key=u'a_coefficient', helptext=( u"First coefficient used either by the polynomial or " u"by the logarithmic valuation function."), label=u"'a' Coefficient (polynomial/logarithmic)", validator=self.validator) self.valuation_tab.add_input(self.a_coefficient) self.b_coefficient = inputs.Text( args_key=u'b_coefficient', helptext=( u"Second coefficient used either by the polynomial or " u"by the logarithmic valuation function."), label=u"'b' Coefficient (polynomial/logarithmic)", validator=self.validator) self.valuation_tab.add_input(self.b_coefficient) self.c_coefficient = inputs.Text( args_key=u'c_coefficient', helptext=u"Third coefficient for the polynomial's quadratic term.", label=u"'c' Coefficient (polynomial only)", validator=self.validator) self.valuation_tab.add_input(self.c_coefficient) self.d_coefficient = inputs.Text( args_key=u'd_coefficient', helptext=u"Fourth coefficient for the polynomial's cubic exponent.", label=u"'d' Coefficient (polynomial only)", validator=self.validator) self.valuation_tab.add_input(self.d_coefficient) self.max_valuation_radius = inputs.Text( args_key=u'max_valuation_radius', helptext=( u"Radius beyond which the valuation is set to zero. " u"The valuation function 'f' cannot be negative at the " u"radius 'r' (f(r)>=0)."), label=u'Maximum Valuation Radius (meters)', validator=self.validator) self.valuation_tab.add_input(self.max_valuation_radius)
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)