Closed corviday closed 1 year ago
We have changed how we handle salmon populations; they are now stored in a postGIS database, instead of shapefiles. This script is no longer needed (though we need a script to add population data to the postGIS database instead).
This command line script should take two inputs - a shapefile (map file) containing a number of named regions, and a CSV file (spreadsheet) that, for each watershed, lists whether a particular group of salmon (conservation unit) is present in that region. We'd like the information about which species of salmon is present to be added to the map file so it can be displayed on the BC-SRIF portal.
CSV FORMAT The CSV has a row for each watershed, identified by watershed code (
WTRSHDGRPC
), and a column for each individual salmon population; it looks like this:This tells us that the salmon population
cc_ck_509
is not present in the PORI watershed, butcc_ck_510
is present in this watershed. The first part of the salmon population code is the region:The second part of the salmon population code is the species:
For each watershed, we'd like to be able to display on the website which region it was in and which salmon species are present. In the shapefile, we'd like to add a region property and an attribute for each of the species of salmon, which we can figure out from the codes of the salmon populations present in each watershed. So add properties named "region", "chinook", "chum", etc. I think spaces might cause trouble in property names, so use an underscore for the two-word species names.
So if, for example, the salmon group
cc_ck_509
is present in watershedPORI
, this is a population of Chinook salmon on the Central Coast, and we know thatPORI
is in the Central Coast region and is home to some Chinook salmon.cc_pke_304
might also be marked as present inPORI
, which would mean Pink Even salmon were present in this watershed as well.Set the region property to the name of the region (all salmon populations in a watershed should have the same regio, a watershed can only be in one region) and set the species property to 1 if one or more of the salmon populations present are that species, and 0 otherwise.
Useful notes:
DESCRIPTION
explaining what the script does with examples on how to use it