Python essentials for GIS learners
Python Essentials for GIS Learners
Icebreaker question
DAY 1
Getting Started with JupyterLab
EXERCISES DAY 1
Work with the bash shell
Variables, values, inputs, outputs
Types and built-in functions
Functions I
Functions II
Lists and indexing
For loops
Conditionals
Variable Scope
READS DAY 1
Unix Shell
Distributed version control
DAY 2
EXERCISES DAY 2
Running someone else’s Python script
Working with libraries
Reading data with pandas
Pandas dataframes
Plotting
Looping Over Data Sets
READS DAY 2
Basic analysis and plotting of geodata with Python
Working with the Python console in QGIS
DAY 3
EXERCISES DAY 3
READS DAY 3
Social coding on GitHub and version control with Git
Instructor notes
References
DAY 1
Open Science
Instructor Notes: Python Essentials for GIS Learners Day 1 (Unix Shell)
Introduce Jupyter lab and basic python concepts
Introduce Jupyter lab and basic python concepts
Guide to programing with Python for the Digital Humanities
Use an index to get a single character from a string.
Use a slice to get a substring.
Use the built-in function
len
to find the length of a string.
Python is case-sensitive.
Use meaningful variable names.
Swapping Values
Solution
Predicting Values
Solution
Challenge
Solution
Choosing a Name
Solution
Slicing practice
Solution
Slicing concepts
Solutions
Functions may only work for certain (combinations of) arguments.
Functions may have default values for some arguments.
Functions attached to objects are called methods
Use the built-in function
help
to get help for a function.
The Jupyter Notebook has two ways to get help.
Python reports a syntax error when it can’t understand the source of a program.
Python reports a runtime error when something goes wrong while a program is executing.
What Happens When
Solution
Spot the Difference
Solution
Why Not?
Solution
Last Character of a String
Solution
Jigsaw Puzzle (Parson’s Problem) Programming Example
Solution
When Is Help Available?
Solution
Importing With Aliases
Solution
There Are Many Ways To Import Libraries!
Solution
Importing Specific Items
Solution
Reading Error Messages
Solution
Iterators and iterables
Iterators and iterables
None pythonic example
The pythonic example
Use variables to store values.
Use
print
to display values.
Variables must be created before they are used.
Variables Persist Between Cells
Variables can be used in calculations.
Use an index to get a single character from a string.
Use a slice to get a substring.
Use the built-in function
len
to find the length of a string.
Python is case-sensitive.
Use meaningful variable names.
Swapping Values
Solution
Predicting Values
Solution
Challenge
Solution
Choosing a Name
Solution
Slicing practice
Solution
Slicing concepts
Solutions
Variables only change value when something is assigned to them.
Fractions
Solution
Automatic Type Conversion
Solution
Choose a Type
Solution
Division Types
Solution
Strings to Numbers
Solution
Arithmetic with Different Types
Solution
Complex Numbers
Solution
Excercise 2
Excercise 2
Exercise 3
DAY 2
Using and reading other people’s code
Object oriented programming
Programmatically access the attributes of international airports
Programmatically access the attributes of international airports
Basic analysis and plotting of geodata with Python
Run map.py on netherlandsmap.csv
Go from for loops and while loops to functions
Python standard libraries
About these instructor notes
Old notes
DAY 3
Instructor Notes: Python Essentials for GIS Learners Day 3
Instructor Notes: Python Essentials for GIS Learners Day 3
Followup notes
.md
.pdf
repository
suggest edit
Instructor notes
¶
Here we describe how is the workshop meant to be run
Social coding on GitHub and version control with Git
References