def __init__(self): model.InVESTModel.__init__( self, label=u'Crop Production Regression Model', target=natcap.invest.crop_production_regression.execute, validator=natcap.invest.crop_production_regression.validate, localdoc=u'crop_production.html') self.model_data_path = inputs.Folder( args_key=u'model_data_path', helptext=(u"A path to the InVEST Crop Production Data directory. " u"These data would have been included with the InVEST " u"installer if selected, or can be manually downloaded " u"from http://data.naturalcapitalproject.org/invest- " u"data/. If downloaded with InVEST, the default value " u"should be used.</b>"), label=u'Directory to model data', validator=self.validator) self.add_input(self.model_data_path) self.landcover_raster_path = inputs.File( args_key=u'landcover_raster_path', helptext=(u"A raster file, representing integer land use/land " u"code covers for each cell. This raster should have" u"a projected coordinate system with units of meters " u"(e.g. UTM) because pixel areas are divided by 10000" u"in order to report some results in hectares."), label=u'Land-Use/Land-Cover Map (raster)', validator=self.validator) self.add_input(self.landcover_raster_path) self.landcover_to_crop_table_path = inputs.File( args_key=u'landcover_to_crop_table_path', helptext=(u"A CSV table mapping canonical crop names to land use " u"codes contained in the landcover/use raster. The " u"allowed crop names are barley, maize, oilpalm, " u"potato, rice, soybean, sugarbeet, sugarcane, " u"sunflower, and wheat."), label=u'Landcover to Crop Table (csv)', validator=self.validator) self.add_input(self.landcover_to_crop_table_path) self.fertilization_rate_table_path = inputs.File( args_key=u'fertilization_rate_table_path', helptext=(u"A table that maps fertilization rates to crops in " u"the simulation. Must include the headers " u"'crop_name', 'nitrogen_rate', 'phosphorous_rate', " u"and 'potassium_rate'."), label=u'Fertilization Rate Table Path (csv)', validator=self.validator) self.add_input(self.fertilization_rate_table_path) self.aggregate_polygon_path = inputs.File( args_key=u'aggregate_polygon_path', helptext=(u"A polygon shapefile containing features with" u"which to aggregate/summarize final results." u"It is fine to have overlapping polygons."), label=u'Aggregate results polygon (vector) (optional)', validator=self.validator) self.add_input(self.aggregate_polygon_path)
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=('Overlap Analysis Management Zone Model: Fisheries and ' 'Recreation'), target=overlap_analysis_mz.execute, validator=overlap_analysis_mz.validate, localdoc='../documentation/overlap_analysis.html') self.aoi = inputs.File( args_key='zone_layer_loc', helptext=( "An OGR-supported vector file. This should be a " "vector file containing multiple polygons since the " "Management Zones tool is used to analyze overlap " "data."), label='Analysis Zones Layer (Vector)', validator=self.validator) self.add_input(self.aoi) self.data_dir = inputs.Folder( args_key='overlap_data_dir_loc', helptext=( "The path to a folder containing ONLY the input data " "for the Overlap Analysis model. Input data can be " "point, line or polygon data layers indicating where " "in the coastal and marine environment the human use " "activity takes place."), label='Overlap Analysis Data Directory', validator=self.validator) self.add_input(self.data_dir)
def __init__(self): model.InVESTModel.__init__( self, label=u'RouteDEM', target=routedem.execute, validator=routedem.validate, localdoc=u'../documentation/routedem.html') self.dem_path = inputs.File( args_key=u'dem_path', helptext=( u"A GDAL-supported raster file containing a base " u"Digital Elevation Model to execute the routing " u"functionality across."), label=u'Digital Elevation Model (Raster)', validator=self.validator) self.add_input(self.dem_path) self.calculate_slope = inputs.Checkbox( args_key=u'calculate_slope', helptext=u'If selected, calculates slope raster.', label=u'Calculate Slope') self.add_input(self.calculate_slope) self.calculate_flow_accumulation = inputs.Checkbox( args_key=u'calculate_flow_accumulation', helptext=u'Select to calculate flow accumulation.', label=u'Calculate Flow Accumulation') self.add_input(self.calculate_flow_accumulation) self.calculate_stream_threshold = inputs.Checkbox( args_key=u'calculate_stream_threshold', helptext=u'Select to calculate a stream threshold to flow accumulation.', interactive=False, label=u'Calculate Stream Thresholds') self.add_input(self.calculate_stream_threshold) self.threshold_flow_accumulation = inputs.Text( args_key=u'threshold_flow_accumulation', helptext=( u"The number of upstream cells that must flow into a " u"cell before it's classified as a stream."), interactive=False, label=u'Threshold Flow Accumulation Limit', validator=self.validator) self.add_input(self.threshold_flow_accumulation) self.calculate_downstream_distance = inputs.Checkbox( args_key=u'calculate_downstream_distance', helptext=( u"If selected, creates a downstream distance raster " u"based on the thresholded flow accumulation stream " u"classification."), interactive=False, label=u'Calculate Distance to stream') self.add_input(self.calculate_downstream_distance) # Set interactivity, requirement as input sufficiency changes self.calculate_flow_accumulation.sufficiency_changed.connect( self.calculate_stream_threshold.set_interactive) self.calculate_stream_threshold.sufficiency_changed.connect( self.threshold_flow_accumulation.set_interactive) self.calculate_stream_threshold.sufficiency_changed.connect( self.calculate_downstream_distance.set_interactive)
def __init__(self): model.InVESTModel.__init__( self, label=u'DelineateIT: Watershed Delineation', target=delineateit.execute, validator=delineateit.validate, localdoc=u'../documentation/delineateit.html') self.dem_uri = inputs.File( args_key=u'dem_uri', helptext=( u"A GDAL-supported raster file with an elevation value " u"for each cell. Make sure the DEM is corrected by " u"filling in sinks, and if necessary burning " u"hydrographic features into the elevation model " u"(recommended when unusual streams are observed.) See " u"the 'Working with the DEM' section of the InVEST " u"User's Guide for more information."), label=u'Digital Elevation Model (Raster)', validator=self.validator) self.add_input(self.dem_uri) self.outlet_shapefile_uri = inputs.File( args_key=u'outlet_shapefile_uri', helptext=( u"This is a layer of points representing outlet points " u"that the watersheds should be built around."), label=u'Outlet Points (Vector)', validator=self.validator) self.add_input(self.outlet_shapefile_uri) self.flow_threshold = inputs.Text( args_key=u'flow_threshold', helptext=( u"The number of upstream cells that must flow into a " u"cell before it's considered part of a stream such " u"that retention stops and the remaining export is " u"exported to the stream. Used to define streams from " u"the DEM."), label=u'Threshold Flow Accumulation', validator=self.validator) self.add_input(self.flow_threshold) self.snap_distance = inputs.Text( args_key=u'snap_distance', label=u'Pixel Distance to Snap Outlet Points', validator=self.validator) self.add_input(self.snap_distance)
def __init__(self): model.InVESTModel.__init__(self, label='Coastal Blue Carbon Preprocessor', target=preprocessor.execute, validator=preprocessor.validate, localdoc='coastal_blue_carbon.html') _ui_keys = functools.partial(_create_input_kwargs_from_args_spec, args_spec=preprocessor.ARGS_SPEC, validator=self.validator) self.lulc_snapshot_csv = inputs.File( **_ui_keys('landcover_snapshot_csv')) self.add_input(self.lulc_snapshot_csv) self.lulc_lookup_table_path = inputs.File( **_ui_keys('lulc_lookup_table_path')) self.add_input(self.lulc_lookup_table_path)
def __init__(self): model.InVESTModel.__init__( self, label=MODEL_METADATA['coastal_blue_carbon_preprocessor']. model_title, target=preprocessor.execute, validator=preprocessor.validate, localdoc=MODEL_METADATA['coastal_blue_carbon_preprocessor']. userguide) _ui_keys = functools.partial(_create_input_kwargs_from_args_spec, args_spec=preprocessor.ARGS_SPEC, validator=self.validator) self.lulc_snapshot_csv = inputs.File( **_ui_keys('landcover_snapshot_csv')) self.add_input(self.lulc_snapshot_csv) self.lulc_lookup_table_path = inputs.File( **_ui_keys('lulc_lookup_table_path')) self.add_input(self.lulc_lookup_table_path)
def __init__(self): model.InVESTModel.__init__(self, label=u'Coastal Blue Carbon Preprocessor', target=preprocessor.execute, validator=preprocessor.validate, localdoc=u'coastal_blue_carbon.html') self.lulc_lookup_uri = inputs.File( args_key=u'lulc_lookup_uri', helptext=(u"A CSV table used to map lulc classes to their values " u"in a raster, as well as to indicate whether or not " u"the lulc class is a coastal blue carbon habitat."), label=u'LULC Lookup Table (CSV)', validator=self.validator) self.add_input(self.lulc_lookup_uri) self.lulc_snapshot_list = inputs.Multi( args_key=u'lulc_snapshot_list', callable_=functools.partial(inputs.File, label="Input"), label=u'Land Use/Land Cover Rasters (GDAL-supported)', link_text=u'Add Another') self.add_input(self.lulc_snapshot_list)
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=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=MODEL_METADATA['pollination'].model_title, target=pollination.execute, validator=pollination.validate, localdoc=MODEL_METADATA['pollination'].userguide) self.landcover_raster_path = inputs.File( args_key='landcover_raster_path', helptext=("This is the landcover map that's used to map " "biophyiscal properties about habitat and floral " "resources of landcover types to a spatial layout."), label='Land Cover Map (Raster)', validator=self.validator) self.add_input(self.landcover_raster_path) self.landcover_biophysical_table_path = inputs.File( args_key='landcover_biophysical_table_path', helptext=("A CSV table mapping landcover codes in the landcover " "raster to indexes of nesting availability for each " "nesting substrate referenced in guilds table as well " "as indexes of abundance of floral resources on that " "landcover type per season in the bee activity columns " "of the guild table.<br/>All indexes are in the range " "[0.0, 1.0].<br/>Columns in the table must be at " "least<br/>* 'lucode': representing all the unique " "landcover codes in the raster st " "`args['landcover_path']`<br/>* For every nesting " "matching _NESTING_SUITABILITY_PATTERN in the guild " "stable, a column matching the pattern in " "`_LANDCOVER_NESTING_INDEX_HEADER`.<br/>* For every " "season matching _FORAGING_ACTIVITY_PATTERN in the " "guilds table, a column matching the pattern in " "`_LANDCOVER_FLORAL_RESOURCES_INDEX_HEADER`."), label='Land Cover Biophysical Table (CSV)', validator=self.validator) self.add_input(self.landcover_biophysical_table_path) self.guild_table_path = inputs.File( args_key='guild_table_path', helptext=("A table indicating the bee species to analyze in " "this model run. Table headers must include:<br/>* " "'species': a bee species whose column string names " "will be referred to in other tables and the model " "will output analyses per species.<br/> * any number " "of columns matching _NESTING_SUITABILITY_PATTERN with " "values in the range [0.0, 1.0] indicating the " "suitability of the given species to nest in a " "particular substrate.<br/>* any number of " "_FORAGING_ACTIVITY_PATTERN columns with values in the " "range [0.0, 1.0] indicating the relative level of " "foraging activity for that species during a " "particular season.<br/>* 'alpha': the sigma average " "flight distance of that bee species in meters.<br/>* " "'relative_abundance': a weight indicating the " "relative abundance of the particular species with " "respect to the sum of all relative abundance weights " "in the table."), label='Guild Table (CSV)', validator=self.validator) self.add_input(self.guild_table_path) self.farm_vector_path = inputs.File( args_key='farm_vector_path', helptext=("This is a layer of polygons representing farm sites " "to be analyzed. The shapefile must have at least the " "following fields:<br/><br/>* season (string): season " "in which the farm needs pollination.<br/>* half_sat " "(float): a real in the range [0.0, 1.0] representing " "the proportion of wild pollinators to achieve a 50% " "yield of that crop.<br/>* p_wild_dep (float): a " "number in the range [0.0, 1.0] representing the " "proportion of yield dependent on pollinators.<br/>* " "p_managed (float): proportion of pollinators that " "come from non-native/managed hives.<br/>* f_[season] " "(float): any number of fields that match this pattern " "such that `season` also matches the season headers in " "the biophysical and guild table. Any areas that " "overlap the landcover map will replace seasonal " "floral resources with this value. Ranges from " "0..1.<br/>* n_[substrate] (float): any number of " "fields that match this pattern such that `substrate` " "also matches the nesting substrate headers in the " "biophysical and guild table. Any areas that overlap " "the landcover map will replace nesting substrate " "suitability with this value. Ranges from 0..1."), label='Farm Vector (Vector) (optional)', validator=self.validator) self.add_input(self.farm_vector_path)
def __init__(self): model.InVESTModel.__init__( self, label='Habitat Risk Assessment', target=hra.execute, validator=hra.validate, localdoc='../documentation/habitat_risk_assessment.html') self.csv_uri = inputs.Folder( args_key='csv_uri', helptext=( "A folder containing multiple CSV files. Each file " "refers to the overlap between a habitat and a " "stressor pulled from habitat and stressor shapefiles " "during the run of the HRA Preprocessor."), label='Criteria Scores CSV Folder', validator=self.validator) self.add_input(self.csv_uri) self.grid_size = inputs.Text( args_key='grid_size', helptext=( "The size that should be used to grid the given " "habitat and stressor shapefiles into rasters. This " "value will be the pixel size of the completed raster " "files."), label='Resolution of Analysis (meters)', validator=self.validator) self.add_input(self.grid_size) self.risk_eq = inputs.Dropdown( args_key='risk_eq', helptext=( "Each of these represents an option of a risk " "calculation equation. This will determine the " "numeric output of risk for every habitat and stressor " "overlap area."), label='Risk Equation', options=['Multiplicative', 'Euclidean']) self.add_input(self.risk_eq) self.decay_eq = inputs.Dropdown( args_key='decay_eq', helptext=( "Each of these represents an option for decay " "equations for the buffered stressors. If stressor " "buffering is desired, these equtions will determine " "the rate at which stressor data is reduced."), label='Decay Equation', options=['None', 'Linear', 'Exponential']) self.add_input(self.decay_eq) self.max_rating = inputs.Text( args_key='max_rating', helptext=( "This is the highest score that is used to rate a " "criteria within this model run. These values would " "be placed within the Rating column of the habitat, " "species, and stressor CSVs."), label='Maximum Criteria Score', validator=self.validator) self.add_input(self.max_rating) self.max_stress = inputs.Text( args_key='max_stress', helptext=( "This is the largest number of stressors that are " "suspected to overlap. This will be used in order to " "make determinations of low, medium, and high risk for " "any given habitat."), label='Maximum Overlapping Stressors', validator=self.validator) self.add_input(self.max_stress) self.aoi_tables = inputs.File( args_key='aoi_tables', helptext=( "An OGR-supported vector file containing feature " "subregions. The program will create additional " "summary outputs across each subregion."), label='Subregions (Vector)', validator=self.validator) self.add_input(self.aoi_tables)
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: Proximity Based', target=natcap.invest.scenario_gen_proximity.execute, validator=natcap.invest.scenario_gen_proximity.validate, localdoc='../documentation/scenario_gen_proximity.html') self.base_lulc_path = inputs.File(args_key='base_lulc_path', label='Base Land Use/Cover (Raster)', validator=self.validator) self.add_input(self.base_lulc_path) self.aoi_path = inputs.File( args_key='aoi_path', helptext=("This is a set of polygons that will be used to " "aggregate carbon values at the end of the run if " "provided."), label='Area of interest (Vector) (optional)', validator=self.validator) self.add_input(self.aoi_path) self.area_to_convert = inputs.Text(args_key='area_to_convert', label='Max area to convert (Ha)', validator=self.validator) self.add_input(self.area_to_convert) self.focal_landcover_codes = inputs.Text( args_key='focal_landcover_codes', label='Focal Landcover Codes (list)', validator=self.validator) self.add_input(self.focal_landcover_codes) self.convertible_landcover_codes = inputs.Text( args_key='convertible_landcover_codes', label='Convertible Landcover Codes (list)', validator=self.validator) self.add_input(self.convertible_landcover_codes) self.replacment_lucode = inputs.Text( args_key='replacment_lucode', label='Replacement Landcover Code (int)', validator=self.validator) self.add_input(self.replacment_lucode) self.convert_farthest_from_edge = inputs.Checkbox( args_key='convert_farthest_from_edge', helptext=("This scenario converts the convertible landcover " "codes starting at the furthest pixel from the closest " "base landcover codes and moves inward."), label='Farthest from edge') self.add_input(self.convert_farthest_from_edge) self.convert_nearest_to_edge = inputs.Checkbox( args_key='convert_nearest_to_edge', helptext=("This scenario converts the convertible landcover " "codes starting at the closest pixel in the base " "landcover codes and moves outward."), label='Nearest to edge') self.add_input(self.convert_nearest_to_edge) self.n_fragmentation_steps = inputs.Text( args_key='n_fragmentation_steps', helptext=("This parameter is used to divide the conversion " "simulation into equal subareas of the requested max " "area. During each sub-step the distance transform is " "recalculated from the base landcover codes. This can " "affect the final result if the base types are also " "convertible types."), label='Number of Steps in Conversion', validator=self.validator) self.add_input(self.n_fragmentation_steps)
def __init__(self): model.InVESTModel.__init__( self, label='Habitat Risk Assessment', target=hra.execute, validator=hra.validate, localdoc='../documentation/habitat_risk_assessment.html') self.info_table_path = inputs.File( args_key='info_table_path', helptext=( "A CSV or Excel file that contains the name of the habitat " "(H) or stressor (s) on the `NAME` column that matches the " "names in `criteria_table_path`. Each H/S has its " "corresponding vector or raster path on the `PATH` column. " "The `STRESSOR BUFFER (meters)` column should have a buffer " "value if the `TYPE` column is a stressor."), label='Habitat Stressor Information CSV or Excel File', validator=self.validator) self.add_input(self.info_table_path) self.criteria_table_path = inputs.File( args_key='criteria_table_path', helptext=( "A CSV or Excel file that contains the set of criteria " "ranking (rating, DQ and weight) of each stressor on each " "habitat, as well as the habitat resilience attributes."), label='Criteria Scores CSV or Excel File', validator=self.validator) self.add_input(self.criteria_table_path) self.resolution = inputs.Text( args_key='resolution', helptext=( "The size that should be used to grid the given habitat and " "stressor files into rasters. This value will be the pixel " "size of the completed raster files."), label='Resolution of Analysis (meters)', validator=self.validator) self.add_input(self.resolution) self.max_rating = inputs.Text( args_key='max_rating', helptext=( "This is the highest score that is used to rate a criteria " "within this model run. This value would be used to compare " "with the values within Rating column of the Criteria Scores " "table."), label='Maximum Criteria Score', validator=self.validator) self.add_input(self.max_rating) self.risk_eq = inputs.Dropdown( args_key='risk_eq', helptext=( "Each of these represents an option of a risk calculation " "equation. This will determine the numeric output of risk " "for every habitat and stressor overlap area."), label='Risk Equation', options=['Multiplicative', 'Euclidean']) self.add_input(self.risk_eq) self.decay_eq = inputs.Dropdown( args_key='decay_eq', helptext=( "Each of these represents an option of a decay equation " "for the buffered stressors. If stressor buffering is " "desired, this equation will determine the rate at which " "stressor data is reduced."), label='Decay Equation', options=['None', 'Linear', 'Exponential']) self.add_input(self.decay_eq) self.aoi_vector_path = inputs.File( args_key='aoi_vector_path', helptext=( "An OGR-supported vector file containing feature containing " "one or more planning regions. subregions. An optional field " "called `name` could be added to compute average risk values " "within each subregion."), label='Area of Interest (Vector)', validator=self.validator) self.add_input(self.aoi_vector_path) self.visualize_outputs = inputs.Checkbox( args_key='visualize_outputs', helptext=( "Check to enable the generation of GeoJSON outputs. This " "could be used to visualize the risk scores on a map in the " "HRA visualization web application."), label='Generate GeoJSONs for Web Visualization') self.add_input(self.visualize_outputs)
def __init__(self): model.InVESTModel.__init__( self, label=MODEL_METADATA['habitat_quality'].model_title, target=habitat_quality.execute, validator=habitat_quality.validate, localdoc=MODEL_METADATA['habitat_quality'].userguide) self.current_landcover = inputs.File( args_key='lulc_cur_path', helptext=("A GDAL-supported raster file. The current LULC must " "have its' own threat rasters, where each threat " "raster file path is defined in the <b>Threats Data</b> " "CSV..<br/><br/> " "Each cell should represent a LULC code as an Integer. " "The dataset should be in a projection where the units " "are in meters and the projection used should be " "defined. <b>The LULC codes must match the codes in " "the Sensitivity table</b>."), label='Current Land Cover (Raster)', validator=self.validator) self.add_input(self.current_landcover) self.future_landcover = inputs.File( args_key='lulc_fut_path', helptext=( "Optional. A GDAL-supported raster file. Inputting " "a future LULC will generate degradation, habitat " "quality, and habitat rarity (If baseline is input) " "outputs. The future LULC must have it's own threat " "rasters, where each threat raster file path is defined " "in the <b>Threats Data</b> CSV.<br/><br/>Each cell should " "represent a LULC code as an Integer. The dataset " "should be in a projection where the units are in " "meters and the projection used should be defined. " "<b>The LULC codes must match the codes in the " "Sensitivity table</b>."), label='Future Land Cover (Raster) (Optional)', validator=self.validator) self.add_input(self.future_landcover) self.baseline_landcover = inputs.File( args_key='lulc_bas_path', helptext=( "Optional. A GDAL-supported raster file. If the " "baseline LULC is provided, rarity outputs will be " "created for the current and future LULC. The baseline " "LULC can have it's own threat rasters (optional), " "where each threat raster file path is defined in the " "<b>Threats Data</b> CSV. If there are no threat rasters and " "the threat paths are left blank in the CSV column, " "degradation and habitat quality outputs will not be " "generated for the baseline LULC.<br/><br/> Each cell " "should represent a LULC code as an Integer. The " "dataset should be in a projection where the units are " "in meters and the projection used should be defined. " "The LULC codes must match the codes in the " "Sensitivity table. If possible the baseline map " "should refer to a time when intensive management of " "the landscape was relatively rare."), label='Baseline Land Cover (Raster) (Optional)', validator=self.validator) self.add_input(self.baseline_landcover) self.threats_data = inputs.File( args_key='threats_table_path', helptext=( "A CSV file of all the threats for the model to consider. " "Each row in the table is a degradation source. The columns " "(THREAT, MAX_DIST, WEIGHT, DECAY) are different attributes " "of each degradation source. The columns (BASE_PATH, CUR_PATH, " "FUT_PATH) specify the filepath name for the degradation " "source where the path is relative to the THREAT CSV. " "Column names are case-insensitive. " "<br/><br/><b>THREAT:</b> The name of the " "threat source must match exactly to the name " "of it's corresponding column in the sensitivity table. " "<br/><br/><b>MAX_DIST:</b> A number in kilometres " "(km) for the maximum distance a threat has an " "affect.<br/><br/><b>WEIGHT:</b> A floating point " "value between 0 and 1 for the the threats weight " "relative to the other threats. Depending on the type " "of habitat under review, certain threats may cause " "greater degradation than other " "threats.<br/><br/><b>DECAY:</b> A string value of " "either <b>exponential</b> or <b>linear</b> " "representing the type of decay over space for the " "threat. <br/><br/><b>BASE_PATH:</b> Required if baseline " "LULC input. The THREAT raster filepath for the base scenario " "where the filepath is relative to the THREAT CSV input. " "Entries can be left empty if there is no baseline scenario " "or if using the baseline LULC for rarity calculations only. " "<br/><br/><b>CUR_PATH:</b> " "The THREAT raster filepath for the current scenario " "where the filepath is relative to the THREAT CSV input. " "<br/><br/><b>FUT_PATH:</b> Required if future LULC input. " "The THREAT raster filepath for the future scenario where the " "filepath is relative to the THREAT CSV input." "<br/><br/>See the user's guide for valid values for these " "columns."), label='Threats Data', validator=self.validator) self.add_input(self.threats_data) self.accessibility_threats = inputs.File( args_key='access_vector_path', helptext=("An OGR-supported vector file. The input contains " "data on the relative protection that legal / " "institutional / social / physical barriers provide " "against threats. The vector file should contain " "polygons with a field <b>ACCESS</b>. The " "<b>ACCESS</b> values should range from 0 - 1, where 1 " "is fully accessible. Any cells not covered by a " "polygon will be set to 1."), label='Accessibility to Threats (Vector) (Optional)', validator=self.validator) self.add_input(self.accessibility_threats) self.sensitivity_data = inputs.File( args_key='sensitivity_table_path', helptext=("A CSV file of LULC types, whether or not the are " "considered habitat, and, for LULC types that are " "habitat, their specific sensitivity to each threat. " "Each row is a LULC type with the following columns: " "<b>LULC, HABITAT, THREAT1, THREAT2, " "...</b><br/><br/>. Column names are case-insensitive. " "<b>LULC:</b> Integer values that " "reflect each LULC code found in current, future, and " "baseline rasters.<br/><br/><b>HABITAT:</b> A value of " "0 or 1 (presence / absence) or a value between 0 and " "1 (continuum) depicting the suitability of " "habitat.<br/><br/><b>THREATN:</b> Each THREATN " "should match exactly with the threat names given in " "the threat CSV file, where the THREATN is the name " "that matches. This is an floating point value " "between 0 and 1 that represents the sensitivity of a " "habitat to a threat. <br/><br/>.Please see the users " "guide for more detailed information on proper column " "values and column names for each threat."), label='Sensitivity of Land Cover Types to Each Threat, File (CSV)', validator=self.validator) self.add_input(self.sensitivity_data) self.half_saturation_constant = inputs.Text( args_key='half_saturation_constant', helptext=("A positive floating point value that is defaulted at " "0.05. This is the value of the parameter k in equation " "(4). In general, set k to half of the highest grid " "cell degradation value on the landscape. To perform " "this model calibration the model must be run once in " "order to find the highest degradation value and set k " "for the provided landscape. Note that the choice of " "k only determines the spread and central tendency of " "habitat quality cores and does not affect the rank."), label='Half-Saturation Constant', validator=self.validator) self.add_input(self.half_saturation_constant)
def __init__(self): model.InVESTModel.__init__( self, label='UrbanFloodRiskMitigation', target=natcap.invest.urban_flood_risk_mitigation.execute, validator=natcap.invest.urban_flood_risk_mitigation.validate, localdoc='../documentation/urban_flood_risk_mitigation.html') self.aoi_watersheds_path = inputs.File( args_key='aoi_watersheds_path', helptext=( "path to a shapefile of (sub)watersheds or sewersheds used " "to indicate spatial area of interest."), label='Watershed Vector', validator=self.validator) self.add_input(self.aoi_watersheds_path) self.rainfall_depth = inputs.Text( args_key='rainfall_depth', label='Depth of rainfall in mm', validator=self.validator) self.add_input(self.rainfall_depth) self.lulc_path = inputs.File( args_key='lulc_path', helptext="path to a landcover raster", label='Landcover Raster', validator=self.validator) self.add_input(self.lulc_path) self.soils_hydrological_group_raster_path = inputs.File( args_key='soils_hydrological_group_raster_path', helptext=( "Raster with values equal to 1, 2, 3, 4, corresponding to " "soil hydrologic group A, B, C, or D, respectively (used to " "derive the CN number"), label='Soils Hydrological Group Raster', validator=self.validator) self.add_input(self.soils_hydrological_group_raster_path) self.curve_number_table_path = inputs.File( args_key='curve_number_table_path', helptext=( "Path to a CSV table that to map landcover codes to curve " "numbers and contains at least the headers 'lucode', " "'CN_A', 'CN_B', 'CN_C', 'CN_D'"), label='Biophysical Table', validator=self.validator) self.add_input(self.curve_number_table_path) self.built_infrastructure_vector_path = inputs.File( args_key='built_infrastructure_vector_path', helptext=( "Path to a vector with built infrastructure footprints. " "Attribute table contains a column 'Type' with integers " "(e.g. 1=residential, 2=office, etc.)."), label='Built Infrastructure Vector (optional)', validator=self.validator) self.add_input(self.built_infrastructure_vector_path) self.infrastructure_damage_loss_table_path = inputs.File( args_key='infrastructure_damage_loss_table_path', helptext=( "path to a a CSV table with columns 'Type' and 'Damage' " "with values of built infrastructure type from the 'Type' " "field in the 'Built Infrastructure Vector' and potential " "damage loss (in $/m^2)."), label='Built Infrastructure Damage Loss Table (optional)', validator=self.validator) self.add_input(self.infrastructure_damage_loss_table_path)
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='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='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='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=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=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=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['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=MODEL_METADATA['sdr'].model_title, target=natcap.invest.sdr.sdr.execute, validator=natcap.invest.sdr.sdr.validate, localdoc=MODEL_METADATA['sdr'].userguide) self.dem_path = inputs.File( args_key='dem_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_path) self.erosivity_path = inputs.File( args_key='erosivity_path', helptext=("A GDAL-supported raster file, with an erosivity " "index value for each cell. This variable depends on " "the intensity and duration of rainfall in the area of " "interest. The greater the intensity and duration of " "the rain storm, the higher the erosion potential. " "The erosivity index is widely used, but in case of " "its absence, there are methods and equations to help " "generate a grid using climatic data. The units are " "MJ*mm/(ha*h*yr)."), label='Rainfall Erosivity Index (R) (Raster)', validator=self.validator) self.add_input(self.erosivity_path) self.erodibility_path = inputs.File( args_key='erodibility_path', helptext=("A GDAL-supported raster file, with a soil " "erodibility value for each cell which is a measure of " "the susceptibility of soil particles to detachment " "and transport by rainfall and runoff. Units are in " "T*ha*h/(ha*MJ*mm)."), label='Soil Erodibility (Raster)', validator=self.validator) self.add_input(self.erodibility_path) self.lulc_path = inputs.File( args_key='lulc_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_path) self.watersheds_path = inputs.File( args_key='watersheds_path', helptext=("This is a layer of polygons representing watersheds " "such that each watershed contributes to a point of " "interest where water quality will be analyzed. It " "must have the integer field 'ws_id' where the values " "uniquely identify each watershed."), label='Watersheds (Vector)', validator=self.validator) self.add_input(self.watersheds_path) self.biophysical_table_path = inputs.File( args_key='biophysical_table_path', helptext=("A CSV table containing model information " "corresponding to each of the land use classes in the " "LULC raster input. It must contain the fields " "'lucode', 'usle_c', and 'usle_p'. See the InVEST " "Sediment User's Guide for more information about " "these fields."), label='Biophysical Table (CSV)', validator=self.validator) self.add_input(self.biophysical_table_path) self.threshold_flow_accumulation = inputs.Text( args_key='threshold_flow_accumulation', helptext=("The number of upslope cells that must flow into a " "cell before it's 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.drainage_path = inputs.File( args_key='drainage_path', helptext=("An optional GDAL-supported raster file mask, that " "indicates areas that drain to the watershed. Format " "is that 1's indicate drainage areas and 0's or nodata " "indicate areas with no additional drainage. This " "model is most accurate when the drainage raster " "aligns with the DEM."), label='Drainages (Raster) (Optional)', validator=self.validator) self.add_input(self.drainage_path) self.k_param = inputs.Text(args_key='k_param', helptext='Borselli k parameter.', label='Borselli k Parameter', validator=self.validator) self.add_input(self.k_param) self.ic_0_param = inputs.Text(args_key='ic_0_param', helptext='Borselli IC0 parameter.', label='Borselli IC0 Parameter', validator=self.validator) self.add_input(self.ic_0_param) self.sdr_max = inputs.Text(args_key='sdr_max', helptext='Maximum SDR value.', label='Max SDR Value', validator=self.validator) self.add_input(self.sdr_max) self.l_max = inputs.Text( args_key='l_max', helptext=( 'L will not exceed this value. Ranges of 122-333 (unitless) ' 'are found in relevant literature.'), label='Max L Value', validator=self.validator) self.add_input(self.l_max)
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=MODEL_METADATA['coastal_vulnerability'].model_title, target=coastal_vulnerability.execute, validator=coastal_vulnerability.validate, localdoc=MODEL_METADATA['coastal_vulnerability'].userguide) self.aoi_vector_path = inputs.File( args_key='aoi_vector_path', helptext=("Path to a polygon vector that is projected in " "a coordinate system with units of meters. " "Shore points will be created along all landmasses " "within the AOI polygon(s)."), label='Area of Interest (Vector)', validator=self.validator) self.add_input(self.aoi_vector_path) self.model_resolution = inputs.Text( args_key='model_resolution', helptext=("Distance in meters between each shore point, " "as measured along the landmass polygon coastline."), label='Model resolution (meters)', validator=self.validator) self.add_input(self.model_resolution) self.landmass_vector_path = inputs.File( args_key='landmass_vector_path', helptext=("Path to a polygon vector representing landmasses " "in the region of interest."), label='Landmass (Vector)', validator=self.validator) self.add_input(self.landmass_vector_path) self.wwiii_vector_path = inputs.File( args_key='wwiii_vector_path', helptext=("Path to a point vector containing wind and wave " "data. This global dataset is provided with the InVEST " "sample data."), label='WaveWatchIII (Vector)', validator=self.validator) self.add_input(self.wwiii_vector_path) self.max_fetch_distance = inputs.Text( args_key='max_fetch_distance', helptext=( "Maximum distance in meters to extend rays from shore points. " "Rays extend in 16 compass directions until they intersect " "land or reach this maximum distance. Fetch (or ray) length " "is a component of wind and wave exposure."), label='Maximum Fetch Distance (meters)', validator=self.validator) self.add_input(self.max_fetch_distance) self.bathymetry_raster_path = inputs.File( args_key='bathymetry_raster_path', helptext=( "Path to a raster representing bathymetry. " "Bathymetry values should be negative and units of meters. " "Positive values will be ignored."), label='Bathymetry (Raster)', validator=self.validator) self.add_input(self.bathymetry_raster_path) self.dem_path = inputs.File( args_key='dem_path', helptext=("Path to a raster representing elevation on land. " "Negative values, if present, are treated as zeros. " "If this input is unprojected, the model will project " "it to match the AOI and resample it to a cell size " "equal to the model resolution."), label='Digital Elevation Model (Raster)', validator=self.validator) self.add_input(self.dem_path) self.dem_averaging_radius = inputs.Text( args_key='dem_averaging_radius', helptext=("A radius around each shore point within which to " "average the elevation values of the DEM raster. "), label='Elevation averaging radius (meters)', validator=self.validator) self.add_input(self.dem_averaging_radius) self.shelf_contour_vector_path = inputs.File( args_key='shelf_contour_vector_path', helptext=( "Path to a polyline vector delineating the edge " "of the continental shelf or another bathymetry contour. "), label='Continental Shelf Contour (Vector)', validator=self.validator) self.add_input(self.shelf_contour_vector_path) self.habitat_table_path = inputs.File( args_key='habitat_table_path', helptext=( "Path to a CSV file that specifies habitat layer input data " "and parameters."), label='Habitats Table (CSV)', validator=self.validator) self.add_input(self.habitat_table_path) self.geomorphology_vector_path = inputs.File( args_key='geomorphology_vector_path', helptext=("Path to a polyline vector that has a field called " "'RANK' with values from 1 to 5. "), label='Geomorphology (Vector) (optional)', validator=self.validator) self.add_input(self.geomorphology_vector_path) self.geomorphology_fill_value = inputs.Dropdown( args_key='geomorphology_fill_value', helptext=( "A value from 1 to 5 that will be used as a geomorphology " "rank for any points not proximate (given the model " "resolution) to the geomorphology_vector_path."), label='Geomorphology fill value', interactive=False, options=('1', '2', '3', '4', '5')) self.add_input(self.geomorphology_fill_value) self.population_raster_path = inputs.File( args_key='population_raster_path', helptext=( "Path to a raster with values representing totals per pixel. " "If this input is unprojected, the model will project " "it to match the AOI and resample it to a cell size " "equal to the model resolution."), label='Human Population (Raster) (optional)', validator=self.validator) self.add_input(self.population_raster_path) self.population_radius = inputs.Text( args_key='population_radius', helptext=("A radius around each shore point within which to " "compute the average population density."), label='Population search radius (meters)', interactive=False, validator=self.validator) self.add_input(self.population_radius) self.slr_vector_path = inputs.File( args_key='slr_vector_path', helptext=( "Path to a point vector with a field of sea-level-rise rates" "or amounts."), label='Sea Level Rise (Vector) (optional)', validator=self.validator) self.add_input(self.slr_vector_path) self.slr_field = inputs.Dropdown( args_key='slr_field', helptext=("The name of a field in the SLR vector table" "from which to load values"), label='Sea Level Rise fieldname', interactive=False, options=( 'UNKNOWN', )) # No options until valid OGR vector provided self.add_input(self.slr_field) # Set interactivity requirement as input sufficiency changes self.slr_vector_path.sufficiency_changed.connect( self.slr_field.set_interactive) self.slr_vector_path.sufficiency_changed.connect(self._load_colnames) self.geomorphology_vector_path.sufficiency_changed.connect( self.geomorphology_fill_value.set_interactive) self.population_raster_path.sufficiency_changed.connect( self.population_radius.set_interactive)
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'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)