1 / 12

Python Final Project: 303d Impairments

Python Final Project: 303d Impairments. Laurel Warddrip W1213599 Spring 2015 Geog 375. Project Statement. Goal: Use Python to pull out impaired water bodies within a selected regional water board boundary and quickly get information back in a table format that answered the question.

ritae
Télécharger la présentation

Python Final Project: 303d Impairments

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Python Final Project: 303d Impairments Laurel Warddrip W1213599 Spring 2015 Geog 375

  2. Project Statement • Goal: Use Python to pull out impaired water bodies within a selected regional water board boundary and quickly get information back in a table format that answered the question..

  3. Project Data Glossary • Impaired Water Bodies: A waterbody (i.e., stream reaches, lakes, waterbody segments) with chronic or recurring monitored violations of the applicable numeric and/or narrative water quality criteria. (US EPA definition) • Regional Water Boards: The State Water Resources Control Board has jurisdiction throughout California. Created by the State Legislature in 1967, the Board protects water quality by setting statewide policy, coordinating and supporting the Regional Water Board efforts, and reviewing petitions that contest Regional Board actions. There are nine regional water quality control boards that exercise rulemaking and regulatory activities by basins. This organization is a result of the landmark Porter-Cologne Act. Source: State Water Resources Control Board Fact Sheet

  4. The Key Data • 2010 303d impaired water bodies • Regional Water Boards

  5. Python Steps • Set up workspace • Set up variables • Creating Feature Layers • Set up proper queries and selections • Create print statements to help check work/count records • Export the product (.dpf file of water bodies)

  6. Setting up Variables # local variables regional_fc = "regions.shp" region_layer = "region_ly" imp_line_fc = "EPAapr_lines.shp" imp_line_layer = "imp_l_layer" out_imp_fc = "out_imp.shp" out_imp_attributes = "out_imp_attrib.dbf“ Challenges: Creating shapefiles, cannot use GDB feature classes. Ensuring naming matches the features names.

  7. Setting up Variables/Print Statements # make a feature layer and check to see if the feature layer exists; if so, delete it for regions and impairments if arcpy.Exists(region_layer): arcpy.Delete_management(region_layer) arcpy.MakeFeatureLayer_management(regional_fc, region_layer) result = arcpy.GetCount_management(regional_fc) print "Number of features in the feature class " + regional_fc + " : " + str(result) Challenges: Forgot to create shapefiles, figured this out and ran smooth. Print statements really helpful and ensured that the correct programming was taking place.

  8. Proper Queries and Selections query = """"HRC" = 'SC'"“" arcpy.SelectLayerByLocation_management(imp_line_layer, "WITHIN", region_layer, "", "ADD_TO_SELECTION") Challenges: Ensured that query made sense using ArcMap, then created the query in python. Also tested the selection logic using ArcMap, helped a lot when completing the correct query to get desired results (took a couple tries).

  9. Export the Product #write out selected imparments to a standalone table that is new if arcpy.Exists(out_imp_attributes): arcpy.Delete_management(out_imp_attributes) arcpy.CopyRows_management (imp_line_layer, out_imp_attributes) print"Copied selected attributes from " + imp_line_layer +" to " + out_imp_attributes Challenges: Ensuring that you use a layer for this part of the code and setting up/using the proper variables.

  10. Code: It worked!

  11. Product

  12. Wrap-Up • This output could be easily added to a website or as part of another analysis. • Could add extra queries and selections for specific water bodies or specific hydrologic units. • Could export to a shapefile to view in ArcMap. • Can be easily updated when a new impaired water body list comes out.

More Related