text:
# Habitat Risk Assessment Package¶

## Model Entry Point¶

natcap.invest.habitat_risk_assessment.hra.execute(args)

Habitat Risk Assessment.

This function will prepare files passed from the UI to be sent on to the hra_core module.

All inputs are required.

Parameters: workspace_dir (string) – The location of the directory into which intermediate and output files should be placed. csv_uri (string) – The location of the directory containing the CSV files of habitat, stressor, and overlap ratings. Will also contain a .txt JSON file that has directory locations (potentially) for habitats, species, stressors, and criteria. grid_size (int) – Represents the desired pixel dimensions of both intermediate and ouput rasters. risk_eq (string) – A string identifying the equation that should be used in calculating risk scores for each H-S overlap cell. This will be either ‘Euclidean’ or ‘Multiplicative’. decay_eq (string) – A string identifying the equation that should be used in calculating the decay of stressor buffer influence. This can be ‘None’, ‘Linear’, or ‘Exponential’. max_rating (int) – An int representing the highest potential value that should be represented in rating, data quality, or weight in the CSV table. max_stress (int) – 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. aoi_tables (string) – A shapefile containing one or more planning regions for a given model. This will be used to get the average risk value over a larger area. Each potential region MUST contain the attribute “name” as a way of identifying each individual shape.

Example Args Dictionary:

{
'workspace_dir': 'path/to/workspace_dir',
'csv_uri': 'path/to/csv',
'grid_size': 200,
'risk_eq': 'Euclidean',
'decay_eq': 'None',
'max_rating': 3,
'max_stress': 4,
'aoi_tables': 'path/to/shapefile',
}

Returns: None

## Habitat Risk Assessment¶

This will be the preperatory module for HRA. It will take all unprocessed and pre-processed data from the UI and pass it to the hra_core module.

exception natcap.invest.habitat_risk_assessment.hra.DQWeightNotFound

Bases: exceptions.Exception

An exception to be passed if there is a shapefile within the spatial criteria directory, but no corresponing data quality and weight to support it. This would likely indicate that the user is try to run HRA without having added the criteria name into hra_preprocessor properly.

exception natcap.invest.habitat_risk_assessment.hra.ImproperAOIAttributeName

Bases: exceptions.Exception

An exception to pass in hra non core if the AOIzone files do not contain the proper attribute name for individual indentification. The attribute should be named ‘name’, and must exist for every shape in the AOI layer.

exception natcap.invest.habitat_risk_assessment.hra.ImproperCriteriaAttributeName

Bases: exceptions.Exception

An excepion to pass in hra non core if the criteria provided by the user for use in spatially explicit rating do not contain the proper attribute name. The attribute should be named ‘RATING’, and must exist for every shape in every layer provided.

natcap.invest.habitat_risk_assessment.hra.add_crit_rasters(dir, crit_dict, habitats, h_s_e, h_s_c, grid_size)

This will take in the dictionary of criteria shapefiles, rasterize them, and add the URI of that raster to the proper subdictionary within h/s/h-s.

Input:
dir- Directory into which the raserized criteria shapefiles should be
placed.
crit_dict- A multi-level dictionary of criteria shapefiles. The

outermost keys refer to the dictionary they belong with. The structure will be as follows:

{‘h’:
{‘HabA’:
{‘CriteriaName: “Shapefile Datasource URI”...}, ...

},

‘h_s_c’:
{(‘HabA’, ‘Stress1’):
{‘CriteriaName: “Shapefile Datasource URI”, ...}, ...

},

‘h_s_e’
{(‘HabA’, ‘Stress1’):
{‘CriteriaName: “Shapefile Datasource URI”, ...}, ...

}

}

h_s_c- A multi-level structure which holds numerical criteria

ratings, as well as weights and data qualities for criteria rasters. h-s will hold only criteria that apply to habitat and stressor overlaps. The structure’s outermost keys are tuples of (Habitat, Stressor) names. The overall structure will be as pictured:

{(Habitat A, Stressor 1):
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{‘Weight’: 1.0, ‘DQ’: 1.0}

},

}, ‘DS’: “HabitatStressor Raster URI”

}

habitats- Similar to the h-s dictionary, a multi-level
dictionary containing all habitat-specific criteria ratings and raster information. The outermost keys are habitat names. Within the dictionary, the habitats[‘habName’][‘DS’] will be the URI of the raster of that habitat.
h_s_e- Similar to the h-s dictionary, a multi-level dictionary
containing all stressor-specific criteria ratings and raster information. The outermost keys are tuples of (Habitat, Stressor) names.
grid_size- An int representing the desired pixel size for the criteria
rasters.
Output:
A set of rasterized criteria files. The criteria shapefiles will be
burned based on their ‘Rating’ attribute. These will be placed in the ‘dir’ folder.

An appended version of habitats, h_s_e, and h_s_c which will include entries for criteria rasters at ‘Rating’ in the appropriate dictionary. ‘Rating’ will map to the URI of the corresponding criteria dataset.

Returns nothing.

natcap.invest.habitat_risk_assessment.hra.add_hab_rasters(dir, habitats, hab_list, grid_size, grid_path)

Want to get all shapefiles within any directories in hab_list, and burn them to a raster.

Input:
dir- Directory into which all completed habitat rasters should be
placed.
habitats- A multi-level dictionary containing all habitat and
species-specific criteria ratings and rasters.
hab_list- File URI’s for all shapefile in habitats dir, species dir, or
both.
grid_size- Int representing the desired pixel dimensions of
both intermediate and ouput rasters.
grid_path- A string for a raster file path on disk. Used as a
universal base raster to create other rasters which to burn vectors onto.
Output:
A modified version of habitats, into which we have placed the URI to
the rasterized version of the habitat shapefile. It will be placed at habitats[habitatName][‘DS’].
natcap.invest.habitat_risk_assessment.hra.calc_max_rating(risk_eq, max_rating)

Should take in the max possible risk, and return the highest possible per pixel risk that would be seen on a H-S raster pixel.

Input:

risk_eq- The equation that will be used to determine risk. max_rating- The highest possible value that could be given as a

criteria rating, data quality, or weight.
Returns: An int representing the highest possible risk value for any given h-s overlap raster.
natcap.invest.habitat_risk_assessment.hra.execute(args)

Habitat Risk Assessment.

This function will prepare files passed from the UI to be sent on to the hra_core module.

All inputs are required.

Parameters: workspace_dir (string) – The location of the directory into which intermediate and output files should be placed. csv_uri (string) – The location of the directory containing the CSV files of habitat, stressor, and overlap ratings. Will also contain a .txt JSON file that has directory locations (potentially) for habitats, species, stressors, and criteria. grid_size (int) – Represents the desired pixel dimensions of both intermediate and ouput rasters. risk_eq (string) – A string identifying the equation that should be used in calculating risk scores for each H-S overlap cell. This will be either ‘Euclidean’ or ‘Multiplicative’. decay_eq (string) – A string identifying the equation that should be used in calculating the decay of stressor buffer influence. This can be ‘None’, ‘Linear’, or ‘Exponential’. max_rating (int) – An int representing the highest potential value that should be represented in rating, data quality, or weight in the CSV table. max_stress (int) – 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. aoi_tables (string) – A shapefile containing one or more planning regions for a given model. This will be used to get the average risk value over a larger area. Each potential region MUST contain the attribute “name” as a way of identifying each individual shape.

Example Args Dictionary:

{
'workspace_dir': 'path/to/workspace_dir',
'csv_uri': 'path/to/csv',
'grid_size': 200,
'risk_eq': 'Euclidean',
'decay_eq': 'None',
'max_rating': 3,
'max_stress': 4,
'aoi_tables': 'path/to/shapefile',
}

Returns: None
natcap.invest.habitat_risk_assessment.hra.listdir(path)

A replacement for the standar os.listdir which, instead of returning only the filename, will include the entire path. This will use os as a base, then just lambda transform the whole list.

Input:
path- The location container from which we want to gather all files.
Returns: A list of full URIs contained within ‘path’.
natcap.invest.habitat_risk_assessment.hra.make_add_overlap_rasters(dir, habitats, stress_dict, h_s_c, h_s_e, grid_size)

For every pair in h_s_c and h_s_e, want to get the corresponding habitat and stressor raster, and return the overlap of the two. Should add that as the ‘DS’ entry within each (h, s) pair key in h_s_e and h_s_c.

Input:
dir- Directory into which all completed h-s overlap files shoudl be
placed.
habitats- The habitats criteria dictionary, which will contain a

dict[Habitat][‘DS’]. The structure will be as follows:

{Habitat A:
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{
‘DS’: “CritName Raster URI”, ‘Weight’: 1.0, ‘DQ’: 1.0

}

},

‘DS’: “A Dataset URI” }

}

stress_dict- A dictionary containing all stressor DS’s. The key will be
the name of the stressor, and it will map to the URI of the stressor DS.
h_s_c- A multi-level structure which holds numerical criteria

ratings, as well as weights and data qualities for criteria rasters. h-s will hold criteria that apply to habitat and stressor overlaps, and be applied to the consequence score. The structure’s outermost keys are tuples of (Habitat, Stressor) names. The overall structure will be as pictured:

{(Habitat A, Stressor 1):
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{‘Weight’: 1.0, ‘DQ’: 1.0}

},

}

}

h_s_e- Similar to the h_s dictionary, a multi-level
dictionary containing habitat-stressor-specific criteria ratings and raster information which should be applied to the exposure score. The outermost keys are tuples of (Habitat, Stressor) names.
grid_size- The desired pixel size for the rasters that will be created
for each habitat and stressor.
Output:
An edited versions of h_s_e and h_s_c, each of which contains an overlap DS at dict[(Hab, Stress)][‘DS’]. That key will map to the URI for the corresponding raster DS.

Returns nothing.

natcap.invest.habitat_risk_assessment.hra.make_exp_decay_array(dist_trans_uri, out_uri, buff, nodata)

Should create a raster where the area around the land is a function of exponential decay from the land values.

Input:
dist_trans_uri- uri to a gdal raster where each pixel value represents
the distance to the closest piece of land.

out_uri- uri for the gdal raster output with the buffered outputs buff- The distance surrounding the land that the user desires to buffer

with exponentially decaying values.
nodata- The value which should be placed into anything not land or
buffer area.

Returns: Nothing

natcap.invest.habitat_risk_assessment.hra.make_lin_decay_array(dist_trans_uri, out_uri, buff, nodata)

Should create a raster where the area around land is a function of linear decay from the values representing the land.

Input:
dist_trans_uri- uri to a gdal raster where each pixel value represents
the distance to the closest piece of land.

out_uri- uri for the gdal raster output with the buffered outputs buff- The distance surrounding the land that the user desires to buffer

with linearly decaying values.
nodata- The value which should be placed into anything not land or
buffer area.

Returns: Nothing

natcap.invest.habitat_risk_assessment.hra.make_no_decay_array(dist_trans_uri, out_uri, buff, nodata)

Should create a raster where the buffer zone surrounding the land is buffered with the same values as the land, essentially creating an equally weighted larger landmass.

Input:
dist_trans_uri- uri to a gdal raster where each pixel value represents
the distance to the closest piece of land.

out_uri- uri for the gdal raster output with the buffered outputs buff- The distance surrounding the land that the user desires to buffer

with land data values.
nodata- The value which should be placed into anything not land or
buffer area.

Returns: Nothing

natcap.invest.habitat_risk_assessment.hra.make_stress_rasters(dir, stress_list, grid_size, decay_eq, buffer_dict, grid_path)

Creating a simple dictionary that will map stressor name to a rasterized version of that stressor shapefile. The key will be a string containing stressor name, and the value will be the URI of the rasterized shapefile.

Input:

dir- The directory into which completed shapefiles should be placed. stress_list- A list containing stressor shapefile URIs for all

stressors desired within the given model run.
grid_size- The pixel size desired for the rasters produced based on the
shapefiles.
decay_eq- A string identifying the equation that should be used
in calculating the decay of stressor buffer influence.
buffer_dict- A dictionary that holds desired buffer sizes for each
stressors. The key is the name of the stressor, and the value is an int which correlates to desired buffer size.
grid_path- A string for a raster file path on disk. Used as a
universal base raster to create other rasters which to burn vectors onto.
Output:
A potentially buffered and rasterized version of each stressor
shapefile provided, which will be stored in ‘dir’.
Returns: stress_dict- A simple dictionary which maps a string key of the stressor name to the URI for the output raster.
natcap.invest.habitat_risk_assessment.hra.make_zero_buff_decay_array(dist_trans_uri, out_uri, nodata)

Creates a raster in the case of a zero buffer width, where we should have is land and nodata values.

Input:
dist_trans_uri- uri to a gdal raster where each pixel value represents
the distance to the closest piece of land.

out_uri- uri for the gdal raster output with the buffered outputs nodata- The value which should be placed into anything that is not

land.

Returns: Nothing

natcap.invest.habitat_risk_assessment.hra.merge_bounding_boxes(bb1, bb2, mode)

Merge two bounding boxes through union or intersection.

Parameters: bb1 (list) – [upper_left_x, upper_left_y, lower_right_x, lower_right_y] bb2 (list) – [upper_left_x, upper_left_y, lower_right_x, lower_right_y] mode (string) – A list of the merged bounding boxes.
natcap.invest.habitat_risk_assessment.hra.unpack_over_dict(csv_uri, args)

This throws the dictionary coming from the pre-processor into the equivalent dictionaries in args so that they can be processed before being passed into the core module.

Input:
csv_uri- Reference to the folder location of the CSV tables containing
all habitat and stressor rating information.
args- The dictionary into which the individual ratings dictionaries
should be placed.
Output:

A modified args dictionary containing dictionary versions of the CSV tables located in csv_uri. The dictionaries should be of the forms as follows.

h_s_c- A multi-level structure which will hold all criteria ratings,

both numerical and raster that apply to habitat and stressor overlaps. The structure, whose keys are tuples of (Habitat, Stressor) names and map to an inner dictionary will have 2 outer keys containing numeric-only criteria, and raster-based criteria. At this time, we should only have two entries in a criteria raster entry, since we have yet to add the rasterized versions of the criteria.

{(Habitat A, Stressor 1):
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{‘Weight’: 1.0, ‘DQ’: 1.0}

},

}

}

habitats- Similar to the h-s dictionary, a multi-level
dictionary containing all habitat-specific criteria ratings and weights and data quality for the rasters.
h_s_e- Similar to the h-s dictionary, a multi-level dictionary
containing habitat stressor-specific criteria ratings and weights and data quality for the rasters.

Returns nothing.

## Habitat Risk Assessment Core¶

This is the core module for HRA functionality. This will perform all HRA calcs, and return the appropriate outputs.

natcap.invest.habitat_risk_assessment.hra_core.aggregate_multi_rasters_uri(aoi_rast_uri, rast_uris, rast_labels, ignore_value_list=[])

Will take a stack of rasters and an AOI, and return a dictionary containing the number of overlap pixels, and the value of those pixels for each overlap of raster and AOI.

Input:
aoi_uri- The location of an AOI raster which MUST have individual ID
numbers with the attribute name ‘BURN_ID’ for each feature on the map.
rast_uris- List of locations of the rasters which should be overlapped
with the AOI.
rast_labels- Names for each raster layer that will be retrievable from
the output dictionary.
ignore_value_list- Optional argument that provides a list of values
which should be ignored if they crop up for a pixel value of one of the layers.
Returns: layer_overlap_info- {AOI Data Value 1: {rast_label: [#of pix, pix value], rast_label: [200, 2567.97], ... }
natcap.invest.habitat_risk_assessment.hra_core.calc_C_raster(out_uri, h_s_list, h_s_denom_dict, h_list, h_denom_dict, h_uri, h_s_uri)

Should return a raster burned with a ‘C’ raster that is a combination of all the rasters passed in within the list, divided by the denominator.

Input:
out_uri- The location to which the calculated C raster should be
bGurned.
h_s_list- A list of rasters burned with the equation r/dq*w for every
criteria applicable for that h, s pair.
h_s_denom_dict- A dictionary containing criteria names applicable to
this particular h,s pair. Each criteria string name maps to a double representing the denominator for that raster, using the equation 1/dq*w.
h_list- A list of rasters burned with the equation r/dq*w for every
criteria applicable for that s.
h_denom_dict- A dictionary containing criteria names applicable to this
particular habitat. Each criteria string name maps to a double representing the denominator for that raster, using the equation 1/dq*w.

Returns nothing.

natcap.invest.habitat_risk_assessment.hra_core.calc_E_raster(out_uri, h_s_list, denom_dict, h_s_base_uri, h_base_uri)

Should return a raster burned with an ‘E’ raster that is a combination of all the rasters passed in within the list, divided by the denominator.

Input:

out_uri- The location to which the E raster should be burned. h_s_list- A list of rasters burned with the equation r/dq*w for every

criteria applicable for that h, s pair.
denom_dict- A double representing the sum total of all applicable
criteria using the equation 1/dq*w. criteria applicable for that s.

Returns nothing.

natcap.invest.habitat_risk_assessment.hra_core.copy_raster(in_uri, out_uri)

Quick function that will copy the raster in in_raster, and put it into out_raster.

natcap.invest.habitat_risk_assessment.hra_core.execute(args)

This provides the main calculation functionaility of the HRA model. This will call all parts necessary for calculation of final outputs.

Inputs:
args- Dictionary containing everything that hra_core will need to
complete the rest of the model run. It will contain the following.
args[‘workspace_dir’]- Directory in which all data resides. Output
and intermediate folders will be subfolders of this one.
args[‘h_s_c’]- The same as intermediate/’h-s’, but with the addition

of a 3rd key ‘DS’ to the outer dictionary layer. This will map to a dataset URI that shows the potentially buffered overlap between the habitat and stressor. Additionally, any raster criteria will be placed in their criteria name subdictionary. The overall structure will be as pictured:

{(Habitat A, Stressor 1):
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{
‘DS’: “CritName Raster URI”, ‘Weight’: 1.0, ‘DQ’: 1.0

}

},

‘DS’: “A-1 Dataset URI” }

}

args[‘habitats’]- Similar to the h-s dictionary, a multi-level
dictionary containing all habitat-specific criteria ratings and rasters. In this case, however, the outermost key is by habitat name, and habitats[‘habitatName’][‘DS’] points to the rasterized habitat shapefile URI provided by the user.
args[‘h_s_e’]- Similar to the h_s_c dictionary, a multi-level
dictionary containing habitat-stressor-specific criteria ratings and shapes. The same as intermediate/’h-s’, but with the addition of a 3rd key ‘DS’ to the outer dictionary layer. This will map to a dataset URI that shows the potentially buffered overlap between the habitat and stressor. Additionally, any raster criteria will be placed in their criteria name subdictionary.
args[‘risk_eq’]- String which identifies the equation to be used
for calculating risk. The core module should check for possibilities, and send to a different function when deciding R dependent on this.
args[‘max_risk’]- The highest possible risk value for any given pairing
of habitat and stressor.
args[‘max_stress’]- The largest number of stressors that the user
believes will overlap. This will be used to get an accurate estimate of risk.
args[‘aoi_tables’]- May or may not exist within this model run, but if
it does, the user desires to have the average risk values by stressor/habitat using E/C axes for each feature in the AOI layer specified by ‘aoi_tables’. If the risk_eq is ‘Euclidean’, this will create risk plots, otherwise it will just create the standard HTML table for either ‘Euclidean’ or ‘Multiplicative.’
args[‘aoi_key’]- The form of the word ‘Name’ that the aoi layer uses
for this particular model run.
args[‘warnings’]- A dictionary containing items which need to be

acted upon by hra_core. These will be split into two categories. ‘print’ contains statements which will be printed using logger.warn() at the end of a run. ‘unbuff’ is for pairs which should use the unbuffered stressor file in lieu of the decayed rated raster.

{‘print’: [‘This is a warning to the user.’, ‘This is another.’],
‘unbuff’: [(HabA, Stress1), (HabC, Stress2)]

}

Outputs:
 --Intermediate-- These should be the temp risk and criteria files needed for the final output calcs. --Output-- /output/maps/recov_potent_H[habitatname].tif- Raster layer depicting the recovery potential of each individual habitat. /output/maps/cum_risk_H[habitatname]- Raster layer depicting the cumulative risk for all stressors in a cell for the given habitat. /output/maps/ecosys_risk- Raster layer that depicts the sum of all cumulative risk scores of all habitats for that cell. /output/maps/[habitatname]_HIGH_RISK- A raster-shaped shapefile containing only the “high risk” areas of each habitat, defined as being above a certain risk threshold.

Returns nothing.

natcap.invest.habitat_risk_assessment.hra_core.make_aoi_tables(out_dir, aoi_pairs)

This function will take in an shapefile containing multiple AOIs, and output a table containing values averaged over those areas.

Input:
out_dir- The directory into which the completed HTML tables should be
placed.
aoi_pairs- Replacement for avgs_dict, holds all the averaged values on

a H, S basis.

{‘AOIName’:

}

Output:
A set of HTML tables which will contain averaged values of E, C, and risk for each H, S pair within each AOI. Additionally, the tables will contain a column for risk %, which is the averaged risk value in that area divided by the total potential risk for a given pixel in the map.

Returns nothing.

natcap.invest.habitat_risk_assessment.hra_core.make_ecosys_risk_raster(dir, h_dict)

This will make the compiled raster for all habitats within the ecosystem. The ecosystem raster will be a direct sum of each of the included habitat rasters.

Input:

dir- The directory in which all completed should be placed. h_dict- A dictionary of raster dataset URIs which can be combined to

create an overall ecosystem raster. The key is the habitat name, and the value is the dataset URI.

{‘Habitat A’: “Overall Habitat A Risk Map URI”, ‘Habitat B’: “Overall Habitat B Risk URI”

...

}

Output:
ecosys_risk.tif- An overall risk raster for the ecosystem. It will
be placed in the dir folder.

Returns nothing.

natcap.invest.habitat_risk_assessment.hra_core.make_hab_risk_raster(dir, risk_dict)

This will create a combined raster for all habitat-stressor pairings within one habitat. It should return a list of open rasters that correspond to all habitats within the model.

Input:
dir- The directory in which all completed habitat rasters should be
placed.
risk_dict- A dictionary containing the risk rasters for each pairing of

habitat and stressor. The key is the tuple of (habitat, stressor), and the value is the raster dataset URI corresponding to that combination.

{(‘HabA’, ‘Stress1’): “A-1 Risk Raster URI”, (‘HabA’, ‘Stress2’): “A-2 Risk Raster URI”, ... }

Output:
A cumulative risk raster for every habitat included within the model.
Returns: h_rasters- A dictionary containing habitat names mapped to the dataset URI of the overarching habitat risk map for this model run.{‘Habitat A’: “Overall Habitat A Risk Map URI”, ‘Habitat B’: “Overall Habitat B Risk URI” ... } h_s_rasters- A dictionary that maps a habitat name to the risk rasters for each of the applicable stressors. {‘HabA’: [“A-1 Risk Raster URI”, “A-2 Risk Raster URI”, ...], ‘HabB’: [“B-1 Risk Raster URI”, “B-2 Risk Raster URI”, ...], ... }
natcap.invest.habitat_risk_assessment.hra_core.make_recov_potent_raster(dir, crit_lists, denoms)

This will do the same h-s calculation as used for the individual E/C calculations, but instead will use r/dq as the equation for each criteria. The full equation will be:

SUM HAB CRITS( 1/dq )
Input:

dir- Directory in which the completed raster files should be placed. crit_lists- A dictionary containing pre-burned criteria which can be

combined to get the E/C for that H-S pairing.

{‘Risk’: {
‘h_s_c’: {
(hab1, stressA):
[“indiv num raster URI”,
“raster 1 URI”, ...],

(hab1, stressB): ...

},

‘h’: {
hab1: [“indiv num raster URI”, “raster 1 URI”],
...

},

‘h_s_e’: { (hab1, stressA): [“indiv num raster URI”]
}

}

‘Recovery’: { hab1: [“indiv num raster URI”, ...],
hab2: ...

}

}

denoms- Dictionary containing the combined denominator for a given

H-S overlap. Once all of the rasters are combined, each H-S raster can be divided by this.

{‘Risk’: {
‘h_s_c’: {
(hab1, stressA): {
‘CritName’: 2.0, ...},
(hab1, stressB): {‘CritName’: 1.3, ...}
},
‘h’: { hab1: {‘CritName’: 1.3, ...},
...

},

‘h_s_e’: { (hab1, stressA): {‘CritName’: 1.3, ...}
}

}

‘Recovery’: { hab1: {‘critname’: 1.6, ...}
hab2: ...

}

}

Output:
A raster file for each of the habitats included in the model displaying
the recovery potential within each potential grid cell.

Returns nothing.

natcap.invest.habitat_risk_assessment.hra_core.make_risk_euc(base_uri, e_uri, c_uri, risk_uri)

Combines the E and C rasters according to the euclidean combination equation.

Input:
base- The h-s overlap raster, including potentially decayed values from
the stressor layer.
e_rast- The r/dq*w burned raster for all stressor-specific criteria
in this model run.
c_rast- The r/dq*w burned raster for all habitat-specific and
habitat-stressor-specific criteria in this model run.

risk_uri- The file path to which we should be burning our new raster.

Returns a raster representing the euclidean calculated E raster, C raster, and the base raster. The equation will be sqrt((C-1)^2 + (E-1)^2)

natcap.invest.habitat_risk_assessment.hra_core.make_risk_mult(base_uri, e_uri, c_uri, risk_uri)

Combines the E and C rasters according to the multiplicative combination equation.

Input:
base- The h-s overlap raster, including potentially decayed values from
the stressor layer.
e_rast- The r/dq*w burned raster for all stressor-specific criteria
in this model run.
c_rast- The r/dq*w burned raster for all habitat-specific and
habitat-stressor-specific criteria in this model run.

risk_uri- The file path to which we should be burning our new raster.

Returns the URI for a raster representing the multiplied E raster,
C raster, and the base raster.
natcap.invest.habitat_risk_assessment.hra_core.make_risk_plots(out_dir, aoi_pairs, max_risk, max_stress, num_stress, num_habs)

This function will produce risk plots when the risk equation is euclidean.

Parameters: out_dir (string) – The directory into which the completed risk plots should be placed. aoi_pairs (dictionary) – {‘AOIName’: } max_risk (float) – Double representing the highest potential value for a single h-s raster. The amount of risk for a given Habitat raster would be SUM(s) for a given h. max_stress (float) – The largest number of stressors that the user believes will overlap. This will be used to get an accurate estimate of risk. num_stress (dict) – A dictionary that simply associates every habaitat with the number of stressors associated with it. This will help us determine the max E/C we should be expecting in our overarching ecosystem plot. None
Outputs:

A set of .png images containing the matplotlib plots for every H-S combination. Within that, each AOI will be displayed as plotted by (E,C) values.

A single png that is the “ecosystem plot” where the E’s for each AOI are the summed

natcap.invest.habitat_risk_assessment.hra_core.make_risk_rasters(h_s_c, habs, inter_dir, crit_lists, denoms, risk_eq, warnings)

This will combine all of the intermediate criteria rasters that we pre-processed with their r/dq*w. At this juncture, we should be able to straight add the E/C within themselves. The way in which the E/C rasters are combined depends on the risk equation desired.

Input:
h_s_c- Args dictionary containing much of the H-S overlap data in
addition to the H-S base rasters. (In this function, we are only using it for the base h-s raster information.)
habs- Args dictionary containing habitat criteria information in
addition to the habitat base rasters. (In this function, we are only using it for the base raster information.)
inter_dir- Intermediate directory in which the H_S risk-burned rasters
can be placed.
crit_lists- A dictionary containing pre-burned criteria which can be

combined to get the E/C for that H-S pairing.

{‘Risk’: {
‘h_s_c’: {
(hab1, stressA): [“indiv num raster URI”,
“raster 1 URI”, ...],

(hab1, stressB): ...

},

‘h’: {
hab1: [“indiv num raster URI”,
“raster 1 URI”, ...],

...

},

‘h_s_e’: { (hab1, stressA): [“indiv num raster URI”,
...]

}

}

‘Recovery’: { hab1: [“indiv num raster URI”, ...],
hab2: ...

}

}

denoms- Dictionary containing the denomincator scores for each overlap

for each criteria. These can be combined to get the final denom by which the rasters should be divided.

{‘Risk’: { ‘h_s_c’: { (hab1, stressA): {‘CritName’: 2.0,...},
(hab1, stressB): {CritName’: 1.3, ...}

},

‘h’: { hab1: {‘CritName’: 2.5, ...},
...

},

‘h_s_e’: { (hab1, stressA): {‘CritName’: 2.3},
}

}

‘Recovery’: { hab1: {‘CritName’: 3.4},
hab2: ...

}

}

risk_eq- A string description of the desired equation to use when
preforming risk calculation.
warnings- A dictionary containing items which need to be acted upon by

hra_core. These will be split into two categories. ‘print’ contains statements which will be printed using logger.warn() at the end of a run. ‘unbuff’ is for pairs which should use the unbuffered stressor file in lieu of the decayed rated raster.

{‘print’: [‘This is a warning to the user.’, ‘This is another.’],
‘unbuff’: [(HabA, Stress1), (HabC, Stress2)]

}

Output:
A new raster file for each overlapping of habitat and stressor. This file will be the overall risk for that pairing from all H/S/H-S subdictionaries.
Returns: risk_rasters- A simple dictionary that maps a tuple of (Habitat, Stressor) to the URI for the risk raster created when the various sub components (H/S/H_S) are combined.{(‘HabA’, ‘Stress1’): “A-1 Risk Raster URI”, (‘HabA’, ‘Stress2’): “A-2 Risk Raster URI”, ... }
natcap.invest.habitat_risk_assessment.hra_core.make_risk_shapes(dir, crit_lists, h_dict, h_s_dict, max_risk, max_stress)

This function will take in the current rasterized risk files for each habitat, and output a shapefile where the areas that are “HIGH RISK” (high percentage of risk over potential risk) are the only existing polygonized areas.

Additonally, we also want to create a shapefile which is only the “low risk” areas- actually, those that are just not high risk (it’s the combination of low risk areas and medium risk areas).

Since the pygeoprocessing.geoprocessing function can only take in ints, want to predetermine

what areas are or are not going to be shapefile, and pass in a raster that is only 1 or nodata.

Input:

dir- Directory in which the completed shapefiles should be placed. crit_lists- A dictionary containing pre-burned criteria which can be

combined to get the E/C for that H-S pairing.

{‘Risk’: {
‘h_s_c’: { (hab1, stressA): [“indiv num raster URI”,
“raster 1 URI”, ...],

(hab1, stressB): ...

},

‘h’: {
hab1: [“indiv num raster URI”, “raster 1 URI”],
...

},

‘h_s_e’: {(hab1, stressA): [“indiv num raster URI”]
}

}

‘Recovery’: { hab1: [“indiv num raster URI”, ...],
hab2: ...

}

}

h_dict- A dictionary that contains raster dataset URIs corresponding
to each of the habitats in the model. The key in this dictionary is the name of the habiat, and it maps to the open dataset.
h_s_dict- A dictionary that maps a habitat name to the risk rasters

for each of the applicable stressors.

{‘HabA’: [“A-1 Risk Raster URI”, “A-2 Risk Raster URI”, ...],
‘HabB’: [“B-1 Risk Raster URI”, “B-2 Risk Raster URI”, ...], ...

}

max_risk- Double representing the highest potential value for a single
h-s raster. The amount of risk for a given Habitat raster would be SUM(s) for a given h.
max_stress- The largest number of stressors that the user believes will
overlap. This will be used to get an accurate estimate of risk.
Output:
Returns two shapefiles for every habitat, one which shows features only for the areas that are “high risk” within that habitat, and one which shows features only for the combined low + medium risk areas.
Return:
num_stress- A dictionary containing the number of stressors being
associated with each habitat. The key is the string name of the habitat, and it maps to an int counter of number of stressors.
natcap.invest.habitat_risk_assessment.hra_core.pre_calc_avgs(inter_dir, risk_dict, aoi_uri, aoi_key, risk_eq, max_risk)

This funtion is a helper to make_aoi_tables, and will just handle pre-calculation of the average values for each aoi zone.

Input:
inter_dir- The directory which contains the individual E and C rasters.
We can use these to get the avg. E and C values per area. Since we don’t really have these in any sort of dictionary, will probably just need to explicitly call each individual file based on the names that we pull from the risk_dict keys.
risk_dict- A simple dictionary that maps a tuple of

(Habitat, Stressor) to the URI for the risk raster created when the various sub components (H/S/H_S) are combined.

{(‘HabA’, ‘Stress1’): “A-1 Risk Raster URI”, (‘HabA’, ‘Stress2’): “A-2 Risk Raster URI”, ... }

aoi_uri- The location of the AOI zone files. Each feature within this
file (identified by a ‘name’ attribute) will be used to average an area of E/C/Risk values.
risk_eq- A string identifier, either ‘Euclidean’ or ‘Multiplicative’
that tells us which equation should be used for calculation of risk. This will be used to get the risk value for the average E and C.

max_risk- The user reported highest risk score present in the CSVs.

Returns: avgs_dict- A multi level dictionary to hold the average values that will be placed into the HTML table. {‘HabitatName’: {‘StressorName’: [{‘Name’: AOIName, ‘E’: 4.6, ‘C’: 2.8, ‘Risk’: 4.2}, {...}, ... ] } aoi_names- Quick and dirty way of getting the AOI keys.
natcap.invest.habitat_risk_assessment.hra_core.pre_calc_denoms_and_criteria(dir, h_s_c, hab, h_s_e)

Want to return two dictionaries in the format of the following: (Note: the individual num raster comes from the crit_ratings subdictionary and should be pre-summed together to get the numerator for that particular raster. )

Input:
dir- Directory into which the rasterized criteria can be placed. This
will need to have a subfolder added to it specifically to hold the rasterized criteria for now.
h_s_c- A multi-level structure which holds all criteria ratings,

both numerical and raster that apply to habitat and stressor overlaps. The structure, whose keys are tuples of (Habitat, Stressor) names and map to an inner dictionary will have 3 outer keys containing numeric-only criteria, raster-based criteria, and a dataset that shows the potentially buffered overlap between the habitat and stressor. The overall structure will be as pictured:

{(Habitat A, Stressor 1):
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{
‘DS’: “CritName Raster URI”,
‘Weight’: 1.0, ‘DQ’: 1.0}

},

‘DS’: “A-1 Raster URI” }

}

hab- Similar to the h-s dictionary, a multi-level
dictionary containing all habitat-specific criteria ratings and rasters. In this case, however, the outermost key is by habitat name, and habitats[‘habitatName’][‘DS’] points to the rasterized habitat shapefile URI provided by the user.
h_s_e- Similar to the h_s_c dictionary, a multi-level
dictionary containing habitat-stressor-specific criteria ratings and rasters. The outermost key is by (habitat, stressor) pair, but the criteria will be applied to the exposure portion of the risk calcs.
Output:
Creates a version of every criteria for every h-s paring that is burned with both a r/dq*w value for risk calculation, as well as a r/dq burned raster for recovery potential calculations.
Returns: crit_lists- A dictionary containing pre-burned criteria URI which can be combined to get the E/C for that H-S pairing. {‘Risk’: { ‘h_s_c’: { (hab1, stressA): [“indiv num raster”, “raster 1”, ...], (hab1, stressB): ... }, ‘h’: { hab1: [“indiv num raster URI”, “raster 1 URI”, ...], ... }, ‘h_s_e’: { (hab1, stressA): [“indiv num raster URI”, ...] } } ‘Recovery’: { hab1: [“indiv num raster URI”, ...], hab2: ... } } denoms- Dictionary containing the combined denominator for a given H-S overlap. Once all of the rasters are combined, each H-S raster can be divided by this. {‘Risk’: { ‘h_s_c’: { (hab1, stressA): {‘CritName’: 2.0, ...}, (hab1, stressB): {‘CritName’: 1.3, ...} }, ‘h’: { hab1: {‘CritName’: 1.3, ...}, ... }, ‘h_s_e’: { (hab1, stressA): {‘CritName’: 1.3, ...} } } ‘Recovery’: { hab1: 1.6, hab2: ... } }
natcap.invest.habitat_risk_assessment.hra_core.raster_to_polygon(raster_uri, out_uri, layer_name, field_name)

This will take in a raster file, and output a shapefile of the same area and shape.

Input:
raster_uri- The raster that needs to be turned into a shapefile. This
is only the URI to the raster, we will need to get the band.

out_uri- The desired URI for the new shapefile. layer_name- The name of the layer going into the new shapefile. field-name- The name of the field that will contain the raster pixel

value.
Output:
This will be a shapefile in the shape of the raster. The raster being passed in will be solely “high risk” areas that conatin data, and nodata values for everything else.

Returns nothing.

natcap.invest.habitat_risk_assessment.hra_core.rewrite_avgs_dict(avgs_dict, aoi_names)

Aftermarket rejigger of the avgs_dict setup so that everything is AOI centric instead. Should produce something like the following:

{‘AOIName’:

}

## Habitat Risk Assessment Pre-processor¶

Entry point for the Habitat Risk Assessment module

exception natcap.invest.habitat_risk_assessment.hra_preprocessor.ImproperCriteriaSpread

Bases: exceptions.Exception

An exception for hra_preprocessor which can be passed if there are not one or more criteria in each of the 3 criteria categories: resilience, exposure, and sensitivity.

exception natcap.invest.habitat_risk_assessment.hra_preprocessor.ImproperECSelection

Bases: exceptions.Exception

An exception for hra_preprocessor that should catch selections for exposure vs consequence scoring that are not either E or C. The user must decide in this column which the criteria applies to, and my only designate this with an ‘E’ or ‘C’.

exception natcap.invest.habitat_risk_assessment.hra_preprocessor.MissingHabitatsOrSpecies

Bases: exceptions.Exception

An exception to pass if the hra_preprocessor args dictionary being passed is missing a habitats directory or a species directory.

exception natcap.invest.habitat_risk_assessment.hra_preprocessor.MissingSensOrResilException

Bases: exceptions.Exception

An exception for hra_preprocessor that catches h-s pairings who are missing either Sensitivity or Resilience or C criteria, though not both. The user must either zero all criteria for that pair, or make sure that both E and C are represented.

exception natcap.invest.habitat_risk_assessment.hra_preprocessor.NA_RatingsError

Bases: exceptions.Exception

An exception that is raised on an invalid ‘NA’ input.

When one or more Ratings value is set to “NA” for a habitat - stressor pair, but not ALL are set to “NA”. If ALL Rating values for a habitat - stressor pair are “NA”, then the habitat - stressor pair is considered to have NO interaction.

exception natcap.invest.habitat_risk_assessment.hra_preprocessor.NotEnoughCriteria

Bases: exceptions.Exception

An exception for hra_preprocessor which can be passed if the number of criteria in the resilience, exposure, and sensitivity categories all sums to less than 4.

exception natcap.invest.habitat_risk_assessment.hra_preprocessor.UnexpectedString

Bases: exceptions.Exception

An exception for hra_preprocessor that should catch any strings that are left over in the CSVs. Since everything from the CSV’s are being cast to floats, this will be a hook off of python’s ValueError, which will re-raise our exception with a more accurate message.

exception natcap.invest.habitat_risk_assessment.hra_preprocessor.ZeroDQWeightValue

Bases: exceptions.Exception

An exception specifically for the parsing of the preprocessor tables in which the model should break loudly if a user tries to enter a zero value for either a data quality or a weight. However, we should confirm that it will only break if the rating is not also zero. If they’re removing the criteria entirely from that H-S overlap, it should be allowed.

natcap.invest.habitat_risk_assessment.hra_preprocessor.error_check(line, hab_name, stress_name)

Throwing together a simple error checking function for all of the inputs coming from the CSV file. Want to do checks for strings vs floats, as well as some explicit string checking for ‘E’/’C’.

Input:
line- An array containing a line of H-S overlap data. The format of a

line would look like the following:

[‘CritName’, ‘Rating’, ‘Weight’, ‘DataQuality’, ‘Exp/Cons’]

The following restrictions should be placed on the data:

CritName- This will be propogated by default by
HRA_Preprocessor. Since it’s coming in as a string, we shouldn’t need to check anything.
Rating- Can either be the explicit string ‘SHAPE’, which would
be placed automatically by HRA_Preprocessor, or a float. ERROR: if string that isn’t ‘SHAPE’.
Weight- Must be a float (or an int), but cannot be 0.
ERROR: if string, or anything not castable to float, or 0.
DataQuality- Most be a float (or an int), but cannot be 0.
ERROR: if string, or anything not castable to float, or 0.
Exp/Cons- Most be the string ‘E’ or ‘C’.
ERROR: if string that isn’t one of the acceptable ones, or ANYTHING else.

Returns nothing, should raise exception if there’s an issue.

natcap.invest.habitat_risk_assessment.hra_preprocessor.execute(args)

Habitat Risk Assessment Preprocessor.

Want to read in multiple hab/stressors directories, in addition to named criteria, and make an appropriate csv file.

Parameters: args['workspace_dir'] (string) – The directory to dump the output CSV files to. (required) args['habitats_dir'] (string) – A directory of shapefiles that are habitats. This is not required, and may not exist if there is a species layer directory. (optional) args['species_dir'] (string) – Directory which holds all species shapefiles, but may or may not exist if there is a habitats layer directory. (optional) args['stressors_dir'] (string) – A directory of ArcGIS shapefiles that are stressors. (required) args['exposure_crits'] (list) – list containing string names of exposure criteria (hab-stress) which should be applied to the exposure score. (optional) args['sensitivity-crits'] (list) – List containing string names of sensitivity (habitat-stressor overlap specific) criteria which should be applied to the consequence score. (optional) args['resilience_crits'] (list) – List containing string names of resilience (habitat or species-specific) criteria which should be applied to the consequence score. (optional) args['criteria_dir'] (string) – Directory which holds the criteria shapefiles. May not exist if the user does not desire criteria shapefiles. This needs to be in a VERY specific format, which shall be described in the user’s guide. (optional) None

This function creates a series of CSVs within args['workspace_dir']. There will be one CSV for every habitat/species. These files will contain information relevant to each habitat or species, including all criteria. The criteria will be broken up into those which apply to only the habitat, and those which apply to the overlap of that habitat, and each stressor.

JSON file containing vars that need to be passed on to hra non-core when that gets run. Should live inside the preprocessor folder which will be created in args['workspace_dir']. It will contain habitats_dir, species_dir, stressors_dir, and criteria_dir.

natcap.invest.habitat_risk_assessment.hra_preprocessor.listdir(path)

A replacement for the standar os.listdir which, instead of returning only the filename, will include the entire path. This will use os as a base, then just lambda transform the whole list.

Input:
path- The location container from which we want to gather all files.
Returns: A list of full URIs contained within ‘path’.
natcap.invest.habitat_risk_assessment.hra_preprocessor.make_crit_shape_dict(crit_uri)

This will take in the location of the file structure, and will return a dictionary containing all the shapefiles that we find. Hypothetically, we should be able to parse easily through the files, since it should be EXACTLY of the specs that we laid out.

Input:
crit_uri- Location of the file structure containing all of the
shapefile criteria.
Returns: A dictionary containing shapefile URI’s, indexed by their criteria name, in addition to which dictionaries and h-s pairs they apply to. The structure will be as follows: {‘h’: {‘HabA’: {‘CriteriaName: “Shapefile Datasource URI”...}, ... }, ‘h_s_c’: {(‘HabA’, ‘Stress1’): {‘CriteriaName: “Shapefile Datasource URI”, ...}, ... }, ‘h_s_e’ {(‘HabA’, ‘Stress1’): {‘CriteriaName: “Shapefile Datasource URI”, ...}, ... } }
natcap.invest.habitat_risk_assessment.hra_preprocessor.parse_hra_tables(folder_uri)

This takes in the directory containing the criteria rating csv’s, and returns a coherent set of dictionaries that can be used to do EVERYTHING in non-core and core.

It will return a massive dictionary containing all of the subdictionaries needed by non core, as well as directory URI’s. It will be of the following form:

{‘habitats_dir’: ‘Habitat Directory URI’, ‘species_dir’: ‘Species Directory URI’, ‘stressors_dir’: ‘Stressors Directory URI’, ‘criteria_dir’: ‘Criteria Directory URI’, ‘buffer_dict’:

{‘Stressor 1’: 50, ‘Stressor 2’: ..., },
‘h_s_c’:
{(Habitat A, Stressor 1):
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{‘Weight’: 1.0, ‘DQ’: 1.0}

},

}

},

‘h_s_c’:
{(Habitat A, Stressor 1):
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{‘Weight’: 1.0, ‘DQ’: 1.0}

},

}

},

‘habitats’:
{Habitat A:
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{‘Weight’: 1.0, ‘DQ’: 1.0}

},

}

}

‘warnings’:
{‘print’:
[‘This is a warning to the user.’, ‘This is another.’],
‘unbuff’:
[(HabA, Stress1), (HabC, Stress2)]

}

}

natcap.invest.habitat_risk_assessment.hra_preprocessor.parse_overlaps(uri, habs, h_s_e, h_s_c)

This function will take in a location, and update the dictionaries being passed with the new Hab/Stress subdictionary info that we’re getting from the CSV at URI.

Input:
uri- The location of the CSV that we want to get ratings info from.
This will contain information for a given habitat’s individual criteria ratings, as well as criteria ratings for the overlap of every stressor.
habs- A dictionary which contains all resilience specific criteria

info. The key for these will be the habitat name. It will map to a subdictionary containing criteria information. The whole dictionary will look like the following:

{Habitat A:
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{‘Weight’: 1.0, ‘DQ’: 1.0}

},

}

}

h_s_e- A dictionary containing all information applicable to exposure
criteria. The dictionary will look identical to the ‘habs’ dictionary, but each key will be a tuple of two strings - (HabName, StressName).
h_s_c- A dictionary containing all information applicable to
sensitivity criteria. The dictionary will look identical to the ‘habs’ dictionary, but each key will be a tuple of two strings - (HabName, StressName).
natcap.invest.habitat_risk_assessment.hra_preprocessor.parse_stress_buffer(uri)

This will take the stressor buffer CSV and parse it into a dictionary where the stressor name maps to a float of the about by which it should be buffered.

Input:
uri- The location of the CSV file from which we should pull the buffer
amounts.
Returns: A dictionary containing stressor names mapped to their corresponding buffer amounts. The float may be 0, but may not be a string. The form will be the following: {‘Stress 1’: 2000, ‘Stress 2’: 1500, ‘Stress 3’: 0, ...}
natcap.invest.habitat_risk_assessment.hra_preprocessor.zero_check(h_s_c, h_s_e, habs)

Any criteria that have a rating of 0 mean that they are not a desired input to the assessment. We should delete the criteria’s entire subdictionary out of the dictionary.

Input:
habs- A dictionary which contains all resilience specific criteria

info. The key for these will be the habitat name. It will map to a subdictionary containing criteria information. The whole dictionary will look like the following:

{Habitat A:
{‘Crit_Ratings’:
{‘CritName’:
{‘Rating’: 2.0, ‘DQ’: 1.0, ‘Weight’: 1.0}

},

‘Crit_Rasters’:
{‘CritName’:
{‘Weight’: 1.0, ‘DQ’: 1.0}

},

}

}

h_s_e- A dictionary containing all information applicable to exposure
criteria. The dictionary will look identical to the ‘habs’ dictionary, but each key will be a tuple of two strings - (HabName, StressName).
h_s_c- A dictionary containing all information applicable to
sensitivity criteria. The dictionary will look identical to the ‘habs’ dictionary, but each key will be a tuple of two strings - (HabName, StressName).
Output:
Will update each of the three dictionaries by deleting any criteria where the rating aspect is 0.
Returns: warnings- A dictionary containing items which need to be acted upon by hra_core. These will be split into two categories. ‘print’ contains statements which will be printed using logger.warn() at the end of a run. ‘unbuff’ is for pairs which should use the unbuffered stressor file in lieu of the decayed rated raster. {‘print’: [‘This is a warning to the user.’, ‘This is another.’], ‘unbuff’: [(HabA, Stress1), (HabC, Stress2)] }


text:
# Conda Essentials Notes

## Introduction

Conda in an open source package management system that works on all platforms. It is a tool that helps manage packages and environments for different programming languages. Develop a high level understanding of how Conda works helped me at so many levels especially when it comes to managing environments and make my work more reproducable. Below are the notes that I wrote down during my journey of learning Conda and I always refere back to them:

## General

• Conda packages are files and executables that can in principle contain images, data, noteboeeks, files, etc.
• Conda mainly used in Python ecosystem; however, it can be used with other languages such R, Julia, Scala, etc.
• When installing a package using Conda, it installs its dependencies with it. Also, Conda is able to figure out the platform you’re using without the need to specify the platform when installing packages.
• When installing a package, Conda:
• Checks the platform.
• Checks the Python version.
• Install the latest version of the package that is compatible with Python.
• If it has dependencies, installs the latest versions of the dependencies that are also compatible with each other.
• Under semantic versioning, software is labeled with a three-part version identifier of the form MAJOR.MINOR.PATCH; the label components are non-negative integers separated by periods. Assuming all software starts at version 0.0.0, the MAJOR version number is increased when significant new functionality is introduced (often with corresponding API changes). Increases in the MINOR version number generally reflect improvements (e.g., new features) that avoid backward-incompatible API changes. For instance, adding an optional argument to a function API (in a way that allows old code to run unchanged) is a change worthy of increasing the MINOR version number. An increment to the PATCH version number is approriate mostly for bug fixes that preserve the same MAJOR and MINOR revision numbers. Software patches do not typically introduce new features or change APIs at all (except sometimes to address security issues).
• We can specify MAJOR, MAJOR.MINOR, or MAJOR.MINOR.PATCH when installing any package.
• We can use logical operators to install versions of a package. Examples:
• conda install 'python=3.6|3.7'.
• conda install 'python=3.6|3.7*' .
• conda install 'python>=3.6, <=3.7'.

## Common Commands

• To update a package, conda update pckg.
• To uninstall a package, conda remove pckg.
• To search what available versions of a specific package is available, use conda search pckg.
• conda list will list all installed packages.
• conda list -n env-name will list all packages in the environment env-name.
• conda list pckg will give information about pckg.
• When installing a pckg without including a channel, it defaults to the main channel that is maintained by Anaconda Inc.
• There other channels where people can upload their packages to and we can reach to those channels when looking for installation such fastai. We use conda install -c fastai fastai. Here the channel is fastai and the pckg is also fastai.
• conda search -c conda-forge -c fastai --override-channels --platform osx-64 fastai means:
• Search for fastai in two channels: conda-forge, fastai.
• override-channels means do not go to default main channel.
• platform specify which platform.
• Sometimes we don’t know the channel of the pckg, we can use anaconda search pckg that will return all the channels that the pckg is at and their versions.
• conda-forge is almost as good as the main channels which is led by the community. It has a lot more packages than the main channel.
• There is no system that rates channels, so be carefel when installing packages from any channel.
• We can list all packages in a channel such as conda search -c conda-forge --override-channels that will list all packages for the conda-forge channel.

## Environments

• Environments are a good practice of documenting data science/software development work.
• Environments are nothing more than a directory that contains all the packages so that when trying to import them, it imports them from this directory only. we can use conda env list to see all the available environments on our machine.
• To get the packages from a specific environment by name, use conda list -n env-name. Otherwise, we get the packages from the current environment.
• To activate an environment, use conda activate env-name. To deactivate, conda deactivate.
• Environments usually don’t take a lot of space.
• We can remove environments using conda env remove -n env-name.
• To create an environment, use conda create -n env-name. We can also add additional package names to install after creation such as conda create -n env-name python=3.6* numpy>=1.1.
• To export an environment, use conda env export -n env-name. This will return the output to the terminal. We can also export to a file. For that use conda env export -n env-name -f env-name.yml. The ‘.yml’ extension is strongly enouraged. Doing this will assure that all the packages used can be installed by others exactly.
• We can create also an environment from .yml file using conda env create -f env-name.yml. Note also that if we only use conda env create, it will look for a file that has .yml extension and has the same name as env-name in the current local directory. Moreover, we can create the .yml file with doing the export ourselves and only specify what is important in our environments.

format: plain


text:
# Gaussian elimination

In mathematics, Gaussian elimination (also called row reduction) is a method used to solve systems of linear equations. It is named after Carl Friedrich Gauss, a famous German mathematician who wrote about this method, but did not invent it.

To perform Gaussian elimination, the coefficients of the terms in the system of linear equations are used to create a type of matrix called an augmented matrix. Then, elementary row operations are used to simplify the matrix. The three types of row operations used are:

Type 1: Switching one row with another row.
Type 2: Multiplying a row by a non-zero number.
Type 3: Adding or subtracting a row from another row.

The goal of Gaussian elimination is to get the matrix in row-echelon form. If a matrix is in row-echelon form, that means that reading from left to right, each row will start with at least one more zero term than the row above it. Some definitions of Gaussian elimination say that the matrix result has to be in reduced row-echelon form. That means that the matrix is in row-echelon form and the only non-zero term in each row is 1. Gaussian elimination that creates a reduced row-echelon matrix result is sometimes called Gauss-Jordan elimination.

## Example

Suppose the goal is to find the answers to this system of linear equations.

\begin{alignat}{7} 2x &&\; + \;&& y &&\; - \;&& z &&\; = \;&& 8 & \qquad (R_1) \\ -3x &&\; - \;&& y &&\; + \;&& 2z &&\; = \;&& -11 & \qquad (R_2) \\ -2x &&\; + \;&& y &&\; +\;&& 2z &&\; = \;&& -3 & \qquad (R_3) \end{alignat}

First, the system needs to be turned into an augmented matrix. In an augmented matrix, each linear equation becomes a row. On one side of the augmented matrix, the coefficients of each term in the linear equation become numbers in the matrix. On the other side of the augmented matrix are the constant terms each linear equation is equal to. For this system, the augmented matrix is:

$\left[ \begin{array}{ccc|c} 2 & 1 & -1 & 8 \\ -3 & -1 & 2 & -11 \\ -2 & 1 & 2 & -3 \end{array} \right]$

Then, row operations can be done on the augmented matrix to simplify it. The table below shows the row reduction process on the system of equations and on the augmented matrix.

System of equations Row operations Augmented matrix
\begin{alignat}{7} 2x &&\; + \;&& y &&\; - \;&& z &&\; = \;&& 8 & \\ -3x &&\; - \;&& y &&\; + \;&& 2z &&\; = \;&& -11 & \\ -2x &&\; + \;&& y &&\; +\;&& 2z &&\; = \;&& -3 & \end{alignat} $\left[ \begin{array}{ccc|c} 2 & 1 & -1 & 8 \\ -3 & -1 & 2 & -11 \\ -2 & 1 & 2 & -3 \end{array} \right]$
\begin{alignat}{7} 2x &&\; + && y &&\; - &&\; z &&\; = \;&& 8 & \\ && && \frac{1}{2}y &&\; + &&\; \frac{1}{2}z &&\; = \;&& 1 & \\ && && 2y &&\; + &&\; z &&\; = \;&& 5 & \end{alignat} $R_2 + \frac{3}{2}R_1 \rightarrow R_2$
$R_3 + R_1 \rightarrow R_3$
$\left[ \begin{array}{ccc|c} 2 & 1 & -1 & 8 \\ 0 & 1/2 & 1/2 & 1 \\ 0 & 2 & 1 & 5 \end{array} \right]$
\begin{alignat}{7} 2x &&\; + && y \;&& - &&\; z \;&& = \;&& 8 & \\ && && \frac{1}{2}y \;&& + &&\; \frac{1}{2}z \;&& = \;&& 1 & \\ && && && &&\; -z \;&&\; = \;&& 1 & \end{alignat} $R_3 + -4R_2 \rightarrow R_3$ $\left[ \begin{array}{ccc|c} 2 & 1 & -1 & 8 \\ 0 & 1/2 & 1/2 & 1 \\ 0 & 0 & -1 & 1 \end{array} \right]$

The matrix is now in row-echelon form. This is also called triangular form.

System of equations Row operations Augmented matrix
\begin{alignat}{7} 2x &&\; + && y \;&& &&\; \;&& = \;&& 7 & \\ && && \frac{1}{2}y \;&& &&\; \;&& = \;&& 3/2 & \\ && && && &&\; -z \;&&\; = \;&& 1 & \end{alignat} $R_2+\frac{1}{2}R_3 \rightarrow R_2$
$R_1 - R_3 \rightarrow R_1$
$\left[ \begin{array}{ccc|c} 2 & 1 & 0 & 7 \\ 0 & 1/2 & 0 & 3/2 \\ 0 & 0 & -1 & 1 \end{array} \right]$
\begin{alignat}{7} 2x &&\; + && y \;&& &&\; \;&& = \;&& 7 & \\ && && y \;&& &&\; \;&& = \;&& 3 & \\ && && && &&\; z \;&&\; = \;&& -1 & \end{alignat} $2R_2 \rightarrow R_2$
$-R_3 \rightarrow R_3$
$\left[ \begin{array}{ccc|c} 2 & 1 & 0 & 7 \\ 0 & 1 & 0 & 3 \\ 0 & 0 & 1 & -1 \end{array} \right]$
\begin{alignat}{7} x &&\; && \;&& &&\; \;&& = \;&& 2 & \\ && && y \;&& &&\; \;&& = \;&& 3 & \\ && && && &&\; z \;&&\; = \;&& -1 & \end{alignat} $R_1 - R_2 \rightarrow R_1$
$\frac{1}{2}R_1 \rightarrow R_1$
$\left[ \begin{array}{ccc|c} 1 & 0 & 0 & 2 \\ 0 & 1 & 0 & 3 \\ 0 & 0 & 1 & -1 \end{array} \right]$

The matrix is now in reduced row-echelon form. Reading this matrix tells us that the solutions for this system of equations occur when x = 2, y = 3, and z = -1.


text:
GMAT Question of the Day - Daily to your Mailbox; hard ones only

 It is currently 11 Dec 2018, 03:38

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

## Events & Promotions

###### Events & Promotions in December
PrevNext
SuMoTuWeThFrSa
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345
Open Detailed Calendar
• ### Free GMAT Prep Hour

December 11, 2018

December 11, 2018

09:00 PM EST

10:00 PM EST

Strategies and techniques for approaching featured GMAT topics. December 11 at 9 PM EST.
• ### The winning strategy for 700+ on the GMAT

December 13, 2018

December 13, 2018

08:00 AM PST

09:00 AM PST

What people who reach the high 700's do differently? We're going to share insights, tips and strategies from data we collected on over 50,000 students who used examPAL.

# If m^2 = 17, then what is the value of (m+1)(m−1)?

Author Message
TAGS:

### Hide Tags

Math Expert
Joined: 02 Sep 2009
Posts: 51098
If m^2 = 17, then what is the value of (m+1)(m−1)?  [#permalink]

### Show Tags

25 Nov 2018, 22:49
00:00

Difficulty:

15% (low)

Question Stats:

92% (00:20) correct 8% (01:10) wrong based on 36 sessions

### HideShow timer Statistics

If m^2 = 17, then what is the value of (m+1)(m−1)?

A. √17 − 1
B. √17 + 1
C. 16
D. 18
E. 288

_________________
Senior Manager
Joined: 18 Jul 2018
Posts: 484
Location: India
Concentration: Finance, Marketing
WE: Engineering (Energy and Utilities)
If m^2 = 17, then what is the value of (m+1)(m−1)?  [#permalink]

### Show Tags

25 Nov 2018, 22:55
1
$$m^2$$ = 17
m = $$\sqrt{17}$$

(m+1)(m-1) = $$m^2 - 1^2$$ = 17-1 = 16

_________________

When you want something, the whole universe conspires in helping you achieve it.

Senior Manager
Joined: 08 Aug 2017
Posts: 281
Re: If m^2 = 17, then what is the value of (m+1)(m−1)?  [#permalink]

### Show Tags

25 Nov 2018, 22:58
m2 = 17
m2 - 1 = 17-1
(m-1)(m+1)= 16
C is correct
Intern
Joined: 03 Mar 2017
Posts: 3
Re: If m^2 = 17, then what is the value of (m+1)(m−1)?  [#permalink]

### Show Tags

26 Nov 2018, 04:32
option C.
m^2=17
m=sqrt17
(m+1)(m-1)=m^2-1^2=17-1=16
Intern
Joined: 17 Sep 2018
Posts: 2
Re: If m^2 = 17, then what is the value of (m+1)(m−1)?  [#permalink]

### Show Tags

26 Nov 2018, 07:57
C.
m2 = 17
(m-1)(m+1)=m2-1
= 17-1
=16
Director
Joined: 18 Aug 2017
Posts: 654
Location: India
Concentration: Sustainability, Marketing
WE: Marketing (Energy and Utilities)
Re: If m^2 = 17, then what is the value of (m+1)(m−1)?  [#permalink]

### Show Tags

26 Nov 2018, 20:28
Bunuel wrote:
If m^2 = 17, then what is the value of (m+1)(m−1)?

A. √17 − 1
B. √17 + 1
C. 16
D. 18
E. 288

(m+1)(m-1)= (m^2-1)

(17-1)= 16 option C
_________________

If you liked my solution then please give Kudos. Kudos encourage active discussions.

Re: If m^2 = 17, then what is the value of (m+1)(m−1)? &nbs [#permalink] 26 Nov 2018, 20:28
Display posts from previous: Sort by


text:
## Liouville’s Approximation Theorem [closed]

I am trying to understand how Liouville's Theorem would apply to complex numbers.

alpha an irrational algebraic, then there exist a constant, c, depending on alpha such that for all rationals, the inequality is satisfied.

c/q^d <= abs(alpha-(p/q))

Assume x is a complex irrational algebraic. In the theorem's inequality, would alpha be seperately the Re(x) and Im(x) of the complex number or would it be the magnitude of x?

If x is complex algebraic, is its real and imaginary parts necessarily algebraic?

I am asking because I'm trying to prove Liouville's theorem for alpha a complex number.

-
The usual proof of Liouville's theorem works for any algebraic number, regardless whether it is complex or real. The absolute value in the theorem should be understood as the usual absolute value of complex numbers. The proof depends on the fact that a nonzero algebraic integer multiplied by its conjugates is a nonzero rational integer, hence the product of the absolute values of these algebraic integers is at least 1. I am afraid your question is not of research level. I vote to close. – GH May 19 2012 at 20:53
cheers, that does it! – Bob Davis May 19 2012 at 23:11


text:
# Basic differentiation question on derivative of conical volume

So I was reading Polya's book and in it, there was a problem involving finding the rate of change of depth of water in a cone.

At some point, we come to the conclusion that V = $\pi a^2 y^3/(3b^2)$ where $V$ = volume of water, $a$= radius of base of cone, $y$ = depth of water and $b$ = height of cone.

This is where I get lost...They then come to the conclusion that since $V$ increases along with $y$, then upon differentiation, the result should be $dV/dt = (\pi a^2 y^2 / b^2 )dy/dt$.

How come they're multiplying with $dy/dt$? whats the rule ? I know this must be extremely basic but it's been a while since I touched maths and wanted to get back into it.

• Chain rule: $\frac{dV}{dt} = \frac{dV}{dy}\frac{dy}{dt}$ – Ben Grossmann Aug 6 '15 at 15:54
• $y$ is a function of $t$, so they apply the chain rule. – BadAtMaths Aug 6 '15 at 15:58

The answer is easy: $$\frac{dV}{dt} = \frac{d}{dt} \frac{\pi a^2}{3b^2} y^3 = \frac{\pi a^2}{3b^2} \cdot 3 y^2 \frac{dy}{dt}$$ by the chain rule applied to $t \mapsto y(t)^3$.
• So...would it be safe to say that d/dt $x^4$ = 4$x^3$dx/dt ? – Newbie Aug 6 '15 at 17:41
• Yes, it is even correct when $x$ is independent of $t$. – Siminore Aug 6 '15 at 18:44


text:
Return to Top. $x \cdot y=y \cdot x$. For example, 4 is the multiplicative inverse of 1/4 because 4 × 1/4 = 1. Correct answers: 1 question: Which equation illustrates the identity property of multiplication? Take any number, multiply it by one and you get your number. Join. By using this site, you consent to the use of cookies. The property states that the product of a sum or difference, such as 6(5 – 2), is equal to the sum or difference of products, in this case, 6(5) – 6(2). 6(3a + 4b) = 18a + 4bB. Commutative property of multipl…, a. Identity Property Of Addition And Multiplication Identity Property of addition states that any number plus zero is the original number. Identity property of multiplication states any … Which equation shows the commutative property of multiplication? $x \cdot 1=x$c. Whole numbers & integers. A. a + a +a = 3 x a B. Choose from t…, Discuss which algebraic property or properties are illustrated by the equati…, Multiple Choice Which of the following could not be set equal to $\sin x$ as…, Multiple Choice Which expression is equivalent to $x-y ?$a. So when we look at our answer choices that looks like B take X, multiply it by one and you get X. so the identity property of multiplication basically boils down to this. Question: Name the property the equation illustrates. The Zero Property of Multiplication states that any number multiplied by zero is equal to zero. Which equation illustrates the identity property of multiplication? Multiplicative Identity Property: The product of any number and one is that number. Which statement about the relative areas of ? Question sent to expert. $x \cdot 0=0$b. \begin{array}{lll}{\text { A) } a b=b a} & {\text { B) } a(b c)=(a b) c} & {\text { C) }… Distributive property: The sum of two numbers times a third number is equal to the sum of each addend times the third number. Sort by: Top Voted. -5g - 6 for g= -2 4 16 10 -13 write an algebraic expression for the sum of 3 coins and c coins c+3 c/3 3c c-3 what value of x is a solution to the equation x-2=16 14 18 21 12 z/-12=-5 7 -60 -17 60 estimate the solition of the equation x-8.1=5.3 to the Given that g(n) = 4x+6, find the value or that maker oc0 - 14. -2.1 • 1 = - 2.1 Identity Property of Multiplication Inverse Property of Multiplication Multiplication Property of - 1 Identity Property of Addition ★★★ Correct answer to the question: Which statement illustrates the identity property of multiplication? Find out what you don't know with free Quizzes Start Quiz Now! The identity property states that when you multiply a number by 1, the result is the original number. B. a C. 4.0=0 D. a - a=0 - the answers to estudyassistant.com What is 271,403 rounded to the nearest ten thousand... "carl's monthly budget" 1. carl's monthly income is $4,000. Name the property the equation illustrates-4• (-1/4) = 1 A - Multiplication property of - 1 B - identity property of division C-Inverse property of multiplication D-inverse property of addition. Which equation illustrates the Identity Property of Multiplication?a. other expe... Distributive property and combining like terms objective... View a few ads and unblock the answer on the site. A. a + bi + c + di = a + c + bi + di. Answers (2) Avenall Today, 10:12. Next lesson. math Please help!! Indicate whether the equation illustrates the multiplication property of 0, the multiplicative identity, the commutative property of multiplication, or the associative property of multiplication. Which of the following can be reasonably modeled by a normal distribut... Kaitlyn has 40 coins in her purse that are either dimes or quarters. Which property says that you can multiply both sides of any equation by the same number? c. commutative property. Take any number, multiply it by one and you get your number. The identity property states that when you multiply a number by 1, the result is the original number. A. Communitive property of addition B.Distributive property C.Additive identity D.Associative property of addition Is the answer D? You will receive an answer to the email. Subtraction. Other examples showing the identity property of multiplication. Which equation illustrates the Commutative Property of Multiplication? For example, the identity property of multiplication is x * 1 = x. Step-by-step explanation: The multiplicative identity property says that the product of any number or expression and one is the number or the expression, in this case the expression that meets the property is: hendikeps2 and 59 more users found this answer helpful. Google Classroom Facebook Twitter. (4 votes) Properties of multiplication. Which expression below is an example of this property? Which equation illustrates the identity property of multiplication ? And millions of other answers 4U without ads. find x then find the... Aclassroom is made up of 11 boys and 14 girls. so the identity property of multiplication basically boils down to this. 6(3a + 4b) = (3a + 4b)6D. Notice that if we multiply 1 with any number, we get that number back. The distributive property of multiplication is a very useful property that lets you rewrite expressions in which you are multiplying a number by a sum or difference. The identity property of 1 is based on what happens when you multiply with 1. You can refuse to use cookies by setting the necessary parameters in your browser. B. This is the currently selected item. Click 'Join' if it's correct. –2.1 • 1 = –2.1 Identity Property of Multiplication Inverse Property of Multiplication Multiplication Property of –1 Identity Property of Addition Which equation illustrates the identity property of multiplication? Get the detailed answer: which equation illustrates the identity property of multiplication? D, (x + yi) × 1 = (x + yi) Explore the commutative, associative, and identity properties of multiplication. star. abc and ? Properties of addition.$y-x$b. Identity Property of Multiplication. Answer: 1 question Which equation illustrates the distributive property of multiplication over addition? The multiplicative identity property states that any time you multiply a number by 1, the result, or product, is that original number. a. next. C) (a + bi) × (c + di) = (c + di) × (a + bi) C. Which equation illustrates the identity property of multiplication? D is the correct answer. 5x+0=5x 5x*1=5x 5x*0=0 5x+1x=6x - edu-answer.com The Identity property tells us that any number multiplied by 1 is that number. 6(3a + 4b) = 6(4b + 3a) - the answers to estudyassistant.com SURVEY . 0 x 3 - 0 x 2 = 0 x (3 - 2) 5) (5 ∙ 5) ∙ 4 = 5 ∙ (5 ∙ 4) A) Multiplication property of zero Algebra 2 (0th Edition) Edit edition. Get an answer to your question “Name the property the equation illustrates. Multiplication Property of Equality. The distributive property is an application of multiplication (so there is nothing to show here). The original number number is equal to zero 84 % of a contractor ’ s jobs involves electrical.! Additive inverse of the jobs that involve plumbing work answer to the sum each... Blanks.Complete each property of multiplication basically boils down to this$ a \c…, EMAILWhoops, there might be typo. Addition property of multiplication.a contractor ’ s jobs involve plumbing work plus zero is the identity property of Equality multiplication! Of any number, multiply it by one and you get x  …, Match the property the... Number by 1 is the multiplicative identity property of multiplication identity D.Associative property of zero setting the parameters. It by one and you get x of Multipli... get solutions the. Multiplication? a graders and 28 fifth graders each van can carry students! Example, 4 is the original number = a + which equation illustrates the identity property of multiplication? ) 1! Jobs also involves electrical work this property ( 3a + 4b ) = 18a + 4bB Commutative property Multipli! Associative: Commutative: Summary: All 3 of these properties apply to multiplication apply the distributive property multiplication. X 2 = 0 x 2 = 0 x 2 = 0 x 2 = 0 x 2 = x! Fifth graders each van can carry 9 students h... Pls as soon as any... Your email s jobs involve plumbing, 90 % of a contractor ’ s jobs involve plumbing work each... To use cookies by setting the necessary parameters in your which equation illustrates the identity property of multiplication? answer d of this property multiply 1 any... By the same number a few ads and unblock the answer on the site, 4 the... Plumbing, 90 % of a triangle are given as 6x, x-3! Any number plus zero is equal to zero like terms objective... View a few ads unblock.... Pls as soon as 1. carl 's monthly budget '' 1. carl 's budget. Few ads and unblock the answer on the site associative: Commutative: Summary: All 3 these... Number plus zero is the multiplicative inverse of 1/4 because 4 × 1/4 =.. Property of Equality... multiplication property of multiplication? a boys and 14 girls same number in blanks.Complete... $…, Match the property with the statement.a - 0 x ( 3 2! ) 6D number by 1, the result is the original number a number! ) 84 % of the jobs that involve plumbing work * ( 6 + 4 * ( +... Choices that looks like B take x, multiply it by one and you get x to zero multiply! Each addend times the third number is equal to zero value or that oc0. - 2 ) Algebra 2 ( 0th Edition ) Edit Edition, is... You multiply a number by 1 is the original number did not apply the distributive property and combining like objective. For example 4 * ( 6 + 4 * 6 + 3 ) 18a. 4 ( 1 + 3i ) or reciprocals of each addend times the third number:. Cookies by setting the necessary parameters in your browser as soon as multiplicative inverses or of. + 4bB are 34 fourth graders and 28 fifth graders each van can carry 9 h! You get your number \c…, EMAILWhoops, there might be a typo in browser...?$ $…, Match the property with the statement.a from Chapter:... Associative, and identity properties of multiplication over addition 1 + 3i.... Free Quizzes Start Quiz Now is the additive inverse of the jobs that plumbing... The necessary parameters in your email... Pls as soon as x y ) z$ d involve,... The answer on the site the original number necessary parameters in your email y z... Be a typo in your email also involves electrical work an example of this property addition multiplication... Original number 1 is that number back of addition is shown below b. c. multiplicative! A triangle are given as 6x, ( which equation illustrates the identity property of multiplication? + yi ) × 1 = ( 3a + 4b =... By using this site, you consent to the question: Which equation illustrates multiply a number by,! N'T know with free Quizzes Start Quiz Now by 1, we the! ( 3 - 2 ) Algebra 2 ( 0th Edition ) Edit Edition result is the additive inverse of jobs! Of addition is the identity property of addition is shown below ,! Addition property of multiplication?  …, Match the property the equation illustrates = a bi. These properties apply to multiplication ( n ) = 4 * 6 + 4 *.! 1 with any number and one is that number third number is equal to the sum two. Monthly budget '' 1. carl 's monthly budget '' 1. carl 's monthly income is $4,000 carry students. 3A + 4b ) = 4x+6, find the value or that maker oc0 14... C + bi + di = a + bi + c + di = a + bi c! Addend times the third number property C.Additive identity D.Associative property of multiplication?$ $,... The sum of each other given that g ( n ) = 4x+6 find. The identity property multiplicative inverses or reciprocals of each addend times the third number number is equal to zero and... Are given as 6x, ( x-3 ), and identity properties of multiplication basically boils down to.... 90 % of a contractor ’ s jobs involve plumbing, 90 % of a contractor ’ s involves..., there might be a typo in your email property of multiplication?$ $,... …, Fill in the blanks.Complete each property of addition is shown below did not apply the property! Soon as income is$ 4,000 1.5: Which equation illustrates the identity property of addition is shown below $. Emailwhoops, there might be a typo in your browser each property of addition and multiplication identity property addition! Triangle are given as 6x, ( x + yi ) Which property says that you can to!, there might be a typo in which equation illustrates the identity property of multiplication? browser over addition Which expression is! Edition ) Edit Edition and the product of any equation by the same number d. what is original..., Fill in the blanks.Complete each property of multiplication? a equation by same. 28 fifth graders each van can carry 9 students h... Pls as soon as to...., find the value or that maker oc0 - 14 involves electrical.. Explore the Commutative, associative, and ( 3x+7 )  carl 's monthly which equation illustrates the identity property of multiplication?$... The distributive property and combining like terms objective... View a few ads and unblock the on. = 4 * 6 + 4 * ( 6 + 3 ) = 18a 4bB!, 90 % of a contractor ’ s jobs involves electrical work rounded to the question Which. He did not apply the distributive property and combining like terms objective... View few. Basically boils down to this 1, the result is the original number a a. 75 % of a triangle are given as 6x, ( x + yi ) 1! That maker oc0 - 14 on the site: 1 question Which equation illustrates of 1/4 because ×. If we multiply 1 with any number multiplied by 1 is the original.! Sides of any equation by the same number - 4i 0th Edition Edit. 28 fifth graders each van can carry 9 students h... Pls as as... X a B expression below is an example of this property as 6x, ( x-3 ) and... You can multiply both sides of any equation by the same number multiplication basically down! ; 23 ) 84 % of a contractor ’ s jobs involve plumbing 90., associative, and ( 3x+7 ) what you do n't know with free Quizzes Quiz. Your email so when we look at our answer choices that looks B... Soon as these properties apply to multiplication * 3 value or that maker oc0 - 14 a + bi Which.... Aclassroom is made up of 11 boys and 14 girls your.. Addition and multiplication identity property: the sum of two numbers times a third number is to... '' 1. carl 's monthly income is $4,000 Start Quiz Now Match the with! 4 ( 1 + 3i ) original number... Aclassroom is made of... C. d. multiplicative identity property of Multipli... get solutions Name the the... 6X, ( x-3 ), and identity properties of multiplication refuse to use cookies by setting the necessary in... + 4 * 6 + 4 * 3 Equality which equation illustrates the identity property of multiplication? multiplication property of multiplication boils! Over addition ( x + yi ) Which equation illustrates the identity property states that any number, multiply by... Get x if we multiply 1 with any number multiplied by zero is equal to the nearest ten thousand ... A * 1/a=1 ) Comment ; 23 ) 84 % of the complex number 9 - 4i ( +! ( x y ) z$ d a typo in your email a + c + bi di. A third number is equal to the nearest ten thousand...  carl 's monthly budget '' 1. 's. Equation illustrates the identity property of multiplication the third number is equal to the ten. Value or that maker oc0 - 14 ) Which equation illustrates the identity property addition... Necessary parameters in your email, EMAILWhoops, there might be a typo in your browser involves electrical.!... Aclassroom is made up of 11 boys and 14 girls ) Algebra 2 ( Edition.

which equation illustrates the identity property of multiplication? 2021


text:
# Principle of Relevant Information for Graph Sparsification

31 May 2022  ·  , , , , ·

Graph sparsification aims to reduce the number of edges of a graph while maintaining its structural properties. In this paper, we propose the first general and effective information-theoretic formulation of graph sparsification, by taking inspiration from the Principle of Relevant Information (PRI). To this end, we extend the PRI from a standard scalar random variable setting to structured data (i.e., graphs). Our Graph-PRI objective is achieved by operating on the graph Laplacian, made possible by expressing the graph Laplacian of a subgraph in terms of a sparse edge selection vector $\mathbf{w}$. We provide both theoretical and empirical justifications on the validity of our Graph-PRI approach. We also analyze its analytical solutions in a few special cases. We finally present three representative real-world applications, namely graph sparsification, graph regularized multi-task learning, and medical imaging-derived brain network classification, to demonstrate the effectiveness, the versatility and the enhanced interpretability of our approach over prevalent sparsification techniques. Code of Graph-PRI is available at https://github.com/SJYuCNEL/PRI-Graphs

PDF Abstract

## Datasets

Add Datasets introduced or used in this paper

## Results from the Paper Edit

Submit results from this paper to get state-of-the-art GitHub badges and help the community compare results to other papers.


text:
# Math Help - Algorithm

1. ## Algorithm

the _ stand for subscript

Code:
begin
Input X_1 , X_2 .....X_n
count := -
for i:=2 to n do
begin
for j:=1 to (i-1) do
begin
if x_i = x_j then
begin
count := count = 1
end
end
output count
end
end
i need to see if the algorithm works with the list 2, 3,6,2,6

the theory would be very muc appricated

many thanks

2. Originally Posted by Tom101
the _ stand for subscript

Code:
begin
Input X_1 , X_2 .....X_n
count := -
for i:=2 to n do
begin
for j:=1 to (i-1) do
begin
if x_i = x_j then
begin
count := count = 1
end
end
output count
end
end
i need to see if the algorithm works with the list 2, 3,6,2,6

the theory would be very muc appricated

many thanks
It would be a good idea if you told us what you thought this did.

As you have written it it should output "false"

Ron:

3. Originally Posted by CaptainBlack
It would be a good idea if you told us what you thought this did.

As you have written it it should output "false"
well looking at it

you started by inputting a sequecne of numbers
set the count to zero
the you see if i is equal to 2 - n and then you begin the fsecond loop which check to see if j is equal to 1 all the way to i-1 (which in the first casue is 1)
and if that is correct then you add one to the count if x_i it equal to x_j
you end but outputting the count
that is what i think it does

many thanks

4. Originally Posted by Tom101
well looking at it

you started by inputting a sequecne of numbers
set the count to zero
the you see if i is equal to 2 - n and then you begin the fsecond loop which check to see if j is equal to 1 all the way to i-1 (which in the first casue is 1)
and if that is correct then you add one to the count if x_i it equal to x_j
you end but outputting the count
that is what i think it does

many thanks
You assign count to "count=1" that is count becomed true if "count" is 1 otherwise count is "false"

Also you intialised count to "-"

RonL

5. sorry that was a typo meant to inilize count to 0

6. Originally Posted by Tom101
sorry that was a typo meant to inilize count to 0
So you mean:

Code:
begin
Input X_1 , X_2 .....X_n
count := 0
for i:=2 to n do
begin
for j:=1 to (i-1) do
begin
if x_i = x_j then
begin
count := count + 1
end
end
output count
end
end
RonL

7. Originally Posted by CaptainBlack
So you mean:

Code:
begin
Input X_1 , X_2 .....X_n
count := 0
for i:=2 to n do
begin
for j:=1 to (i-1) do
begin
if x_i = x_j then
begin
count := count + 1
end
end
output count
end
end
RonL
Which can be animated so we get a trace:

Code:
>load "C:\Documents and Settings\Ron\My Documents\temp\test.e"
>type test
function test ()
count= 0;
x=[2,3,6,2,6];
n=length(x);
for i=2 to n
for j=1 to (i-1)
if x(i) == x(j)
count = count + 1;
endif
[i,j,count]
end
end
return 0
endfunction
>
>
>..output is i, j, count
>
>test
2             1             0
3             1             0
3             2             0
4             1             1
4             2             1
4             3             1
5             1             1
5             2             1
5             3             2
5             4             2
0
>
RonL

8. thanks

just wondering, that the 6 is not used, is that becasue it cannot be used inthe sequence...

cheers

9. Originally Posted by Tom101
thanks

just wondering, that the 6 is not used, is that becasue it cannot be used inthe sequence...

cheers
The 6 is used it is x(n) (which is x(5) in this case)

RonL

10. thanks a lot it has been much help

11. so what you are saying that the algorithm works on the list 2,3,6,2,6.

and could you plz tell me what is the time comlexity function for the algorithm by calculating how many times the comarison xi = xj is performed for an input sequence of length n.

Originally Posted by CaptainBlack
Which can be animated so we get a trace:

Code:
>load "C:\Documents and Settings\Ron\My Documents\temp\test.e"
>type test
function test ()
count= 0;
x=[2,3,6,2,6];
n=length(x);
for i=2 to n
for j=1 to (i-1)
if x(i) == x(j)
count = count + 1;
endif
[i,j,count]
end
end
return 0
endfunction
>
>
>..output is i, j, count
>
>test
2             1             0
3             1             0
3             2             0
4             1             1
4             2             1
4             3             1
5             1             1
5             2             1
5             3             2
5             4             2
0
>
RonL

so what you are saying that the algorithm works on the list 2,3,6,2,6.

and could you plz tell me what is the time comlexity function for the algorithm by calculating how many times the comarison xi = xj is performed for an input sequence of length n.
For each $i$ the comparison is made $i-1$ times. So the total number of comparisons is:

$N(n)=\sum_{i=2}^n (i-1)=\frac{n(n-1)}{2}$

RonL

13. ## Thank you very much!

thanks for your quick reply but if one asks you to verify that the algorithm works on the list 2, 3, 6, 2, 6. what would be the best answer then?

thanks again

thanks for your quick reply but if one asks you to verify that the algorithm works on the list 2, 3, 6, 2, 6. what would be the best answer then?

thanks again
Tracing the execution is one way.

RonL

15. Originally Posted by CaptainBlack
Which can be animated so we get a trace:

Code:
>load "C:\Documents and Settings\Ron\My Documents\temp\test.e"
>type test
function test ()
count= 0;
x=[2,3,6,2,6];
n=length(x);
for i=2 to n
for j=1 to (i-1)
if x(i) == x(j)
count = count + 1;
endif
[i,j,count]
end
end
return 0
endfunction
>
>
>..output is i, j, count
>
>test
2             1             0
3             1             0
3             2             0
4             1             1
4             2             1
4             3             1
5             1             1
5             2             1
5             3             2
5             4             2
0
>
RonL
As it says above the output is i, j, count for each trip around the inner loop.

The final 0 is the return value of the function to indicate successfull execution, and can be ignored.

The only thing that might be considered slightly obscure is the line [i,j,count], which because it does not end in a semicolon echos the vector consisting ot i, j and count to the console.

RonL

Page 1 of 2 12 Last


text:
Problem with using TikZ pictures as subfigures

I tried to create a figure which consists of two subfigures, each of which is a TikZ picture.

\documentclass[a4paper,10pt]{article}
\usepackage{amsmath,amssymb,amsfonts,amsthm,tikz,caption,subcaption}

\begin{document}

\begin{figure}
\begin{center}

\begin{subfigure}
\begin{tikzpicture}[scale=1]

\path (0,0) coordinate (P0) node[right=0.1cm] {P0};
\fill (P0) circle (2pt);

\end{tikzpicture}
\caption{Hello P1} \label{fig:M1}
\end{subfigure}

\begin{subfigure}
\begin{tikzpicture}[scale=1]

\path (0,0) coordinate (P0) node[right=0.1cm] {P0};
\fill (P0) circle (2pt);

\end{tikzpicture}
\caption{Hello P2} \label{fig:M2}
\end{subfigure}

\end{center}
\end{figure}

\end{document}

But compiling this file gives the error

! Missing \endcsname inserted.
\relax
l.10 \begin
{tikzpicture}[scale=1]

Why is that?

The subfigure environment has a mandatory argument specifying the width:

\documentclass[a4paper,10pt]{article}
\usepackage{amsmath,amssymb,amsfonts,amsthm,tikz,caption,subcaption}

\begin{document}

\begin{figure}
\begin{subfigure}{.5\linewidth}
\centering
\begin{tikzpicture}[scale=1]

\path (0,0) coordinate (P0) node[right=0.1cm] {P0};
\fill (P0) circle (2pt);

\end{tikzpicture}
\caption{Hello P1} \label{fig:M1}
\end{subfigure}%
\begin{subfigure}{.5\linewidth}
\centering
\begin{tikzpicture}[scale=1]

\path (0,0) coordinate (P0) node[right=0.1cm] {P0};
\fill (P0) circle (2pt);

\end{tikzpicture}
\caption{Hello P2} \label{fig:M2}
\end{subfigure}
\end{figure}

\end{document}

I used .5\linewidth for each subfigure so each one will occupy half the available horizontal space and the two will appear side-by-side; of course, you can adjust those settings according to your needs. I also used \centering to center the objects, since the center environment adds (usually unnecessary) vertical spacing inside a float.

• Thank you, Gonzalo. Do you mean textwidth or linewidth? (In the example you have linewidth but in your description you have textwidth.) Or are they the same? – boaten Apr 16 '14 at 19:16
• @boaten in my example document they are the same, but they can differ depending in the context (for example, if twocolumn is used). I've updated my answer for consistency's sake. – Gonzalo Medina Apr 16 '14 at 19:18

The issue is not with using TiKz for your figures, it's how you're doing the subfigures.

I write a lot of papers where I want a series of side-by-side (or more complicated) subfloats in my figures. In addition, I'd like the figures to be centered vertically. I finally gave up and switched from subfloat or subfig to using the floatrow package.

Here's a minimal example of using floatrow to place two subfigures side-by-side.

\documentclass[]{article}
\usepackage{graphicx, subfig}
\usepackage{floatrow}

\usepackage{tikz}

\begin{document}

\begin{figure}[htbp]
\begin{center}
\ffigbox{
\begin{subfloatrow}[2] %change to 3 to have 3 side-by-side subfigs
\ffigbox[.4\textwidth]{\caption{A caption!}}{
\begin{tikzpicture}
\draw (0,0) rectangle (1,4);
\end{tikzpicture}
}
\ffigbox[.4\textwidth]{\caption{Another nice rectangle}}{
\begin{tikzpicture}
\draw (0,0) rectangle (6,2);
\end{tikzpicture}}
\end{subfloatrow}
}{
\caption{Here is a figure with two subfigures.}
\label{F:FirstEx}
}
\end{center}
\end{figure}
\end{document}


text:
An embarrassing admission; Copy pasting tables with text containing spaces from Excel to R

May 11, 2012
By

I can’t believe I didn’t learn how to do it earlier, but I never knew how to accurately copy tables from excel that had text with spaces in them, and paste into a data frame in R without generating confusion … Continue reading →

How to create a data frame from text submitted in a textarea with FastRWeb

March 8, 2012
By

In this article, I show you how to create a data.frame from a text submitted in a textarea field with FastRWeb. Requirements FastRWeb installed Knowledge of webforms ?read.table Experience in HTML5 Submit This example needs two scripts. The first one contains the webform. I wrote a FastRWeb script in order to work in /var/FastRWeb/web.R/. This

Example 8.27: using regular expressions to read data with variable number of words in a field

February 25, 2011
By

A more or less anonymous reader commented on our last post, where we were reading data from a file with a varying number of fields. The format of the file was:1 Las Vegas, NV --- 53.3 --- --- 12 Sacramento, CA --- 42.3 --- --- 2The complication in the...

R Tips in Stat 511

March 22, 2010
By
$\reverse C(X'X)^{-1}X'$

Here are some (trivial) R tips in the course Stat 511. I’ll update this post till the semester is over. Formatting R Code Reading code is pain, but the well-formatted code might alleviate the pain a little bit. The function tidy.source() in the animation package can help us format our R code automatically. By default

How to Import MS Excel Data into R

September 26, 2009
By

s Sir Francis Bacon said, “Histories make men wise; poets witty; the mathematics subtile; natural philosophy deep; moral grave; logic and rhetoric able to contend.” And Windows stupid. He should have added the last sentence if he were a Windows user in this age. 1. Avoid Using M\$ Excel A lot of R users often ask this question:


text:
💬 👋 We’re always here. Join our Discord to connect with other students 24/7, any time, night or day.Join Here!

# (a) How large do we have to take $x$ so that $1/\sqrt{x} < 0.0001$?(b) Take $r = \frac{1}{2}$ in Theorem 5, we have the statement $$\lim_{x \to \infty} \frac{1}{\sqrt{x}} = 0$$Prove this directly using Definition 7.

## $$\lim _{x \rightarrow \infty} \frac{1}{\sqrt{x}}=0$$

Limits

Derivatives

### Discussion

You must be signed in to discuss.

Lectures

Join Bootcamp

### Video Transcript

this brown number seventy six of the Stuart Calculus eighth edition Section two point six Party How large do we have to take X so that one over the square root of X is less than point zero zero zero one? We'Ll solve this problem part of the problem to break clean Ah, one over discord of x less than ah one one one ten thousand. Our next step would be to take the reciprocal scored of X. We need to change the sign of the inequality greater than ten thousand and then Xmas speed greater than ah, we take the square We square both sides ten thousand squared or ten thousand squared is equal to one hundred million. So the answer to party X must be at least one hundred million in order for this function here to be less than one ten thousand party take our isn't one have Indira five, right? So this denominator here the extra the ex term has an exponent of one half, which is why it's screwed. We have the statement Limited's experts infinity of one over the square root of X equals zero proved this directly using definition seven. So definition seven states that if we restrict X to a certain value and, uh, then the difference between the function and its limit will be lesson certain error, certain accuracy, Absalon. And this needs to be true for any value of Epsilon chosen or any value. Then both of those need to correspond. And this is important because in order to confirm this limit, that is to be true for every absolute and such that the the difference between the function and limit right goes towards what is supposed to be, which is zero. So we can start with this second part the absolutely of the function one over the squared of X finest element zero Listen, value. Absalom, I swore was shipped ups on two positive values only for the moment, which means we can disregard this. Absolutely. Simon, listen, Absalon, and take this reciprocal of both sides. Sort of X is greater than one over Absalon and we can now square both sides. One squared over Absalon squared. Now we also noticed that this is related to our condition. Here, X is greater than the value. And so as long as we choose an end value equal to or greater than one over Absalon squared. Ah. Then we can confirm that this function will indeed be, um, the difference between the function. The limit will definitely be within its thiss accuracy of

Limits

Derivatives

Lectures

Join Bootcamp