-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Python Challenges to Repository
- Loading branch information
Showing
11 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
monthlypythonproblem/Clipping_Related_Tables/Clipping_Related_Tables_Problem.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Binary file not shown.
Binary file added
BIN
+1.58 MB
monthlypythonproblem/Clipping_Related_Tables/Fish_Releases_Public.xls
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+16.8 KB
monthlypythonproblem/Clipping_Related_Tables/Link_list_mastersheet.xlsx
Binary file not shown.
Binary file added
BIN
+35.6 KB
monthlypythonproblem/Clipping_Related_Tables/Stocked_assessments.xlsx
Binary file not shown.
Binary file added
BIN
+90.7 KB
monthlypythonproblem/Clipping_Related_Tables/Wild_Lakes_Game_Fish.xlsx
Binary file not shown.
Binary file added
BIN
+145 KB
monthlypythonproblem/Clipping_Related_Tables/Wild_Lakes_Other_Fish.xlsx
Binary file not shown.
20 changes: 20 additions & 0 deletions
20
monthlypythonproblem/Find_Coniferous_Stands_In_VRI/Find_Coniferous_Stands_In_VRI_Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
Binary file added
BIN
+2.67 MB
monthlypythonproblem/Find_Coniferous_Stands_In_VRI/VRI_Comp_Poly_R1_Cleaned.xls
Binary file not shown.