Generate Species Matrix

Titleā€ƒ Generate Species Matrix


Exports a presence/absence matrix for the specified species/groups and the specified presence types in all HUC12s. It exports the data as a csv file into the folder specified in the Output Folder parameter. HUC12s are rows in the output matrix and species are columns.



generatematrix2 ({Species_and_Groups}, Species_and_Groups_Holder, Presence_Types, Output_Folder, Present_Value, Not_Present_Value, {QC_Data_Only}, {Use_Scientific_Names}, Zone_Table, Zone_Field, {Database_Query})

Parameter Explanation Data Type
Species_and_Groups (Optional) Dialog Reference

Select the set of species or groups to include in the presence/absence matrix. When you select one, it will appear in the next box down (which is the holder for these items), indicating it is selected for output.

This field supports autocomplete when you type more than 5 characters and position your cursor outside the box

Species_and_Groups_Holder Dialog Reference

Holds the items selected in the previous box. Uncheck an item to remove it.

Multiple Value
Presence_Types Dialog Reference

When presence types are checked here for inclusion, then a species will show as present in the output matrix if and only if they are present in one of these presence types.

Multiple Value
Output_Folder Dialog Reference

Choose the folder to output the matrix into. A file named HUC12FullState_presence_matrix.csv will be output into that folder

Present_Value Dialog Reference

Choose the value to place in the matrix when a species is present in a given HUC12

Not_Present_Value Dialog Reference

Choose the value to place in the matrix when a species is not present in a given HUC12

QC_Data_Only (Optional) Dialog Reference

Choose whether you want the matrix to only include quality controlled data. When unchecked, all live data in the PISCES observations table will be queried for the resulting matrix.

Use_Scientific_Names (Optional) Dialog Reference

When checked, the species names in the columns will be scientific names rather. When unchecked, the tool outputs common names instead.

Zone_Table Dialog Reference

Choose the table that includes the list of zones to query. If you wish to subset to a region, you will need to export that region as a feature class into the PISCES database first and then specify it here.

Zone_Field Dialog Reference

The field in the zones table that indicates a unique zone (such as the field HUC_12 in the HUC12FullState layer)

Database_Query (Optional) Dialog Reference

Don't touch this unless you know what you're doing.

This field overrides the default database query of this tool so that you can use it to generate matrices of other types of PISCES data (so, say you want to see HUCs that were specifically invalidated for each species). This will cause the script to ignore the presence types you specify above so you will need to include that in your query in numerical form.

The default query is of the form: "select Zone_ID from Observations where Species_ID = ? and Presence_Type in (1,3,6,7,9)"

Where (1,3,6,7,9) is updated to the types of presence you specify. Your query MUST include a "?" as a species FID replacement variable, or this script will break. Other than that, pull in whatever data you need, so long as it returns HUCs that represent something about a species at a location.


Code Samples


generate, matrix, species, export, presence, absence, translate, send


Use limitations