def __init__(self): model.InVESTModel.__init__( self, label=('Overlap Analysis Management Zone Model: Fisheries and ' 'Recreation'), target=overlap_analysis_mz.execute, validator=overlap_analysis_mz.validate, localdoc='../documentation/overlap_analysis.html') self.aoi = inputs.File( args_key='zone_layer_loc', helptext=( "An OGR-supported vector file. This should be a " "vector file containing multiple polygons since the " "Management Zones tool is used to analyze overlap " "data."), label='Analysis Zones Layer (Vector)', validator=self.validator) self.add_input(self.aoi) self.data_dir = inputs.Folder( args_key='overlap_data_dir_loc', helptext=( "The path to a folder containing ONLY the input data " "for the Overlap Analysis model. Input data can be " "point, line or polygon data layers indicating where " "in the coastal and marine environment the human use " "activity takes place."), label='Overlap Analysis Data Directory', validator=self.validator) self.add_input(self.data_dir)
def __init__(self): model.InVESTModel.__init__( self, label=u'Crop Production Regression Model', target=natcap.invest.crop_production_regression.execute, validator=natcap.invest.crop_production_regression.validate, localdoc=u'crop_production.html') self.model_data_path = inputs.Folder( args_key=u'model_data_path', helptext=(u"A path to the InVEST Crop Production Data directory. " u"These data would have been included with the InVEST " u"installer if selected, or can be manually downloaded " u"from http://data.naturalcapitalproject.org/invest- " u"data/. If downloaded with InVEST, the default value " u"should be used.</b>"), label=u'Directory to model data', validator=self.validator) self.add_input(self.model_data_path) self.landcover_raster_path = inputs.File( args_key=u'landcover_raster_path', helptext=(u"A raster file, representing integer land use/land " u"code covers for each cell. This raster should have" u"a projected coordinate system with units of meters " u"(e.g. UTM) because pixel areas are divided by 10000" u"in order to report some results in hectares."), label=u'Land-Use/Land-Cover Map (raster)', validator=self.validator) self.add_input(self.landcover_raster_path) self.landcover_to_crop_table_path = inputs.File( args_key=u'landcover_to_crop_table_path', helptext=(u"A CSV table mapping canonical crop names to land use " u"codes contained in the landcover/use raster. The " u"allowed crop names are barley, maize, oilpalm, " u"potato, rice, soybean, sugarbeet, sugarcane, " u"sunflower, and wheat."), label=u'Landcover to Crop Table (csv)', validator=self.validator) self.add_input(self.landcover_to_crop_table_path) self.fertilization_rate_table_path = inputs.File( args_key=u'fertilization_rate_table_path', helptext=(u"A table that maps fertilization rates to crops in " u"the simulation. Must include the headers " u"'crop_name', 'nitrogen_rate', 'phosphorous_rate', " u"and 'potassium_rate'."), label=u'Fertilization Rate Table Path (csv)', validator=self.validator) self.add_input(self.fertilization_rate_table_path) self.aggregate_polygon_path = inputs.File( args_key=u'aggregate_polygon_path', helptext=(u"A polygon shapefile containing features with" u"which to aggregate/summarize final results." u"It is fine to have overlapping polygons."), label=u'Aggregate results polygon (vector) (optional)', validator=self.validator) self.add_input(self.aggregate_polygon_path)
def __init__(self): model.InVESTModel.__init__( self, label='Seasonal Water Yield', target=seasonal_water_yield.execute, validator=seasonal_water_yield.validate, localdoc='../documentation/seasonalwateryield.html') self.threshold_flow_accumulation = inputs.Text( args_key='threshold_flow_accumulation', helptext=("The number of upstream cells that must flow into a " "cell before it's considered part of a stream such " "that retention stops and the remaining export is " "exported to the stream. Used to define streams from " "the DEM."), label='Threshold Flow Accumulation', validator=self.validator) self.add_input(self.threshold_flow_accumulation) self.et0_dir = inputs.Folder( args_key='et0_dir', helptext=("The selected folder has a list of ET0 files with a " "specified format."), label='ET0 Directory', validator=self.validator) self.add_input(self.et0_dir) self.precip_dir = inputs.Folder( args_key='precip_dir', helptext=("The selected folder has a list of monthly " "precipitation files with a specified format."), label='Precipitation Directory', validator=self.validator) self.add_input(self.precip_dir) self.dem_raster_path = inputs.File( args_key='dem_raster_path', helptext=("A GDAL-supported raster file with an elevation value " "for each cell. Make sure the DEM is corrected by " "filling in sinks, and if necessary burning " "hydrographic features into the elevation model " "(recommended when unusual streams are observed.) See " "the 'Working with the DEM' section of the InVEST " "User's Guide for more information."), label='Digital Elevation Model (Raster)', validator=self.validator) self.add_input(self.dem_raster_path) self.lulc_raster_path = inputs.File( args_key='lulc_raster_path', helptext=("A GDAL-supported raster file, with an integer LULC " "code for each cell."), label='Land-Use/Land-Cover (Raster)', validator=self.validator) self.add_input(self.lulc_raster_path) self.soil_group_path = inputs.File( args_key='soil_group_path', helptext=("Map of SCS soil groups (A, B, C, or D) mapped to " "integer values (1, 2, 3, or 4) used in combination of " "the LULC map to compute the CN map."), label='Soil Group (Raster)', validator=self.validator) self.add_input(self.soil_group_path) self.aoi_path = inputs.File(args_key='aoi_path', label='AOI/Watershed (Vector)', validator=self.validator) self.add_input(self.aoi_path) self.biophysical_table_path = inputs.File( args_key='biophysical_table_path', helptext=("A CSV table containing model information " "corresponding to each of the land use classes in the " "LULC raster input. It must contain the fields " "'lucode', and 'Kc'."), label='Biophysical Table (CSV)', validator=self.validator) self.add_input(self.biophysical_table_path) self.rain_events_table_path = inputs.File( args_key='rain_events_table_path', label='Rain Events Table (CSV)', validator=self.validator) self.add_input(self.rain_events_table_path) self.alpha_m = inputs.Text(args_key='alpha_m', label='alpha_m Parameter', validator=self.validator) self.add_input(self.alpha_m) self.beta_i = inputs.Text(args_key='beta_i', label='beta_i Parameter', validator=self.validator) self.add_input(self.beta_i) self.gamma = inputs.Text(args_key='gamma', label='gamma Parameter', validator=self.validator) self.add_input(self.gamma) self.climate_zone_container = inputs.Container( args_key='user_defined_climate_zones', expandable=True, label='Climate Zones (Advanced)') self.add_input(self.climate_zone_container) self.climate_zone_table_path = inputs.File( args_key='climate_zone_table_path', label='Climate Zone Table (CSV)', validator=self.validator) self.climate_zone_container.add_input(self.climate_zone_table_path) self.climate_zone_raster_path = inputs.File( args_key='climate_zone_raster_path', helptext=("Map of climate zones that are found in the Climate " "Zone Table input. Pixel values correspond to cz_id."), label='Climate Zone (Raster)', validator=self.validator) self.climate_zone_container.add_input(self.climate_zone_raster_path) self.user_defined_local_recharge_container = inputs.Container( args_key='user_defined_local_recharge', expandable=True, label='User Defined Recharge Layer (Advanced)') self.add_input(self.user_defined_local_recharge_container) self.l_path = inputs.File(args_key='l_path', label='Local Recharge (Raster)', validator=self.validator) self.user_defined_local_recharge_container.add_input(self.l_path) self.monthly_alpha_container = inputs.Container( args_key='monthly_alpha', expandable=True, label='Monthly Alpha Table (Advanced)') self.add_input(self.monthly_alpha_container) self.monthly_alpha_path = inputs.File( args_key='monthly_alpha_path', label='Monthly Alpha Table (csv)', validator=self.validator) self.monthly_alpha_container.add_input(self.monthly_alpha_path) # Set interactivity, requirement as input sufficiency changes self.user_defined_local_recharge_container.sufficiency_changed.connect( self._toggle_user_defined_local_recharge) self.monthly_alpha_container.sufficiency_changed.connect( self._toggle_monthly_alpha)
def __init__(self): model.InVESTModel.__init__( self, label=MODEL_METADATA['fisheries'].model_title, target=fisheries.execute, validator=fisheries.validate, localdoc=MODEL_METADATA['fisheries'].userguide) self.alpha_only = inputs.Label( text=("This tool is in an ALPHA testing stage and should " "not be used for decision making.")) self.aoi_vector_path = inputs.File( args_key='aoi_vector_path', helptext=("An OGR-supported vector file used to display outputs " "within the region(s) of interest.<br><br>The layer " "should contain one feature for every region of " "interest, each feature of which should have a ‘NAME’ " "attribute. The 'NAME' attribute can be numeric or " "alphabetic, but must be unique within the given file."), label='Area of Interest (Vector) (Optional)', validator=self.validator) self.add_input(self.aoi_vector_path) self.total_timesteps = inputs.Text( args_key='total_timesteps', helptext=("The number of time steps the simulation shall " "execute before completion.<br><br>Must be a positive " "integer."), label='Number of Time Steps for Model Run', validator=self.validator) self.add_input(self.total_timesteps) self.popu_cont = inputs.Container(label='Population Parameters') self.add_input(self.popu_cont) self.population_type = inputs.Dropdown( args_key='population_type', helptext=("Specifies whether the lifecycle classes provided in " "the Population Parameters CSV file represent ages " "(uniform duration) or stages.<br><br>Age-based models " "(e.g. Lobster, Dungeness Crab) are separated by " "uniform, fixed-length time steps (usually " "representing a year).<br><br>Stage-based models (e.g. " "White Shrimp) allow lifecycle-classes to have " "nonuniform durations based on the assumed resolution " "of the provided time step.<br><br>If the stage-based " "model is selected, the Population Parameters CSV file " "must include a ‘Duration’ vector alongside the " "survival matrix that contains the number of time " "steps that each stage lasts."), label='Population Model Type', options=['Age-Based', 'Stage-Based']) self.popu_cont.add_input(self.population_type) self.sexsp = inputs.Dropdown( args_key='sexsp', helptext=("Specifies whether or not the lifecycle classes " "provided in the Populaton Parameters CSV file are " "distinguished by sex."), label='Population Classes are Sex-Specific', options=['No', 'Yes']) self.popu_cont.add_input(self.sexsp) self.harvest_units = inputs.Dropdown( args_key='harvest_units', helptext=("Specifies whether the harvest output values are " "calculated in terms of number of individuals or in " "terms of biomass (weight).<br><br>If ‘Weight’ is " "selected, the Population Parameters CSV file must " "include a 'Weight' vector alongside the survival " "matrix that contains the weight of each lifecycle " "class and sex if model is sex-specific."), label='Harvest by Individuals or Weight', options=['Individuals', 'Weight']) self.popu_cont.add_input(self.harvest_units) self.do_batch = inputs.Checkbox( args_key='do_batch', helptext=("Specifies whether program will perform a single " "model run or a batch (set) of model runs.<br><br>For " "single model runs, users submit a filepath pointing " "to a single Population Parameters CSV file. For " "batch model runs, users submit a directory path " "pointing to a set of Population Parameters CSV files."), label='Batch Processing') self.popu_cont.add_input(self.do_batch) self.population_csv_path = inputs.File( args_key='population_csv_path', helptext=("The provided CSV file should contain all necessary " "attributes for the sub-populations based on lifecycle " "class, sex, and area - excluding possible migration " "information.<br><br>Please consult the documentation " "to learn more about what content should be provided " "and how the CSV file should be structured."), label='Population Parameters File (CSV)', validator=self.validator) self.popu_cont.add_input(self.population_csv_path) self.population_csv_dir = inputs.Folder( args_key='population_csv_dir', helptext=("The provided CSV folder should contain a set of " "Population Parameters CSV files with all necessary " "attributes for sub-populations based on lifecycle " "class, sex, and area - excluding possible migration " "information.<br><br>The name of each file will serve " "as the prefix of the outputs created by the model " "run.<br><br>Please consult the documentation to learn " "more about what content should be provided and how " "the CSV file should be structured."), interactive=False, label='Population Parameters CSV Folder', validator=self.validator) self.popu_cont.add_input(self.population_csv_dir) self.recr_cont = inputs.Container(label='Recruitment Parameters') self.add_input(self.recr_cont) self.total_init_recruits = inputs.Text( args_key='total_init_recruits', helptext=("The initial number of recruits in the population " "model at time equal to zero.<br><br>If the model " "contains multiple regions of interest or is " "distinguished by sex, this value will be evenly " "divided and distributed into each sub-population."), label='Total Initial Recruits', validator=self.validator) self.recr_cont.add_input(self.total_init_recruits) self.recruitment_type = inputs.Dropdown( args_key='recruitment_type', helptext=("The selected equation is used to calculate " "recruitment into the subregions at the beginning of " "each time step. Corresponding parameters must be " "specified with each function:<br><br>The Beverton- " "Holt and Ricker functions both require arguments for " "the ‘Alpha’ and ‘Beta’ parameters.<br><br>The " "Fecundity function requires a 'Fecundity' vector " "alongside the survival matrix in the Population " "Parameters CSV file indicating the per-capita " "offspring for each lifecycle class.<br><br>The Fixed " "function requires an argument for the ‘Total Recruits " "per Time Step’ parameter that represents a single " "total recruitment value to be distributed into the " "population model at the beginning of each time step."), label='Recruitment Function Type', options=['Beverton-Holt', 'Ricker', 'Fecundity', 'Fixed']) self.recr_cont.add_input(self.recruitment_type) self.spawn_units = inputs.Dropdown( args_key='spawn_units', helptext=("Specifies whether the spawner abundance used in the " "recruitment function should be calculated in terms of " "number of individuals or in terms of biomass " "(weight).<br><br>If 'Weight' is selected, the user " "must provide a 'Weight' vector alongside the survival " "matrix in the Population Parameters CSV file. The " "'Alpha' and 'Beta' parameters provided by the user " "should correspond to the selected choice.<br><br>Used " "only for the Beverton-Holt and Ricker recruitment " "functions."), label='Spawners by Individuals or Weight (Beverton-Holt / Ricker)', options=['Individuals', 'Weight']) self.recr_cont.add_input(self.spawn_units) self.alpha = inputs.Text( args_key='alpha', helptext=("Specifies the shape of the stock-recruit curve. " "Used only for the Beverton-Holt and Ricker " "recruitment functions.<br><br>Used only for the " "Beverton-Holt and Ricker recruitment functions."), label='Alpha (Beverton-Holt / Ricker)', validator=self.validator) self.recr_cont.add_input(self.alpha) self.beta = inputs.Text( args_key='beta', helptext=("Specifies the shape of the stock-recruit " "curve.<br><br>Used only for the Beverton-Holt and " "Ricker recruitment functions."), label='Beta (Beverton-Holt / Ricker)', validator=self.validator) self.recr_cont.add_input(self.beta) self.total_recur_recruits = inputs.Text( args_key='total_recur_recruits', helptext=("Specifies the total number of recruits that come " "into the population at each time step (a fixed " "number).<br><br>Used only for the Fixed recruitment " "function."), label='Total Recruits per Time Step (Fixed)', validator=self.validator) self.recr_cont.add_input(self.total_recur_recruits) self.migr_cont = inputs.Container(args_key='migr_cont', expandable=True, expanded=False, label='Migration Parameters') self.add_input(self.migr_cont) self.migration_dir = inputs.Folder( args_key='migration_dir', helptext=("The selected folder contain CSV migration matrices " "to be used in the simulation. Each CSV file contains " "a single migration matrix corresponding to an " "lifecycle class that migrates. The folder should " "contain one CSV file for each lifecycle class that " "migrates.<br><br>The files may be named anything, but " "must end with an underscore followed by the name of " "the age or stage. The name of the age or stage must " "correspond to an age or stage within the Population " "Parameters CSV file. For example, a migration file " "might be named 'migration_adult.csv'.<br><br>Each " "matrix cell should contain a decimal fraction " "indicating the percetage of the population that will " "move from one area to another. Each column should " "sum to one."), label='Migration Matrix CSV Folder (Optional)', validator=self.validator) self.migr_cont.add_input(self.migration_dir) self.val_cont = inputs.Container(args_key='val_cont', expandable=True, expanded=False, label='Valuation Parameters') self.add_input(self.val_cont) self.frac_post_process = inputs.Text( args_key='frac_post_process', helptext=("Decimal fraction indicating the percentage of " "harvested catch remaining after post-harvest " "processing is complete."), label='Fraction of Harvest Kept After Processing', validator=self.validator) self.val_cont.add_input(self.frac_post_process) self.unit_price = inputs.Text( args_key='unit_price', helptext=("Specifies the price per harvest unit.<br><br>If " "‘Harvest by Individuals or Weight’ was set to " "‘Individuals’, this should be the price per " "individual. If set to ‘Weight’, this should be the " "price per unit weight."), label='Unit Price', validator=self.validator) self.val_cont.add_input(self.unit_price) # Set interactivity, requirement as input sufficiency changes self.do_batch.sufficiency_changed.connect(self._toggle_batch_runs) # Enable/disable parameters when the recruitment function changes. self.recruitment_type.value_changed.connect( self._control_recruitment_parameters)
def __init__(self): model.InVESTModel.__init__( self, label='Habitat Risk Assessment', target=hra.execute, validator=hra.validate, localdoc='../documentation/habitat_risk_assessment.html') self.csv_uri = inputs.Folder( args_key='csv_uri', helptext=( "A folder containing multiple CSV files. Each file " "refers to the overlap between a habitat and a " "stressor pulled from habitat and stressor shapefiles " "during the run of the HRA Preprocessor."), label='Criteria Scores CSV Folder', validator=self.validator) self.add_input(self.csv_uri) self.grid_size = inputs.Text( args_key='grid_size', helptext=( "The size that should be used to grid the given " "habitat and stressor shapefiles into rasters. This " "value will be the pixel size of the completed raster " "files."), label='Resolution of Analysis (meters)', validator=self.validator) self.add_input(self.grid_size) self.risk_eq = inputs.Dropdown( args_key='risk_eq', helptext=( "Each of these represents an option of a risk " "calculation equation. This will determine the " "numeric output of risk for every habitat and stressor " "overlap area."), label='Risk Equation', options=['Multiplicative', 'Euclidean']) self.add_input(self.risk_eq) self.decay_eq = inputs.Dropdown( args_key='decay_eq', helptext=( "Each of these represents an option for decay " "equations for the buffered stressors. If stressor " "buffering is desired, these equtions will determine " "the rate at which stressor data is reduced."), label='Decay Equation', options=['None', 'Linear', 'Exponential']) self.add_input(self.decay_eq) self.max_rating = inputs.Text( args_key='max_rating', helptext=( "This is the highest score that is used to rate a " "criteria within this model run. These values would " "be placed within the Rating column of the habitat, " "species, and stressor CSVs."), label='Maximum Criteria Score', validator=self.validator) self.add_input(self.max_rating) self.max_stress = inputs.Text( args_key='max_stress', helptext=( "This is the largest number of stressors that are " "suspected to overlap. This will be used in order to " "make determinations of low, medium, and high risk for " "any given habitat."), label='Maximum Overlapping Stressors', validator=self.validator) self.add_input(self.max_stress) self.aoi_tables = inputs.File( args_key='aoi_tables', helptext=( "An OGR-supported vector file containing feature " "subregions. The program will create additional " "summary outputs across each subregion."), label='Subregions (Vector)', validator=self.validator) self.add_input(self.aoi_tables)
def __init__(self): model.InVESTModel.__init__( self, label='Habitat Risk Assessment Preprocessor', target=hra_preprocessor.execute, validator=hra_preprocessor.validate, localdoc='../documentation/habitat_risk_assessment.html') self.habs_dir = inputs.File( args_key='habitats_dir', helptext=( "Checking this box indicates that habitats should be " "used as a base for overlap with provided stressors. " "If checked, the path to the habitat layers folder " "must be provided."), hideable=True, label='Calculate Risk to Habitats?', validator=self.validator) self.add_input(self.habs_dir) self.species_dir = inputs.File( args_key='species_dir', helptext=( "Checking this box indicates that species should be " "used as a base for overlap with provided stressors. " "If checked, the path to the species layers folder " "must be provided."), hideable=True, label='Calculate Risk to Species?', validator=self.validator) self.add_input(self.species_dir) self.stressor_dir = inputs.Folder( args_key='stressors_dir', helptext='This is the path to the stressors layers folder.', label='Stressors Layers Folder', validator=self.validator) self.add_input(self.stressor_dir) self.cur_lulc_box = inputs.Container( expandable=False, label='Criteria') self.add_input(self.cur_lulc_box) self.help_label = inputs.Label( text=( "(Choose at least 1 criteria for each category below, " "and at least 4 total.)")) self.exp_crit = inputs.Multi( args_key='exposure_crits', callable_=functools.partial(inputs.Text, label="Input Criteria"), label='Exposure', link_text='Add Another') self.cur_lulc_box.add_input(self.exp_crit) self.sens_crit = inputs.Multi( args_key='sensitivity_crits', callable_=functools.partial(inputs.Text, label="Input Criteria"), label='Consequence: Sensitivity', link_text='Add Another') self.cur_lulc_box.add_input(self.sens_crit) self.res_crit = inputs.Multi( args_key='resilience_crits', callable_=functools.partial(inputs.Text, label="Input Criteria"), label='Consequence: Resilience', link_text='Add Another') self.cur_lulc_box.add_input(self.res_crit) self.crit_dir = inputs.File( args_key='criteria_dir', helptext=( "Checking this box indicates that model should use " "criteria from provided shapefiles. Each shapefile in " "the folder directories will need to contain a " "'Rating' attribute to be used for calculations in the " "HRA model. Refer to the HRA User's Guide for " "information about the MANDATORY layout of the " "shapefile directories."), hideable=True, label='Use Spatially Explicit Risk Score in Shapefiles', validator=self.validator) self.add_input(self.crit_dir)
def __init__(self): model.InVESTModel.__init__( self, label='Scenario Generator', target=natcap.invest.scenario_generator.scenario_generator.execute, validator=natcap.invest.scenario_generator.scenario_generator. validate, localdoc='../documentation/scenario_generator.html', suffix_args_key='suffix', ) self.landcover = inputs.File( args_key='landcover', helptext= 'A GDAL-supported raster file representing land-use/land-cover.', label='Land Cover (Raster)', validator=self.validator) self.add_input(self.landcover) self.transition = inputs.File( args_key='transition', helptext=("This table contains the land-cover transition " "likelihoods, priority of transitions, area change, " "proximity suitiblity, proximity effect distance, seed " "size, short name, and patch size."), label='Transition Table (CSV)', validator=self.validator) self.add_input(self.transition) self.calculate_priorities = inputs.Checkbox( args_key='calculate_priorities', helptext=("This option enables calculation of the land-cover " "priorities using analytical hierarchical processing. " "A matrix table must be entered below. Optionally, " "the priorities can manually be entered in the " "priority column of the land attributes table."), interactive=False, label='Calculate Priorities') self.add_input(self.calculate_priorities) self.priorities_csv_uri = inputs.File( args_key='priorities_csv_uri', helptext=("This table contains a matrix of land-cover type " "pairwise priorities used to calculate land-cover " "priorities."), interactive=False, label='Priorities Table (CSV)', validator=self.validator) self.add_input(self.priorities_csv_uri) self.calculate_proximity = inputs.Container( args_key='calculate_proximity', expandable=True, expanded=True, label='Proximity') self.add_input(self.calculate_proximity) self.calculate_transition = inputs.Container( args_key='calculate_transition', expandable=True, expanded=True, label='Specify Transitions') self.add_input(self.calculate_transition) self.calculate_factors = inputs.Container(args_key='calculate_factors', expandable=True, expanded=True, label='Use Factors') self.add_input(self.calculate_factors) self.suitability_folder = inputs.Folder(args_key='suitability_folder', label='Factors Folder', validator=self.validator) self.calculate_factors.add_input(self.suitability_folder) self.suitability = inputs.File( args_key='suitability', helptext=("This table lists the factors that determine " "suitability of the land-cover for change, and " "includes: the factor name, layer name, distance of " "influence, suitability value, weight of the factor, " "distance breaks, and applicable land-cover."), label='Factors Table', validator=self.validator) self.calculate_factors.add_input(self.suitability) self.weight = inputs.Text( args_key='weight', helptext=("The factor weight is a value between 0 and 1 which " "determines the weight given to the factors vs. the " "expert opinion likelihood rasters. For example, if a " "weight of 0.3 is entered then 30% of the final " "suitability is contributed by the factors and the " "likelihood matrix contributes 70%. This value is " "entered on the tool interface."), label='Factor Weight', validator=self.validator) self.calculate_factors.add_input(self.weight) self.factor_inclusion = inputs.Dropdown( args_key='factor_inclusion', helptext='', interactive=False, label='Rasterization Method', options=[ 'All touched pixels', 'Only pixels with covered center points' ]) self.calculate_factors.add_input(self.factor_inclusion) self.calculate_constraints = inputs.Container( args_key='calculate_constraints', expandable=True, label='Constraints Layer') self.add_input(self.calculate_constraints) self.constraints = inputs.File( args_key='constraints', helptext=("An OGR-supported vector file. This is a vector " "layer which indicates the parts of the landscape that " "are protected of have constraints to land-cover " "change. The layer should have one field named " "'porosity' with a value between 0 and 1 where 0 means " "its fully protected and 1 means its fully open to " "change."), label='Constraints Layer (Vector)', validator=self.validator) self.calculate_constraints.add_input(self.constraints) self.constraints.sufficiency_changed.connect( self._load_colnames_constraints) self.constraints_field = inputs.Dropdown( args_key='constraints_field', helptext=("The field from the override table that contains the " "value for the override."), interactive=False, options=('UNKNOWN', ), label='Constraints Field') self.calculate_constraints.add_input(self.constraints_field) self.override_layer = inputs.Container(args_key='override_layer', expandable=True, expanded=True, label='Override Layer') self.add_input(self.override_layer) self.override = inputs.File( args_key='override', helptext=("An OGR-supported vector file. This is a vector " "(polygon) layer with land-cover types in the same " "scale and projection as the input land-cover. This " "layer is used to override all the changes and is " "applied after the rule conversion is complete."), label='Override Layer (Vector)', validator=self.validator) self.override_layer.add_input(self.override) self.override.sufficiency_changed.connect(self._load_colnames_override) self.override_field = inputs.Dropdown( args_key='override_field', helptext=("The field from the override table that contains the " "value for the override."), interactive=False, options=('UNKNOWN', ), label='Override Field') self.override_layer.add_input(self.override_field) self.override_inclusion = inputs.Dropdown( args_key='override_inclusion', helptext='', interactive=False, label='Rasterization Method', options=[ 'All touched pixels', 'Only pixels with covered center points' ]) self.override_layer.add_input(self.override_inclusion) self.seed = inputs.Text( args_key='seed', helptext=("Seed must be an integer or blank. <br/><br/>Under " "normal conditions, parcels with the same suitability " "are picked in a random order. Setting the seed value " "allows the scenario generator to randomize the order " "in which parcels are picked, but two runs with the " "same seed will pick parcels in the same order."), label='Seed for random parcel selection (optional)', validator=self.validator) self.add_input(self.seed) # Set interactivity, requirement as input sufficiency changes self.transition.sufficiency_changed.connect( self.calculate_priorities.set_interactive) self.calculate_priorities.sufficiency_changed.connect( self.priorities_csv_uri.set_interactive) self.calculate_factors.sufficiency_changed.connect( self.factor_inclusion.set_interactive) self.constraints.sufficiency_changed.connect( self.constraints_field.set_interactive) self.override.sufficiency_changed.connect( self.override_field.set_interactive) self.override_field.sufficiency_changed.connect( self.override_inclusion.set_interactive)
def __init__(self): model.InVESTModel.__init__( self, label=u'Wave Energy', target=natcap.invest.wave_energy.execute, validator=natcap.invest.wave_energy.validate, localdoc=u'wave_energy.html') self.wave_base_data = inputs.Folder( args_key=u'wave_base_data_path', helptext=(u'Select the folder that has the packaged Wave Energy ' u'Data.'), label=u'Wave Base Data Folder', validator=self.validator) self.add_input(self.wave_base_data) self.analysis_area = inputs.Dropdown( args_key=u'analysis_area_path', helptext=(u"A list of analysis areas for which the model can " u"currently be run. All the wave energy data needed " u"for these areas are pre-packaged in the WaveData " u"folder."), label=u'Analysis Area', options=(u'West Coast of North America and Hawaii', u'East Coast of North America and Puerto Rico', u'North Sea 4 meter resolution', u'North Sea 10 meter resolution', u'Australia', u'Global')) self.add_input(self.analysis_area) self.aoi = inputs.File( args_key=u'aoi_path', helptext=(u"An OGR-supported vector file containing a single " u"polygon representing the area of interest. This " u"input is required for computing valuation and is " u"recommended for biophysical runs as well. The AOI " u"should be projected in linear units of meters."), label=u'Area of Interest (Vector)', validator=self.validator) self.add_input(self.aoi) self.machine_perf_table = inputs.File( args_key=u'machine_perf_path', helptext=(u"A CSV Table that has the performance of a particular " u"wave energy machine at certain sea state conditions."), label=u'Machine Performance Table (CSV)', validator=self.validator) self.add_input(self.machine_perf_table) self.machine_param_table = inputs.File( args_key=u'machine_param_path', helptext=(u"A CSV Table that has parameter values for a wave " u"energy machine. This includes information on the " u"maximum capacity of the device and the upper limits " u"for wave height and period."), label=u'Machine Parameter Table (CSV)', validator=self.validator) self.add_input(self.machine_param_table) self.dem = inputs.File( args_key=u'dem_path', helptext=(u"A GDAL-supported raster file containing a digital " u"elevation model dataset that has elevation values in " u"meters. Used to get the cable distance for wave " u"energy transmission."), label=u'Global Digital Elevation Model (Raster)', validator=self.validator) self.add_input(self.dem) self.valuation_container = inputs.Container( args_key=u'valuation_container', expandable=True, expanded=False, label=u'Valuation') self.add_input(self.valuation_container) self.land_grid_points = inputs.File( args_key=u'land_gridPts_path', helptext=(u"A CSV Table that has the landing points and grid " u"points locations for computing cable distances."), label=u'Grid Connection Points File (CSV)', validator=self.validator) self.valuation_container.add_input(self.land_grid_points) self.machine_econ_table = inputs.File( args_key=u'machine_econ_path', helptext=(u"A CSV Table that has the economic parameters for the " u"wave energy machine."), label=u'Machine Economic Table (CSV)', validator=self.validator) self.valuation_container.add_input(self.machine_econ_table) self.number_of_machines = inputs.Text( args_key=u'number_of_machines', helptext=(u"An integer for how many wave energy machines will be " u"in the wave farm."), label=u'Number of Machines', validator=self.validator) self.valuation_container.add_input(self.number_of_machines)
def __init__(self): model.InVESTModel.__init__(self, label=u'GLOBIO', target=natcap.invest.globio.execute, validator=natcap.invest.globio.validate, localdoc=u'../documentation/globio.html') self.lulc_to_globio_table_path = inputs.File( args_key=u'lulc_to_globio_table_path', helptext=(u"A CSV table containing model information " u"corresponding to each of the land use classes in the " u"LULC raster input. It must contain the fields " u"'lucode', 'usle_c', and 'usle_p'. See the InVEST " u"Sediment User's Guide for more information about " u"these fields."), label=u'Landcover to GLOBIO Landcover Table (CSV)', validator=self.validator) self.add_input(self.lulc_to_globio_table_path) self.aoi_path = inputs.File( args_key=u'aoi_path', helptext=(u"This is a set of polygons that can be used to " u"aggregate MSA sum and mean to a polygon."), label=u'AOI (Vector) (optional)', validator=self.validator) self.add_input(self.aoi_path) self.land_use = inputs.File(args_key=u'lulc_path', label=u'Land Use/Cover (Raster)', validator=self.validator) self.add_input(self.land_use) self.infrastructure_dir = inputs.Folder( args_key=u'infrastructure_dir', label=u'Infrastructure Directory', validator=self.validator) self.add_input(self.infrastructure_dir) self.pasture_path = inputs.File(args_key=u'pasture_path', label=u'Pasture (Raster)', validator=self.validator) self.add_input(self.pasture_path) self.potential_vegetation_path = inputs.File( args_key=u'potential_vegetation_path', label=u'Potential Vegetation (Raster)', validator=self.validator) self.add_input(self.potential_vegetation_path) self.primary_threshold = inputs.Text(args_key=u'primary_threshold', label=u'Primary Threshold', validator=self.validator) self.add_input(self.primary_threshold) self.pasture_threshold = inputs.Text(args_key=u'pasture_threshold', label=u'Pasture Threshold', validator=self.validator) self.add_input(self.pasture_threshold) self.intensification_fraction = inputs.Text( args_key=u'intensification_fraction', helptext=(u"A value between 0 and 1 denoting proportion of total " u"agriculture that should be classified as 'high " u"input'."), label=u'Proportion of of Agriculture Intensified', validator=self.validator) self.add_input(self.intensification_fraction) self.msa_parameters_path = inputs.File( args_key=u'msa_parameters_path', helptext=(u"A CSV table containing MSA threshold values as " u"defined in the user's guide. Provided for advanced " u"users that may wish to change those values."), label=u'MSA Parameter Table (CSV)', validator=self.validator) self.add_input(self.msa_parameters_path) self.predefined_globio = inputs.Container( args_key=u'predefined_globio', expandable=True, expanded=False, label=u'Predefined land use map for GLOBIO') self.add_input(self.predefined_globio) self.globio_land_use = inputs.File( args_key=u'globio_lulc_path', label=u'GLOBIO Classified Land Use (Raster)', validator=self.validator) self.predefined_globio.add_input(self.globio_land_use) # Set interactivity, requirement as input sufficiency changes self.predefined_globio.sufficiency_changed.connect( self._predefined_globio_toggled)
def __init__(self): model.InVESTModel.__init__( self, label='Coastal Vulnerability Assessment Tool', target=coastal_vulnerability.execute, validator=coastal_vulnerability.validate, localdoc='../documentation/coastal_vulnerability.html', suffix_args_key='suffix' ) self.general_tab = inputs.Container( interactive=True, label='General') self.add_input(self.general_tab) self.area_computed = inputs.Dropdown( args_key='area_computed', helptext=( "Determine if the output data is about all the coast " "or about sheltered segments only."), label='Output Area: Sheltered/Exposed?', options=['both', 'sheltered']) self.general_tab.add_input(self.area_computed) self.area_of_interest = inputs.File( args_key='aoi_uri', helptext=( "An OGR-supported, single-feature polygon vector " "file. All outputs will be in the AOI's projection."), label='Area of Interest (Vector)', validator=self.validator) self.general_tab.add_input(self.area_of_interest) self.landmass_uri = inputs.File( args_key='landmass_uri', helptext=( "An OGR-supported vector file containing a landmass " "polygon from where the coastline will be extracted. " "The default is the global land polygon."), label='Land Polygon (Vector)', validator=self.validator) self.general_tab.add_input(self.landmass_uri) self.bathymetry_layer = inputs.File( args_key='bathymetry_uri', helptext=( "A GDAL-supported raster of the terrain elevation in " "the area of interest. Used to compute depths along " "fetch rays, relief and surge potential."), label='Bathymetry Layer (Raster)', validator=self.validator) self.general_tab.add_input(self.bathymetry_layer) self.bathymetry_constant = inputs.Text( args_key='bathymetry_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.bathymetry_constant) self.relief = inputs.File( args_key='relief_uri', helptext=( "A GDAL-supported raster file containing the land " "elevation used to compute the average land elevation " "within a user-defined radius (see Elevation averaging " "radius)."), label='Relief (Raster)', validator=self.validator) self.general_tab.add_input(self.relief) self.relief_constant = inputs.Text( args_key='relief_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value If Path Omitted', validator=self.validator) self.general_tab.add_input(self.relief_constant) self.cell_size = inputs.Text( args_key='cell_size', helptext=( "Cell size in meters. The higher the value, the " "faster the computation, but the coarser the output " "rasters produced by the model."), label='Model Resolution (Segment Size)', validator=self.validator) self.general_tab.add_input(self.cell_size) self.depth_threshold = inputs.Text( args_key='depth_threshold', helptext=( "Depth in meters (integer) cutoff to determine if " "fetch rays project over deep areas."), label='Depth Threshold (meters)', validator=self.validator) self.general_tab.add_input(self.depth_threshold) self.exposure_proportion = inputs.Text( args_key='exposure_proportion', helptext=( "Minimum proportion of rays that project over exposed " "and/or deep areas need to classify a shore segment as " "exposed."), label='Exposure Proportion', validator=self.validator) self.general_tab.add_input(self.exposure_proportion) self.geomorphology_uri = inputs.File( args_key='geomorphology_uri', helptext=( "A OGR-supported polygon vector file that has a field " "called 'RANK' with values between 1 and 5 in the " "attribute table."), label='Geomorphology (Vector)', validator=self.validator) self.general_tab.add_input(self.geomorphology_uri) self.geomorphology_constant = inputs.Text( args_key='geomorphology_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.geomorphology_constant) self.habitats_directory_uri = inputs.Folder( args_key='habitats_directory_uri', helptext=( "Directory containing OGR-supported polygon vectors " "associated with natural habitats. The name of these " "shapefiles should be suffixed with the ID that is " "specified in the natural habitats CSV file provided " "along with the habitats."), label='Natural Habitats Directory', validator=self.validator) self.general_tab.add_input(self.habitats_directory_uri) self.habitats_csv_uri = inputs.File( args_key='habitats_csv_uri', helptext=( "A CSV file listing the attributes for each habitat. " "For more information, see 'Habitat Data Layer' " "section in the model's documentation.</a>."), interactive=False, label='Natural Habitats Table (CSV)', validator=self.validator) self.general_tab.add_input(self.habitats_csv_uri) self.habitats_constant = inputs.Text( args_key='habitat_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.habitats_constant) self.climatic_forcing_uri = inputs.File( args_key='climatic_forcing_uri', helptext=( "An OGR-supported vector containing both wind and " "wave information across the region of interest."), label='Climatic Forcing Grid (Vector)', validator=self.validator) self.general_tab.add_input(self.climatic_forcing_uri) self.climatic_forcing_constant = inputs.Text( args_key='climatic_forcing_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.climatic_forcing_constant) self.continental_shelf_uri = inputs.File( args_key='continental_shelf_uri', helptext=( "An OGR-supported polygon vector delineating the " "edges of the continental shelf. Default is global " "continental shelf shapefile. If omitted, the user " "can specify depth contour. See entry below."), label='Continental Shelf (Vector)', validator=self.validator) self.general_tab.add_input(self.continental_shelf_uri) self.depth_contour = inputs.Text( args_key='depth_contour', helptext=( "Used to delineate shallow and deep areas. " "Continental shelf limit is at about 150 meters."), label='Depth Countour Level (meters)', validator=self.validator) self.general_tab.add_input(self.depth_contour) self.sea_level_rise_uri = inputs.File( args_key='sea_level_rise_uri', helptext=( "An OGR-supported point or polygon vector file " "containing features with 'Trend' fields in the " "attributes table."), label='Sea Level Rise (Vector)', validator=self.validator) self.general_tab.add_input(self.sea_level_rise_uri) self.sea_level_rise_constant = inputs.Text( args_key='sea_level_rise_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.sea_level_rise_constant) self.structures_uri = inputs.File( args_key='structures_uri', helptext=( "An OGR-supported vector file containing rigid " "structures used to identify the portions of the coast " "that is armored."), label='Structures (Vectors)', validator=self.validator) self.general_tab.add_input(self.structures_uri) self.structures_constant = inputs.Text( args_key='structures_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.structures_constant) self.population_uri = inputs.File( args_key='population_uri', helptext=( 'A GDAL-supported raster file representing the population ' 'density.'), label='Population Layer (Raster)', validator=self.validator) self.general_tab.add_input(self.population_uri) self.urban_center_threshold = inputs.Text( args_key='urban_center_threshold', helptext=( "Minimum population required to consider the shore " "segment a population center."), label='Min. Population in Urban Centers', validator=self.validator) self.general_tab.add_input(self.urban_center_threshold) self.additional_layer_uri = inputs.File( args_key='additional_layer_uri', helptext=( "An OGR-supported vector file representing sea level " "rise, and will be used in the computation of coastal " "vulnerability and coastal vulnerability without " "habitat."), label='Additional Layer (Vector)', validator=self.validator) self.general_tab.add_input(self.additional_layer_uri) self.additional_layer_constant = inputs.Text( args_key='additional_layer_constant', helptext=( "Integer value between 1 and 5. If layer associated " "to this field is omitted, replace all shore points " "for this layer with a constant rank value in the " "computation of the coastal vulnerability index. If " "both the file and value for the layer are omitted, " "the layer is skipped altogether."), label='Layer Value if Path Omitted', validator=self.validator) self.general_tab.add_input(self.additional_layer_constant) self.advanced_tab = inputs.Container( interactive=True, label='Advanced') self.add_input(self.advanced_tab) self.elevation_averaging_radius = inputs.Text( args_key='elevation_averaging_radius', helptext=( "Distance in meters (integer). Each pixel average " "elevation will be computed within this radius."), label='Elevation Averaging Radius (meters)', validator=self.validator) self.advanced_tab.add_input(self.elevation_averaging_radius) self.mean_sea_level_datum = inputs.Text( args_key='mean_sea_level_datum', helptext=( "Height in meters (integer). This input is the " "elevation of Mean Sea Level (MSL) datum relative to " "the datum of the bathymetry layer. The model " "transforms all depths to MSL datum. A positive value " "means the MSL is higher than the bathymetry's zero " "(0) elevation, so the value is subtracted from the " "bathymetry."), label='Mean Sea Level Datum (meters)', validator=self.validator) self.advanced_tab.add_input(self.mean_sea_level_datum) self.rays_per_sector = inputs.Text( args_key='rays_per_sector', helptext=( "Number of rays used to subsample the fetch distance " "within each of the 16 sectors."), label='Rays per Sector', validator=self.validator) self.advanced_tab.add_input(self.rays_per_sector) self.max_fetch = inputs.Text( args_key='max_fetch', helptext=( 'Maximum fetch distance computed by the model ' '(>=60,000m).'), label='Maximum Fetch Distance (meters)', validator=self.validator) self.advanced_tab.add_input(self.max_fetch) self.spread_radius = inputs.Text( args_key='spread_radius', helptext=( "Integer multiple of 'cell size'. The coast from the " "geomorphology layer could be of a better resolution " "than the global landmass, so the shores do not " "necessarily overlap. To make them coincide, the " "shore from the geomorphology layer is widened by 1 or " "more pixels. The value should be a multiple of 'cell " "size' that indicates how many pixels the coast from " "the geomorphology layer is widened. The widening " "happens on each side of the coast (n pixels landward, " "and n pixels seaward)."), label='Coastal Overlap (meters)', validator=self.validator) self.advanced_tab.add_input(self.spread_radius) self.population_radius = inputs.Text( args_key='population_radius', helptext=( "Radius length in meters used to count the number of " "people leaving close to the coast."), label='Coastal Neighborhood (radius in meters)', validator=self.validator) self.advanced_tab.add_input(self.population_radius) # Set interactivity, requirement as input sufficiency changes self.habitats_directory_uri.sufficiency_changed.connect( self.habitats_csv_uri.set_interactive)
def __init__(self): model.InVESTModel.__init__( self, label=u'Crop Production Percentile Model', target=natcap.invest.crop_production_percentile.execute, validator=natcap.invest.crop_production_percentile.validate, localdoc=u'crop_production.html') self.model_data_path = inputs.Folder( args_key=u'model_data_path', helptext=(u"A path to the InVEST Crop Production Data directory. " u"These data would have been included with the InVEST " u"installer if selected, or can be manually downloaded " u"from http://data.naturalcapitalproject.org/invest- " u"data/. If downloaded with InVEST, the default value " u"should be used.</b>"), label=u'Directory to model data', validator=self.validator) self.add_input(self.model_data_path) self.landcover_raster_path = inputs.File( args_key=u'landcover_raster_path', helptext=(u"A raster file, representing integer land use/land " u"code covers for each cell. This raster should have" u"a projected coordinate system with units of meters " u"(e.g. UTM) because pixel areas are divided by 10000" u"in order to report some results in hectares."), label=u'Land-Use/Land-Cover Map (raster)', validator=self.validator) self.add_input(self.landcover_raster_path) self.landcover_to_crop_table_path = inputs.File( args_key=u'landcover_to_crop_table_path', helptext=(u"A CSV table mapping canonical crop names to land use " u"codes contained in the landcover/use raster. The " u"allowed crop names are 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 containing features with" u"which to aggregate/summarize final results." u"It is fine to have overlapping polygons."), label=u'Aggregate results polygon (vector) (optional)', validator=self.validator) self.add_input(self.aggregate_polygon_path)
def __init__(self): model.InVESTModel.__init__( self, label='Crop Production Percentile Model', target=natcap.invest.crop_production_percentile.execute, validator=natcap.invest.crop_production_percentile.validate, localdoc='../documentation/crop_production.html') self.model_data_path = inputs.Folder( args_key='model_data_path', helptext=("A path to the InVEST Crop Production Data directory. " "These data would have been included with the InVEST " "installer if selected, or can be manually downloaded " "from http://data.naturalcapitalproject.org/invest- " "data/. If downloaded with InVEST, the default value " "should be used.</b>"), label='Directory to model data', validator=self.validator) self.add_input(self.model_data_path) self.landcover_raster_path = inputs.File( args_key='landcover_raster_path', helptext=("A raster file, representing integer land use/land " "code covers for each cell."), label='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='landcover_to_crop_table_path', helptext=("A CSV table mapping canonical crop names to land use " "codes contained in the landcover/use raster. The " "allowed crop names are abaca, agave, alfalfa, almond, " "aniseetc, apple, apricot, areca, artichoke, " "asparagus, avocado, bambara, banana, barley, bean, " "beetfor, berrynes, blueberry, brazil, broadbean, " "buckwheat, cabbage, cabbagefor, canaryseed, carob, " "carrot, carrotfor, cashew, cashewapple, cassava, " "castor, cauliflower, cerealnes, cherry, chestnut, " "chickpea, chicory, chilleetc, cinnamon, citrusnes, " "clove, clover, cocoa, coconut, coffee, cotton, " "cowpea, cranberry, cucumberetc, currant, date, " "eggplant, fibrenes, fig, flax, fonio, fornes, " "fruitnes, garlic, ginger, gooseberry, grape, " "grapefruitetc, grassnes, greenbean, greenbroadbean, " "greencorn, greenonion, greenpea, groundnut, hazelnut, " "hemp, hempseed, hop, jute, jutelikefiber, kapokfiber, " "kapokseed, karite, kiwi, kolanut, legumenes, " "lemonlime, lentil, lettuce, linseed, lupin, maize, " "maizefor, mango, mate, melonetc, melonseed, millet, " "mixedgrain, mixedgrass, mushroom, mustard, nutmeg, " "nutnes, oats, oilpalm, oilseedfor, oilseednes, okra, " "olive, onion, orange, papaya, pea, peachetc, pear, " "pepper, peppermint, persimmon, pigeonpea, pimento, " "pineapple, pistachio, plantain, plum, poppy, potato, " "pulsenes, pumpkinetc, pyrethrum, quince, quinoa, " "ramie, rapeseed, rasberry, rice, rootnes, rubber, " "rye, ryefor, safflower, sesame, sisal, sorghum, " "sorghumfor, sourcherry, soybean, spicenes, spinach, " "stonefruitnes, strawberry, stringbean, sugarbeet, " "sugarcane, sugarnes, sunflower, swedefor, " "sweetpotato, tangetc, taro, tea, tobacco, tomato, " "triticale, tropicalnes, tung, turnipfor, vanilla, " "vegetablenes, vegfor, vetch,walnut, watermelon, " "wheat, yam, and yautia."), label='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='aggregate_polygon_path', helptext=("A polygon shapefile to aggregate/summarize final " "results. It is fine to have overlapping polygons. " "The attribute table must contain a keyfield for " "identifying polygons, be sure to indicate the name of " "this field in the Aggregate Polygon ID Field below."), label='Aggregate results polygon (vector) (optional)', validator=self.validator) self.add_input(self.aggregate_polygon_path) self.aggregate_polygon_id = inputs.Text( args_key='aggregate_polygon_id', helptext=("If an aggregate polygon is provided, this field is " "used to indicate the key field of that polygon for " "aggregation. The aggregate table produced by this " "model will index the results by this field value."), interactive=False, label='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)
def __init__(self): model.InVESTModel.__init__( self, label='Crop Production Regression Model', target=natcap.invest.crop_production_regression.execute, validator=natcap.invest.crop_production_regression.validate, localdoc='../documentation/crop_production.html') self.model_data_path = inputs.Folder( args_key='model_data_path', helptext=("A path to the InVEST Crop Production Data directory. " "These data would have been included with the InVEST " "installer if selected, or can be manually downloaded " "from http://data.naturalcapitalproject.org/invest- " "data/. If downloaded with InVEST, the default value " "should be used.</b>"), label='Directory to model data', validator=self.validator) self.add_input(self.model_data_path) self.landcover_raster_path = inputs.File( args_key='landcover_raster_path', helptext=("A raster file, representing integer land use/land " "code covers for each cell."), label='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='landcover_to_crop_table_path', helptext=("A CSV table mapping canonical crop names to land use " "codes contained in the landcover/use raster. The " "allowed crop names are barley, maize, oilpalm, " "potato, rice, soybean, sugarbeet, sugarcane, " "sunflower, and wheat."), label='Landcover to Crop Table (csv)', validator=self.validator) self.add_input(self.landcover_to_crop_table_path) self.fertilization_rate_table_path = inputs.File( args_key='fertilization_rate_table_path', helptext=("A table that maps fertilization rates to crops in " "the simulation. Must include the headers " "'crop_name', 'nitrogen_rate', 'phosphorous_rate', " "and 'potassium_rate'."), label='Fertilization Rate Table Path (csv)', validator=self.validator) self.add_input(self.fertilization_rate_table_path) self.aggregate_polygon_path = inputs.File( args_key='aggregate_polygon_path', helptext=("A polygon shapefile to aggregate/summarize final " "results. It is fine to have overlapping polygons. " "The attribute table must contain a keyfield for " "identifying polygons, be sure to indicate the name of " "this field in the Aggregate Polygon ID Field below."), label='Aggregate results polygon (vector) (optional)', validator=self.validator) self.add_input(self.aggregate_polygon_path) self.aggregate_polygon_id = inputs.Text( args_key='aggregate_polygon_id', helptext=("If an aggregate polygon is provided, this field is " "used to indicate the key field of that polygon for " "aggregation. The aggregate table produced by this " "model will index the results by this field value."), interactive=False, label='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)
def __init__(self): model.InVESTModel.__init__( self, label='Habitat Quality', target=natcap.invest.habitat_quality.execute, validator=natcap.invest.habitat_quality.validate, localdoc='../documentation/habitat_quality.html') self.current_landcover = inputs.File( args_key='lulc_cur_path', helptext=("A GDAL-supported raster file. The current LULC must " "have its' own threat rasters, where each threat " "raster file path has a suffix of <b>_c</b>.<br/><br/> " "Each cell should represent a LULC code as an Integer. " "The dataset should be in a projection where the units " "are in meters and the projection used should be " "defined. <b>The LULC codes must match the codes in " "the Sensitivity table</b>."), label='Current Land Cover (Raster)', validator=self.validator) self.add_input(self.current_landcover) self.future_landcover = inputs.File( args_key='lulc_fut_path', helptext=("Optional. A GDAL-supported raster file. Inputting " "a future LULC will generate degradation, habitat " "quality, and habitat rarity (If baseline is input) " "outputs. The future LULC must have it's own threat " "rasters, where each threat raster file path has a " "suffix of <b>_f</b>.<br/><br/>Each cell should " "represent a LULC code as an Integer. The dataset " "should be in a projection where the units are in " "meters and the projection used should be defined. " "<b>The LULC codes must match the codes in the " "Sensitivity table</b>."), label='Future Land Cover (Raster) (Optional)', validator=self.validator) self.add_input(self.future_landcover) self.baseline_landcover = inputs.File( args_key='lulc_bas_path', helptext=("Optional. A GDAL-supported raster file. If the " "baseline LULC is provided, rarity outputs will be " "created for the current and future LULC. The baseline " "LULC can have it's own threat rasters (optional), " "where each threat raster file path has a suffix of " "<b>_b</b>. If no threat rasters are found, " "degradation and habitat quality outputs will not be " "generated for the baseline LULC.<br/><br/> Each cell " "should represent a LULC code as an Integer. The " "dataset should be in a projection where the units are " "in meters and the projection used should be defined. " "The LULC codes must match the codes in the " "Sensitivity table. If possible the baseline map " "should refer to a time when intensive management of " "the landscape was relatively rare."), label='Baseline Land Cover (Raster) (Optional)', validator=self.validator) self.add_input(self.baseline_landcover) self.threat_rasters = inputs.Folder( args_key='threat_raster_folder', helptext=("The selected folder is used as the location to find " "all threat rasters for the threats listed in the " "below table."), label='Folder Containing Threat Rasters', validator=self.validator) self.add_input(self.threat_rasters) self.threats_data = inputs.File( args_key='threats_table_path', helptext=("A CSV file of all the threats for the model to " "consider. Each row in the table is a degradation " "source and each column contains a different attribute " "of each degradation source (THREAT, MAX_DIST, " "WEIGHT).<br/><br/><b>THREAT:</b> The name of the " "threat source and this name must match exactly to the " "name of the threat raster and to the name of it's " "corresponding column in the sensitivity table. " "<b>NOTE:</b> The threat raster path should have a " "suffix indicator ( _c, _f, _b ) and the sensitivity " "column should have a prefix indicator (L_). The " "THREAT name in the threat table should not include " "either the suffix or prefix. " "<br/><br/><b>MAX_DIST:</b> A number in kilometres " "(km) for the maximum distance a threat has an " "affect.<br/><br/><b>WEIGHT:</b> A floating point " "value between 0 and 1 for the the threats weight " "relative to the other threats. Depending on the type " "of habitat under review, certain threats may cause " "greater degradation than other " "threats.<br/><br/><b>DECAY:</b> A string value of " "either <b>exponential</b> or <b>linear</b> " "representing the type of decay over space for the " "threat.<br/><br/>See the user's guide for valid " "values for these columns."), label='Threats Data', validator=self.validator) self.add_input(self.threats_data) self.accessibility_threats = inputs.File( args_key='access_vector_path', helptext=("An OGR-supported vector file. The input contains " "data on the relative protection that legal / " "institutional / social / physical barriers provide " "against threats. The vector file should contain " "polygons with a field <b>ACCESS</b>. The " "<b>ACCESS</b> values should range from 0 - 1, where 1 " "is fully accessible. Any cells not covered by a " "polygon will be set to 1."), label='Accessibility to Threats (Vector) (Optional)', validator=self.validator) self.add_input(self.accessibility_threats) self.sensitivity_data = inputs.File( args_key='sensitivity_table_path', helptext=("A CSV file of LULC types, whether or not the are " "considered habitat, and, for LULC types that are " "habitat, their specific sensitivity to each threat. " "Each row is a LULC type with the following columns: " "<b>LULC, HABITAT, L_THREAT1, L_THREAT2, " "...</b><br/><br/><b>LULC:</b> Integer values that " "reflect each LULC code found in current, future, and " "baseline rasters.<br/><br/><b>HABITAT:</b> A value of " "0 or 1 (presence / absence) or a value between 0 and " "1 (continuum) depicting the suitability of " "habitat.<br/><br/><b>L_THREATN:</b> Each L_THREATN " "should match exactly with the threat names given in " "the threat CSV file, where the THREATN is the name " "that matches. This is an floating point value " "between 0 and 1 that represents the sensitivity of a " "habitat to a threat. <br/><br/>.Please see the users " "guide for more detailed information on proper column " "values and column names for each threat."), label='Sensitivity of Land Cover Types to Each Threat, File (CSV)', validator=self.validator) self.add_input(self.sensitivity_data) self.half_saturation_constant = inputs.Text( args_key='half_saturation_constant', helptext=("A positive floating point value that is defaulted at " "0.5. This is the value of the parameter k in equation " "(4). In general, set k to half of the highest grid " "cell degradation value on the landscape. To perform " "this model calibration the model must be run once in " "order to find the highest degradation value and set k " "for the provided landscape. Note that the choice of " "k only determines the spread and central tendency of " "habitat quality cores and does not affect the rank."), label='Half-Saturation Constant', validator=self.validator) self.add_input(self.half_saturation_constant)
def __init__(self): model.InVESTModel.__init__( self, label='Overlap Analysis Model: Fisheries and Recreation', target=overlap_analysis.execute, validator=overlap_analysis.validate, localdoc='../documentation/overlap_analysis.html') self.aoi = inputs.File( args_key='zone_layer_uri', helptext=( "An OGR-supported vector file. If Management Zones " "is being used to analyze overlap data, this should be " "a polygon shapefile containing multiple polygons. " "If, on the other hand, gridding is being used in " "order to separate the area, this can be a single " "polygon shapefile."), label='Analysis Zones Layer (Vector)', validator=self.validator) self.add_input(self.aoi) self.grid_size = inputs.Text( args_key='grid_size', helptext=( "By specifying a number in the interface, an analysis " "grid within the AOI of size x size will be created."), label='Analysis Cell Size (meters)', validator=self.validator) self.add_input(self.grid_size) self.data_dir = inputs.Folder( args_key='overlap_data_dir_uri', helptext=( "Users are required to specify the path on their " "system to a folder containing only the input data for " "the Overlap Analysis model. Input data can be point, " "line or polygon data layers indicating where in the " "coastal and marine environment the human use activity " "takes place."), label='Overlap Analysis Data Directory', validator=self.validator) self.add_input(self.data_dir) self.intra = inputs.Checkbox( args_key='do_intra', helptext=( "Checking this box indicates that intra-activity " "valuation of the data should be used. These weights " "will be retrieved from the column in the attribute " "table of the shapefile specified in 'Analysis Zones " "Layer' that bears the name specified in the 'Intra- " "Activity Field Name' field below."), label='Intra-Activity Weighting?') self.add_input(self.intra) self.IS_field_name = inputs.Text( args_key='intra_name', helptext=( "The column heading to look for in the activity " "layers' attribute tables that gives intra-activity " "weights."), interactive=False, label='Intra-Activity Attribute Name', validator=self.validator) self.add_input(self.IS_field_name) self.inter = inputs.Checkbox( args_key='do_inter', helptext=( "Checking this box indicates that inter-activity " "valuation of the data should be used. These weights " "will be derived from the data included in the CSV " "provided in the 'Overlap Analysis Importance Score " "Table' field."), label='Inter-Activity Weighting?') self.add_input(self.inter) self.IS_tbl = inputs.File( args_key='overlap_layer_tbl', helptext=( "The name of the CSV table that links each provided " "activity layer to the desired inter-activity weight."), interactive=False, label='Inter-Activity Weight Table (CSV)', validator=self.validator) self.add_input(self.IS_tbl) self.HU_Hubs = inputs.Checkbox( args_key='do_hubs', helptext=( "Checking this box indicates taht a layer of human " "use hubs should be used to weight the raster file " "output. This input should be in the form of a point " "shapefile."), label='Human Use Hubs?') self.add_input(self.HU_Hubs) self.HU_Hub_URI = inputs.File( args_key='hubs_uri', helptext=( "An OGR-supported vector file. If human use hubs are " "desired, this is the file that shows the hubs " "themselves. This should be a shapefile of points " "where each point is a hub."), interactive=False, label='Points Layer of Human Use Hubs (Vector)', validator=self.validator) self.add_input(self.HU_Hub_URI) self.hub_decay = inputs.Text( args_key='decay_amt', helptext=( "This number is the rate (r) of interest decay from " "each of the human use hubs for use in the final " "weighted raster for the function exp(-r*d) where d is " "the distance from the closest hub."), interactive=False, label='Distance Decay Rate', validator=self.validator) self.add_input(self.hub_decay) # Set interactivity, requirement as input sufficiency changes self.intra.sufficiency_changed.connect( self.IS_field_name.set_interactive) self.inter.sufficiency_changed.connect( self.IS_tbl.set_interactive) self.HU_Hubs.sufficiency_changed.connect( self.HU_Hub_URI.set_interactive) self.HU_Hubs.sufficiency_changed.connect( self.hub_decay.set_interactive)