diff --git a/monthlypythonproblem/Clipping_Related_Tables/Clipping_Related_Tables_Problem.md b/monthlypythonproblem/Clipping_Related_Tables/Clipping_Related_Tables_Problem.md new file mode 100644 index 0000000..6277096 --- /dev/null +++ b/monthlypythonproblem/Clipping_Related_Tables/Clipping_Related_Tables_Problem.md @@ -0,0 +1,11 @@ +** Press Ctrl+Shift+V to view Markdown Text + +# Problem #1 - "Clipping" Data in Related Tables +You have a shapefile of lakes in the Omineca Region called Management Objectives. It was created by using the Omineca Wildlife Habitat Areas clipping the freshwater atlas layer. (For this exercies it is "Join Table") +This shapefile has 7 tables related to it. The tables are all related to the Management Objectives with Waterbody ID as the primary key. +Unfortunately, all of the tables contain data not just for Omineca, but the whole Province of BC. The client wants you to remove all data that is not in the Omineca region so that the related tables only contain the data for Omineca. If all the data was spatialized, you could use the Omineca Polygon to clip the related table data. However, the data isn't spatialized so you will need to use python to clean the data. + +Hint** The Join Table (aka our shapefile) is already clipped to Omineca. Therefore, every waterbody Id in the join table is an Omineca Waterbody + +Tables are here: (Make a copy in your working drive) + \\spatialfiles.bcgov\work\srm\nel\Local\Geomatics\Workarea\csostad\FishDataWebmap\ExcelSheets\Cleaned_Sheets_Master - Copy diff --git a/monthlypythonproblem/Clipping_Related_Tables/DockList_stocked.xlsx b/monthlypythonproblem/Clipping_Related_Tables/DockList_stocked.xlsx new file mode 100644 index 0000000..69bc564 Binary files /dev/null and b/monthlypythonproblem/Clipping_Related_Tables/DockList_stocked.xlsx differ diff --git a/monthlypythonproblem/Clipping_Related_Tables/Fish_Releases_Public.xls b/monthlypythonproblem/Clipping_Related_Tables/Fish_Releases_Public.xls new file mode 100644 index 0000000..e411c52 Binary files /dev/null and b/monthlypythonproblem/Clipping_Related_Tables/Fish_Releases_Public.xls differ diff --git a/monthlypythonproblem/Clipping_Related_Tables/Join_Table.xlsx b/monthlypythonproblem/Clipping_Related_Tables/Join_Table.xlsx new file mode 100644 index 0000000..4a3eb53 Binary files /dev/null and b/monthlypythonproblem/Clipping_Related_Tables/Join_Table.xlsx differ diff --git a/monthlypythonproblem/Clipping_Related_Tables/LakeSurveys.xlsx b/monthlypythonproblem/Clipping_Related_Tables/LakeSurveys.xlsx new file mode 100644 index 0000000..8f92aa3 Binary files /dev/null and b/monthlypythonproblem/Clipping_Related_Tables/LakeSurveys.xlsx differ diff --git a/monthlypythonproblem/Clipping_Related_Tables/Link_list_mastersheet.xlsx b/monthlypythonproblem/Clipping_Related_Tables/Link_list_mastersheet.xlsx new file mode 100644 index 0000000..5cda890 Binary files /dev/null and b/monthlypythonproblem/Clipping_Related_Tables/Link_list_mastersheet.xlsx differ diff --git a/monthlypythonproblem/Clipping_Related_Tables/Stocked_assessments.xlsx b/monthlypythonproblem/Clipping_Related_Tables/Stocked_assessments.xlsx new file mode 100644 index 0000000..348ae59 Binary files /dev/null and b/monthlypythonproblem/Clipping_Related_Tables/Stocked_assessments.xlsx differ diff --git a/monthlypythonproblem/Clipping_Related_Tables/Wild_Lakes_Game_Fish.xlsx b/monthlypythonproblem/Clipping_Related_Tables/Wild_Lakes_Game_Fish.xlsx new file mode 100644 index 0000000..c77731a Binary files /dev/null and b/monthlypythonproblem/Clipping_Related_Tables/Wild_Lakes_Game_Fish.xlsx differ diff --git a/monthlypythonproblem/Clipping_Related_Tables/Wild_Lakes_Other_Fish.xlsx b/monthlypythonproblem/Clipping_Related_Tables/Wild_Lakes_Other_Fish.xlsx new file mode 100644 index 0000000..e67964a Binary files /dev/null and b/monthlypythonproblem/Clipping_Related_Tables/Wild_Lakes_Other_Fish.xlsx differ diff --git a/monthlypythonproblem/Find_Coniferous_Stands_In_VRI/Find_Coniferous_Stands_In_VRI_Problem b/monthlypythonproblem/Find_Coniferous_Stands_In_VRI/Find_Coniferous_Stands_In_VRI_Problem new file mode 100644 index 0000000..528b661 --- /dev/null +++ b/monthlypythonproblem/Find_Coniferous_Stands_In_VRI/Find_Coniferous_Stands_In_VRI_Problem @@ -0,0 +1,20 @@ +# Find Only Coniferous Stands In VRI Data + +### From the Client: + +**"Conifer stand – I looked up the definition of what a conifer stand is to be sure – in our case, a conifer stand is any stand with less than 25% deciduous species. +This means that we can still have deciduous species in the SPEC_CD_1 to SPEC_CD_6 fields of the VRI. + +Broadleaf species are "D", "DR", "DG","DM","U", "UP", "A", "AC", "ACB", "ACT", "AX", "AT", "R", "RA", "E", "EA", "EXP", "EP", "EW","G","GP", "M", "MB", "MV", "Q", "QG", "XH", "V", "VB", "VP", "W", "WS", "WA", "WB", "WD", "WP", "WT","ZH"** + +So for any given polygon, if any of the species code listed above are in any of the SPEC_CD_1 to SPEC_CD_6 fields AND add up to more than 25% in the SPEC_PCT_1 to SPEC_PCT_6 fields combined, then we would drop that polygon. " + + +The python script should iterate through each of Species Code 1 - Species Code 6 +If the species code contains a broadleaf species, it should read the percentage for that column. (Species_1_PCT) +if the species_pct is greater than 25%, delete the row. +if the species_pct is less than 25%, read the next species code (Species_Code_2). +If THAT species code contains a broadleaf species, add that value to the first broadleaf species percentage (if there was one) +If the new total is greater than 25%, delete the row. +Continue to iterate over each column 1 - 6 until all broadleaf species polygons of greater than 25% are eliminated. + diff --git a/monthlypythonproblem/Find_Coniferous_Stands_In_VRI/VRI_Comp_Poly_R1_Cleaned.xls b/monthlypythonproblem/Find_Coniferous_Stands_In_VRI/VRI_Comp_Poly_R1_Cleaned.xls new file mode 100644 index 0000000..e1193ae Binary files /dev/null and b/monthlypythonproblem/Find_Coniferous_Stands_In_VRI/VRI_Comp_Poly_R1_Cleaned.xls differ