SlideShare a Scribd company logo
1 of 71
Download to read offline
PYTHON IN CIVIL AND
ENVIRONMENTAL ENGINEERING
PAUL HOBSON
GEOSYNTEC CONSULTANTS
PDX PYTHON 2016-03-24
PYTHON IN CIVIL ENGINEERING
HEALTH AND SAFETY
▸ Nearest exit in case of emergency
▸ Ergonomics
▸ Right angles
▸ Head level
▸ Take breaks, look and move around
PYTHON IN CIVIL ENGINEERING
I’M AN ENGINEER (I STUDIED MUD)
▸ What is Civil Engineering?
▸ Structural
▸ Transportation
▸ Construction Management
▸ Geotechnical
▸ Environmental
▸ Water and Natural Resources
PYTHON IN CIVIL ENGINEERING
I’M AN ENGINEER (I STUDIED MUD)
▸ What is Civil Engineering?
▸ Structural
▸ Transportation
▸ Construction Management
▸ Geotechnical
▸ Environmental
▸ Water and Natural Resources
Thesis Title:
Rheologic and Flume Erosion
Characteristics of Georgia
Sediments at Bridge Piers
PYTHON IN CIVIL ENGINEERING
I’M AN ENGINEER (I STUDIED MUD)
▸ What is Civil Engineering?
▸ Structural
▸ Transportation
▸ Construction Management
▸ Geotechnical
▸ Environmental
▸ Water and Natural Resources
Thesis Title:
Rheologic and Flume Erosion
Characteristics of Georgia
Sediments at Bridge Piers
PYTHON IN CIVIL ENGINEERING
I WORK AS AN ENVIRONMENTAL CONSULTANT
▸ Help industry with compliance and remediation
▸ Litigation support for allocation of environmental
damages
▸ Grant-funded research with NCHRP, FHWA, WERF
PYTHON IN CIVIL ENGINEERING
I WORK AS AN ENVIRONMENTAL CONSULTANT
PYTHON IN CIVIL ENGINEERING
I WORK AS AN ENVIRONMENTAL CONSULTANT
▸ Build spatial databases of contaminant concentrations
PYTHON IN CIVIL ENGINEERING
I WORK AS AN ENVIRONMENTAL CONSULTANT
▸ Build spatial databases of contaminant concentrations
▸ Scrape the web (brute force) to meteorologic and
hydrologic data
PYTHON IN CIVIL ENGINEERING
I WORK AS AN ENVIRONMENTAL CONSULTANT
▸ Build spatial databases of contaminant concentrations
▸ Scrape the web (brute force) to meteorologic and
hydrologic data
▸ Statistical analysis of pollution mitigation and remediation
systems
PYTHON IN CIVIL ENGINEERING
I WORK AS AN ENVIRONMENTAL CONSULTANT
▸ Build spatial databases of contaminant concentrations
▸ Scrape the web (brute force) to meteorologic and
hydrologic data
▸ Statistical analysis of pollution mitigation and remediation
systems
▸ Build inputs for, run, and analyze output from vetted
numerical models
PYTHON IN CIVIL ENGINEERING
I WORK AS AN ENVIRONMENTAL CONSULTANT
▸ Build spatial databases of contaminant concentrations
▸ Scrape the web (brute force) to meteorologic and
hydrologic data
▸ Statistical analysis of pollution mitigation and remediation
systems
▸ Build inputs for, run, and analyze output from vetted
numerical models
▸ Build tools to help my colleagues do the same
PYTHON IN CIVIL ENGINEERING
SUMMARY FOR THE REST OF THE TALK
▸ My take on the general state of the practice in engineering
consulting
▸ Characteristic challenges of environmental consulting
▸ Tools I like to use
▸ Tools I have built over the course of my career
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DATABASES
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DATABASES
▸ Overwhelming everything is in MS Access
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DATABASES
▸ Overwhelming everything is in MS Access
▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the
same architecture to work together
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DATABASES
▸ Overwhelming everything is in MS Access
▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the
same architecture to work together
▸ Last Client’s DB
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DATABASES
▸ Overwhelming everything is in MS Access
▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the
same architecture to work together
▸ Last Client’s DB
▸ 110 tables
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DATABASES
▸ Overwhelming everything is in MS Access
▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the
same architecture to work together
▸ Last Client’s DB
▸ 110 tables
▸ 200 saved insert/create/update
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DATABASES
▸ Overwhelming everything is in MS Access
▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the
same architecture to work together
▸ Last Client’s DB
▸ 110 tables
▸ 200 saved insert/create/update
▸ 100 save select and pivot queries
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DATABASES
▸ Overwhelming everything is in MS Access
▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the
same architecture to work together
▸ Last Client’s DB
▸ 110 tables
▸ 200 saved insert/create/update
▸ 100 save select and pivot queries
▸ 25 queries that deleted stuff
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DATABASES
▸ Overwhelming everything is in MS Access
▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the
same architecture to work together
▸ Last Client’s DB
▸ 110 tables
▸ 200 saved insert/create/update
▸ 100 save select and pivot queries
▸ 25 queries that deleted stuff
▸ Everything connected with 40 VBA forms, 15 utility modules (9000 LOC)
PYTHON IN CIVIL ENGINEERING
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - ANALYSIS
▸ Excel is the behemoth that cannot be stopped
▸ Most people manage their data with it
▸ No one follows best practices (www.datacarpentry.org/
spreadsheet-ecology-lesson)
▸ Will be pried from cold dead hands, despite will published
statistical errors (resolved, IIRC)
PYTHON IN CIVIL ENGINEERING
MANNING’S EQUATION
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
▸ GUI or cmd-line based numerical models maintained
by federal agencies
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
▸ GUI or cmd-line based numerical models maintained
by federal agencies
▸ SWMM
▸ 1-D urban hydrology
▸ Written in very legible C
▸ Open source
▸ Maintained by EPA, transitioning to UT Austin
▸ Compiles on Linux and Windows
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
▸ GUI or cmd-line based numerical models maintained
by federal agencies
▸ SWMM
▸ 1-D urban hydrology
▸ Written in very legible C
▸ Open source
▸ Maintained by EPA, transitioning to UT Austin
▸ Compiles on Linux and Windows
▸ HEC-RAS
▸ 2-D River hydraulics
▸ Completely closed source
▸ Guarded over by US Army Corps of Engineers
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
▸ GUI or cmd-line based numerical models maintained
by federal agencies
▸ SWMM
▸ 1-D urban hydrology
▸ Written in very legible C
▸ Open source
▸ Maintained by EPA, transitioning to UT Austin
▸ Compiles on Linux and Windows
▸ HEC-RAS
▸ 2-D River hydraulics
▸ Completely closed source
▸ Guarded over by US Army Corps of Engineers
▸ EFDC
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
▸ GUI or cmd-line based numerical models maintained
by federal agencies
▸ SWMM
▸ 1-D urban hydrology
▸ Written in very legible C
▸ Open source
▸ Maintained by EPA, transitioning to UT Austin
▸ Compiles on Linux and Windows
▸ HEC-RAS
▸ 2-D River hydraulics
▸ Completely closed source
▸ Guarded over by US Army Corps of Engineers
▸ EFDC
▸ Spaghetti FORTRAN
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
▸ GUI or cmd-line based numerical models maintained
by federal agencies
▸ SWMM
▸ 1-D urban hydrology
▸ Written in very legible C
▸ Open source
▸ Maintained by EPA, transitioning to UT Austin
▸ Compiles on Linux and Windows
▸ HEC-RAS
▸ 2-D River hydraulics
▸ Completely closed source
▸ Guarded over by US Army Corps of Engineers
▸ EFDC
▸ Spaghetti FORTRAN
▸ Compiles on Linux but results are
garbage
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
▸ GUI or cmd-line based numerical models maintained
by federal agencies
▸ SWMM
▸ 1-D urban hydrology
▸ Written in very legible C
▸ Open source
▸ Maintained by EPA, transitioning to UT Austin
▸ Compiles on Linux and Windows
▸ HEC-RAS
▸ 2-D River hydraulics
▸ Completely closed source
▸ Guarded over by US Army Corps of Engineers
▸ EFDC
▸ Spaghetti FORTRAN
▸ Compiles on Linux but results are
garbage
▸ 3-D river hydraulics, sediment and
pollutant fate and transport
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
▸ GUI or cmd-line based numerical models maintained
by federal agencies
▸ SWMM
▸ 1-D urban hydrology
▸ Written in very legible C
▸ Open source
▸ Maintained by EPA, transitioning to UT Austin
▸ Compiles on Linux and Windows
▸ HEC-RAS
▸ 2-D River hydraulics
▸ Completely closed source
▸ Guarded over by US Army Corps of Engineers
▸ EFDC
▸ Spaghetti FORTRAN
▸ Compiles on Linux but results are
garbage
▸ 3-D river hydraulics, sediment and
pollutant fate and transport
▸ Very optimized: 1 yr simulation takes ~
1 day
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
PYTHON IN CIVIL ENGINEERING
PYTHON IN CIVIL ENGINEERING
STATE OF THE PRACTICE - DOMAIN SPECIFIC TOOLS
▸ All (numerically) solve the St. Venant Equations
▸ Differential equations in time and space
▸ Very difficult to even work with symbolically
▸ Large code bases
▸ Represent a significant intellectual investment from civil/
environmental community
PYTHON IN CIVIL ENGINEERING
WHERE DOES PYTHON FIT IN ALL OF THIS?
▸ Scrape model inputs from web
▸ Hack input files for batch processing
▸ Move data around between formats
▸ General data and model results analysis
▸ (Rarely) Wrap C/Fortran libraries with ctypes/cython/
numpy
PYTHON IN CIVIL ENGINEERING
CIVIL/ENVIRONMENTAL CHALLENGES
▸ Arcane input file formats
▸ Left-censored (non-detect) data
▸ Non-parametric statistics
▸ Regression-on-order statistics
▸ Kaplan-Meier
▸ Project management inertia
▸ Disconnect between libraries and project needs
▸ ~5 coworkers (out of ~600) are comfortable with python
PYTHON IN CIVIL ENGINEERING
TOOLS I USE
▸ numpy/scipy
▸ Fast numeric arrays implemented in C
▸ Specialized scientific functions
▸ Matplotlib/seaborn: generic and statistical 2-D visualizations
▸ pandas/statsmodels: table-like data structures and statistical models
▸ Jupyter: interactive computing via notebooks
▸ conda: sane installation of python packages on Windows and other
operating systems
PYTHON IN CIVIL ENGINEERING
PYTHON IN CIVIL ENGINEERING
SCRAPING WEATHER DATA
▸ conda install —channel=phobson cloudside
▸ Python 3 fork of python-metar by Tom Pollard (github.com/tomp/python-
metar.git)
▸ ~1000 lines of regex
▸ Cloudside uses python-metar to pull 5-min and hourly data from the FAA
▸ ~1000 lines of regex
▸ 24229KPDX PDX20120101000009801/01/12 00:00:31 5-MIN KPDX
010800Z 31005KT 10SM OVC085 04/02 A3026 -280 85 -1500 290/05
RMK A02 P0005
PYTHON IN CIVIL ENGINEERING
WEATHER DATA
▸ Simple commands for bulk data download and parsing
▸ Creates a directory structure for each station, source, and
stage of processing
▸ searches for existing files before attempting to download or
parse
▸ High-level plotting functions
PYTHON IN CIVIL ENGINEERING
PYTHON IN CIVIL ENGINEERING
PYTHON IN CIVIL ENGINEERING
WQIO - WATER QUALITY, INFLOW/OUTFLOW
PYTHON IN CIVIL ENGINEERING
WQIO - WATER QUALITY, INFLOW/OUTFLOW
▸ conda install --channel=phobson wqio
PYTHON IN CIVIL ENGINEERING
WQIO - WATER QUALITY, INFLOW/OUTFLOW
▸ conda install --channel=phobson wqio
▸ Centered around examining the efficacy of so-called BMPs
PYTHON IN CIVIL ENGINEERING
WQIO - WATER QUALITY, INFLOW/OUTFLOW
▸ conda install --channel=phobson wqio
▸ Centered around examining the efficacy of so-called BMPs
▸ Handles left-censored data with ROS
▸ No such things as having “zero” pollution
▸ Can only say that things are “less than” the instrument’s precision
PYTHON IN CIVIL ENGINEERING
WQIO - WATER QUALITY, INFLOW/OUTFLOW
▸ conda install --channel=phobson wqio
▸ Centered around examining the efficacy of so-called BMPs
▸ Handles left-censored data with ROS
▸ No such things as having “zero” pollution
▸ Can only say that things are “less than” the instrument’s precision
▸ Bias-corrected, accelerated non-parametric bootstrapping to estimate
confidence intervals around statistics
PYTHON IN CIVIL ENGINEERING
WQIO - WATER QUALITY, INFLOW/OUTFLOW
▸ conda install --channel=phobson wqio
▸ Centered around examining the efficacy of so-called BMPs
▸ Handles left-censored data with ROS
▸ No such things as having “zero” pollution
▸ Can only say that things are “less than” the instrument’s precision
▸ Bias-corrected, accelerated non-parametric bootstrapping to estimate
confidence intervals around statistics
▸ High-level plotting interface built on seaborn
PYTHON IN CIVIL ENGINEERING
WQIO - WATER QUALITY, INFLOW/OUTFLOW
▸ conda install --channel=phobson wqio
▸ Centered around examining the efficacy of so-called BMPs
▸ Handles left-censored data with ROS
▸ No such things as having “zero” pollution
▸ Can only say that things are “less than” the instrument’s precision
▸ Bias-corrected, accelerated non-parametric bootstrapping to estimate
confidence intervals around statistics
▸ High-level plotting interface built on seaborn
▸ Basis for client-specific libraries that I distribute to them through conda
PYTHON IN CIVIL ENGINEERING
PARAMNORMAL - CONVENTIONALLY PARAMETERIZED STATISTICAL DISTRIBUTIONS
▸ http://phobson.github.io/paramnormal/index.html
▸ conda install --channel=phobson paramnormal
▸ Problem: scipy distributions are incredibly flexible, but also
perhaps a bit over generalized
▸ Wanted to create an API that let statisticians of all caliber specify
and fit distributions using the parameters they read about in text
books.
▸ The activity module provides a simple interface for creating,
fitting, and plotting statistical distributions
PYTHON IN CIVIL ENGINEERING
PARANORMAL: BRIEF EXAMPLES
▸ (super fast demo)
PYTHON IN CIVIL ENGINEERING
PARAMNORMAL: ENDORSEMENTS
PYTHON IN CIVIL ENGINEERING
PARAMNORMAL: ENDORSEMENTS
PYTHON IN CIVIL ENGINEERING
PARAMNORMAL: ENDORSEMENTS
PYTHON IN CIVIL ENGINEERING
MPL-PROBSCALE
▸ Legit probability
scales for matplotlib
▸ Similar to a quantile
plot, but expressed
as a probability
instead of a z-score
▸ Simply import
probscale and
you’re set
import probscale
ax1.set_xscale('prob')
ax1.set_xlim(left=2, right=98)
ax1.set_xlabel('Normal probability scale')
ax2.set_xscale('prob', dist=paramnormal.beta(α=3, β=2))
ax2.set_xlim(left=2, right=98)
ax2.set_xlabel('Beta probability scale (α=3, β=2)')
PYTHON IN CIVIL ENGINEERING
MPL-PROBSCALE
▸ Can fit linear
regression in
probability space
▸ Top-level functions
for easy plotting
PYTHON IN CIVIL ENGINEERING
GENERATING MODEL GRIDS
▸ Multi-corner, curvilinear-orthogonal grids are fairly difficult to
compute — lots of very expensive proprietary stuff out there.
▸ Dr. Pavel Sakov (Australian Bureau of Meteorology wrote gridgen-c
▸ Built a types interface with help from:
▸ Dr. Robert Hetland (Texas A&M)
▸ Dr. Richard Signell (USGS)
▸ Mac and Linux binaries available through conda
▸ Docs at: phobson.github.io/pygridgen
PYTHON IN CIVIL ENGINEERING
GRID EXAMPLE
PYTHON IN CIVIL ENGINEERING
GRID EXAMPLE
PYTHON IN CIVIL ENGINEERING
HIGHER LEVEL GRID OPERATIONS
▸ conda install --channel=conda-forge pygridtools
▸ geosyntec.github.io/pygridtools
▸ Interactivity with grid generation parameters
▸ Simple, general manipulations methods (merge, split,
refine, transform)
▸ Took inspiration from pandas/xarray/seaborn
▸ File IO with general and GIS data formats via fiona
PYTHON IN CIVIL ENGINEERING
GRID EXAMPLE - MANIPULATION
grid1, grid2, grid3 = make_test_grids()
fig = (
grid2.merge(grid3, how='vert', where='-', shift=2)
.merge(grid1, how='horiz', where='-', shift=11)
.refine(10, axis=1, n_points=4)
.refine(13, axis=0, n_points=2)
.transform(lambda x: x*5 + 2)
.update_cell_mask()
.plotCells(ax=ax, cell_kws=dict(facecolor=palette[2], alpha=0.75))
)
PYTHON IN CIVIL ENGINEERING
GRIDS IN THE REAL WORLD: SULLIVAN CREEK, NE WASHINGTON
PYTHON IN CIVIL ENGINEERING
GRIDS IN THE REAL WORLD: SULLIVAN CREEK, NE WASHINGTON
PYTHON IN CIVIL ENGINEERING
PROJECTING MODEL RESULTS ON THE GRID
PYTHON IN CIVIL ENGINEERING
PROJECTING MODEL RESULTS ON THE GRID
PYTHON IN CIVIL ENGINEERING
RESOURCES FOR GETTING STARTED AS A MEAT-SPACE ENGINEER
▸ I was lucky enough to get started with numpy and matplotlib while:
▸ I was still very familiar with MATLAB
▸ Both projects were directly trying to take market share away
from MATLAB
▸ APIs and efforts have changed since then.
▸ More recently, a new employee started with MATLAB experience
from college. We gave them a copy of Python For Data Analysis by
Wes McKinney (author of pandas), and were pretty productive with
python in a couple of week.
PYTHON IN CIVIL ENGINEERING
LINK DUMP
▸ Me:
▸ https://twitter.com/pmhobson
▸ https://github.com/phobson
▸ My (documented) Projects
▸ http://geosyntec.github.io/pygridtools/
▸ http://phobson.github.io/paramnormal/
▸ http://phobson.github.io/mpl-probscale
▸ https://github.com/phobson/cloudside (docs forthcoming)
DEMOS
&
QUESTIONS.
Thank you

More Related Content

What's hot

What's hot (20)

Bridge survey
Bridge surveyBridge survey
Bridge survey
 
final year Project (civil)
final year Project (civil)final year Project (civil)
final year Project (civil)
 
Use of plastic waste in road construction.
Use of plastic waste in road construction. Use of plastic waste in road construction.
Use of plastic waste in road construction.
 
project final year civil
project final year civilproject final year civil
project final year civil
 
Plastic roads
Plastic roadsPlastic roads
Plastic roads
 
Artificial intelligence in civil engineering
Artificial intelligence in civil engineering Artificial intelligence in civil engineering
Artificial intelligence in civil engineering
 
Artificial intelligence in civil engineering technicial seminar ppt
Artificial intelligence in civil engineering technicial seminar pptArtificial intelligence in civil engineering technicial seminar ppt
Artificial intelligence in civil engineering technicial seminar ppt
 
Introduction to Civil Engineering
Introduction to Civil Engineering Introduction to Civil Engineering
Introduction to Civil Engineering
 
2 marks Question with Answer for Design of Reinforced Cement Concrete Elements
2 marks Question with Answer for Design of Reinforced Cement Concrete Elements 2 marks Question with Answer for Design of Reinforced Cement Concrete Elements
2 marks Question with Answer for Design of Reinforced Cement Concrete Elements
 
Advancement in civil engineering
Advancement in civil engineeringAdvancement in civil engineering
Advancement in civil engineering
 
Green concrete
Green concreteGreen concrete
Green concrete
 
Self Healing Concrete
Self Healing Concrete Self Healing Concrete
Self Healing Concrete
 
basics of civil engineering
basics of civil engineeringbasics of civil engineering
basics of civil engineering
 
Civil Engineering
Civil EngineeringCivil Engineering
Civil Engineering
 
Use of plastic waste in road construction
Use of plastic waste in road constructionUse of plastic waste in road construction
Use of plastic waste in road construction
 
Revit and Building Information Modeling (BIM) Presentation
Revit and Building Information Modeling (BIM) PresentationRevit and Building Information Modeling (BIM) Presentation
Revit and Building Information Modeling (BIM) Presentation
 
Concrete technology
Concrete technologyConcrete technology
Concrete technology
 
Recycle material used in road construction
Recycle material used in road constructionRecycle material used in road construction
Recycle material used in road construction
 
DESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRO
DESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRODESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRO
DESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRO
 
Presentation on MIVAN -- A versatile aluminum formwork construction technique
Presentation on MIVAN -- A versatile aluminum formwork construction techniquePresentation on MIVAN -- A versatile aluminum formwork construction technique
Presentation on MIVAN -- A versatile aluminum formwork construction technique
 

Viewers also liked

Basic concepts in environmental engineering
Basic concepts in environmental engineeringBasic concepts in environmental engineering
Basic concepts in environmental engineering
joefreim
 
A view to civil engineering in india by 2020
A view to civil engineering in india by 2020A view to civil engineering in india by 2020
A view to civil engineering in india by 2020
ash09uce
 
Nano technology
Nano technologyNano technology
Nano technology
Saad Khan
 

Viewers also liked (20)

2016-03-17 Structural Value Engineering
2016-03-17 Structural Value Engineering2016-03-17 Structural Value Engineering
2016-03-17 Structural Value Engineering
 
Open source engineering and sustainability tools for the built environment
Open source engineering and sustainability tools for the built environmentOpen source engineering and sustainability tools for the built environment
Open source engineering and sustainability tools for the built environment
 
Presentation at DMSB 2013
Presentation at DMSB 2013Presentation at DMSB 2013
Presentation at DMSB 2013
 
Software And Computer Applications for civil engineering
Software And Computer Applications for civil engineeringSoftware And Computer Applications for civil engineering
Software And Computer Applications for civil engineering
 
CE6605 Environmental Engineering II - Course Presentation
CE6605 Environmental Engineering II - Course PresentationCE6605 Environmental Engineering II - Course Presentation
CE6605 Environmental Engineering II - Course Presentation
 
1 introduction to environmental engineering
1 introduction to environmental engineering1 introduction to environmental engineering
1 introduction to environmental engineering
 
Value engineering
Value engineeringValue engineering
Value engineering
 
How to Find Information in Civil and Environmental Engineering
How to Find Information in Civil and Environmental EngineeringHow to Find Information in Civil and Environmental Engineering
How to Find Information in Civil and Environmental Engineering
 
Simulating Civil Engineering Projects In Virtual Worlds
Simulating Civil Engineering Projects In Virtual WorldsSimulating Civil Engineering Projects In Virtual Worlds
Simulating Civil Engineering Projects In Virtual Worlds
 
SOFTWARES IN CIVIL ENGINEERING
SOFTWARES IN CIVIL ENGINEERINGSOFTWARES IN CIVIL ENGINEERING
SOFTWARES IN CIVIL ENGINEERING
 
Geotechnical engineering, civil engineering
Geotechnical engineering, civil engineeringGeotechnical engineering, civil engineering
Geotechnical engineering, civil engineering
 
Advanced softwares used in civil engineering
Advanced softwares used in civil  engineeringAdvanced softwares used in civil  engineering
Advanced softwares used in civil engineering
 
Basic concepts in environmental engineering
Basic concepts in environmental engineeringBasic concepts in environmental engineering
Basic concepts in environmental engineering
 
Environmental Engineering-I
Environmental Engineering-IEnvironmental Engineering-I
Environmental Engineering-I
 
A view to civil engineering in india by 2020
A view to civil engineering in india by 2020A view to civil engineering in india by 2020
A view to civil engineering in india by 2020
 
Civil engineering
Civil engineeringCivil engineering
Civil engineering
 
Ellis, Melissa, Tellevate, NESHAP Regulations Update, 2015 Midwest Environmen...
Ellis, Melissa, Tellevate, NESHAP Regulations Update, 2015 Midwest Environmen...Ellis, Melissa, Tellevate, NESHAP Regulations Update, 2015 Midwest Environmen...
Ellis, Melissa, Tellevate, NESHAP Regulations Update, 2015 Midwest Environmen...
 
Civil Engineering Projetcs-Omegacadd
Civil Engineering Projetcs-OmegacaddCivil Engineering Projetcs-Omegacadd
Civil Engineering Projetcs-Omegacadd
 
Nano technology
Nano technologyNano technology
Nano technology
 
Trends in Disaster Risk Reduction (orthodox version)
Trends in Disaster Risk Reduction (orthodox version)Trends in Disaster Risk Reduction (orthodox version)
Trends in Disaster Risk Reduction (orthodox version)
 

Similar to Python in Civil/Environmental Engineering

Determination of safe grade elevation by using hec ras case study mutha river
Determination of safe grade elevation by using hec ras case study mutha riverDetermination of safe grade elevation by using hec ras case study mutha river
Determination of safe grade elevation by using hec ras case study mutha river
eSAT Journals
 
Determination of safe grade elevation by using hec ras case study mutha river
Determination of safe grade elevation by using hec ras case study mutha riverDetermination of safe grade elevation by using hec ras case study mutha river
Determination of safe grade elevation by using hec ras case study mutha river
eSAT Journals
 
eresau2015_submission_34
eresau2015_submission_34eresau2015_submission_34
eresau2015_submission_34
brimstone4814
 
Open sourcery using open source powers for good - kcdc 2013
Open sourcery  using open source powers for good - kcdc 2013Open sourcery  using open source powers for good - kcdc 2013
Open sourcery using open source powers for good - kcdc 2013
CodeMontage
 

Similar to Python in Civil/Environmental Engineering (20)

Blue Green Toolkit
Blue Green ToolkitBlue Green Toolkit
Blue Green Toolkit
 
Renewable Energy Decision Support Engine
Renewable Energy Decision Support EngineRenewable Energy Decision Support Engine
Renewable Energy Decision Support Engine
 
Designing for Sustainability - WebVisions 2016
Designing for Sustainability - WebVisions 2016Designing for Sustainability - WebVisions 2016
Designing for Sustainability - WebVisions 2016
 
Breaking the hec code
Breaking the hec codeBreaking the hec code
Breaking the hec code
 
EcoTas13 BradEvans e-MAST
EcoTas13 BradEvans e-MASTEcoTas13 BradEvans e-MAST
EcoTas13 BradEvans e-MAST
 
An Empirical Study on the Maturity of the Eclipse Modeling Ecosystem
An Empirical Study on the Maturity of the Eclipse Modeling EcosystemAn Empirical Study on the Maturity of the Eclipse Modeling Ecosystem
An Empirical Study on the Maturity of the Eclipse Modeling Ecosystem
 
Determination of safe grade elevation by using hec ras case study mutha river
Determination of safe grade elevation by using hec ras case study mutha riverDetermination of safe grade elevation by using hec ras case study mutha river
Determination of safe grade elevation by using hec ras case study mutha river
 
Determination of safe grade elevation by using hec ras case study mutha river
Determination of safe grade elevation by using hec ras case study mutha riverDetermination of safe grade elevation by using hec ras case study mutha river
Determination of safe grade elevation by using hec ras case study mutha river
 
eresau2015_submission_34
eresau2015_submission_34eresau2015_submission_34
eresau2015_submission_34
 
Improving access to geospatial Big Data in the hydrology domain
Improving access to geospatial Big Data in the hydrology domainImproving access to geospatial Big Data in the hydrology domain
Improving access to geospatial Big Data in the hydrology domain
 
Developing a successful big data business strategy
Developing a successful big data business strategyDeveloping a successful big data business strategy
Developing a successful big data business strategy
 
Let's not rewrite it all
Let's not rewrite it allLet's not rewrite it all
Let's not rewrite it all
 
AI for Earth: Analyzing Global Data with Azure
AI for Earth: Analyzing Global Data with AzureAI for Earth: Analyzing Global Data with Azure
AI for Earth: Analyzing Global Data with Azure
 
Acf environmental 2016 apwa fl expo - integrated infrastructure-an innovati...
Acf environmental   2016 apwa fl expo - integrated infrastructure-an innovati...Acf environmental   2016 apwa fl expo - integrated infrastructure-an innovati...
Acf environmental 2016 apwa fl expo - integrated infrastructure-an innovati...
 
Big data for SAS programmers
Big data for SAS programmersBig data for SAS programmers
Big data for SAS programmers
 
universal laws.ppt
universal laws.pptuniversal laws.ppt
universal laws.ppt
 
The Rhode Island Ocean SAMP: Developing an Integrated Geospatial Framework to...
The Rhode Island Ocean SAMP: Developing an Integrated Geospatial Framework to...The Rhode Island Ocean SAMP: Developing an Integrated Geospatial Framework to...
The Rhode Island Ocean SAMP: Developing an Integrated Geospatial Framework to...
 
Open sourcery using open source powers for good - kcdc 2013
Open sourcery  using open source powers for good - kcdc 2013Open sourcery  using open source powers for good - kcdc 2013
Open sourcery using open source powers for good - kcdc 2013
 
Seven most coveted job openings for hydroinformatics engineering.pptx
Seven most coveted job openings for hydroinformatics engineering.pptxSeven most coveted job openings for hydroinformatics engineering.pptx
Seven most coveted job openings for hydroinformatics engineering.pptx
 
The State of High-Performance Computing in the Open-Source R Ecosystem
The State of High-Performance Computing in the Open-Source R EcosystemThe State of High-Performance Computing in the Open-Source R Ecosystem
The State of High-Performance Computing in the Open-Source R Ecosystem
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 

Python in Civil/Environmental Engineering

  • 1. PYTHON IN CIVIL AND ENVIRONMENTAL ENGINEERING PAUL HOBSON GEOSYNTEC CONSULTANTS PDX PYTHON 2016-03-24
  • 2. PYTHON IN CIVIL ENGINEERING HEALTH AND SAFETY ▸ Nearest exit in case of emergency ▸ Ergonomics ▸ Right angles ▸ Head level ▸ Take breaks, look and move around
  • 3. PYTHON IN CIVIL ENGINEERING I’M AN ENGINEER (I STUDIED MUD) ▸ What is Civil Engineering? ▸ Structural ▸ Transportation ▸ Construction Management ▸ Geotechnical ▸ Environmental ▸ Water and Natural Resources
  • 4. PYTHON IN CIVIL ENGINEERING I’M AN ENGINEER (I STUDIED MUD) ▸ What is Civil Engineering? ▸ Structural ▸ Transportation ▸ Construction Management ▸ Geotechnical ▸ Environmental ▸ Water and Natural Resources Thesis Title: Rheologic and Flume Erosion Characteristics of Georgia Sediments at Bridge Piers
  • 5. PYTHON IN CIVIL ENGINEERING I’M AN ENGINEER (I STUDIED MUD) ▸ What is Civil Engineering? ▸ Structural ▸ Transportation ▸ Construction Management ▸ Geotechnical ▸ Environmental ▸ Water and Natural Resources Thesis Title: Rheologic and Flume Erosion Characteristics of Georgia Sediments at Bridge Piers
  • 6. PYTHON IN CIVIL ENGINEERING I WORK AS AN ENVIRONMENTAL CONSULTANT ▸ Help industry with compliance and remediation ▸ Litigation support for allocation of environmental damages ▸ Grant-funded research with NCHRP, FHWA, WERF
  • 7. PYTHON IN CIVIL ENGINEERING I WORK AS AN ENVIRONMENTAL CONSULTANT
  • 8. PYTHON IN CIVIL ENGINEERING I WORK AS AN ENVIRONMENTAL CONSULTANT ▸ Build spatial databases of contaminant concentrations
  • 9. PYTHON IN CIVIL ENGINEERING I WORK AS AN ENVIRONMENTAL CONSULTANT ▸ Build spatial databases of contaminant concentrations ▸ Scrape the web (brute force) to meteorologic and hydrologic data
  • 10. PYTHON IN CIVIL ENGINEERING I WORK AS AN ENVIRONMENTAL CONSULTANT ▸ Build spatial databases of contaminant concentrations ▸ Scrape the web (brute force) to meteorologic and hydrologic data ▸ Statistical analysis of pollution mitigation and remediation systems
  • 11. PYTHON IN CIVIL ENGINEERING I WORK AS AN ENVIRONMENTAL CONSULTANT ▸ Build spatial databases of contaminant concentrations ▸ Scrape the web (brute force) to meteorologic and hydrologic data ▸ Statistical analysis of pollution mitigation and remediation systems ▸ Build inputs for, run, and analyze output from vetted numerical models
  • 12. PYTHON IN CIVIL ENGINEERING I WORK AS AN ENVIRONMENTAL CONSULTANT ▸ Build spatial databases of contaminant concentrations ▸ Scrape the web (brute force) to meteorologic and hydrologic data ▸ Statistical analysis of pollution mitigation and remediation systems ▸ Build inputs for, run, and analyze output from vetted numerical models ▸ Build tools to help my colleagues do the same
  • 13. PYTHON IN CIVIL ENGINEERING SUMMARY FOR THE REST OF THE TALK ▸ My take on the general state of the practice in engineering consulting ▸ Characteristic challenges of environmental consulting ▸ Tools I like to use ▸ Tools I have built over the course of my career
  • 14. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DATABASES
  • 15. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DATABASES ▸ Overwhelming everything is in MS Access
  • 16. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DATABASES ▸ Overwhelming everything is in MS Access ▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the same architecture to work together
  • 17. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DATABASES ▸ Overwhelming everything is in MS Access ▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the same architecture to work together ▸ Last Client’s DB
  • 18. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DATABASES ▸ Overwhelming everything is in MS Access ▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the same architecture to work together ▸ Last Client’s DB ▸ 110 tables
  • 19. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DATABASES ▸ Overwhelming everything is in MS Access ▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the same architecture to work together ▸ Last Client’s DB ▸ 110 tables ▸ 200 saved insert/create/update
  • 20. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DATABASES ▸ Overwhelming everything is in MS Access ▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the same architecture to work together ▸ Last Client’s DB ▸ 110 tables ▸ 200 saved insert/create/update ▸ 100 save select and pivot queries
  • 21. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DATABASES ▸ Overwhelming everything is in MS Access ▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the same architecture to work together ▸ Last Client’s DB ▸ 110 tables ▸ 200 saved insert/create/update ▸ 100 save select and pivot queries ▸ 25 queries that deleted stuff
  • 22. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DATABASES ▸ Overwhelming everything is in MS Access ▸ PROTIP: Your MS Office, MS Access Drivers, and python all must have the same architecture to work together ▸ Last Client’s DB ▸ 110 tables ▸ 200 saved insert/create/update ▸ 100 save select and pivot queries ▸ 25 queries that deleted stuff ▸ Everything connected with 40 VBA forms, 15 utility modules (9000 LOC)
  • 23. PYTHON IN CIVIL ENGINEERING
  • 24. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - ANALYSIS ▸ Excel is the behemoth that cannot be stopped ▸ Most people manage their data with it ▸ No one follows best practices (www.datacarpentry.org/ spreadsheet-ecology-lesson) ▸ Will be pried from cold dead hands, despite will published statistical errors (resolved, IIRC)
  • 25. PYTHON IN CIVIL ENGINEERING MANNING’S EQUATION
  • 26. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
  • 27. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS ▸ GUI or cmd-line based numerical models maintained by federal agencies
  • 28. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS ▸ GUI or cmd-line based numerical models maintained by federal agencies ▸ SWMM ▸ 1-D urban hydrology ▸ Written in very legible C ▸ Open source ▸ Maintained by EPA, transitioning to UT Austin ▸ Compiles on Linux and Windows
  • 29. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS ▸ GUI or cmd-line based numerical models maintained by federal agencies ▸ SWMM ▸ 1-D urban hydrology ▸ Written in very legible C ▸ Open source ▸ Maintained by EPA, transitioning to UT Austin ▸ Compiles on Linux and Windows ▸ HEC-RAS ▸ 2-D River hydraulics ▸ Completely closed source ▸ Guarded over by US Army Corps of Engineers
  • 30. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS ▸ GUI or cmd-line based numerical models maintained by federal agencies ▸ SWMM ▸ 1-D urban hydrology ▸ Written in very legible C ▸ Open source ▸ Maintained by EPA, transitioning to UT Austin ▸ Compiles on Linux and Windows ▸ HEC-RAS ▸ 2-D River hydraulics ▸ Completely closed source ▸ Guarded over by US Army Corps of Engineers ▸ EFDC
  • 31. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS ▸ GUI or cmd-line based numerical models maintained by federal agencies ▸ SWMM ▸ 1-D urban hydrology ▸ Written in very legible C ▸ Open source ▸ Maintained by EPA, transitioning to UT Austin ▸ Compiles on Linux and Windows ▸ HEC-RAS ▸ 2-D River hydraulics ▸ Completely closed source ▸ Guarded over by US Army Corps of Engineers ▸ EFDC ▸ Spaghetti FORTRAN
  • 32. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS ▸ GUI or cmd-line based numerical models maintained by federal agencies ▸ SWMM ▸ 1-D urban hydrology ▸ Written in very legible C ▸ Open source ▸ Maintained by EPA, transitioning to UT Austin ▸ Compiles on Linux and Windows ▸ HEC-RAS ▸ 2-D River hydraulics ▸ Completely closed source ▸ Guarded over by US Army Corps of Engineers ▸ EFDC ▸ Spaghetti FORTRAN ▸ Compiles on Linux but results are garbage
  • 33. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS ▸ GUI or cmd-line based numerical models maintained by federal agencies ▸ SWMM ▸ 1-D urban hydrology ▸ Written in very legible C ▸ Open source ▸ Maintained by EPA, transitioning to UT Austin ▸ Compiles on Linux and Windows ▸ HEC-RAS ▸ 2-D River hydraulics ▸ Completely closed source ▸ Guarded over by US Army Corps of Engineers ▸ EFDC ▸ Spaghetti FORTRAN ▸ Compiles on Linux but results are garbage ▸ 3-D river hydraulics, sediment and pollutant fate and transport
  • 34. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS ▸ GUI or cmd-line based numerical models maintained by federal agencies ▸ SWMM ▸ 1-D urban hydrology ▸ Written in very legible C ▸ Open source ▸ Maintained by EPA, transitioning to UT Austin ▸ Compiles on Linux and Windows ▸ HEC-RAS ▸ 2-D River hydraulics ▸ Completely closed source ▸ Guarded over by US Army Corps of Engineers ▸ EFDC ▸ Spaghetti FORTRAN ▸ Compiles on Linux but results are garbage ▸ 3-D river hydraulics, sediment and pollutant fate and transport ▸ Very optimized: 1 yr simulation takes ~ 1 day
  • 35. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN-SPECIFIC TOOLS
  • 36. PYTHON IN CIVIL ENGINEERING
  • 37. PYTHON IN CIVIL ENGINEERING STATE OF THE PRACTICE - DOMAIN SPECIFIC TOOLS ▸ All (numerically) solve the St. Venant Equations ▸ Differential equations in time and space ▸ Very difficult to even work with symbolically ▸ Large code bases ▸ Represent a significant intellectual investment from civil/ environmental community
  • 38. PYTHON IN CIVIL ENGINEERING WHERE DOES PYTHON FIT IN ALL OF THIS? ▸ Scrape model inputs from web ▸ Hack input files for batch processing ▸ Move data around between formats ▸ General data and model results analysis ▸ (Rarely) Wrap C/Fortran libraries with ctypes/cython/ numpy
  • 39. PYTHON IN CIVIL ENGINEERING CIVIL/ENVIRONMENTAL CHALLENGES ▸ Arcane input file formats ▸ Left-censored (non-detect) data ▸ Non-parametric statistics ▸ Regression-on-order statistics ▸ Kaplan-Meier ▸ Project management inertia ▸ Disconnect between libraries and project needs ▸ ~5 coworkers (out of ~600) are comfortable with python
  • 40. PYTHON IN CIVIL ENGINEERING TOOLS I USE ▸ numpy/scipy ▸ Fast numeric arrays implemented in C ▸ Specialized scientific functions ▸ Matplotlib/seaborn: generic and statistical 2-D visualizations ▸ pandas/statsmodels: table-like data structures and statistical models ▸ Jupyter: interactive computing via notebooks ▸ conda: sane installation of python packages on Windows and other operating systems
  • 41. PYTHON IN CIVIL ENGINEERING
  • 42. PYTHON IN CIVIL ENGINEERING SCRAPING WEATHER DATA ▸ conda install —channel=phobson cloudside ▸ Python 3 fork of python-metar by Tom Pollard (github.com/tomp/python- metar.git) ▸ ~1000 lines of regex ▸ Cloudside uses python-metar to pull 5-min and hourly data from the FAA ▸ ~1000 lines of regex ▸ 24229KPDX PDX20120101000009801/01/12 00:00:31 5-MIN KPDX 010800Z 31005KT 10SM OVC085 04/02 A3026 -280 85 -1500 290/05 RMK A02 P0005
  • 43. PYTHON IN CIVIL ENGINEERING WEATHER DATA ▸ Simple commands for bulk data download and parsing ▸ Creates a directory structure for each station, source, and stage of processing ▸ searches for existing files before attempting to download or parse ▸ High-level plotting functions
  • 44. PYTHON IN CIVIL ENGINEERING
  • 45. PYTHON IN CIVIL ENGINEERING
  • 46. PYTHON IN CIVIL ENGINEERING WQIO - WATER QUALITY, INFLOW/OUTFLOW
  • 47. PYTHON IN CIVIL ENGINEERING WQIO - WATER QUALITY, INFLOW/OUTFLOW ▸ conda install --channel=phobson wqio
  • 48. PYTHON IN CIVIL ENGINEERING WQIO - WATER QUALITY, INFLOW/OUTFLOW ▸ conda install --channel=phobson wqio ▸ Centered around examining the efficacy of so-called BMPs
  • 49. PYTHON IN CIVIL ENGINEERING WQIO - WATER QUALITY, INFLOW/OUTFLOW ▸ conda install --channel=phobson wqio ▸ Centered around examining the efficacy of so-called BMPs ▸ Handles left-censored data with ROS ▸ No such things as having “zero” pollution ▸ Can only say that things are “less than” the instrument’s precision
  • 50. PYTHON IN CIVIL ENGINEERING WQIO - WATER QUALITY, INFLOW/OUTFLOW ▸ conda install --channel=phobson wqio ▸ Centered around examining the efficacy of so-called BMPs ▸ Handles left-censored data with ROS ▸ No such things as having “zero” pollution ▸ Can only say that things are “less than” the instrument’s precision ▸ Bias-corrected, accelerated non-parametric bootstrapping to estimate confidence intervals around statistics
  • 51. PYTHON IN CIVIL ENGINEERING WQIO - WATER QUALITY, INFLOW/OUTFLOW ▸ conda install --channel=phobson wqio ▸ Centered around examining the efficacy of so-called BMPs ▸ Handles left-censored data with ROS ▸ No such things as having “zero” pollution ▸ Can only say that things are “less than” the instrument’s precision ▸ Bias-corrected, accelerated non-parametric bootstrapping to estimate confidence intervals around statistics ▸ High-level plotting interface built on seaborn
  • 52. PYTHON IN CIVIL ENGINEERING WQIO - WATER QUALITY, INFLOW/OUTFLOW ▸ conda install --channel=phobson wqio ▸ Centered around examining the efficacy of so-called BMPs ▸ Handles left-censored data with ROS ▸ No such things as having “zero” pollution ▸ Can only say that things are “less than” the instrument’s precision ▸ Bias-corrected, accelerated non-parametric bootstrapping to estimate confidence intervals around statistics ▸ High-level plotting interface built on seaborn ▸ Basis for client-specific libraries that I distribute to them through conda
  • 53. PYTHON IN CIVIL ENGINEERING PARAMNORMAL - CONVENTIONALLY PARAMETERIZED STATISTICAL DISTRIBUTIONS ▸ http://phobson.github.io/paramnormal/index.html ▸ conda install --channel=phobson paramnormal ▸ Problem: scipy distributions are incredibly flexible, but also perhaps a bit over generalized ▸ Wanted to create an API that let statisticians of all caliber specify and fit distributions using the parameters they read about in text books. ▸ The activity module provides a simple interface for creating, fitting, and plotting statistical distributions
  • 54. PYTHON IN CIVIL ENGINEERING PARANORMAL: BRIEF EXAMPLES ▸ (super fast demo)
  • 55. PYTHON IN CIVIL ENGINEERING PARAMNORMAL: ENDORSEMENTS
  • 56. PYTHON IN CIVIL ENGINEERING PARAMNORMAL: ENDORSEMENTS
  • 57. PYTHON IN CIVIL ENGINEERING PARAMNORMAL: ENDORSEMENTS
  • 58. PYTHON IN CIVIL ENGINEERING MPL-PROBSCALE ▸ Legit probability scales for matplotlib ▸ Similar to a quantile plot, but expressed as a probability instead of a z-score ▸ Simply import probscale and you’re set import probscale ax1.set_xscale('prob') ax1.set_xlim(left=2, right=98) ax1.set_xlabel('Normal probability scale') ax2.set_xscale('prob', dist=paramnormal.beta(α=3, β=2)) ax2.set_xlim(left=2, right=98) ax2.set_xlabel('Beta probability scale (α=3, β=2)')
  • 59. PYTHON IN CIVIL ENGINEERING MPL-PROBSCALE ▸ Can fit linear regression in probability space ▸ Top-level functions for easy plotting
  • 60. PYTHON IN CIVIL ENGINEERING GENERATING MODEL GRIDS ▸ Multi-corner, curvilinear-orthogonal grids are fairly difficult to compute — lots of very expensive proprietary stuff out there. ▸ Dr. Pavel Sakov (Australian Bureau of Meteorology wrote gridgen-c ▸ Built a types interface with help from: ▸ Dr. Robert Hetland (Texas A&M) ▸ Dr. Richard Signell (USGS) ▸ Mac and Linux binaries available through conda ▸ Docs at: phobson.github.io/pygridgen
  • 61. PYTHON IN CIVIL ENGINEERING GRID EXAMPLE
  • 62. PYTHON IN CIVIL ENGINEERING GRID EXAMPLE
  • 63. PYTHON IN CIVIL ENGINEERING HIGHER LEVEL GRID OPERATIONS ▸ conda install --channel=conda-forge pygridtools ▸ geosyntec.github.io/pygridtools ▸ Interactivity with grid generation parameters ▸ Simple, general manipulations methods (merge, split, refine, transform) ▸ Took inspiration from pandas/xarray/seaborn ▸ File IO with general and GIS data formats via fiona
  • 64. PYTHON IN CIVIL ENGINEERING GRID EXAMPLE - MANIPULATION grid1, grid2, grid3 = make_test_grids() fig = ( grid2.merge(grid3, how='vert', where='-', shift=2) .merge(grid1, how='horiz', where='-', shift=11) .refine(10, axis=1, n_points=4) .refine(13, axis=0, n_points=2) .transform(lambda x: x*5 + 2) .update_cell_mask() .plotCells(ax=ax, cell_kws=dict(facecolor=palette[2], alpha=0.75)) )
  • 65. PYTHON IN CIVIL ENGINEERING GRIDS IN THE REAL WORLD: SULLIVAN CREEK, NE WASHINGTON
  • 66. PYTHON IN CIVIL ENGINEERING GRIDS IN THE REAL WORLD: SULLIVAN CREEK, NE WASHINGTON
  • 67. PYTHON IN CIVIL ENGINEERING PROJECTING MODEL RESULTS ON THE GRID
  • 68. PYTHON IN CIVIL ENGINEERING PROJECTING MODEL RESULTS ON THE GRID
  • 69. PYTHON IN CIVIL ENGINEERING RESOURCES FOR GETTING STARTED AS A MEAT-SPACE ENGINEER ▸ I was lucky enough to get started with numpy and matplotlib while: ▸ I was still very familiar with MATLAB ▸ Both projects were directly trying to take market share away from MATLAB ▸ APIs and efforts have changed since then. ▸ More recently, a new employee started with MATLAB experience from college. We gave them a copy of Python For Data Analysis by Wes McKinney (author of pandas), and were pretty productive with python in a couple of week.
  • 70. PYTHON IN CIVIL ENGINEERING LINK DUMP ▸ Me: ▸ https://twitter.com/pmhobson ▸ https://github.com/phobson ▸ My (documented) Projects ▸ http://geosyntec.github.io/pygridtools/ ▸ http://phobson.github.io/paramnormal/ ▸ http://phobson.github.io/mpl-probscale ▸ https://github.com/phobson/cloudside (docs forthcoming)