Skip to content

Commit 9832c30

Browse files
committed
solved!
1 parent d90a282 commit 9832c30

2 files changed

Lines changed: 59 additions & 26 deletions

File tree

index.Rmd

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@ During this tutorial, we will demonstrate different ways to visualize data on a
3838

3939
## Today’s Learning objectives
4040

41-
- Familiarize yourself with python objects and inheritance
42-
- Learn to make basic vizualizations and static maps with Matplotlib
43-
- Use GeoPandas built in plot functionality to vizualize GeoPandasDataFrames
44-
- Create basic interactive maps
45-
46-
## TO DO! Create the yaml with dependencies
41+
- Vizualize data using Matplotlib and understand the structure matplotlib uses
42+
- Use cartopy's built in functionality to create maps
43+
- Add geospatial data to a map using rasterio for rasters, geopandas for vector
4744

45+
## Dependencies
46+
For the tutorial today we make use of a set of packages. Create a new yaml file (`env.yml` for example) and paste the following environment definition in it.
4847
```
4948
name: python-programming
5049
dependencies:
@@ -53,8 +52,11 @@ dependencies:
5352
- spyder
5453
- geopandas
5554
- rasterio
56-
-
55+
- matplotlib
5756
```
57+
58+
Create the environment using `mamba env create --file vector.yaml`.
59+
5860
# Python help
5961

6062
Before we dive into python, it makes sense to take some time to find how what to do if you are stuck. There are several ways to find help with programming in Python. Most packages, especially the larger ones, have a webpage with documentation. The documentation is a good first place to look for information. Secondly, googling your issue typically solves your problem too, because it finds answers on multiple platforms, such as StackOverflow and Github. Try to use terms that are used by others, don't include filepaths and personal variable names for example. Generative AI is also a useful source of coding help, but be careful, GenAI doesn't understand programming, it might come up with not existing functions for example. Lastly, during Geoscripting we have the forum to ask and give help. Asking your friends or colleagues in person is also a great way to learn and fix programming problems. Another good option is get documentation and more information about a package inside Python:
@@ -70,7 +72,6 @@ See how the objects and functions in the `sys` package got listed.
7072
> **Question 1**: What kind of functionality does the `sys` package provide?
7173
```
7274

73-
7475
# Object-Oriented Programming in Python
7576

7677
Up until now in this course we have looked at R mainly as a scripting language. We call this way of programming Procedural Programming, where procedures (functions) are called in series of steps. Both Python and R can be used in another programming paradigm: Object Oriented Programming. Object Oriented Programming (OOP) is a way of programming where functionality and information is encapsulated in objects. Instead of assigning values and functions to variables individually, objects are used where both values (properties, attributes) and calculations (functions, methods) can be stored together. This offers several advantages.
@@ -433,11 +434,21 @@ show(dataset, ax=ax, cmap='gist_ncar')
433434

434435
# What have we learned?
435436

436-
#TODO
437+
You finished this tutorial well done!
438+
We started with a short introduction about object oriented programming, you now know what objects are, how they are implemented in python and how they can inherit functionality from eachother. In this way we can stand on top of the shoulders of giants, we do not have to write some code somebody else already has.
439+
440+
Next Matplotlib was introduced, you now know what the structure of a Matplotlib plot is, how different elements are organized on a figure and how to add data to a plot.
441+
442+
Building on that, we looked at Cartopy, building on top of Matplotlib, illustrating object oriented programming and showing it's power. We made basic maps using all built in functionality, and we also saw how to add our own data to maps both vector and raster.
443+
444+
What you learned today is only a tip of the iceberg. For more elaborate plots and other examples, visit the Pythia project and the cartopy gallery, both listed below!
445+
437446

438447
# More info
439448

440449
- [Official Python tutorial](https://docs.Python.org/3/contents.html)
441450
- [Python Style guide](https://www.python.org/dev/peps/pep-0008/)
442451
- [Python 3 Cheatsheet](https://ugoproto.github.io/ugo_py_doc/py_cs/)
443452
- [Overview Python package Cheatsheets](https://www.datacamp.com/community/data-science-cheatsheets?tag=python)
453+
- [Project Pythia](https://foundations.projectpythia.org/core/cartopy/cartopy.html)
454+
- [Cartopy examples](https://scitools.org.uk/cartopy/docs/latest/gallery/index.html)

index.html

Lines changed: 39 additions & 17 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)