def __init__(self): model.InVESTModel.__init__( self, label=MODEL_METADATA['scenic_quality'].model_title, target=scenic_quality.execute, validator=scenic_quality.validate, localdoc=MODEL_METADATA['scenic_quality'].userguide) self.general_tab = inputs.Container(interactive=True, label='General') self.add_input(self.general_tab) self.aoi_path = inputs.File( args_key='aoi_path', helptext=("An OGR-supported vector file. This AOI instructs " "the model where to clip the input data and the extent " "of analysis. Users will create a polygon feature " "layer that defines their area of interest. The AOI " "must intersect the Digital Elevation Model (DEM)."), label='Area of Interest (Vector) (Required)', validator=self.validator) self.general_tab.add_input(self.aoi_path) self.structure_path = inputs.File( args_key='structure_path', helptext=("An OGR-supported vector file. The user must specify " "a point feature layer that indicates locations of " "objects that contribute to negative scenic quality, " "such as aquaculture netpens or wave energy " "facilities. In order for the viewshed analysis to " "run correctly, the projection of this input must be " "consistent with the project of the DEM input."), label='Features Impacting Scenic Quality (Vector) (Required)', validator=self.validator) self.general_tab.add_input(self.structure_path) self.dem_path = inputs.File( args_key='dem_path', helptext=("A GDAL-supported raster file. An elevation raster " "layer is required to conduct viewshed analysis. " "Elevation data allows the model to determine areas " "within the AOI's land-seascape where point features " "contributing to negative scenic quality are visible."), label='Digital Elevation Model (Raster) (Required)', validator=self.validator) self.general_tab.add_input(self.dem_path) self.refraction = inputs.Text( args_key='refraction', helptext=("The earth curvature correction option corrects for " "the curvature of the earth and refraction of visible " "light in air. Changes in air density curve the light " "downward causing an observer to see further and the " "earth to appear less curved. While the magnitude of " "this effect varies with atmospheric conditions, a " "standard rule of thumb is that refraction of visible " "light reduces the apparent curvature of the earth by " "one-seventh. By default, this model corrects for the " "curvature of the earth and sets the refractivity " "coefficient to 0.13."), label='Refractivity Coefficient (Required)', validator=self.validator) self.general_tab.add_input(self.refraction) self.valuation_container = inputs.Container(args_key='do_valuation', expandable=True, expanded=False, interactive=True, label='Valuation') self.add_input(self.valuation_container) self.valuation_function = inputs.Dropdown( args_key='valuation_function', helptext=("This field indicates the functional form f(x) the " "model will use to value the visual impact for each " "viewpoint."), label='Valuation Function', options=[ 'linear: a + bx', 'logarithmic: a + b log(x+1)', 'exponential: a * e^(-bx)' ]) self.valuation_container.add_input(self.valuation_function) self.a_coefficient = inputs.Text( args_key='a_coef', helptext=("First coefficient used by the valuation function"), label="'a' Coefficient (Required)", validator=self.validator) self.valuation_container.add_input(self.a_coefficient) self.b_coefficient = inputs.Text( args_key='b_coef', helptext=("Second coefficient used by the valuation function"), label="'b' Coefficient (Required)", validator=self.validator) self.valuation_container.add_input(self.b_coefficient) self.max_valuation_radius = inputs.Text( args_key='max_valuation_radius', helptext=("Radius beyond which the valuation is set to zero. " "The valuation function 'f' cannot be negative at the " "radius 'r' (f(r)>=0)."), label='Maximum Valuation Radius (meters) (Required)', validator=self.validator) self.valuation_container.add_input(self.max_valuation_radius)
def __init__(self): model.InVESTModel.__init__( self, label=u'Coastal Vulnerability Assessment Tool', target=coastal_vulnerability.execute, validator=coastal_vulnerability.validate, localdoc=u'../documentation/coastal_vulnerability.html', suffix_args_key='suffix' ) self.general_tab = inputs.Container( interactive=True, label=u'General') self.add_input(self.general_tab) self.area_computed = inputs.Dropdown( args_key=u'area_computed', helptext=( u"Determine if the output data is about all the coast " u"or about sheltered segments only."), label=u'Output Area: Sheltered/Exposed?', options=[u'both', u'sheltered']) self.general_tab.add_input(self.area_computed) self.area_of_interest = inputs.File( args_key=u'aoi_uri', helptext=( u"An OGR-supported, single-feature polygon vector " u"file. All outputs will be in the AOI's projection."), label=u'Area of Interest (Vector)', validator=self.validator) self.general_tab.add_input(self.area_of_interest) self.landmass_uri = inputs.File( args_key=u'landmass_uri', helptext=( u"An OGR-supported vector file containing a landmass " u"polygon from where the coastline will be extracted. " u"The default is the global land polygon."), label=u'Land Polygon (Vector)', validator=self.validator) self.general_tab.add_input(self.landmass_uri) self.bathymetry_layer = inputs.File( args_key=u'bathymetry_uri', helptext=( u"A GDAL-supported raster of the terrain elevation in " u"the area of interest. Used to compute depths along " u"fetch rays, relief and surge potential."), label=u'Bathymetry Layer (Raster)', validator=self.validator) self.general_tab.add_input(self.bathymetry_layer) self.bathymetry_constant = inputs.Text( args_key=u'bathymetry_constant', helptext=( u"Integer value between 1 and 5. If layer associated " u"to this field is omitted, replace all shore points " u"for this layer with a constant rank value in the " u"computation of the coastal vulnerability index. If " u"both the file and value for the layer are omitted, " u"the layer is skipped altogether."), label=u'Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.bathymetry_constant) self.relief = inputs.File( args_key=u'relief_uri', helptext=( u"A GDAL-supported raster file containing the land " u"elevation used to compute the average land elevation " u"within a user-defined radius (see Elevation averaging " u"radius)."), label=u'Relief (Raster)', validator=self.validator) self.general_tab.add_input(self.relief) self.relief_constant = inputs.Text( args_key=u'relief_constant', helptext=( u"Integer value between 1 and 5. If layer associated " u"to this field is omitted, replace all shore points " u"for this layer with a constant rank value in the " u"computation of the coastal vulnerability index. If " u"both the file and value for the layer are omitted, " u"the layer is skipped altogether."), label=u'Layer Value If Path Omitted', validator=self.validator) self.general_tab.add_input(self.relief_constant) self.cell_size = inputs.Text( args_key=u'cell_size', helptext=( u"Cell size in meters. The higher the value, the " u"faster the computation, but the coarser the output " u"rasters produced by the model."), label=u'Model Resolution (Segment Size)', validator=self.validator) self.general_tab.add_input(self.cell_size) self.depth_threshold = inputs.Text( args_key=u'depth_threshold', helptext=( u"Depth in meters (integer) cutoff to determine if " u"fetch rays project over deep areas."), label=u'Depth Threshold (meters)', validator=self.validator) self.general_tab.add_input(self.depth_threshold) self.exposure_proportion = inputs.Text( args_key=u'exposure_proportion', helptext=( u"Minimum proportion of rays that project over exposed " u"and/or deep areas need to classify a shore segment as " u"exposed."), label=u'Exposure Proportion', validator=self.validator) self.general_tab.add_input(self.exposure_proportion) self.geomorphology_uri = inputs.File( args_key=u'geomorphology_uri', helptext=( u"A OGR-supported polygon vector file that has a field " u"called 'RANK' with values between 1 and 5 in the " u"attribute table."), label=u'Geomorphology (Vector)', validator=self.validator) self.general_tab.add_input(self.geomorphology_uri) self.geomorphology_constant = inputs.Text( args_key=u'geomorphology_constant', helptext=( u"Integer value between 1 and 5. If layer associated " u"to this field is omitted, replace all shore points " u"for this layer with a constant rank value in the " u"computation of the coastal vulnerability index. If " u"both the file and value for the layer are omitted, " u"the layer is skipped altogether."), label=u'Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.geomorphology_constant) self.habitats_directory_uri = inputs.Folder( args_key=u'habitats_directory_uri', helptext=( u"Directory containing OGR-supported polygon vectors " u"associated with natural habitats. The name of these " u"shapefiles should be suffixed with the ID that is " u"specified in the natural habitats CSV file provided " u"along with the habitats."), label=u'Natural Habitats Directory', validator=self.validator) self.general_tab.add_input(self.habitats_directory_uri) self.habitats_csv_uri = inputs.File( args_key=u'habitats_csv_uri', helptext=( u"A CSV file listing the attributes for each habitat. " u"For more information, see 'Habitat Data Layer' " u"section in the model's documentation.</a>."), interactive=False, label=u'Natural Habitats Table (CSV)', validator=self.validator) self.general_tab.add_input(self.habitats_csv_uri) self.habitats_constant = inputs.Text( args_key=u'habitat_constant', helptext=( u"Integer value between 1 and 5. If layer associated " u"to this field is omitted, replace all shore points " u"for this layer with a constant rank value in the " u"computation of the coastal vulnerability index. If " u"both the file and value for the layer are omitted, " u"the layer is skipped altogether."), label=u'Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.habitats_constant) self.climatic_forcing_uri = inputs.File( args_key=u'climatic_forcing_uri', helptext=( u"An OGR-supported vector containing both wind and " u"wave information across the region of interest."), label=u'Climatic Forcing Grid (Vector)', validator=self.validator) self.general_tab.add_input(self.climatic_forcing_uri) self.climatic_forcing_constant = inputs.Text( args_key=u'climatic_forcing_constant', helptext=( u"Integer value between 1 and 5. If layer associated " u"to this field is omitted, replace all shore points " u"for this layer with a constant rank value in the " u"computation of the coastal vulnerability index. If " u"both the file and value for the layer are omitted, " u"the layer is skipped altogether."), label=u'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=u'continental_shelf_uri', helptext=( u"An OGR-supported polygon vector delineating the " u"edges of the continental shelf. Default is global " u"continental shelf shapefile. If omitted, the user " u"can specify depth contour. See entry below."), label=u'Continental Shelf (Vector)', validator=self.validator) self.general_tab.add_input(self.continental_shelf_uri) self.depth_contour = inputs.Text( args_key=u'depth_contour', helptext=( u"Used to delineate shallow and deep areas. " u"Continental shelf limit is at about 150 meters."), label=u'Depth Countour Level (meters)', validator=self.validator) self.general_tab.add_input(self.depth_contour) self.sea_level_rise_uri = inputs.File( args_key=u'sea_level_rise_uri', helptext=( u"An OGR-supported point or polygon vector file " u"containing features with 'Trend' fields in the " u"attributes table."), label=u'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=u'sea_level_rise_constant', helptext=( u"Integer value between 1 and 5. If layer associated " u"to this field is omitted, replace all shore points " u"for this layer with a constant rank value in the " u"computation of the coastal vulnerability index. If " u"both the file and value for the layer are omitted, " u"the layer is skipped altogether."), label=u'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=u'structures_uri', helptext=( u"An OGR-supported vector file containing rigid " u"structures used to identify the portions of the coast " u"that is armored."), label=u'Structures (Vectors)', validator=self.validator) self.general_tab.add_input(self.structures_uri) self.structures_constant = inputs.Text( args_key=u'structures_constant', helptext=( u"Integer value between 1 and 5. If layer associated " u"to this field is omitted, replace all shore points " u"for this layer with a constant rank value in the " u"computation of the coastal vulnerability index. If " u"both the file and value for the layer are omitted, " u"the layer is skipped altogether."), label=u'Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.structures_constant) self.population_uri = inputs.File( args_key=u'population_uri', helptext=( u'A GDAL-supported raster file representing the population ' u'density.'), label=u'Population Layer (Raster)', validator=self.validator) self.general_tab.add_input(self.population_uri) self.urban_center_threshold = inputs.Text( args_key=u'urban_center_threshold', helptext=( u"Minimum population required to consider the shore " u"segment a population center."), label=u'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=u'additional_layer_uri', helptext=( u"An OGR-supported vector file representing sea level " u"rise, and will be used in the computation of coastal " u"vulnerability and coastal vulnerability without " u"habitat."), label=u'Additional Layer (Vector)', validator=self.validator) self.general_tab.add_input(self.additional_layer_uri) self.additional_layer_constant = inputs.Text( args_key=u'additional_layer_constant', helptext=( u"Integer value between 1 and 5. If layer associated " u"to this field is omitted, replace all shore points " u"for this layer with a constant rank value in the " u"computation of the coastal vulnerability index. If " u"both the file and value for the layer are omitted, " u"the layer is skipped altogether."), label=u'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=u'Advanced') self.add_input(self.advanced_tab) self.elevation_averaging_radius = inputs.Text( args_key=u'elevation_averaging_radius', helptext=( u"Distance in meters (integer). Each pixel average " u"elevation will be computed within this radius."), label=u'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=u'mean_sea_level_datum', helptext=( u"Height in meters (integer). This input is the " u"elevation of Mean Sea Level (MSL) datum relative to " u"the datum of the bathymetry layer. The model " u"transforms all depths to MSL datum. A positive value " u"means the MSL is higher than the bathymetry's zero " u"(0) elevation, so the value is subtracted from the " u"bathymetry."), label=u'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=u'rays_per_sector', helptext=( u"Number of rays used to subsample the fetch distance " u"within each of the 16 sectors."), label=u'Rays per Sector', validator=self.validator) self.advanced_tab.add_input(self.rays_per_sector) self.max_fetch = inputs.Text( args_key=u'max_fetch', helptext=( u'Maximum fetch distance computed by the model ' u'(>=60,000m).'), label=u'Maximum Fetch Distance (meters)', validator=self.validator) self.advanced_tab.add_input(self.max_fetch) self.spread_radius = inputs.Text( args_key=u'spread_radius', helptext=( u"Integer multiple of 'cell size'. The coast from the " u"geomorphology layer could be of a better resolution " u"than the global landmass, so the shores do not " u"necessarily overlap. To make them coincide, the " u"shore from the geomorphology layer is widened by 1 or " u"more pixels. The value should be a multiple of 'cell " u"size' that indicates how many pixels the coast from " u"the geomorphology layer is widened. The widening " u"happens on each side of the coast (n pixels landward, " u"and n pixels seaward)."), label=u'Coastal Overlap (meters)', validator=self.validator) self.advanced_tab.add_input(self.spread_radius) self.population_radius = inputs.Text( args_key=u'population_radius', helptext=( u"Radius length in meters used to count the number of " u"people leaving close to the coast."), label=u'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=u'Fisheries', target=fisheries.execute, validator=fisheries.validate, localdoc=u'../documentation/fisheries.html') self.alpha_only = inputs.Label( text=(u"This tool is in an ALPHA testing stage and should " u"not be used for decision making.")) self.aoi_uri = inputs.File( args_key=u'aoi_uri', helptext=( u"An OGR-supported vector file used to display outputs " u"within the region(s) of interest.<br><br>The layer " u"should contain one feature for every region of " u"interest, each feature of which should have a ‘NAME’ " u"attribute. The 'NAME' attribute can be numeric or " u"alphabetic, but must be unique within the given file."), label=u'Area of Interest (Vector) (Optional)', validator=self.validator) self.add_input(self.aoi_uri) self.total_timesteps = inputs.Text( args_key=u'total_timesteps', helptext=(u"The number of time steps the simulation shall " u"execute before completion.<br><br>Must be a positive " u"integer."), label=u'Number of Time Steps for Model Run', validator=self.validator) self.add_input(self.total_timesteps) self.popu_cont = inputs.Container(label=u'Population Parameters') self.add_input(self.popu_cont) self.population_type = inputs.Dropdown( args_key=u'population_type', helptext=(u"Specifies whether the lifecycle classes provided in " u"the Population Parameters CSV file represent ages " u"(uniform duration) or stages.<br><br>Age-based models " u"(e.g. Lobster, Dungeness Crab) are separated by " u"uniform, fixed-length time steps (usually " u"representing a year).<br><br>Stage-based models (e.g. " u"White Shrimp) allow lifecycle-classes to have " u"nonuniform durations based on the assumed resolution " u"of the provided time step.<br><br>If the stage-based " u"model is selected, the Population Parameters CSV file " u"must include a ‘Duration’ vector alongside the " u"survival matrix that contains the number of time " u"steps that each stage lasts."), label=u'Population Model Type', options=[u'Age-Based', u'Stage-Based']) self.popu_cont.add_input(self.population_type) self.sexsp = inputs.Dropdown( args_key=u'sexsp', helptext=(u"Specifies whether or not the lifecycle classes " u"provided in the Populaton Parameters CSV file are " u"distinguished by sex."), label=u'Population Classes are Sex-Specific', options=[u'No', u'Yes']) self.popu_cont.add_input(self.sexsp) self.harvest_units = inputs.Dropdown( args_key=u'harvest_units', helptext=(u"Specifies whether the harvest output values are " u"calculated in terms of number of individuals or in " u"terms of biomass (weight).<br><br>If ‘Weight’ is " u"selected, the Population Parameters CSV file must " u"include a 'Weight' vector alongside the survival " u"matrix that contains the weight of each lifecycle " u"class and sex if model is sex-specific."), label=u'Harvest by Individuals or Weight', options=[u'Individuals', u'Weight']) self.popu_cont.add_input(self.harvest_units) self.do_batch = inputs.Checkbox( args_key=u'do_batch', helptext=( u"Specifies whether program will perform a single " u"model run or a batch (set) of model runs.<br><br>For " u"single model runs, users submit a filepath pointing " u"to a single Population Parameters CSV file. For " u"batch model runs, users submit a directory path " u"pointing to a set of Population Parameters CSV files."), label=u'Batch Processing') self.popu_cont.add_input(self.do_batch) self.population_csv_uri = inputs.File( args_key=u'population_csv_uri', helptext=(u"The provided CSV file should contain all necessary " u"attributes for the sub-populations based on lifecycle " u"class, sex, and area - excluding possible migration " u"information.<br><br>Please consult the documentation " u"to learn more about what content should be provided " u"and how the CSV file should be structured."), label=u'Population Parameters File (CSV)', validator=self.validator) self.popu_cont.add_input(self.population_csv_uri) self.population_csv_dir = inputs.Folder( args_key=u'population_csv_dir', helptext=(u"The provided CSV folder should contain a set of " u"Population Parameters CSV files with all necessary " u"attributes for sub-populations based on lifecycle " u"class, sex, and area - excluding possible migration " u"information.<br><br>The name of each file will serve " u"as the prefix of the outputs created by the model " u"run.<br><br>Please consult the documentation to learn " u"more about what content should be provided and how " u"the CSV file should be structured."), interactive=False, label=u'Population Parameters CSV Folder', validator=self.validator) self.popu_cont.add_input(self.population_csv_dir) self.recr_cont = inputs.Container(label=u'Recruitment Parameters') self.add_input(self.recr_cont) self.total_init_recruits = inputs.Text( args_key=u'total_init_recruits', helptext=(u"The initial number of recruits in the population " u"model at time equal to zero.<br><br>If the model " u"contains multiple regions of interest or is " u"distinguished by sex, this value will be evenly " u"divided and distributed into each sub-population."), label=u'Total Initial Recruits', validator=self.validator) self.recr_cont.add_input(self.total_init_recruits) self.recruitment_type = inputs.Dropdown( args_key=u'recruitment_type', helptext=(u"The selected equation is used to calculate " u"recruitment into the subregions at the beginning of " u"each time step. Corresponding parameters must be " u"specified with each function:<br><br>The Beverton- " u"Holt and Ricker functions both require arguments for " u"the ‘Alpha’ and ‘Beta’ parameters.<br><br>The " u"Fecundity function requires a 'Fecundity' vector " u"alongside the survival matrix in the Population " u"Parameters CSV file indicating the per-capita " u"offspring for each lifecycle class.<br><br>The Fixed " u"function requires an argument for the ‘Total Recruits " u"per Time Step’ parameter that represents a single " u"total recruitment value to be distributed into the " u"population model at the beginning of each time step."), label=u'Recruitment Function Type', options=[u'Beverton-Holt', u'Ricker', u'Fecundity', u'Fixed']) self.recr_cont.add_input(self.recruitment_type) self.spawn_units = inputs.Dropdown( args_key=u'spawn_units', helptext=(u"Specifies whether the spawner abundance used in the " u"recruitment function should be calculated in terms of " u"number of individuals or in terms of biomass " u"(weight).<br><br>If 'Weight' is selected, the user " u"must provide a 'Weight' vector alongside the survival " u"matrix in the Population Parameters CSV file. The " u"'Alpha' and 'Beta' parameters provided by the user " u"should correspond to the selected choice.<br><br>Used " u"only for the Beverton-Holt and Ricker recruitment " u"functions."), label=u'Spawners by Individuals or Weight (Beverton-Holt / Ricker)', options=[u'Individuals', u'Weight']) self.recr_cont.add_input(self.spawn_units) self.alpha = inputs.Text( args_key=u'alpha', helptext=(u"Specifies the shape of the stock-recruit curve. " u"Used only for the Beverton-Holt and Ricker " u"recruitment functions.<br><br>Used only for the " u"Beverton-Holt and Ricker recruitment functions."), label=u'Alpha (Beverton-Holt / Ricker)', validator=self.validator) self.recr_cont.add_input(self.alpha) self.beta = inputs.Text( args_key=u'beta', helptext=(u"Specifies the shape of the stock-recruit " u"curve.<br><br>Used only for the Beverton-Holt and " u"Ricker recruitment functions."), label=u'Beta (Beverton-Holt / Ricker)', validator=self.validator) self.recr_cont.add_input(self.beta) self.total_recur_recruits = inputs.Text( args_key=u'total_recur_recruits', helptext=(u"Specifies the total number of recruits that come " u"into the population at each time step (a fixed " u"number).<br><br>Used only for the Fixed recruitment " u"function."), label=u'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=u'migr_cont', expandable=True, expanded=False, label=u'Migration Parameters') self.add_input(self.migr_cont) self.migration_dir = inputs.Folder( args_key=u'migration_dir', helptext=(u"The selected folder contain CSV migration matrices " u"to be used in the simulation. Each CSV file contains " u"a single migration matrix corresponding to an " u"lifecycle class that migrates. The folder should " u"contain one CSV file for each lifecycle class that " u"migrates.<br><br>The files may be named anything, but " u"must end with an underscore followed by the name of " u"the age or stage. The name of the age or stage must " u"correspond to an age or stage within the Population " u"Parameters CSV file. For example, a migration file " u"might be named 'migration_adult.csv'.<br><br>Each " u"matrix cell should contain a decimal fraction " u"indicating the percetage of the population that will " u"move from one area to another. Each column should " u"sum to one."), label=u'Migration Matrix CSV Folder (Optional)', validator=self.validator) self.migr_cont.add_input(self.migration_dir) self.val_cont = inputs.Container(args_key=u'val_cont', expandable=True, expanded=False, label=u'Valuation Parameters') self.add_input(self.val_cont) self.frac_post_process = inputs.Text( args_key=u'frac_post_process', helptext=(u"Decimal fraction indicating the percentage of " u"harvested catch remaining after post-harvest " u"processing is complete."), label=u'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=u'unit_price', helptext=(u"Specifies the price per harvest unit.<br><br>If " u"‘Harvest by Individuals or Weight’ was set to " u"‘Individuals’, this should be the price per " u"individual. If set to ‘Weight’, this should be the " u"price per unit weight."), label=u'Unit Price', validator=self.validator) self.val_cont.add_input(self.unit_price) # Set interactivity, requirement as input sufficiency changes self.do_batch.sufficiency_changed.connect(self._toggle_batch_runs) # Enable/disable parameters when the recruitment function changes. self.recruitment_type.value_changed.connect( self._control_recruitment_parameters)
def __init__(self): model.InVESTModel.__init__( self, label=u'Habitat Quality', target=natcap.invest.habitat_quality.execute, validator=natcap.invest.habitat_quality.validate, localdoc=u'../documentation/habitat_quality.html') self.current_landcover = inputs.File( args_key=u'lulc_cur_path', helptext=( u"A GDAL-supported raster file. The current LULC must " u"have its' own threat rasters, where each threat " u"raster file path has a suffix of <b>_c</b>.<br/><br/> " u"Each cell should represent a LULC code as an Integer. " u"The dataset should be in a projection where the units " u"are in meters and the projection used should be " u"defined. <b>The LULC codes must match the codes in " u"the Sensitivity table</b>."), label=u'Current Land Cover (Raster)', validator=self.validator) self.add_input(self.current_landcover) self.future_landcover = inputs.File( args_key=u'lulc_fut_path', helptext=( u"Optional. A GDAL-supported raster file. Inputting " u"a future LULC will generate degradation, habitat " u"quality, and habitat rarity (If baseline is input) " u"outputs. The future LULC must have it's own threat " u"rasters, where each threat raster file path has a " u"suffix of <b>_f</b>.<br/><br/>Each cell should " u"represent a LULC code as an Integer. The dataset " u"should be in a projection where the units are in " u"meters and the projection used should be defined. " u"<b>The LULC codes must match the codes in the " u"Sensitivity table</b>."), label=u'Future Land Cover (Raster) (Optional)', validator=self.validator) self.add_input(self.future_landcover) self.baseline_landcover = inputs.File( args_key=u'lulc_bas_path', helptext=( u"Optional. A GDAL-supported raster file. If the " u"baseline LULC is provided, rarity outputs will be " u"created for the current and future LULC. The baseline " u"LULC can have it's own threat rasters (optional), " u"where each threat raster file path has a suffix of " u"<b>_b</b>. If no threat rasters are found, " u"degradation and habitat quality outputs will not be " u"generated for the baseline LULC.<br/><br/> Each cell " u"should represent a LULC code as an Integer. The " u"dataset should be in a projection where the units are " u"in meters and the projection used should be defined. " u"The LULC codes must match the codes in the " u"Sensitivity table. If possible the baseline map " u"should refer to a time when intensive management of " u"the landscape was relatively rare."), label=u'Baseline Land Cover (Raster) (Optional)', validator=self.validator) self.add_input(self.baseline_landcover) self.threat_rasters = inputs.Folder( args_key=u'threat_raster_folder', helptext=( u"The selected folder is used as the location to find " u"all threat rasters for the threats listed in the " u"below table."), label=u'Folder Containing Threat Rasters', validator=self.validator) self.add_input(self.threat_rasters) self.threats_data = inputs.File( args_key=u'threats_table_path', helptext=( u"A CSV file of all the threats for the model to " u"consider. Each row in the table is a degradation " u"source and each column contains a different attribute " u"of each degradation source (THREAT, MAX_DIST, " u"WEIGHT).<br/><br/><b>THREAT:</b> The name of the " u"threat source and this name must match exactly to the " u"name of the threat raster and to the name of it's " u"corresponding column in the sensitivity table. " u"<b>NOTE:</b> The threat raster path should have a " u"suffix indicator ( _c, _f, _b ) and the sensitivity " u"column should have a prefix indicator (L_). The " u"THREAT name in the threat table should not include " u"either the suffix or prefix. " u"<br/><br/><b>MAX_DIST:</b> A number in kilometres " u"(km) for the maximum distance a threat has an " u"affect.<br/><br/><b>WEIGHT:</b> A floating point " u"value between 0 and 1 for the the threats weight " u"relative to the other threats. Depending on the type " u"of habitat under review, certain threats may cause " u"greater degradation than other " u"threats.<br/><br/><b>DECAY:</b> A string value of " u"either <b>exponential</b> or <b>linear</b> " u"representing the type of decay over space for the " u"threat.<br/><br/>See the user's guide for valid " u"values for these columns."), label=u'Threats Data', validator=self.validator) self.add_input(self.threats_data) self.accessibility_threats = inputs.File( args_key=u'access_vector_path', helptext=( u"An OGR-supported vector file. The input contains " u"data on the relative protection that legal / " u"institutional / social / physical barriers provide " u"against threats. The vector file should contain " u"polygons with a field <b>ACCESS</b>. The " u"<b>ACCESS</b> values should range from 0 - 1, where 1 " u"is fully accessible. Any cells not covered by a " u"polygon will be set to 1."), label=u'Accessibility to Threats (Vector) (Optional)', validator=self.validator) self.add_input(self.accessibility_threats) self.sensitivity_data = inputs.File( args_key=u'sensitivity_table_path', helptext=( u"A CSV file of LULC types, whether or not the are " u"considered habitat, and, for LULC types that are " u"habitat, their specific sensitivity to each threat. " u"Each row is a LULC type with the following columns: " u"<b>LULC, HABITAT, L_THREAT1, L_THREAT2, " u"...</b><br/><br/><b>LULC:</b> Integer values that " u"reflect each LULC code found in current, future, and " u"baseline rasters.<br/><br/><b>HABITAT:</b> A value of " u"0 or 1 (presence / absence) or a value between 0 and " u"1 (continuum) depicting the suitability of " u"habitat.<br/><br/><b>L_THREATN:</b> Each L_THREATN " u"should match exactly with the threat names given in " u"the threat CSV file, where the THREATN is the name " u"that matches. This is an floating point value " u"between 0 and 1 that represents the sensitivity of a " u"habitat to a threat. <br/><br/>.Please see the users " u"guide for more detailed information on proper column " u"values and column names for each threat."), label=u'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=u'half_saturation_constant', helptext=( u"A positive floating point value that is defaulted at " u"0.5. This is the value of the parameter k in equation " u"(4). In general, set k to half of the highest grid " u"cell degradation value on the landscape. To perform " u"this model calibration the model must be run once in " u"order to find the highest degradation value and set k " u"for the provided landscape. Note that the choice of " u"k only determines the spread and central tendency of " u"habitat quality cores and does not affect the rank."), label=u'Half-Saturation Constant', validator=self.validator) self.add_input(self.half_saturation_constant)
def __init__(self): model.InVESTModel.__init__( self, label='Coastal Vulnerability', target=coastal_vulnerability.execute, validator=coastal_vulnerability.validate, localdoc='coastal_vulnerability.html') 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'Fisheries Habitat Scenario Tool', target=fisheries_hst.execute, validator=fisheries_hst.validate, localdoc=u'../documentation/fisheries.html') self.alpha_only = inputs.Label( text=(u"This tool is in an ALPHA testing stage and should " u"not be used for decision making.")) self.pop_cont = inputs.Container(args_key=u'pop_cont', expanded=True, label=u'Population Parameters') self.add_input(self.pop_cont) self.population_csv_uri = inputs.File( args_key=u'population_csv_uri', helptext=(u"A CSV file containing all necessary attributes for " u"population classes based on age/stage, sex, and area " u"- excluding possible migration " u"information.<br><br>See the 'Running the Model >> " u"Core Model >> Population Parameters' section in the " u"model's documentation for help on how to format this " u"file."), label=u'Population Parameters File (CSV)', validator=self.validator) self.pop_cont.add_input(self.population_csv_uri) self.sexsp = inputs.Dropdown( args_key=u'sexsp', helptext=(u"Specifies whether or not the population classes " u"provided in the Populaton Parameters CSV file are " u"distinguished by sex."), label=u'Population Classes are Sex-Specific', options=[u'No', u'Yes']) self.pop_cont.add_input(self.sexsp) self.hab_cont = inputs.Container(args_key=u'hab_cont', expanded=True, label=u'Habitat Parameters') self.add_input(self.hab_cont) self.habitat_csv_dep_uri = inputs.File( args_key=u'habitat_dep_csv_uri', helptext=(u"A CSV file containing the habitat dependencies (0-1) " u"for each life stage or age and for each habitat type " u"included in the Habitat Change CSV File.<br><br>See " u"the 'Running the Model >> Habitat Scenario Tool >> " u"Habitat Parameters' section in the model's " u"documentation for help on how to format this file."), label=u'Habitat Dependency Parameters File (CSV)', validator=self.validator) self.hab_cont.add_input(self.habitat_csv_dep_uri) self.habitat_chg_csv_uri = inputs.File( args_key=u'habitat_chg_csv_uri', helptext=(u"A CSV file containing the percent changes in habitat " u"area by subregion (if applicable). The habitats " u"included should be those which the population depends " u"on at any life stage.<br><br>See the 'Running the " u"Model >> Habitat Scenario Tool >> Habitat Parameters' " u"section in the model's documentation for help on how " u"to format this file."), label=u'Habitat Area Change File (CSV)', validator=self.validator) self.hab_cont.add_input(self.habitat_chg_csv_uri) self.gamma = inputs.Text( args_key=u'gamma', helptext=(u"Gamma describes the relationship between a change in " u"habitat area and a change in survival of life stages " u"dependent on that habitat. Specify a value between 0 " u"and 1.<br><br>See the documentation for advice on " u"selecting a gamma value."), label=u'Gamma', validator=self.validator) self.hab_cont.add_input(self.gamma)
def __init__(self): model.InVESTModel.__init__( self, label=u'Habitat Risk Assessment', target=hra.execute, validator=hra.validate, localdoc=u'../documentation/habitat_risk_assessment.html') self.csv_uri = inputs.Folder( args_key=u'csv_uri', helptext=(u"A folder containing multiple CSV files. Each file " u"refers to the overlap between a habitat and a " u"stressor pulled from habitat and stressor shapefiles " u"during the run of the HRA Preprocessor."), label=u'Criteria Scores CSV Folder', validator=self.validator) self.add_input(self.csv_uri) self.grid_size = inputs.Text( args_key=u'grid_size', helptext=(u"The size that should be used to grid the given " u"habitat and stressor shapefiles into rasters. This " u"value will be the pixel size of the completed raster " u"files."), label=u'Resolution of Analysis (meters)', validator=self.validator) self.add_input(self.grid_size) self.risk_eq = inputs.Dropdown( args_key=u'risk_eq', helptext=(u"Each of these represents an option of a risk " u"calculation equation. This will determine the " u"numeric output of risk for every habitat and stressor " u"overlap area."), label=u'Risk Equation', options=[u'Multiplicative', u'Euclidean']) self.add_input(self.risk_eq) self.decay_eq = inputs.Dropdown( args_key=u'decay_eq', helptext=(u"Each of these represents an option for decay " u"equations for the buffered stressors. If stressor " u"buffering is desired, these equtions will determine " u"the rate at which stressor data is reduced."), label=u'Decay Equation', options=[u'None', u'Linear', u'Exponential']) self.add_input(self.decay_eq) self.max_rating = inputs.Text( args_key=u'max_rating', helptext=(u"This is the highest score that is used to rate a " u"criteria within this model run. These values would " u"be placed within the Rating column of the habitat, " u"species, and stressor CSVs."), label=u'Maximum Criteria Score', validator=self.validator) self.add_input(self.max_rating) self.max_stress = inputs.Text( args_key=u'max_stress', helptext=(u"This is the largest number of stressors that are " u"suspected to overlap. This will be used in order to " u"make determinations of low, medium, and high risk for " u"any given habitat."), label=u'Maximum Overlapping Stressors', validator=self.validator) self.add_input(self.max_stress) self.aoi_tables = inputs.File( args_key=u'aoi_tables', helptext=(u"An OGR-supported vector file containing feature " u"subregions. The program will create additional " u"summary outputs across each subregion."), label=u'Subregions (Vector)', validator=self.validator) self.add_input(self.aoi_tables)
def __init__(self): model.InVESTModel.__init__( self, label='Scenic Quality', target=scenic_quality.execute, validator=scenic_quality.validate, localdoc='../documentation/scenic_quality.html') self.beta_only = inputs.Label( text=("This tool is considered UNSTABLE. Users may " "experience performance issues and unexpected errors.")) self.general_tab = inputs.Container(interactive=True, label='General') self.add_input(self.general_tab) self.aoi_uri = inputs.File( args_key='aoi_uri', helptext=("An OGR-supported vector file. This AOI instructs " "the model where to clip the input data and the extent " "of analysis. Users will create a polygon feature " "layer that defines their area of interest. The AOI " "must intersect the Digital Elevation Model (DEM)."), label='Area of Interest (Vector)', validator=self.validator) self.general_tab.add_input(self.aoi_uri) self.cell_size = inputs.Text( args_key='cell_size', helptext='Length (in meters) of each side of the (square) cell.', label='Cell Size (meters)', validator=self.validator) self.general_tab.add_input(self.cell_size) self.structure_uri = inputs.File( args_key='structure_uri', helptext=("An OGR-supported vector file. The user must specify " "a point feature layer that indicates locations of " "objects that contribute to negative scenic quality, " "such as aquaculture netpens or wave energy " "facilities. In order for the viewshed analysis to " "run correctly, the projection of this input must be " "consistent with the project of the DEM input."), label='Features Impacting Scenic Quality (Vector)', validator=self.validator) self.general_tab.add_input(self.structure_uri) self.dem_uri = inputs.File( args_key='dem_uri', helptext=("A GDAL-supported raster file. An elevation raster " "layer is required to conduct viewshed analysis. " "Elevation data allows the model to determine areas " "within the AOI's land-seascape where point features " "contributing to negative scenic quality are visible."), label='Digital Elevation Model (Raster)', validator=self.validator) self.general_tab.add_input(self.dem_uri) self.refraction = inputs.Text( args_key='refraction', helptext=("The earth curvature correction option corrects for " "the curvature of the earth and refraction of visible " "light in air. Changes in air density curve the light " "downward causing an observer to see further and the " "earth to appear less curved. While the magnitude of " "this effect varies with atmospheric conditions, a " "standard rule of thumb is that refraction of visible " "light reduces the apparent curvature of the earth by " "one-seventh. By default, this model corrects for the " "curvature of the earth and sets the refractivity " "coefficient to 0.13."), label='Refractivity Coefficient', validator=self.validator) self.general_tab.add_input(self.refraction) self.pop_uri = inputs.File( args_key='pop_uri', helptext=("A GDAL-supported raster file. A population raster " "layer is required to determine population within the " "AOI's land-seascape where point features contributing " "to negative scenic quality are visible and not " "visible."), label='Population (Raster)', validator=self.validator) self.general_tab.add_input(self.pop_uri) self.overlap_uri = inputs.File( args_key='overlap_uri', helptext=("An OGR-supported vector file. The user has the " "option of providing a polygon feature layer where " "they would like to determine the impact of objects on " "visual quality. This input must be a polygon and " "projected in meters. The model will use this layer " "to determine what percent of the total area of each " "polygon feature can see at least one of the point " "features impacting scenic quality."), label='Overlap Analysis Features (Vector)', validator=self.validator) self.general_tab.add_input(self.overlap_uri) self.valuation_tab = inputs.Container(interactive=True, label='Valuation') self.add_input(self.valuation_tab) self.valuation_function = inputs.Dropdown( args_key='valuation_function', helptext=("This field indicates the functional form f(x) the " "model will use to value the visual impact for each " "viewpoint. For distances less than 1 km (x<1), the " "model uses a linear form g(x) where the line passes " "through f(1) (i.e. g(1) == f(1)) and extends to zero " "with the same slope as f(1) (i.e. g'(x) == f'(1))."), label='Valuation Function', options=[ 'polynomial: a + bx + cx^2 + dx^3', 'logarithmic: a + b ln(x)' ]) self.valuation_tab.add_input(self.valuation_function) self.a_coefficient = inputs.Text( args_key='a_coefficient', helptext=("First coefficient used either by the polynomial or " "by the logarithmic valuation function."), label="'a' Coefficient (polynomial/logarithmic)", validator=self.validator) self.valuation_tab.add_input(self.a_coefficient) self.b_coefficient = inputs.Text( args_key='b_coefficient', helptext=("Second coefficient used either by the polynomial or " "by the logarithmic valuation function."), label="'b' Coefficient (polynomial/logarithmic)", validator=self.validator) self.valuation_tab.add_input(self.b_coefficient) self.c_coefficient = inputs.Text( args_key='c_coefficient', helptext="Third coefficient for the polynomial's quadratic term.", label="'c' Coefficient (polynomial only)", validator=self.validator) self.valuation_tab.add_input(self.c_coefficient) self.d_coefficient = inputs.Text( args_key='d_coefficient', helptext="Fourth coefficient for the polynomial's cubic exponent.", label="'d' Coefficient (polynomial only)", validator=self.validator) self.valuation_tab.add_input(self.d_coefficient) self.max_valuation_radius = inputs.Text( args_key='max_valuation_radius', helptext=("Radius beyond which the valuation is set to zero. " "The valuation function 'f' cannot be negative at the " "radius 'r' (f(r)>=0)."), label='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'Wave Energy', target=natcap.invest.wave_energy.wave_energy.execute, validator=natcap.invest.wave_energy.wave_energy.validate, localdoc=u'../documentation/wave_energy.html') self.results_suffix = inputs.Text( args_key=u'suffix', helptext=( u'A string that will be added to the end of the output file ' u'paths.'), label=u'Results Suffix (Optional)', validator=self.validator) self.add_input(self.results_suffix) self.wave_base_data = inputs.Folder( args_key=u'wave_base_data_uri', 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_uri', 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_uri', 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_uri', 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_uri', 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_uri', 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_uri', 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_uri', 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='Recreation Model', target=recmodel_client.execute, validator=recmodel_client.validate, localdoc='recreation.html') self.internet_warning = inputs.Label( text=("Note, this computer must have an Internet connection " "in order to run this model.")) self.aoi_path = inputs.File( args_key='aoi_path', helptext=("An OGR-supported vector file representing the area " "of interest where the model will run the analysis."), label='Area of Interest (Vector)', validator=self.validator) self.add_input(self.aoi_path) self.start_year = inputs.Text( args_key='start_year', helptext='Year to start PUD calculations, date starts on Jan 1st.', label='Start Year (inclusive, must be >= 2005)', validator=self.validator) self.add_input(self.start_year) self.end_year = inputs.Text( args_key='end_year', helptext=('Year to end PUD calculations, date ends and includes ' 'Dec 31st.'), label='End Year (inclusive, must be <= 2017)', validator=self.validator) self.add_input(self.end_year) self.regression_container = inputs.Container( args_key='compute_regression', expandable=True, expanded=True, label='Compute Regression') self.add_input(self.regression_container) self.predictor_table_path = inputs.File( args_key='predictor_table_path', helptext=("A table that maps predictor IDs to files and their " "types with required headers of 'id', 'path', and " "'type'. The file paths can be absolute, or relative " "to the table."), label='Predictor Table', validator=self.validator) self.regression_container.add_input(self.predictor_table_path) self.scenario_predictor_table_path = inputs.File( args_key='scenario_predictor_table_path', helptext=("A table that maps predictor IDs to files and their " "types with required headers of 'id', 'path', and " "'type'. The file paths can be absolute, or relative " "to the table."), label='Scenario Predictor Table (optional)', validator=self.validator) self.regression_container.add_input(self.scenario_predictor_table_path) self.grid_container = inputs.Container(args_key='grid_aoi', expandable=True, expanded=True, label='Grid the AOI') self.add_input(self.grid_container) self.grid_type = inputs.Dropdown(args_key='grid_type', label='Grid Type', options=['square', 'hexagon']) self.grid_container.add_input(self.grid_type) self.cell_size = inputs.Text( args_key='cell_size', helptext=("The size of the grid units measured in the " "projection units of the AOI. For example, UTM " "projections use meters."), label='Cell Size', validator=self.validator) self.grid_container.add_input(self.cell_size)
def __init__(self): model.InVESTModel.__init__(self, label=u'Marine Aquaculture: Finfish', target=finfish_aquaculture.execute, validator=finfish_aquaculture.validate, localdoc=u'marine_fish.html') self.farm_location = inputs.File( args_key=u'ff_farm_loc', helptext=(u"An OGR-supported vector file containing polygon or " u"point, with a latitude and longitude value and a " u"numerical identifier for each farm. File can be " u"named anything, but no spaces in the " u"name.<br><br>File type: polygon shapefile or " u".gdb<br>Rows: each row is a specific netpen or entire " u"aquaculture farm<br>Columns: columns contain " u"attributes about each netpen (area, location, " u"etc.).<br>Sample data set: " u"\InVEST\Aquaculture\Input\Finfish_Netpens.shp"), label=u'Finfish Farm Location (Vector)', validator=self.validator) self.add_input(self.farm_location) self.farm_identifier = inputs.Dropdown( args_key=u'farm_ID', helptext=(u"The name of a column heading used to identify each " u"farm and link the spatial information from the " u"shapefile to subsequent table input data (farm " u"operation and daily water temperature at farm " u"tables). Additionally, the numbers underneath this " u"farm identifier name must be unique integers for all " u"the inputs."), interactive=False, options=( 'UNKNOWN', ), # No options until valid OGR vector provided label=u'Farm Identifier Name') self.add_input(self.farm_identifier) self.param_a = inputs.Text( args_key=u'g_param_a', helptext=(u"Default a = (0.038 g/day). If the user chooses to " u"adjust these parameters, we recommend using them in " u"the simple growth model to determine if the time " u"taken for a fish to reach a target harvest weight " u"typical for the region of interest is accurate."), label=u'Fish Growth Parameter (a)', validator=self.validator) self.add_input(self.param_a) self.param_b = inputs.Text( args_key=u'g_param_b', helptext=(u"Default b = (0.6667 g/day). If the user chooses to " u"adjust these parameters, we recommend using them in " u"the simple growth model to determine if the time " u"taken for a fish to reach a target harvest weight " u"typical for the region of interest is accurate."), label=u'Fish Growth Parameter (b)', validator=self.validator) self.add_input(self.param_b) self.param_tau = inputs.Text( args_key=u'g_param_tau', helptext=(u"Default tau = (0.08 C^-1). Specifies how sensitive " u"finfish growth is to temperature. If the user " u"chooses to adjust these parameters, we recommend " u"using them in the simple growth model to determine if " u"the time taken for a fish to reach a target harvest " u"weight typical for the region of interest is " u"accurate."), label=u'Fish Growth Parameter (tau)', validator=self.validator) self.add_input(self.param_tau) self.uncertainty_data_container = inputs.Container( args_key=u'use_uncertainty', expandable=True, label=u'Enable Uncertainty Analysis') self.add_input(self.uncertainty_data_container) self.param_a_sd = inputs.Text( args_key=u'g_param_a_sd', helptext=(u"Standard deviation for fish growth parameter a. " u"This indicates the level of uncertainty in the " u"estimate for parameter a."), label=u'Standard Deviation for Parameter (a)', validator=self.validator) self.uncertainty_data_container.add_input(self.param_a_sd) self.param_b_sd = inputs.Text( args_key=u'g_param_b_sd', helptext=(u"Standard deviation for fish growth parameter b. " u"This indicates the level of uncertainty in the " u"estimate for parameter b."), label=u'Standard Deviation for Parameter (b)', validator=self.validator) self.uncertainty_data_container.add_input(self.param_b_sd) self.num_monte_carlo_runs = inputs.Text( args_key=u'num_monte_carlo_runs', helptext=(u"Number of runs of the model to perform as part of a " u"Monte Carlo simulation. A larger number will tend to " u"produce more consistent and reliable output, but will " u"also take longer to run."), label=u'Number of Monte Carlo Simulation Runs', validator=self.validator) self.uncertainty_data_container.add_input(self.num_monte_carlo_runs) self.water_temperature = inputs.File( args_key=u'water_temp_tbl', helptext=(u"Users must provide a time series of daily water " u"temperature (C) for each farm in the shapefile. When " u"daily temperatures are not available, users can " u"interpolate seasonal or monthly temperatures to a " u"daily resolution. Water temperatures collected at " u"existing aquaculture facilities are preferable, but " u"if unavailable, users can consult online sources such " u"as NOAAs 4 km AVHRR Pathfinder Data and Canadas " u"Department of Fisheries and Oceans Oceanographic " u"Database. The most appropriate temperatures to use " u"are those from the upper portion of the water column, " u"which are the temperatures experienced by the fish in " u"the netpens."), label=u'Table of Daily Water Temperature at Farm (CSV)', validator=self.validator) self.add_input(self.water_temperature) self.farm_operations = inputs.File( args_key=u'farm_op_tbl', helptext=(u"A table of general and farm-specific operations " u"parameters. Please refer to the sample data table " u"for reference to ensure correct incorporation of data " u"in the model.<br><br>The values for 'farm operations' " u"(applied to all farms) and 'add new farms' (beginning " u"with row 32) may be modified according to the user's " u"needs . However, the location of cells in this " u"template must not be modified. If for example, if " u"the model is to run for three farms only, the farms " u"should be listed in rows 10, 11 and 12 (farms 1, 2, " u"and 3, respectively). Several default values that are " u"applicable to Atlantic salmon farming in British " u"Columbia are also included in the sample data table."), label=u'Farm Operations Table (CSV)', validator=self.validator) self.add_input(self.farm_operations) self.outplant_buffer = inputs.Text( args_key=u'outplant_buffer', helptext=(u"This value will allow the outplant start day to " u"start plus or minus the number of days specified " u"here."), label=u'Outplant Date Buffer', validator=self.validator) self.add_input(self.outplant_buffer) self.valuation = inputs.Checkbox( args_key=u'do_valuation', helptext=(u"By checking this box, a valuation analysis will be " u"run on the model."), label=u'Run Valuation?') self.add_input(self.valuation) self.market_price = inputs.Text( args_key=u'p_per_kg', helptext=(u"Default value comes from Urner-Berry monthly fresh " u"sheet reports on price of farmed Atlantic salmon."), interactive=False, label=u'Market Price per Kilogram of Processed Fish', validator=self.validator) self.add_input(self.market_price) self.fraction_price = inputs.Text( args_key=u'frac_p', helptext=(u"Fraction of market price that accounts for costs " u"rather than profit. Default value is 0.3 (30%)."), interactive=False, label=u'Fraction of Price that Accounts to Costs', validator=self.validator) self.add_input(self.fraction_price) self.discount_rate = inputs.Text( args_key=u'discount', helptext=(u"We use a 7% annual discount rate, adjusted to a " u"daily rate of 0.000192 for 0.0192% (7%/365 days)."), interactive=False, label=u'Daily Market Discount Rate', validator=self.validator) self.add_input(self.discount_rate) # Set interactivity, requirement as input sufficiency changes self.farm_location.sufficiency_changed.connect( self.farm_identifier.set_interactive) self.farm_location.sufficiency_changed.connect(self._load_colnames) self.valuation.sufficiency_changed.connect( self.market_price.set_interactive) self.valuation.sufficiency_changed.connect( self.fraction_price.set_interactive) self.valuation.sufficiency_changed.connect( self.discount_rate.set_interactive)
def __init__(self): model.InVESTModel.__init__( self, label=u'Scenario Generator', target=natcap.invest.scenario_generator.scenario_generator.execute, validator=natcap.invest.scenario_generator.scenario_generator. validate, localdoc=u'../documentation/scenario_generator.html', suffix_args_key='suffix', ) self.landcover = inputs.File( args_key=u'landcover', helptext= u'A GDAL-supported raster file representing land-use/land-cover.', label=u'Land Cover (Raster)', validator=self.validator) self.add_input(self.landcover) self.transition = inputs.File( args_key=u'transition', helptext=(u"This table contains the land-cover transition " u"likelihoods, priority of transitions, area change, " u"proximity suitiblity, proximity effect distance, seed " u"size, short name, and patch size."), label=u'Transition Table (CSV)', validator=self.validator) self.add_input(self.transition) self.calculate_priorities = inputs.Checkbox( args_key=u'calculate_priorities', helptext=(u"This option enables calculation of the land-cover " u"priorities using analytical hierarchical processing. " u"A matrix table must be entered below. Optionally, " u"the priorities can manually be entered in the " u"priority column of the land attributes table."), interactive=False, label=u'Calculate Priorities') self.add_input(self.calculate_priorities) self.priorities_csv_uri = inputs.File( args_key=u'priorities_csv_uri', helptext=(u"This table contains a matrix of land-cover type " u"pairwise priorities used to calculate land-cover " u"priorities."), interactive=False, label=u'Priorities Table (CSV)', validator=self.validator) self.add_input(self.priorities_csv_uri) self.calculate_proximity = inputs.Container( args_key=u'calculate_proximity', expandable=True, expanded=True, label=u'Proximity') self.add_input(self.calculate_proximity) self.calculate_transition = inputs.Container( args_key=u'calculate_transition', expandable=True, expanded=True, label=u'Specify Transitions') self.add_input(self.calculate_transition) self.calculate_factors = inputs.Container( args_key=u'calculate_factors', expandable=True, expanded=True, label=u'Use Factors') self.add_input(self.calculate_factors) self.suitability_folder = inputs.Folder(args_key=u'suitability_folder', label=u'Factors Folder', validator=self.validator) self.calculate_factors.add_input(self.suitability_folder) self.suitability = inputs.File( args_key=u'suitability', helptext=(u"This table lists the factors that determine " u"suitability of the land-cover for change, and " u"includes: the factor name, layer name, distance of " u"influence, suitability value, weight of the factor, " u"distance breaks, and applicable land-cover."), label=u'Factors Table', validator=self.validator) self.calculate_factors.add_input(self.suitability) self.weight = inputs.Text( args_key=u'weight', helptext=(u"The factor weight is a value between 0 and 1 which " u"determines the weight given to the factors vs. the " u"expert opinion likelihood rasters. For example, if a " u"weight of 0.3 is entered then 30% of the final " u"suitability is contributed by the factors and the " u"likelihood matrix contributes 70%. This value is " u"entered on the tool interface."), label=u'Factor Weight', validator=self.validator) self.calculate_factors.add_input(self.weight) self.factor_inclusion = inputs.Dropdown( args_key=u'factor_inclusion', helptext=u'', interactive=False, label=u'Rasterization Method', options=[ u'All touched pixels', u'Only pixels with covered center points' ]) self.calculate_factors.add_input(self.factor_inclusion) self.calculate_constraints = inputs.Container( args_key=u'calculate_constraints', expandable=True, label=u'Constraints Layer') self.add_input(self.calculate_constraints) self.constraints = inputs.File( args_key=u'constraints', helptext=(u"An OGR-supported vector file. This is a vector " u"layer which indicates the parts of the landscape that " u"are protected of have constraints to land-cover " u"change. The layer should have one field named " u"'porosity' with a value between 0 and 1 where 0 means " u"its fully protected and 1 means its fully open to " u"change."), label=u'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=u'constraints_field', helptext=(u"The field from the override table that contains the " u"value for the override."), interactive=False, options=('UNKNOWN', ), label=u'Constraints Field') self.calculate_constraints.add_input(self.constraints_field) self.override_layer = inputs.Container(args_key=u'override_layer', expandable=True, expanded=True, label=u'Override Layer') self.add_input(self.override_layer) self.override = inputs.File( args_key=u'override', helptext=(u"An OGR-supported vector file. This is a vector " u"(polygon) layer with land-cover types in the same " u"scale and projection as the input land-cover. This " u"layer is used to override all the changes and is " u"applied after the rule conversion is complete."), label=u'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=u'override_field', helptext=(u"The field from the override table that contains the " u"value for the override."), interactive=False, options=('UNKNOWN', ), label=u'Override Field') self.override_layer.add_input(self.override_field) self.override_inclusion = inputs.Dropdown( args_key=u'override_inclusion', helptext=u'', interactive=False, label=u'Rasterization Method', options=[ u'All touched pixels', u'Only pixels with covered center points' ]) self.override_layer.add_input(self.override_inclusion) self.seed = inputs.Text( args_key=u'seed', helptext=(u"Seed must be an integer or blank. <br/><br/>Under " u"normal conditions, parcels with the same suitability " u"are picked in a random order. Setting the seed value " u"allows the scenario generator to randomize the order " u"in which parcels are picked, but two runs with the " u"same seed will pick parcels in the same order."), label=u'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=u'Hydropower Water Yield', target=hydropower_water_yield.execute, validator=hydropower_water_yield.validate, localdoc=u'../documentation/reservoirhydropowerproduction.html') self.precipitation = inputs.File( args_key=u'precipitation_uri', helptext=(u"A GDAL-supported raster file containing non-zero, " u"average annual precipitation values for each cell. " u"The precipitation values should be in millimeters " u"(mm)."), label=u'Precipitation (Raster)', validator=self.validator) self.add_input(self.precipitation) self.potential_evapotranspiration = inputs.File( args_key=u'eto_uri', helptext=(u"A GDAL-supported raster file containing annual " u"average reference evapotranspiration values for each " u"cell. The reference evapotranspiration values should " u"be in millimeters (mm)."), label=u'Reference Evapotranspiration (Raster)', validator=self.validator) self.add_input(self.potential_evapotranspiration) self.depth_to_root_rest_layer = inputs.File( args_key=u'depth_to_root_rest_layer_uri', helptext=(u"A GDAL-supported raster file containing an average " u"root restricting layer depth value for each cell. " u"The root restricting layer depth value should be in " u"millimeters (mm)."), label=u'Depth To Root Restricting Layer (Raster)', validator=self.validator) self.add_input(self.depth_to_root_rest_layer) self.plant_available_water_fraction = inputs.File( args_key=u'pawc_uri', helptext=(u"A GDAL-supported raster file containing plant " u"available water content values for each cell. The " u"plant available water content fraction should be a " u"value between 0 and 1."), label=u'Plant Available Water Fraction (Raster)', validator=self.validator) self.add_input(self.plant_available_water_fraction) self.land_use = inputs.File( args_key=u'lulc_uri', helptext=(u"A GDAL-supported raster file containing LULC code " u"(expressed as integers) for each cell."), label=u'Land Use (Raster)', validator=self.validator) self.add_input(self.land_use) self.watersheds = inputs.File( args_key=u'watersheds_uri', helptext=(u"An OGR-supported vector file containing one polygon " u"per watershed. Each polygon that represents a " u"watershed is required to have a field 'ws_id' that is " u"a unique integer which identifies that watershed."), label=u'Watersheds (Vector)', validator=self.validator) self.add_input(self.watersheds) self.sub_watersheds = inputs.File( args_key=u'sub_watersheds_uri', helptext=(u"An OGR-supported vector file with one polygon per " u"sub-watershed within the main watersheds specified in " u"the Watersheds shapefile. Each polygon that " u"represents a sub-watershed is required to have a " u"field 'subws_id' that is a unique integer which " u"identifies that sub-watershed."), label=u'Sub-Watersheds (Vector) (Optional)', validator=self.validator) self.add_input(self.sub_watersheds) self.biophysical_table = inputs.File( args_key=u'biophysical_table_uri', helptext=(u"A CSV table of land use/land cover (LULC) classes, " u"containing data on biophysical coefficients used in " u"this model. The following columns are required: " u"'lucode' (integer), 'root_depth' (mm), 'Kc' " u"(coefficient)."), label=u'Biophysical Table (CSV)', validator=self.validator) self.add_input(self.biophysical_table) self.seasonality_constant = inputs.Text( args_key=u'seasonality_constant', helptext=(u"Floating point value on the order of 1 to 30 " u"corresponding to the seasonal distribution of " u"precipitation."), label=u'Z parameter', validator=self.validator) self.add_input(self.seasonality_constant) self.water_scarcity_container = inputs.Container( args_key=u'calculate_water_scarcity', expandable=True, expanded=False, label=u'Water Scarcity') self.add_input(self.water_scarcity_container) self.demand_table = inputs.File( args_key=u'demand_table_uri', helptext=(u"A CSV table of LULC classes, showing consumptive " u"water use for each land-use/land-cover type. The " u"table requires two column fields: 'lucode' and " u"'demand'. The demand values should be the estimated " u"average consumptive water use for each land-use/land- " u"cover type. Water use should be given in cubic " u"meters per year for a pixel in the land-use/land- " u"cover map. NOTE: the accounting for pixel area is " u"important since larger areas will consume more water " u"for the same land-cover type."), label=u'Water Demand Table (CSV)', validator=self.validator) self.water_scarcity_container.add_input(self.demand_table) self.valuation_container = inputs.Container( args_key=u'calculate_valuation', expandable=True, expanded=False, label=u'Valuation') self.add_input(self.valuation_container) self.hydropower_valuation_table = inputs.File( args_key=u'valuation_table_uri', helptext=(u"A CSV table of hydropower stations with associated " u"model values. The table should have the following " u"column fields: 'ws_id', 'efficiency', 'fraction', " u"'height', 'kw_price', 'cost', 'time_span', and " u"'discount'."), label=u'Hydropower Valuation Table (CSV)', validator=self.validator) self.valuation_container.add_input(self.hydropower_valuation_table)
def __init__(self): model.InVESTModel.__init__( self, label=MODEL_METADATA['stormwater'].model_title, target=stormwater.execute, validator=stormwater.validate, localdoc=MODEL_METADATA['stormwater'].userguide) self.lulc_path = inputs.File( args_key='lulc_path', helptext=("A GDAL-supported raster representing land-cover."), label='Land Use/Land Cover', validator=self.validator) self.add_input(self.lulc_path) self.soil_group_path = inputs.File( args_key='soil_group_path', helptext=( "A GDAL-supported raster representing hydrologic soil groups." ), label='Soil Groups', validator=self.validator) self.add_input(self.soil_group_path) self.precipitation_path = inputs.File( args_key='precipitation_path', helptext=( "A GDAL-supported raster showing annual precipitation amounts" ), label='Precipitation', validator=self.validator) self.add_input(self.precipitation_path) self.biophysical_table = inputs.File( args_key='biophysical_table', helptext=( "A CSV file with runoff coefficient (RC), infiltration " "coefficient (IR), and pollutant event mean concentration " "(EMC) data for each LULC code."), label='Biophysical Table', validator=self.validator) self.add_input(self.biophysical_table) self.adjust_retention_ratios = inputs.Checkbox( args_key='adjust_retention_ratios', helptext=( 'If checked, adjust retention ratios using road centerlines.'), label='Adjust Retention Ratios') self.add_input(self.adjust_retention_ratios) self.retention_radius = inputs.Text( args_key='retention_radius', helptext=('Radius within which to adjust retention ratios'), label='Retention Radius', validator=self.validator) self.add_input(self.retention_radius) self.road_centerlines_path = inputs.File( args_key='road_centerlines_path', helptext=('Polyline vector representing centerlines of roads'), label='Road Centerlines', validator=self.validator) self.add_input(self.road_centerlines_path) self.aggregate_areas_path = inputs.File( args_key='aggregate_areas_path', helptext=( 'Polygon vector outlining area(s) of interest by which to ' 'aggregate results (typically watersheds or sewersheds).'), label='Aggregate Areas', validator=self.validator) self.add_input(self.aggregate_areas_path) self.replacement_cost = inputs.Text( args_key='replacement_cost', helptext=('Replacement cost of retention per cubic meter'), label='Replacement Cost', validator=self.validator) self.add_input(self.replacement_cost) # retention_radius is active when adjust_retention_ratios is checked self.adjust_retention_ratios.sufficiency_changed.connect( self.retention_radius.set_interactive) self.adjust_retention_ratios.sufficiency_changed.connect( self.road_centerlines_path.set_interactive)
def __init__(self): model.InVESTModel.__init__( self, label='Coastal Blue Carbon', target=coastal_blue_carbon.execute, validator=coastal_blue_carbon.validate, localdoc='../documentation/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='Transition LULC 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='Transition 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.interest_rate = inputs.Text( args_key='interest_rate', helptext=("The interest rate on the price per Megatonne CO2e, " "compounded yearly."), label='Interest Rate (%)', validator=self.validator) self.do_economic_analysis.add_input(self.interest_rate) self.price_table_uri = inputs.File( args_key='price_table_uri', helptext=("Can be used in place of price and interest rate " "inputs. The provided CSV table contains the price " "per Megatonne CO2e sequestered for a given year, for " "all years from the original snapshot to the analysis " "year, if provided."), interactive=False, label='Price Table (CSV)', validator=self.validator) self.do_economic_analysis.add_input(self.price_table_uri) self.discount_rate = inputs.Text( args_key='discount_rate', helptext=("The discount rate on future valuations of " "sequestered carbon, compounded yearly."), label='Discount Rate (%)', validator=self.validator) self.do_economic_analysis.add_input(self.discount_rate) # Set interactivity, requirement as input sufficiency changes self.do_price_table.sufficiency_changed.connect( self._price_table_sufficiency_changed)
def __init__(self): model.InVESTModel.__init__( self, label=MODEL_METADATA['routedem'].model_title, target=routedem.execute, validator=routedem.validate, localdoc=MODEL_METADATA['routedem'].userguide) self.dem_path = inputs.File( args_key='dem_path', helptext=( "A GDAL-supported raster file containing a base " "Digital Elevation Model to execute the routing " "functionality across."), label='Digital Elevation Model (Raster)', validator=self.validator) self.add_input(self.dem_path) self.dem_band_index = inputs.Text( args_key='dem_band_index', helptext=( 'The band index to use from the raster. ' 'This positive integer is 1-based.' 'Default: 1'), label='Band Index (optional)', validator=self.validator) self.dem_band_index.set_value(1) self.add_input(self.dem_band_index) self.calculate_slope = inputs.Checkbox( args_key='calculate_slope', helptext='If selected, calculates slope raster.', label='Calculate Slope') self.add_input(self.calculate_slope) self.algorithm = inputs.Dropdown( args_key='algorithm', label='Routing Algorithm', helptext=( 'The routing algorithm to use. ' '<ul><li>D8: all water flows directly into the most downhill ' 'of each of the 8 neighbors of a cell.</li>' '<li>MFD: Multiple Flow Direction. Fractional flow is ' 'modelled between pixels.</li></ul>'), options=('D8', 'MFD')) self.add_input(self.algorithm) self.calculate_flow_direction = inputs.Checkbox( args_key='calculate_flow_direction', helptext='Select to calculate flow direction', label='Calculate Flow Direction') self.add_input(self.calculate_flow_direction) self.calculate_flow_accumulation = inputs.Checkbox( args_key='calculate_flow_accumulation', helptext='Select to calculate flow accumulation.', label='Calculate Flow Accumulation', interactive=False) self.add_input(self.calculate_flow_accumulation) self.calculate_stream_threshold = inputs.Checkbox( args_key='calculate_stream_threshold', helptext='Select to calculate a stream threshold to flow accumulation.', interactive=False, label='Calculate Stream Thresholds') self.add_input(self.calculate_stream_threshold) self.threshold_flow_accumulation = inputs.Text( args_key='threshold_flow_accumulation', helptext=( "The number of upslope cells that must flow into a " "cell before it's classified as a stream."), interactive=False, label='Threshold Flow Accumulation Limit', validator=self.validator) self.add_input(self.threshold_flow_accumulation) self.calculate_downslope_distance = inputs.Checkbox( args_key='calculate_downslope_distance', helptext=( "If selected, creates a downslope distance raster " "based on the thresholded flow accumulation stream " "classification."), interactive=False, label='Calculate Distance to stream') self.add_input(self.calculate_downslope_distance) # Set interactivity, requirement as input sufficiency changes self.calculate_flow_direction.sufficiency_changed.connect( self.calculate_flow_accumulation.set_interactive) self.calculate_flow_accumulation.sufficiency_changed.connect( self.calculate_stream_threshold.set_interactive) self.calculate_stream_threshold.sufficiency_changed.connect( self.threshold_flow_accumulation.set_interactive) self.calculate_stream_threshold.sufficiency_changed.connect( self.calculate_downslope_distance.set_interactive)
def __init__(self): model.InVESTModel.__init__( self, label=u'Crop Production Percentile Model', target=natcap.invest.crop_production_percentile.execute, validator=natcap.invest.crop_production_percentile.validate, localdoc=u'../documentation/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."), 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 abaca, agave, alfalfa, almond, " u"aniseetc, apple, apricot, areca, artichoke, " u"asparagus, avocado, bambara, banana, barley, bean, " u"beetfor, berrynes, blueberry, brazil, broadbean, " u"buckwheat, cabbage, cabbagefor, canaryseed, carob, " u"carrot, carrotfor, cashew, cashewapple, cassava, " u"castor, cauliflower, cerealnes, cherry, chestnut, " u"chickpea, chicory, chilleetc, cinnamon, citrusnes, " u"clove, clover, cocoa, coconut, coffee, cotton, " u"cowpea, cranberry, cucumberetc, currant, date, " u"eggplant, fibrenes, fig, flax, fonio, fornes, " u"fruitnes, garlic, ginger, gooseberry, grape, " u"grapefruitetc, grassnes, greenbean, greenbroadbean, " u"greencorn, greenonion, greenpea, groundnut, hazelnut, " u"hemp, hempseed, hop, jute, jutelikefiber, kapokfiber, " u"kapokseed, karite, kiwi, kolanut, legumenes, " u"lemonlime, lentil, lettuce, linseed, lupin, maize, " u"maizefor, mango, mate, melonetc, melonseed, millet, " u"mixedgrain, mixedgrass, mushroom, mustard, nutmeg, " u"nutnes, oats, oilpalm, oilseedfor, oilseednes, okra, " u"olive, onion, orange, papaya, pea, peachetc, pear, " u"pepper, peppermint, persimmon, pigeonpea, pimento, " u"pineapple, pistachio, plantain, plum, poppy, potato, " u"pulsenes, pumpkinetc, pyrethrum, quince, quinoa, " u"ramie, rapeseed, rasberry, rice, rootnes, rubber, " u"rye, ryefor, safflower, sesame, sisal, sorghum, " u"sorghumfor, sourcherry, soybean, spicenes, spinach, " u"stonefruitnes, strawberry, stringbean, sugarbeet, " u"sugarcane, sugarnes, sunflower, swedefor, " u"sweetpotato, tangetc, taro, tea, tobacco, tomato, " u"triticale, tropicalnes, tung, turnipfor, vanilla, " u"vegetablenes, vegfor, vetch,walnut, watermelon, " u"wheat, yam, and yautia."), label=u'Landcover to Crop Table (csv)', validator=self.validator) self.add_input(self.landcover_to_crop_table_path) self.aggregate_polygon_path = inputs.File( args_key=u'aggregate_polygon_path', helptext=(u"A polygon shapefile to aggregate/summarize final " u"results. It is fine to have overlapping polygons. " u"The attribute table must contain a keyfield for " u"identifying polygons, be sure to indicate the name of " u"this field in the Aggregate Polygon ID Field below."), label=u'Aggregate results polygon (vector) (optional)', validator=self.validator) self.add_input(self.aggregate_polygon_path) self.aggregate_polygon_id = inputs.Text( args_key=u'aggregate_polygon_id', helptext=(u"If an aggregate polygon is provided, this field is " u"used to indicate the key field of that polygon for " u"aggregation. The aggregate table produced by this " u"model will index the results by this field value."), interactive=False, label=u'Aggregate polygon ID field', validator=self.validator) self.add_input(self.aggregate_polygon_id) # Set interactivity, requirement as input sufficiency changes self.aggregate_polygon_path.sufficiency_changed.connect( self.aggregate_polygon_id.set_interactive)