├── .gitignore ├── .readthedocs.yaml ├── .travis.yml ├── Makefile ├── README.md ├── ai ├── Bill-the-vending-machine.ai └── Geo-Python-video-intro-screen.ai ├── key ├── Pandas-data-structure-images.key └── driver-navigator.key ├── make.bat ├── postBuild ├── push.sh ├── requirements.txt ├── setup.cfg ├── setup.py ├── source ├── _static │ ├── 01-Computers-and-programs.pdf │ ├── L4 │ │ └── temp_converter.py │ ├── Temp-anomalies-2018.mp4 │ ├── Temp-anomalies-2019.mp4 │ ├── css │ │ └── custom.css │ ├── geo-python.css │ ├── geopython.png │ └── geopython2.png ├── _templates │ ├── footer.html │ └── layout.html ├── conf.py ├── course-info │ ├── ai-tools.rst │ ├── course-info.rst │ ├── grading.rst │ ├── img │ │ ├── Anaconda-Mac.png │ │ ├── conda_shapely_windows.PNG │ │ ├── google_query_conda.PNG │ │ ├── install_shapely.PNG │ │ ├── miniconda-linux.png │ │ ├── miniconda-macos.png │ │ ├── miniconda-windows.png │ │ └── python-environment.png │ ├── installing-anacondas.rst │ ├── installing-miniconda.rst │ ├── learning-goals.rst │ ├── licensing.rst │ ├── python-vocabulary.rst │ ├── resources.rst │ └── theteam.rst ├── data │ └── L5 │ │ └── Kumpula-June-2016-w-metadata.txt ├── final-exercise │ ├── grading.ipynb │ └── overview.rst ├── img │ ├── HY-logo-2017.png │ └── banner │ │ ├── GeoPython_banner.png │ │ ├── geo-python-2020.png │ │ └── geo-python-2023.png ├── index.rst ├── lessons │ ├── L1 │ │ ├── course-environment-components.rst │ │ ├── discord-usage.rst │ │ ├── exercise-1.rst │ │ ├── img │ │ │ ├── Binder_launcher.png │ │ │ ├── Binder_loading.png │ │ │ ├── CSC_join_group.png │ │ │ ├── CSC_launch_new.png │ │ │ ├── Discord-logo.png │ │ │ ├── GitHub.png │ │ │ ├── JupyterLab.png │ │ │ ├── LaunchButtons.png │ │ │ ├── Slack-logo.png │ │ │ ├── Thebe_launcher.png │ │ │ ├── Thumbs.db │ │ │ ├── answering-thread.PNG │ │ │ ├── clone-notebooks.png │ │ │ ├── discord-basic-view.png │ │ │ ├── launch-buttons.png │ │ │ ├── notifying-user.PNG │ │ │ ├── pull-changes.png │ │ │ ├── slack-basic-view.png │ │ │ ├── start-thread-discord.PNG │ │ │ └── start-thread.PNG │ │ ├── motivation.rst │ │ ├── overview.rst │ │ └── slack-usage.rst │ ├── L2 │ │ ├── GitHub-classroom.rst │ │ ├── exercise-2.rst │ │ ├── git-basics.rst │ │ ├── img │ │ │ ├── 1_classroom_invitation.PNG │ │ │ ├── Git-Logo-2Color.png │ │ │ ├── Git-Logo-Black.png │ │ │ ├── GitHub_Logo.png │ │ │ ├── GitHub_clone_link.png │ │ │ ├── Git_illustration.png │ │ │ ├── Preview-changes.png │ │ │ ├── Raw-button.png │ │ │ ├── Spyder-editor.png │ │ │ ├── Spyder-play-button.png │ │ │ ├── Spyder.png │ │ │ ├── Terminal_git_status1.png │ │ │ ├── choose-file.PNG │ │ │ ├── commit_message.PNG │ │ │ ├── committed_file.PNG │ │ │ ├── download-starter-script.PNG │ │ │ ├── drag-and-drop.PNG │ │ │ ├── driver-navigator.png │ │ │ ├── edit-readme.png │ │ │ ├── edit-testMD.png │ │ │ ├── git-commit-credentials.png │ │ │ ├── git-copy-url.png │ │ │ ├── git-plugin-changed.png │ │ │ ├── git-plugin-clone.png │ │ │ ├── git-plugin-commit-message.png │ │ │ ├── git-plugin-commit-ok.png │ │ │ ├── git-plugin-commit.png │ │ │ ├── git-plugin-credentials.png │ │ │ ├── git-plugin-discard-changes.png │ │ │ ├── git-plugin-history1.png │ │ │ ├── git-plugin-pull-ok.png │ │ │ ├── git-plugin-pull-push-buttons.png │ │ │ ├── git-plugin-pull.png │ │ │ ├── git-plugin-push-ok.png │ │ │ ├── git-plugin-push.png │ │ │ ├── git-plugin-stage-changes.png │ │ │ ├── git-plugin-staged-changes.png │ │ │ ├── git-plugin-start-cloning.png │ │ │ ├── git-plugin-status1.png │ │ │ ├── git-plugin-tracked-changes.png │ │ │ ├── git-plugin-version-history.png │ │ │ ├── git-plugin.png │ │ │ ├── github_classroom_create_repository.png │ │ │ ├── open-terminal.png │ │ │ ├── play-changes.PNG │ │ │ ├── pull-push-illustration.png │ │ │ ├── start-assignment.png │ │ │ ├── terminal-icon.png │ │ │ ├── test_doc.PNG │ │ │ ├── token_expiration.png │ │ │ ├── token_name.png │ │ │ ├── token_scopes.png │ │ │ ├── upload_files.PNG │ │ │ ├── upload_files_button.PNG │ │ │ └── version_control_motivation_comics.png │ │ ├── intro-to-GitHub.rst │ │ ├── log-in-GitHub.rst │ │ ├── overview.rst │ │ └── why-pairs.rst │ ├── L3 │ │ ├── exercise-3.rst │ │ └── overview.rst │ ├── L4 │ │ ├── exercise-4.rst │ │ └── overview.rst │ ├── L5 │ │ ├── exercise-5.rst │ │ ├── img │ │ │ ├── first-line-of-text.PNG │ │ │ ├── pandas_logo.png │ │ │ ├── second-line-of-text-fixed.PNG │ │ │ ├── second-line-of-text.PNG │ │ │ └── third-line-of-text.PNG │ │ ├── midterm-feedback.rst │ │ ├── overview.rst │ │ └── pandas-overview.rst │ ├── L6 │ │ ├── exercise-6.rst │ │ ├── img │ │ │ ├── Kiira-storm.PNG │ │ │ └── read-csv-varying-spaces.PNG │ │ └── overview.rst │ └── L7 │ │ ├── exercise-7.rst │ │ └── overview.rst ├── notebooks │ ├── L1 │ │ ├── a-taste-of-python.ipynb │ │ └── gcp-1-variable-naming.ipynb │ ├── L2 │ │ ├── Python-basic-elements.ipynb │ │ └── gcp-2-describing-code.ipynb │ ├── L3 │ │ ├── conditional-statements.ipynb │ │ ├── for-loops.ipynb │ │ └── gcp-3-pep8.ipynb │ ├── L4 │ │ ├── functions.ipynb │ │ ├── gcp-4-writing-scripts.ipynb │ │ ├── img │ │ │ ├── Thumbs.db │ │ │ ├── chatgpt.png │ │ │ └── chatgpt_signup.png │ │ ├── modules.ipynb │ │ ├── script-files.ipynb │ │ └── use-of-ai.ipynb │ ├── L5 │ │ ├── data │ │ │ └── kumpula-summer-2024.txt │ │ ├── exploring-data-using-pandas.ipynb │ │ └── processing-data-with-pandas.ipynb │ ├── L6 │ │ ├── advanced-data-processing-with-pandas.ipynb │ │ ├── data │ │ │ ├── Helsinki_Kumpula.csv │ │ │ ├── Lappeenranta_airport.csv │ │ │ ├── Oulu_harbour.csv │ │ │ ├── Porvoo_Emäsalo.csv │ │ │ ├── Rovaniemi_station.csv │ │ │ └── Turku_Rajakari.csv │ │ ├── debugging.ipynb │ │ ├── errors.ipynb │ │ ├── gcp-5-assertions.ipynb │ │ └── img │ │ │ ├── error-message-annotated.png │ │ │ ├── fmi.png │ │ │ └── yle-summer-2024.png │ └── L7 │ │ ├── basic-plotting.ipynb │ │ ├── data │ │ └── 029740.txt │ │ ├── img │ │ ├── matplotlib-gallery.png │ │ └── subplots.png │ │ ├── line-plots.ipynb │ │ ├── metadata │ │ ├── 3505doc.txt │ │ ├── 6367598020644inv.txt │ │ └── 6367598020644stn.txt │ │ ├── python-plotting.ipynb │ │ └── subplots.ipynb └── rtd_requirements.txt └── svg └── geo-python-banner-2020.svg /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .DS_Store 3 | .idea 4 | .ipynb_checkpoints 5 | .nbgrader.log 6 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | python: 4 | install: 5 | - requirements: source/rtd_requirements.txt 6 | - method: pip 7 | path: . 8 | 9 | build: 10 | os: ubuntu-22.04 11 | tools: 12 | python: "3" 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - 3.6 4 | install: 5 | - sudo apt-get install pandoc 6 | - pip install sphinx==1.7.9 sphinx_rtd_theme nbsphinx==0.4.3 IPython==6.5.0 jupyter_client ipykernel 7 | - pip install matplotlib numpy pandas imageio 8 | - pip install git+https://github.com/HTenkanen/sphinxcontrib-versioning.git 9 | - pip install sphinxcontrib-googleanalytics 10 | script: sphinx-versioning build source build/html 11 | after_success: 12 | - ./push.sh 13 | env: 14 | global: 15 | - secure: "sYbPUwm5tk2a8/VlYpXwi3lMhjXZDFtj23MP3FMm0bf0+Z5eO0pPV443ALOMRZB393xJoxKmCze+RngNCDX0+xpU7HAu9pJ8BSN4oNOx4ggjL66t6/yaS3kKKbJv06DlQLBs5iQ0BbfF8OA+SzUAEgXzF4rfKRDfLpFZiPMW3uSOTRo3YOZSw8ZlwWshl2h7ahLT4rCiQi17e/zHpB8jvw6/YKKEPey7d8fejkuP1mKRRuoowxrJ3s8QLqgwtjOtBcyR20crospnh7tSHT7eIJVZemoUhlDQkvxcISNKqHCSqVON1qe/XRgVVXo7tLlMS5G2fcueiXfttDC6NHWOl7oe8l6OXCUdh94hMInVGYi8q0Lo9jYEB3cffsppaA24yvxZ+00HMH+ng9FOJif6j0FnJSMabvv2R+b/G2mHxe8zgHWkuOI2WSjRy7NUF8ocKOJfvEyExcfsEi9qdempDhfCPLU+0yZ4k5JR7okSK/oGk6LZNHX+lRp4YuH8V0PoLkOdZygb5Ai9CNhelqZb9s9O5bALCW85vfYmvungxTm53xSbWXMWHL8Q7xN4oxQgzNqzjnRg2CiJBd0e4OGQg+pq9IAuzo79WbCEsH1GbYVNcoR7ScHnR1tJxsdeecjIezZb688h+8GrAY64Lo+R67/apwOhDJUvok9PYHAwR6M=" 16 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = Geo-Python 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Geo-Python 2 | 3 | [![Documentation Status](https://readthedocs.org/projects/geo-python-site/badge/?version=latest)](https://geo-python-site.readthedocs.io/en/latest/?badge=latest) 4 | 5 | This repository contains the source files of course material available at [https://geo-python.github.io/site/](https://geo-python.github.io/site/) 6 | 7 | The course introduces you to the basic concepts of computer programming in the Python programming language. 8 | 9 | If you are interested in using our course materials, you may be interested in the following links: 10 | 11 | - [License and usage of our materials](https://geo-python-site.readthedocs.io/en/latest/course-info/licensing.html) 12 | - [Hosting your own version of the course online](https://geo-python-site.readthedocs.io/en/latest/course-info/licensing.html#getting-started-hosting-your-own-version-of-the-course) -------------------------------------------------------------------------------- /ai/Bill-the-vending-machine.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/ai/Bill-the-vending-machine.ai -------------------------------------------------------------------------------- /ai/Geo-Python-video-intro-screen.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/ai/Geo-Python-video-intro-screen.ai -------------------------------------------------------------------------------- /key/Pandas-data-structure-images.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/key/Pandas-data-structure-images.key -------------------------------------------------------------------------------- /key/driver-navigator.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/key/driver-navigator.key -------------------------------------------------------------------------------- /make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | set SPHINXPROJ=Geo-Python 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 20 | echo.installed, then set the SPHINXBUILD environment variable to point 21 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 22 | echo.may add the Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /postBuild: -------------------------------------------------------------------------------- 1 | jupyter lab build --dev-build=False --minimize=False 2 | -------------------------------------------------------------------------------- /push.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Push HTML files to gh-pages automatically. 3 | 4 | # Fill this out with the correct org/repo 5 | ORG=geo-python 6 | REPO=site 7 | # This probably should match an email for one of your users. 8 | EMAIL=david.whipp@helsinki.fi 9 | 10 | set -e 11 | 12 | # Clone the gh-pages branch outside of the repo and cd into it. 13 | cd .. 14 | git clone -b gh-pages "https://$GH_TOKEN@github.com/$ORG/$REPO.git" gh-pages 15 | cd gh-pages 16 | 17 | # Update git configuration so I can push. 18 | if [ "$1" != "dry" ]; then 19 | # Update git config. 20 | git config user.name "Travis Builder" 21 | git config user.email "$EMAIL" 22 | fi 23 | 24 | # Copy in the HTML. You may want to change this with your documentation path. 25 | cp -R ../$REPO/build/html/* ./ 26 | 27 | # Add and commit changes. 28 | git add -A . 29 | git commit -m "[ci skip] Autodoc commit for $COMMIT." 30 | if [ "$1" != "dry" ]; then 31 | # -q is very important, otherwise you leak your GH_TOKEN 32 | git push -q origin gh-pages 33 | fi 34 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | matplotlib 3 | imageio 4 | pandas 5 | jupyter-offlinenotebook 6 | #jupyterlab-git # Disabling jupyterlab-git for now as it hangs indefinitely 7 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = Geo-Python 3 | version = 2020 4 | license = MIT 5 | description = Contents for the book. 6 | author = Dave Whipp, Henrikki Tenkanen, Vuokko Heikinheimo 7 | url = https://github.com/geo-python/site 8 | classifiers = 9 | Development Status :: 2 - 10 | Environment :: Web Environment 11 | License :: OSI Approved :: MIT License 12 | Operating System :: OS Independent 13 | Programming Language :: Python 14 | Programming Language :: Python :: 2.7 15 | Programming Language :: Python :: 3.4 16 | Programming Language :: Python :: 3.5 17 | Programming Language :: Python :: 3.6 18 | Programming Language :: Python :: 3.7 19 | Programming Language :: Python :: 3.8 20 | 21 | [options] 22 | packages = find: 23 | include_package_data = True 24 | zip_safe = False 25 | 26 | [tool:release] 27 | github_owner = geo-python 28 | github_repo = site -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | # Configuration is in setup.cfg 4 | setup() 5 | -------------------------------------------------------------------------------- /source/_static/01-Computers-and-programs.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/_static/01-Computers-and-programs.pdf -------------------------------------------------------------------------------- /source/_static/L4/temp_converter.py: -------------------------------------------------------------------------------- 1 | def celsius_to_fahr(temp_celsius): 2 | return 9 / 5 * temp_celsius + 32 3 | 4 | 5 | def kelvins_to_celsius(temp_kelvins): 6 | return temp_kelvins - 273.15 7 | 8 | 9 | def kelvins_to_fahr(temp_kelvins): 10 | temp_celsius = kelvins_to_celsius(temp_kelvins) 11 | temp_fahr = celsius_to_fahr(temp_celsius) 12 | return temp_fahr 13 | 14 | 15 | def temp_calculator(temp_k, convert_to): 16 | """ 17 | Function for converting temperature in Kelvins to Celsius or Fahrenheit. 18 | 19 | Parameters 20 | ---------- 21 | temp_k: 22 | Temperature in Kelvins 23 | convert_to: 24 | Target temperature that can be either Celsius ('C') or Fahrenheit ('F'). Supported values: 'C' | 'F' 25 | 26 | Returns 27 | ------- 28 | 29 | Converted temperature. 30 | """ 31 | 32 | # Check if user wants the temperature in Celsius 33 | if convert_to == "C": 34 | # Convert the value to Celsius using the dedicated function for the task that we imported from another script 35 | converted_temp = kelvins_to_celsius(temp_kelvins=temp_k) 36 | elif convert_to == "F": 37 | # Convert the value to Fahrenheit using the dedicated function for the task that we imported from another script 38 | converted_temp = kelvins_to_fahr(temp_kelvins=temp_k) 39 | # Return the result 40 | return converted_temp 41 | -------------------------------------------------------------------------------- /source/_static/Temp-anomalies-2018.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/_static/Temp-anomalies-2018.mp4 -------------------------------------------------------------------------------- /source/_static/Temp-anomalies-2019.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/_static/Temp-anomalies-2019.mp4 -------------------------------------------------------------------------------- /source/_static/css/custom.css: -------------------------------------------------------------------------------- 1 | div.admonition.admonition-youtube { 2 | border-color: #ff0000; /* YouTube red */ 3 | } 4 | div.admonition.admonition-youtube > .admonition-title:before { 5 | background-color: #ff0000; 6 | } 7 | div.admonition.admonition-youtube > .admonition-title:after { 8 | color: #ff0000; 9 | content: "\f26c"; /* fa-solid fa-tv */ 10 | } -------------------------------------------------------------------------------- /source/_static/geo-python.css: -------------------------------------------------------------------------------- 1 | .wy-nav-content { 2 | max-width: 900px !important; 3 | } 4 | 5 | .wy-side-nav-search{ 6 | background-color: #4D7F79; 7 | } 8 | 9 | .wy-nav-top{ 10 | background-color: #4D7F79; 11 | } -------------------------------------------------------------------------------- /source/_static/geopython.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/_static/geopython.png -------------------------------------------------------------------------------- /source/_static/geopython2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/_static/geopython2.png -------------------------------------------------------------------------------- /source/_templates/footer.html: -------------------------------------------------------------------------------- 1 | {% extends "!footer.html" %} 2 | {% block extrafooter %} 3 |


Creative Commons License

4 | {{ super() }} 5 | {% endblock %} -------------------------------------------------------------------------------- /source/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | 3 | {% block extrahead %} 4 | 5 | {{ super() }} 6 | {% endblock %} 7 | 8 | -------------------------------------------------------------------------------- /source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Configuration file for the Sphinx documentation builder. 4 | # 5 | # This file does only contain a selection of the most common options. For a 6 | # full list see the documentation: 7 | # http://www.sphinx-doc.org/en/master/config 8 | 9 | # -- Path setup -------------------------------------------------------------- 10 | 11 | # If extensions (or modules to document with autodoc) are in another directory, 12 | # add these directories to sys.path here. If the directory is relative to the 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. 14 | # 15 | # import os 16 | # import sys 17 | # sys.path.insert(0, os.path.abspath('.')) 18 | 19 | 20 | # -- Project information ----------------------------------------------------- 21 | 22 | project = "Geo-Python" 23 | copyright = "2016-2024, The Geo-Python team, Department of Geosciences and Geography, University of Helsinki" 24 | # author = 'David Whipp, Henrikki Tenkanen, Vuokko Heikinheimo, Håvard Aagesen' 25 | author = "" 26 | 27 | # The short X.Y version 28 | version = "2024" 29 | # The full version, including alpha/beta/rc tags 30 | release = "site" 31 | 32 | # Set documentation language 33 | language="en" 34 | 35 | # -- General configuration --------------------------------------------------- 36 | 37 | # Add any Sphinx extension module names here, as strings. They can be 38 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 39 | # ones. 40 | extensions = [ 41 | "sphinx.ext.mathjax", 42 | "sphinx.ext.githubpages", 43 | "sphinx.ext.todo", 44 | "sphinxcontrib.googleanalytics", 45 | "sphinxcontrib.youtube", 46 | "IPython.sphinxext.ipython_console_highlighting", 47 | "IPython.sphinxext.ipython_directive", 48 | "myst_nb", 49 | "jupyter_sphinx", 50 | ] 51 | 52 | # Google Analytics ID to enable tracking of site traffic 53 | googleanalytics_id = "UA-105019106-1" 54 | googleanalytics_enabled = True 55 | 56 | # Add any paths that contain templates here, relative to this directory. 57 | templates_path = ["_templates"] 58 | 59 | # The suffix(es) of source filenames. 60 | # You can specify multiple suffix as a list of string: 61 | # 62 | # source_suffix = ['.rst', '.md'] 63 | source_suffix = ".rst" 64 | 65 | # The master toctree document. 66 | master_doc = "index" 67 | 68 | # The language for content autogenerated by Sphinx. Refer to documentation 69 | # for a list of supported languages. 70 | # 71 | # This is also used if you do content translation via gettext catalogs. 72 | # Usually you set "language" from the command line for these cases. 73 | language = None 74 | 75 | # List of patterns, relative to source directory, that match files and 76 | # directories to ignore when looking for source files. 77 | # This pattern also affects html_static_path and html_extra_path . 78 | exclude_patterns = [] 79 | 80 | # The name of the Pygments (syntax highlighting) style to use. 81 | pygments_style = "sphinx" 82 | 83 | 84 | # -- Options for HTML output ------------------------------------------------- 85 | 86 | # The theme to use for HTML and HTML Help pages. See the documentation for 87 | # a list of builtin themes. 88 | # 89 | 90 | # ====================== 91 | # TODO: Remove OLD SETUP 92 | # ====================== 93 | # import sphinx_rtd_theme 94 | # html_theme = 'alabaster' 95 | # html_theme = 'sphinx_rtd_theme' 96 | # html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] 97 | # def setup(app): 98 | # app.add_stylesheet('theme_overrides.css') 99 | # html_logo = 'img/HY-logo-2017.png' 100 | 101 | # ======================= 102 | # NEW SPHINX THEME SETUP 103 | # ======================= 104 | 105 | html_theme = "sphinx_book_theme" 106 | html_logo = "_static/geopython.png" 107 | html_title = "" 108 | 109 | html_theme_options = { 110 | # "external_links": [], 111 | "repository_url": "https://github.com/geo-python/site/", 112 | "repository_branch": "master", 113 | "path_to_docs": "source/", 114 | # "twitter_url": "https://twitter.com/pythongis", 115 | # "google_analytics_id": "UA-159257488-1", 116 | "use_edit_page_button": True, 117 | "use_repository_button": True, 118 | "launch_buttons": { 119 | "binderhub_url": "https://mybinder.org", 120 | "thebe": False, 121 | "notebook_interface": "jupyterlab", 122 | "collapse_navigation": False, 123 | }, 124 | } 125 | 126 | # Add last modified to all pages 127 | html_last_updated_fmt = "" 128 | 129 | # Add any paths that contain custom static files (such as style sheets) here, 130 | # relative to this directory. They are copied after the builtin static files, 131 | # so a file named "default.css" will overwrite the builtin "default.css". 132 | html_static_path = ["_static"] 133 | 134 | html_css_files = [ 135 | 'css/custom.css', 136 | ] 137 | 138 | # Custom sidebar templates, must be a dictionary that maps document names 139 | # to template names. 140 | # 141 | # The default sidebars (for documents that don't match any pattern) are 142 | # defined by theme itself. Builtin themes are using these templates by 143 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', 144 | # 'searchbox.html']``. 145 | # 146 | # html_sidebars = {} 147 | 148 | html_context = { 149 | # Enable the "Edit in GitHub link within the header of each page. 150 | "display_github": True, 151 | # Set the following variables to generate the resulting github URL for each page. 152 | # Format Template: https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/blob/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }} 153 | "github_user": "geo-python", 154 | "github_repo": "site", 155 | "github_version": "master/", 156 | "conf_py_path": "/source/", 157 | } 158 | 159 | # -- Options for HTMLHelp output --------------------------------------------- 160 | 161 | # Output file base name for HTML help builder. 162 | htmlhelp_basename = "Geo-Pythondoc" 163 | 164 | 165 | # -- Options for LaTeX output ------------------------------------------------ 166 | # latex_docclass = { 167 | # 'howto': 'krantz.cls', 168 | # 'manual': 'krantz.cls', 169 | # } 170 | # 171 | # latex_additional_files = ["hyperref.sty"] 172 | 173 | latex_elements = { 174 | # The paper size ('letterpaper' or 'a4paper'). 175 | # 176 | # 'papersize': 'letterpaper', 177 | # The font size ('10pt', '11pt' or '12pt'). 178 | # 179 | # 'pointsize': '10pt', 180 | # Additional stuff for the LaTeX preamble. 181 | # 182 | # 'preamble': '', 183 | # Latex figure (float) alignment 184 | # 185 | # 'figure_align': 'htbp', 186 | } 187 | 188 | # Grouping the document tree into LaTeX files. List of tuples 189 | # (source start file, target name, title, 190 | # author, documentclass [howto, manual, or own class]). 191 | latex_documents = [ 192 | ( 193 | master_doc, 194 | "Geo-Python.tex", 195 | "Geo-Python Documentation", 196 | "H. Tenkanen and D. Whipp", 197 | "manual", 198 | ), 199 | ] 200 | 201 | # -- Options for manual page output ------------------------------------------ 202 | 203 | # One entry per manual page. List of tuples 204 | # (source start file, name, description, authors, manual section). 205 | man_pages = [(master_doc, "geo-python", "Geo-Python Documentation", [author], 1)] 206 | 207 | # Allow errors 208 | execution_allow_errors = True 209 | 210 | # Execute cells only if any of the cells is missing output 211 | jupyter_execute_notebooks = "auto" 212 | 213 | # Exclude execution of some notebooks 214 | execution_excludepatterns = ['advanced-data-processing-with-pandas.ipynb', 'errors.ipynb', 'matplotlib.ipynb', 'advanced_plotting.ipynb'] 215 | 216 | # Add math config options for new version of MyST 217 | myst_enable_extensions = ["dollarmath"] 218 | -------------------------------------------------------------------------------- /source/course-info/ai-tools.rst: -------------------------------------------------------------------------------- 1 | Use of AI tools 2 | =============== 3 | 4 | Artificial intelligence (AI)-based tools using large language models (AI-LLMs), such as ChatGPT, Google Bard, or DeepL, are changing the ways in which people produce content including software. 5 | Although these tools have great potential to expidite many coding tasks, it is important to note that one must understand the code that is produced in order to ensure it functions properly. 6 | As the goal of the Geo-Python course is to introduce both basic programming concepts and how to write code using the Python programming language, we (the teachers) must be careful to ensure the use of AI tools does not compromise the learning goals of the course. 7 | Thus, we provide some guidelines for the use of AI tools below. 8 | 9 | Guidelines for AI-LLM use in the Geo-Python course 10 | -------------------------------------------------- 11 | 12 | .. note:: 13 | 14 | Please note these guidelines apply only to students enrolled in the Geo-Python/AutoGIS 1 course for credit. 15 | 16 | 1. Unless stated otherwise, AI-LLMs should not be used to generate code or answer questions in the course exercises. 17 | 2. Exercise problems or parts of problems where AI-LLM use is OK will be clearly indicated in the exercise assignment by the text "**AI-LLM OK**". 18 | 3. For problems or parts of problems where AI-LLM use is OK, students must indicate in writing which AI tool/model has been used and in what way. 19 | 4. If a student uses an AI-LLM for part of an exercise where it is prohibited or fails to report the use of an AI-LLM as instructed, this will be considered cheating and will be handled as such. 20 | 21 | The guidelines above are based on the `University of Helsinki guidelines for the use of AI in teaching `_. 22 | More information is available in the `instructions for students `_. 23 | 24 | An introduction to AI-LLMs 25 | -------------------------- 26 | 27 | During the first week in which the use of AI-LLMs is possible for the course exercises, we will provide a brief introduction to how to use ChatGPT to produce Python code. 28 | In this demonstration we will highlight some of the advantages and disadvantages to the code ChatGPT produces, as well as how to review the code to ensure it works properly. 29 | 30 | .. note:: 31 | 32 | Please note that we are adjusting to a changing environment as far as the AI-LLMs go, so we will do our best to encourage use where it makes sense. 33 | At the same time, we do not want to negatively impact your learning of core programming concepts. 34 | -------------------------------------------------------------------------------- /source/course-info/course-info.rst: -------------------------------------------------------------------------------- 1 | General info 2 | ============ 3 | 4 | This is a joint course for geography and geology students at the Department of Geosciences and Geography, University of Helsinki (course codes GEOK3001 and GEOG-329-1). 5 | 6 | Course materials are freely available online for anyone interested in the course contents. 7 | 8 | Course meetings in Period I 9 | --------------------------- 10 | 11 | - Lectures: 12 | - Mondays 09:15 - 12:00 in A129, Chemicum 13 | - Work sessions: 14 | - Group 1 on Thursdays 12:15 - 15:45 in A113+A114, Physicum 15 | - Group 2 on Fridays 8:15 - 11:45 in A113+A114, Physicum 16 | 17 | Instructors 18 | ----------- 19 | 20 | Email: *firstname.lastname@helsinki.fi* 21 | 22 | Lecturers 23 | ~~~~~~~~~ 24 | 25 | - Kamyar Hasanzadeh 26 | 27 | - Office: D431, Exactum 28 | 29 | - David Whipp 30 | 31 | - Office: D426, Exactum 32 | 33 | Course assistants 34 | ~~~~~~~~~~~~~~~~~ 35 | 36 | - Nino Chkhartishvili 37 | - Sanni Laaksonen 38 | - Vili Rauhala 39 | - Annarosa Whitman 40 | 41 | Course websites 42 | --------------- 43 | 44 | - Course sites for Period I (Introduction to Python programming): 45 | 46 | - Main course site: ``_ 47 | - *Introduction to Python for Geographic Data Science* book site: ``_ 48 | - Noppe by CSC: ``_ 49 | - Discord (Q&A + chat): ``_ 50 | - Polling / voting (active during lectures only): ``_ 51 | 52 | - Course websites for Period II 53 | 54 | - Automating GIS processes (GEOG-329-2): ``_ 55 | -------------------------------------------------------------------------------- /source/course-info/grading.rst: -------------------------------------------------------------------------------- 1 | Grading 2 | ======= 3 | 4 | General grading breakdown 5 | ------------------------- 6 | 7 | Course grades will be given using the standard six-level grading scale from 0 to 5: 8 | 9 | - 5 (Excellent) 10 | - 4 (Very Good) 11 | - 3 (Good) 12 | - 2 (Satisfactory) 13 | - 1 (Passable) 14 | - 0 (Fail) 15 | 16 | .. note:: 17 | 18 | The border between grades 4 and 5 is typically 95% due to the large number of points from the exercises. 19 | 20 | Your grade will be determined as follows: 21 | 22 | - 60% from weekly exercises 23 | - 40% from the final course project 24 | 25 | .. admonition:: Weekly deadlines 26 | 27 | Generally, exercises are due at the start of class the week following their assignment. 28 | Please submit the exercises on time in order to keep up with the course. 29 | You can discuss with the course assistants in case you need more time with the exercises. 30 | -------------------------------------------------------------------------------- /source/course-info/img/Anaconda-Mac.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/course-info/img/Anaconda-Mac.png -------------------------------------------------------------------------------- /source/course-info/img/conda_shapely_windows.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/course-info/img/conda_shapely_windows.PNG -------------------------------------------------------------------------------- /source/course-info/img/google_query_conda.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/course-info/img/google_query_conda.PNG -------------------------------------------------------------------------------- /source/course-info/img/install_shapely.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/course-info/img/install_shapely.PNG -------------------------------------------------------------------------------- /source/course-info/img/miniconda-linux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/course-info/img/miniconda-linux.png -------------------------------------------------------------------------------- /source/course-info/img/miniconda-macos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/course-info/img/miniconda-macos.png -------------------------------------------------------------------------------- /source/course-info/img/miniconda-windows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/course-info/img/miniconda-windows.png -------------------------------------------------------------------------------- /source/course-info/img/python-environment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/course-info/img/python-environment.png -------------------------------------------------------------------------------- /source/course-info/installing-anacondas.rst: -------------------------------------------------------------------------------- 1 | Installing Python 2 | ================= 3 | 4 | **It is possible to do programming with Python on your own computer**, but first you need to install Python. The purpose of this page is to help you to 5 | install Python and different Python packages into your own computer. Even though it is possible to install Python from their `homepage `_, 6 | **we highly recommend using** `Anaconda `_ which is an open source distribution of the Python and R programming 7 | languages for large-scale data processing, predictive analytics, and scientific computing, that aims to simplify package management and deployment. In short, 8 | it makes life much easier when installing new tools to your Python. 9 | 10 | Install Python on Windows 11 | ------------------------- 12 | 13 | For people working with computers from University of Helsinki: A recent version of Anaconda should be available from the `University of Helsinki Software Center `__. 14 | 15 | Following steps have been tested to work on Windows 7 and 10 with Anaconda3 version 5.2.0 (June 2018) that installs Python 3.6 and various useful packages. 16 | 17 | `Download Anaconda installer (64 bit) `_ for Windows. 18 | 19 | Install Anaconda to your computer by double clicking the installer and install it into a directory you want (needs admin rights). 20 | Install it to **all users** and use default settings. 21 | 22 | .. note:: 23 | 24 | Note for Windows users with a **computer administered by the University of Helsinki**: If you don't have administrator rights on your 25 | computer, you might want to apply for an admin account. 26 | Read more about administrator rights and software installations in `here `__ 27 | 28 | 29 | Test that the Anaconda´s package manage called ``conda`` works by 30 | `opening a command prompt as a admin user `_ 31 | and running command ``conda --version``. If the command returns a version number of conda (e.g. ``conda 4.5.9``) everything is working correctly. 32 | 33 | Install Python on macOS 34 | ----------------------- 35 | 36 | There is now a convenient graphical installer that can be used to install Anaconda for Mac. 37 | For the IntroQG people, we recommend you install Anaconda 4.4.0 by visiting `the Anaconda downloads page `__ and clicking on the button to install the latest Python 3 version of Anaconda, as shown below. 38 | 39 | .. note:: 40 | 41 | For the AutoGIS people, we recommend that you install a slightly older version of Anaconda for Mac (version 4.2.0). 42 | You can download that version using `this link to the Anaconda software repository `__. 43 | 44 | .. figure:: img/Anaconda-Mac.png 45 | :width: 600px 46 | :align: center 47 | :alt: Downloading the latest Anaconda for Mac 48 | 49 | Anaconda installation for the IntroQG students 50 | 51 | Install Python on Linux 52 | ----------------------- 53 | 54 | The following have been tested on Ubuntu 16.04. Might work also on Mac (not tested yet). 55 | 56 | **Install Anaconda 3 and add it to system path** 57 | 58 | 59 | .. code-block:: 60 | 61 | # Download and install Anaconda 62 | sudo wget https://repo.continuum.io/archive/Anaconda3-4.1.1-Linux-x86_64.sh 63 | sudo bash Anaconda3-4.1.1-Linux-x86_64.sh 64 | 65 | # Add Anaconda installation permanently to PATH variable 66 | nano ~/.bashrc 67 | 68 | # Add following line at the end of the file and save (EDIT ACCORDING YOUR INSTALLATION PATH) 69 | export PATH=$PATH:/PATH_TO_ANACONDA/anaconda3/bin:/PATH_TO_ANACONDA/anaconda3/lib/python3.5/site-packages 70 | 71 | 72 | 73 | Installing packages using Conda 74 | --------------------------------- 75 | 76 | Conda has an excellent `online user guide `__ which covers most of the basic things, such as installing new packages. 77 | 78 | The easiest way 79 | ~~~~~~~~~~~~~~~ 80 | 81 | You can install new packages using the ``conda install`` command in a terminal of an Anaconda Prompt (as admin). 82 | 83 | :: 84 | 85 | conda install [packagename] 86 | 87 | You can first check which packages you have installed using the ``conda list`` command. 88 | It's a good idea to search for installation instructions for each package online. 89 | 90 | 91 | 92 | Installing Jupyter Lab using conda 93 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | 95 | If you want to use Jupyter Lab on your own computer, you can install it using conda (or pip). 96 | First, have a quick look at the Jupyter Lab installation instructions: https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html 97 | 98 | According to the instructions, you can run: 99 | 100 | ``` 101 | conda install -c conda-forge jupyterlab 102 | ``` 103 | 104 | After installation is completed, you can start a Jupyter Lab instance by running this command: 105 | 106 | 107 | .. code-block:: 108 | 109 | jupyter lab 110 | 111 | Jupyter Lab should open up in a browser window. 112 | 113 | 114 | 115 | Alternative way to install packages if typical doesn't work 116 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | 118 | In most cases using ``conda install`` is the best approach, but sometimes you get errors when trying to install a package. 119 | Here is an example when trying to install a module called shapely: 120 | 121 | 122 | .. code-block:: 123 | 124 | C:\WINDOWS\system32>conda install shapely 125 | Using Anaconda API: https://api.anaconda.org 126 | Fetching package metadata ......... 127 | Solving package specifications: . 128 | Error: Package missing in current win-64 channels: 129 | - shapely 130 | 131 | You can search for packages on anaconda.org with 132 | 133 | anaconda search -t conda shapely 134 | 135 | In this case conda was not able to find the shapely module from the default channel it uses for downloading the module. 136 | Conda downloads packages from different remote `channels `__, and it is often good 137 | idea to download all packages from the same channel in order to avoid conflicts with versions. 138 | 139 | 140 | If ``conda install`` command was not able to install the package you were interested in there is an alternative way to do it by taking advantage of different conda distribution channels that 141 | are maintained by programmers themselves. An easy way to find the right command to install a package from these alternative conda distribution channels is to Google it. 142 | 143 | Let's find our way to install the Shapely module by typing following query to Google: 144 | 145 | .. image:: img/google_query_conda.PNG 146 | 147 | Here, we can see that we have different pages showing how to install ``Shapely`` using conda package manager. 148 | 149 | **Which one of them is the correct one to use?** 150 | 151 | We need to check the operating system banners and if you find a logo of the operating system of your computer, 152 | that is the one to use! Thus, in our case the first page that Google gives does not work in Windows but the second one does, as it has Windows logo on it: 153 | 154 | .. image:: img/conda_shapely_windows.PNG 155 | 156 | From here we can get the correct installation command for conda and it works! 157 | 158 | .. image:: img/install_shapely.PNG 159 | 160 | You can follow these steps similarly for all of the other Python modules that you are interested to install. 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /source/course-info/learning-goals.rst: -------------------------------------------------------------------------------- 1 | Learning goals 2 | ============== 3 | 4 | During the Geo-Python course you will learn the basics of programming and scientific data analysis in the Python programming language. 5 | This course will also teach you several skills related to open science. Each week you will learn new skills building upon the content of the previous weeks. 6 | 7 | After each week of the course, students will be able to: 8 | 9 | Week one 10 | -------- 11 | 12 | * Understand tools we are using during this course 13 | * Explain the basic concepts of a 14 | 15 | #. computer 16 | #. program 17 | #. programming language 18 | 19 | * Define and use variables 20 | * Describe the concept of a data type 21 | * Determine the data type of a variable in Python 22 | 23 | Week two 24 | -------- 25 | 26 | * conduct basic data type conversions 27 | * store and access values in a list 28 | * explain the concept of an index value 29 | * understand the basics of version control 30 | * use git and GitHub to record changes to your files 31 | * use Jupyter notebooks for writing and documenting your code 32 | 33 | Week three 34 | ---------- 35 | 36 | * create a for loop and use it to repeat a section of code 37 | * understand the logic of conditional statements and comparison operators 38 | * write a short piece of pseudo-code 39 | * format and indent code when using for loops and conditional statements 40 | 41 | Week four 42 | --------- 43 | 44 | * explain how functions are used and why they are useful 45 | * create simple functions with parameters and return values 46 | * save functions to a separate script file 47 | * write docstrings for functions and script files 48 | 49 | Week five 50 | --------- 51 | 52 | * explain what a Python module is and how they can be used 53 | * search for documentation about a module 54 | * read tabular data from a file using the pandas module 55 | * understand the structure and basic functionality of a pandas DataFrame 56 | * explore data in a pandas DataFrame 57 | 58 | Week six 59 | -------- 60 | 61 | * manage and analyze tabular data using pandas 62 | * repeat an analysis workflow for several input files 63 | * understand common Python errors 64 | * follow a simple set of guidelines to debug programs efficiently 65 | 66 | Week seven 67 | ---------- 68 | 69 | * visualize tabular data using Matplotlib 70 | * manipulate plot formatting 71 | * save plots as image files 72 | -------------------------------------------------------------------------------- /source/course-info/licensing.rst: -------------------------------------------------------------------------------- 1 | License and using our materials 2 | =============================== 3 | 4 | It is our hope that the materials provided here will be helpful for others. 5 | Thus, we share all the lesson materials openly, and our source codes and lesson materials are openly available `from GitHub `__. 6 | If you would like to create your own copy of the course online, you can also find :ref:`information about how to do that below`. 7 | 8 | If you modify the lesson materials we request that you also share your materials openly (e.g., on GitHub), where everyone could benefit from your work in the same way that we provide these materials for you. 9 | We also welcome collaboration and ideas of how to improve the materials on these pages. 10 | Contact us via :doc:`email ` or fork the docs on **GitHub**. 11 | 12 | **Our materials and code snippets are licensed** as explained below: 13 | 14 | Instructional materials 15 | ----------------------- 16 | 17 | .. raw:: html 18 | 19 | Creative Commons License
20 | 21 | All the instructional material is made available under the **Creative Commons Attribution-ShareAlike 4.0 International licence** . See the `full licence `_. 22 | 23 | In short as a human-readable version of the license: 24 | 25 | You are free to 26 | ~~~~~~~~~~~~~~~ 27 | 28 | - **Share** - copy and redistribute the material in any medium or format 29 | - **Adapt** - remix, transform, and build upon the material 30 | 31 | for any purpose, even commercially. The licensor cannot revoke these freedoms as long as you follow the license terms. 32 | 33 | Under the following terms 34 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | 36 | - **Attribution** - You must give appropriate-credit_, provide a link to the license, and indicate_ if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 37 | - **ShareAlike** - If you remix, transform, or build upon the material, you must distribute your contributions under the same-license_ as the original. 38 | 39 | **No additional restrictions** — You may not apply legal terms or technological-measures_ that legally restrict others from doing anything the license permits. 40 | 41 | Notices 42 | ~~~~~~~ 43 | 44 | You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception_ or **limitation**. 45 | 46 | No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity_, privacy, 47 | or moral rights may limit how you use the material. 48 | 49 | .. admonition:: Footnotes 50 | 51 | .. _appropriate-credit: 52 | 53 | **Appropriate credit**: If supplied, you must provide the name of the creator and attribution parties, a copyright notice, a license notice, a disclaimer notice, and a link to the material. CC licenses prior to Version 4.0 also require you to provide the title of the material if supplied, and may have other slight differences. 54 | 55 | .. _indicate: 56 | 57 | **Indicate changes**: In 4.0, you must indicate if you modified the material and retain an indication of previous modifications. In 3.0 and earlier license versions, the indication of changes is only required if you create a derivative. 58 | 59 | .. _same-license: 60 | 61 | **Same license**: You may also use a license listed as compatible at `https://creativecommons.org/compatiblelicenses `_. 62 | 63 | .. _technological-measures: 64 | 65 | **Technological measures**: The license prohibits application of effective technological measures, defined with reference to Article 11 of the WIPO Copyright Treaty. 66 | 67 | .. _exception: 68 | 69 | **Exception or limitation**: The rights of users under exceptions and limitations, such as fair use and fair dealing, are not affected by the CC licenses.** 70 | 71 | .. _publicity: 72 | 73 | **Publicity, privacy, or moral rights**: You may need to get additional permissions before using the material as you intend. 74 | 75 | 76 | Code snippets / software 77 | ------------------------ 78 | 79 | Except where otherwise noted, the example programs, code snippets and other software provided by the Geo-Python course are made available under the **GNU GPLv3 license** (read the licence `here `_). 80 | 81 | Getting started hosting your own version of the course 82 | ------------------------------------------------------ 83 | 84 | Below are some instructions about how to create your own copy of the Geo-Python course materials and host it online using `Read the Docs `__. 85 | In essence, this allows you to easily copy and customize the course materials for your use. 86 | 87 | Preparations 88 | ~~~~~~~~~~~~ 89 | 90 | #. If you do not already have one, create a GitHub user account at https://github.com. You can find instructions for this as part of `Exercise 1 in the course `__. 91 | 92 | #. If you do not already have one, create a "Read the Docs Community" account on Read the Docs at https://about.readthedocs.com. You can click **Sign up** to get started, and we recommend that you use the "Sign up with GitHub" option on the sign up page. 93 | 94 | Copying and deploying the course 95 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 96 | 97 | #. Create your copy of the course materials in GitHub by visiting the `Geo-Python course GitHub repository `__ and clicking on the **Fork** button on the top right side of the page. It is fine to leave the "Copy the master branch only" option ticked. This will make a copy of the course materials for your GitHub account, but keep the connection to the original course repository. 98 | 99 | #. Sign in to Read the Docs at https://about.readthedocs.com and then click **Import a Project**. You may need to click the refresh button to get a list of available projects, but you should then see "yourusername/site" in the list (where "yourusername" is your GitHub username), which you can select by clicking on the **+** button. 100 | 101 | * You can edit the **Name**, but otherwise leave the project details as they are and click **Next**. 102 | 103 | * We already have a ``.readthedocs.yaml`` configuration file in the repository, so you can click **Finish** on the next screen. 104 | 105 | #. After importing, click on **Build version** to build and deploy the course website. This will take a few minutes. 106 | 107 | #. Once the page builds and is deployed, you can view the course online by clicking the **View Docs** button on the top right of the Read the Docs page. 108 | 109 | Making changes to the materials 110 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | 112 | At this point your page should be online and to make changes to the materials, simply visit your GitHub repository with the forked course materials and edit the materials on GitHub.com or locally on your computer if you have cloned them. 113 | You will find all of the website content in the ``source`` directory of the Geo-Python course repository. 114 | 115 | Every time you push changes to the course materials to your forked copy the website will automatically rebuild and be updated online within a few minutes. 116 | We hope this will be helpful in getting your version of the course up and running smoothly! -------------------------------------------------------------------------------- /source/course-info/python-vocabulary.rst: -------------------------------------------------------------------------------- 1 | Glossary 2 | ======== 3 | 4 | Python vocabulary 5 | ----------------- 6 | 7 | .. todo:: 8 | 9 | Add links to dedicated parts of the documentation. 10 | 11 | Here we provide a list of commonly used terms that you will most probably encounter when doing Python programming. 12 | Terms are listed in alphabetical order in English. Finnish terms and definitions are shown in italics. 13 | 14 | .. glossary:: 15 | 16 | data type (*tietotyyppi*) 17 | An attribute defining the characteristics of a value in a program. For example, type `int` is an integer (whole number). 18 | 19 | *Definition to be given in Finnish.* 20 | 21 | function (*funktio*) 22 | A reusable piece of code that performs a single action. 23 | 24 | *Definition to be given in Finnish.* 25 | 26 | index (*taulukko*) 27 | A number indicating the location of a specific value stored in Python lists or tuples. The first index value of list is always ``0``. 28 | 29 | *Definition to be given in Finnish.* 30 | 31 | library (*ohjelmakirjasto*) 32 | A group of related modules. 33 | 34 | *Definition to be given in Finnish.* 35 | 36 | list (*lista*) 37 | A data type in Python that can be used to store collections of values. The data in lists can be heterogeneous and data can be added or removed from lists. Index values can be used to access invididual list items. 38 | 39 | *Definition to be given in Finnish.* 40 | 41 | module (*moduuli*) 42 | A file containing Python definitions and statements. Module files have the ``.py`` file extension. 43 | 44 | *Definition to be given in Finnish.* 45 | 46 | script (*ohjelma*) 47 | A dedicated document for writing Python code that you can execute. Python script files should always have the ``.py`` file extension. 48 | 49 | *Definition to be given in Finnish.* 50 | 51 | variable (*muuttuja*) 52 | A way of storing values in the memory of the computer using specific names that you define. 53 | 54 | *Definition to be given in Finnish.* 55 | 56 | - **Data types** 57 | 58 | - Integer (int) = Whole number 59 | 60 | - Float (float) = Decimal number 61 | 62 | - String (str) = Text 63 | 64 | - Boolean (bool) = True / False 65 | 66 | - List (list) = A "container" that can store any kind of values. You can create a list with square brackets e.g. ``[1, 2, 3, 'a', 'b', 'c']``. 67 | 68 | - Tuple (tuple) = A similar "container" as list with a difference that you cannot update the values in a tuple. You can create a tuple with parentheses ``(1, 2, 3, 'a', 'b', 'c')``. 69 | 70 | Basic vocabulary of Version Control 71 | ----------------------------------- 72 | 73 | Few basic terms that are used often when discussing about version 74 | control (not exhaustive). 75 | 76 | .. glossary:: 77 | 78 | Repository 79 | A location where all the files for a particular project are stored, usually abbreviated to “repo.” 80 | Each project will have its own repo, which is usually located on a server and can be accessed by a unique URL (a link to GitHub page for example). 81 | 82 | 83 | - **Commit** = To commit is to write or merge the changes made in the 84 | working copy back to the repository. Whe you commit, you are 85 | basically taking a “snapshot” of your repository at that point in 86 | time, giving you a checkpoint to which you can reevaluate or restore 87 | your project to any previous state. The terms 'commit' or 'checkin' 88 | can also be used as nouns to describe the new revision that is 89 | created as a result of committing. 90 | 91 | - **Revision / version** = A revision or a version is any change in 92 | made in any form to a document(s). 93 | 94 | - **Clone** = Cloning means creating a repository containing the 95 | revisions from another repository. This is equivalent to pushing or 96 | pulling into an empty (newly initialized) repository. As a noun, two 97 | repositories can be said to be clones if they are kept synchronized, 98 | and contain the same revisions. 99 | 100 | - **Pull / push** = Copy revisions from one repository into another. 101 | Pull is initiated by the receiving repository, while push is 102 | initiated by the source. Fetch is sometimes used as a synonym for 103 | pull, or to mean a pull followed by an update. 104 | 105 | - **Merge** = A merge or integration is an operation in which two sets 106 | of changes are applied to a file or set of files. 107 | -------------------------------------------------------------------------------- /source/course-info/resources.rst: -------------------------------------------------------------------------------- 1 | Useful books and sites 2 | ====================== 3 | 4 | In addition to our course, there are countless of excellent books, tutorials and examples related to programming in Python. 5 | Here we list some good places to look for further information. 6 | 7 | New book: Introduction to Python for Geographic Data Analysis 8 | ------------------------------------------------------------- 9 | 10 | Henrikki Tenkanen, Vuokko Heikinheimo, and David Whipp (all current or past course teachers) are working on a textbook that is based on the Geo-Python and Automating GIS processes courses. 11 | The book will be openly available online and is currently under development. 12 | The material in the first part of the book originates from this course and has reached a point where we will be using the book for most of our Python lessons. You can access the current book draft at ``_. 13 | 14 | Other books 15 | ----------- 16 | 17 | There are **no required textbooks** for this course. This course uses a wide range of sources for course information and the main textbooks are given below. 18 | 19 | - Recommended textbooks and online resources: 20 | 21 | - Zelle, J. (2017) `Python Programming: An Introduction to Computer Science `_, Third edition. Franklin, Beedle & Associates. *Copies of this book are available in the Kumpula Campus library.* 22 | - McKinney, W. (2022) `Python for Data Analysis: Data wrangling with Pandas, NumPy and iPython `_, Third edition. O'Reilly Media, Incorporated. 23 | - `Learn Python the Hard Way `__ *Free sample of the book is available on the webpage.* 24 | 25 | 26 | Python tutorials 27 | ---------------- 28 | 29 | - `Codecademy's Learn to program in Python `__ 30 | - `Software Carpentry's programming in Python `__ 31 | 32 | 33 | Git + Github tutorials 34 | ---------------------- 35 | 36 | - `Online "Try-Git" tutorial (learn Git in your browser) `__ 37 | - `Git simple guide ("no deep shit") tutorial `__ 38 | - `Software Carpentry's Git novice tutorial `__ 39 | - `Git official documentation `__ 40 | - `Screencast series in Youtube for learning GitHub `__ 41 | - `Tutorial on few extra features of GitHub not (most probably) covered in this course (e.g. branch, pull-request, merge) `__ 42 | - `A TechCrunch article about 'What is GitHub Anyway?' `__ 43 | - `A list of resources for learning Git and GitHub `__ 44 | -------------------------------------------------------------------------------- /source/course-info/theteam.rst: -------------------------------------------------------------------------------- 1 | The Geo-Python team 2 | =================== 3 | 4 | The Geo-Python course has been produced by a team of teachers, content creators, and course assistants. 5 | 6 | Teachers and content creators 7 | ----------------------------- 8 | 9 | - `Håvard Aagesen `__: Former course teacher 10 | - `Christoph Fink `__: Former course teacher 11 | - `Kamyar Hasanzadeh `__: Course teacher 12 | - `Vuokko Heikinheimo `__: Former course teacher and course assistant 13 | - `Henrikki Tenkanen `__: Course co-creator and former teacher 14 | - `Yijun Wang `__: Developer of course autograding system 15 | - `David Whipp `__: Course co-creator and teacher 16 | 17 | Current and former course assistants 18 | ------------------------------------ 19 | 20 | - Nino Chkhartishvili 21 | - Emil Ehnström 22 | - Antti Kallanranta 23 | - Mikko Kangasmaa 24 | - Sonja Koivisto 25 | - Sanni Laaksonen 26 | - Hertta Lehvävirta 27 | - Samuli Massinen 28 | - Oyelowo Oyedayo 29 | - Justus Poutanen 30 | - Aleksi Rantanen 31 | - Vili Rauhala 32 | - Sakari Sarjakoski 33 | - Aino Schulz 34 | - Jorina Schütt 35 | - Veeti Sihvola 36 | - Sara Todorovic 37 | - Leevi Tuikka 38 | - Bryan Vallejo 39 | - Annarosa Whitman 40 | - Lotta Ylä-Mella -------------------------------------------------------------------------------- /source/data/L5/Kumpula-June-2016-w-metadata.txt: -------------------------------------------------------------------------------- 1 | # Data file contents: Daily temperatures (mean, min, max) for Kumpula, Helsinki 2 | # for June 1-30, 2016 3 | # Data source: https://www.ncdc.noaa.gov/cdo-web/search?datasetid=GHCND 4 | # Data processing: Extracted temperatures from raw data file, converted to 5 | # comma-separated format 6 | # 7 | # David Whipp - 02.10.2017 8 | 9 | YEARMODA,TEMP,MAX,MIN 10 | 20160601,65.5,73.6,54.7 11 | 20160602,65.8,80.8,55.0 12 | 20160603,68.4,,55.6 13 | 20160604,57.5,70.9,47.3 14 | 20160605,51.4,58.3,43.2 15 | 20160606,52.2,59.7,42.8 16 | 20160607,56.9,65.1,45.9 17 | 20160608,54.2,,47.5 18 | 20160609,49.4,54.1,45.7 19 | 20160610,49.5,55.9,43.0 20 | 20160611,54.0,62.1,41.7 21 | 20160612,55.4,64.2,46.0 22 | 20160613,58.3,68.2,47.3 23 | 20160614,59.7,67.8,47.8 24 | 20160615,63.4,70.3,49.3 25 | 20160616,57.8,67.5,55.6 26 | 20160617,60.4,70.7,55.9 27 | 20160618,57.3,,54.0 28 | 20160619,56.3,59.2,54.1 29 | 20160620,59.3,69.1,52.2 30 | 20160621,62.6,71.4,50.4 31 | 20160622,61.7,70.2,55.4 32 | 20160623,60.9,67.1,54.9 33 | 20160624,61.1,68.9,56.7 34 | 20160625,65.7,75.4,57.9 35 | 20160626,69.6,77.7,60.3 36 | 20160627,60.7,70.0, 37 | 20160628,65.4,73.0,55.8 38 | 20160629,65.8,73.2, 39 | 20160630,65.7,72.7,59.2 40 | -------------------------------------------------------------------------------- /source/final-exercise/grading.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Grading\n", 8 | "\n", 9 | "Your final exercise will be graded on the following criteria. Please note that the **use of AI large language models such as ChatGPT is OK for this exercise**, but must follow the [course guidelines for the use of AI tools](https://geo-python-site.readthedocs.io/en/latest/course-info/ai-tools.html) and the [final exercise instructions on the use of AI tools](https://github.com/Geo-Python-2023/Final-exercise#use-of-ai-llm-tools-in-this-exercise).\n", 10 | "\n", 11 | "| Item (Max Points) | Excellent (100%) | Very good (80%) | Good (60%) | Satisfactory (40%) | Passable (20%) | Fail (0%) |\n", 12 | "| ------------------------------------------ | ----------------- | --------------- | ---------- | ------------------- | -------------- | --------- |\n", 13 | "| **Reading data file (4)** | Data file read using Pandas, header row skipped, and `-9999` values converted to NA | | Data file read using Pandas, but NA values not converted on read or header not skipped | | Data file read | Data file not read |\n", 14 | "| **Processing input (8)** | New column of estimated \"TAVG\" values created, missing TEMP values filled, remaining TEMP NA values dropped | | TEMP values filled with TAVG, but TEMP NA values not dropped | | TEMP values filled with something other than TAVG | Missing TEMP values not filled |\n", 15 | "| **Defining and using functions (4)** | Created a function for temperature conversion and used it to create a new column of Celsius temperatures as shown in class | | Created a function for temperature conversion, but used it in a different way than shown in class | | Did not create a temperature conversion function or did not use it | Did not create a function or convert temperatures |\n", 16 | "| **Aggregating data (12)** | Calculated correct seasonal average temperatures for all years, correct reference temperatures, and correct anomalies | | Calculated incorrect seasonal average temperatures for all years, but correct reference temperatures (or vice versa), calculated anomalies too | | Only calculated one of seasonal average temperatures for all years or reference temperatures, or did not calculate anomalies | Did not aggregate data | \n", 17 | "| **Plot, data (4)** | Correct data plotted in each plot panel | | Data plotted for all 4 seasons, but not all correct data included | | Data not plotted in all 4 panels or incorrect data selected | Data not plotted |\n", 18 | "| **Plot, format (2)** | Plot format includes axis labels, consistent axis ranges, and relevant labels | | Plot is missing some labels or has inconsistent axis ranges | | Plot labels missing, axis ranges not consistent | Data not plotted | \n", 19 | "| **Markdown documentation (4)** | Markdown cells are used to provide additional information about the workflow, appropriate rich text formatting is used to enhance the text style | | Markdown cells are used to describe most of the workflow with some rich text formatting | | Markdown cell use is limited with no rich text formatting | Markdown documentation is missing |\n", 20 | "| **Code comments and style (2)** | Clear code comments are present in sufficient number to clarify the code cells. Code follows the PEP-8 guidelines. | | Code comments are present and explain most of the code cells. PEP-8 guidelines used in places. | | Few code comments and PEP-8 guidelines not followed | No code comments and PEP-8 guidelines not followed |\n", 21 | "| **Total (40)** | | | | | | |\n", 22 | "\n", 23 | "\n", 24 | "\n", 25 | "\n", 26 | "\n", 27 | "\n", 28 | "\n", 29 | "\n", 30 | "**Note**: The empty cells correspond to:\n", 31 | "\n", 32 | "- Grade 4: Less than criterion for grade 5, but more than criterion for grade 3\n", 33 | "- Grade 2: Less than criterion for grade 3, but more than criterion for grade 1" 34 | ] 35 | } 36 | ], 37 | "metadata": { 38 | "kernelspec": { 39 | "display_name": "Python 3 (ipykernel)", 40 | "language": "python", 41 | "name": "python3" 42 | }, 43 | "language_info": { 44 | "codemirror_mode": { 45 | "name": "ipython", 46 | "version": 3 47 | }, 48 | "file_extension": ".py", 49 | "mimetype": "text/x-python", 50 | "name": "python", 51 | "nbconvert_exporter": "python", 52 | "pygments_lexer": "ipython3", 53 | "version": "3.11.6" 54 | } 55 | }, 56 | "nbformat": 4, 57 | "nbformat_minor": 4 58 | } 59 | -------------------------------------------------------------------------------- /source/final-exercise/overview.rst: -------------------------------------------------------------------------------- 1 | Final exercise assignment 2 | ========================= 3 | 4 | .. note:: 5 | 6 | The final exercise is due by **23:59 on Friday, November 8th, 2024**. 7 | 8 | .. admonition:: Start your assignment 9 | 10 | **You can start working on your copy of the final exercise by** `accepting the GitHub Classroom assignment `__. 11 | 12 | You can also take a look at the template repository for `the final exercise on GitHub `__ (does not require logging in). Note that you should not try to make changes to this copy of the exercise, but rather only to the copy available via GitHub Classroom. 13 | 14 | .. attention:: 15 | 16 | The final exercise should be **completed indivudially**, not with your partner. 17 | Each person will need to submit their own solutions of their own work for this final exercise! 18 | 19 | Cloud computing environments 20 | ----------------------------- 21 | 22 | .. image:: https://img.shields.io/badge/launch-binder-red.svg 23 | :target: https://mybinder.org/v2/gh/Geo-Python-2024/Binder/main?urlpath=lab 24 | 25 | .. image:: https://img.shields.io/badge/launch-CSC%20Noppe-blue.svg 26 | :target: https://noppe.csc.fi/ 27 | -------------------------------------------------------------------------------- /source/img/HY-logo-2017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/img/HY-logo-2017.png -------------------------------------------------------------------------------- /source/img/banner/GeoPython_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/img/banner/GeoPython_banner.png -------------------------------------------------------------------------------- /source/img/banner/geo-python-2020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/img/banner/geo-python-2020.png -------------------------------------------------------------------------------- /source/img/banner/geo-python-2023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/img/banner/geo-python-2023.png -------------------------------------------------------------------------------- /source/index.rst: -------------------------------------------------------------------------------- 1 | .. Geo-Python documentation master file, created by 2 | sphinx-quickstart on Thu Aug 23 14:00:02 2018. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | .. image:: img/banner/geo-python-2023.png 7 | :class: dark-light 8 | 9 | Welcome to Geo-Python 2024! 10 | =========================== 11 | 12 | The **Geo-Python** course teaches you the basic concepts of programming and scientific data analysis using the Python programming language in a format that is easy to learn and understand (no previous programming experience required). 13 | Each lesson is a tutorial with specific topic(s) where the aim is to gain skills and understanding how to solve common data-related tasks using Python. 14 | Geo-Python is jointly organized by the `Master's Program in Geography `_ and the `Bachelor's Program in Geoscience `_ at the University of Helsinki. 15 | 16 | Geo-Python covers the essential skills needed to continue to more advanced courses such as `Automating GIS processes `_ and/or `Introduction to Quantitative Geology `_. 17 | 18 | .. admonition:: Open Access! 19 | 20 | The course is **open for everyone to follow online**. 21 | The aim of this course is to share the knowledge and help people to get started with their journey towards doing science more efficiently and in a reproducible manner using Python programming. 22 | 23 | .. admonition:: University of Helsinki students 24 | 25 | The Geo-Python course is run under two course codes in teaching period I at the University of Helsinki. 26 | Please sign up using only one of these course codes (not both)! 27 | 28 | - GEOG-329-1 for geography students 29 | - GEOK3001 for geology students 30 | 31 | Course format 32 | ------------- 33 | 34 | The majority of this course will be spent in front of a computer learning to program in the Python language. 35 | The course consists of interactive lectures and weekly exercises. 36 | The exercises will focus on developing basic programming skills using Python and applying those skills to various analytical problems. 37 | Typical exercises will involve a brief introduction followed by topical computer-based tasks. 38 | For each exercise, you may be asked to submit the Python codes you have written, output figures and answers to related questions. 39 | You are encouraged to discuss and work together with other students while working on the weekly exercises. 40 | However, the exercises you submit must must clearly reflect your own work (in short, don't copy/paste from other students). 41 | 42 | .. admonition:: On-site teaching 43 | 44 | Please note that the course is organized completely on site during the 2023 autumn semester. 45 | Online support for University of Helsinki and Aalto University students will be available in the discussion channels in Discord. 46 | 47 | Course topics 48 | ------------- 49 | 50 | After completing this course, students will (1) understand basic programming concepts, (2) be able to write short programs, and (3) manipulate, analyze, and visualize scientific data using Python. 51 | Students will also learn to use version control (git) and online repositories (GitHub) for documenting and sharing their work. 52 | Themes for each week are listed below. 53 | You can also read more about the weekly :doc:`learning goals `. 54 | 55 | The course runs for seven weeks in the autumn semester starting on the 4th of September 2023. 56 | New materials are updated on this course page each Monday. 57 | 58 | +----------+----------------------+ 59 | | Week | Theme | 60 | +==========+======================+ 61 | |**1** | Basic concepts of | 62 | | | Python and computer | 63 | | | programs | 64 | | | | 65 | +----------+----------------------+ 66 | |**2** | Diving into Python | 67 | | | | 68 | | | | 69 | +----------+----------------------+ 70 | |**3** | Repeating tasks | 71 | | | and making decisions | 72 | | | | 73 | | | | 74 | +----------+----------------------+ 75 | |**4** | Creating and using | 76 | | | functions | 77 | | | | 78 | +----------+----------------------+ 79 | |**5** | Data analysis | 80 | | | Part I | 81 | | | | 82 | +----------+----------------------+ 83 | |**6** | Data analysis | 84 | | | Part II + | 85 | | | Dealing with errors | 86 | +----------+----------------------+ 87 | |**7** | Data visualization | 88 | | | | 89 | | | | 90 | +----------+----------------------+ 91 | 92 | 93 | .. admonition:: Step by step instructions with cloud computing! 94 | 95 | The materials are presented in a way that you can follow them step by step exactly as they are written, as long as you use the cloud computing resources that we provide for you (namely JupyterLab Notebooks using Binder or CSC Cloud computing resources). 96 | If you would like, you can find :doc:`more information about our cloud computing environment `. 97 | For those planning to work on the course materials on your own computer, please note that you will **need to adjust the file paths to the data** accordingly. 98 | 99 | .. admonition:: For teachers 100 | 101 | If you would like to use these materials for your own teaching or develop them further, we highly support that. 102 | Please read more about how to do it from :doc:`our licensing terms`. 103 | 104 | .. toctree:: 105 | :maxdepth: 2 106 | :caption: Course information 107 | 108 | course-info/course-info 109 | course-info/learning-goals 110 | course-info/grading 111 | course-info/ai-tools 112 | course-info/licensing 113 | course-info/theteam 114 | 115 | .. toctree:: 116 | :maxdepth: 2 117 | :caption: Lesson 1 118 | 119 | lessons/L1/motivation 120 | lessons/L1/overview 121 | lessons/L1/course-environment-components 122 | lessons/L1/discord-usage 123 | notebooks/L1/a-taste-of-python.ipynb 124 | notebooks/L1/gcp-1-variable-naming.ipynb 125 | lessons/L1/exercise-1 126 | 127 | .. toctree:: 128 | :maxdepth: 2 129 | :caption: Lesson 2 130 | 131 | lessons/L2/overview 132 | notebooks/L2/Python-basic-elements.ipynb 133 | lessons/L2/intro-to-GitHub 134 | lessons/L2/git-basics 135 | lessons/L2/GitHub-classroom 136 | notebooks/L2/gcp-2-describing-code.ipynb 137 | lessons/L2/why-pairs 138 | lessons/L2/exercise-2 139 | 140 | .. toctree:: 141 | :maxdepth: 2 142 | :caption: Lesson 3 143 | 144 | lessons/L3/overview 145 | notebooks/L3/for-loops.ipynb 146 | notebooks/L3/conditional-statements.ipynb 147 | notebooks/L3/gcp-3-pep8.ipynb 148 | lessons/L3/exercise-3 149 | 150 | .. toctree:: 151 | :maxdepth: 2 152 | :caption: Lesson 4 153 | 154 | lessons/L4/overview 155 | notebooks/L4/functions.ipynb 156 | notebooks/L4/use-of-ai.ipynb 157 | notebooks/L4/script-files.ipynb 158 | notebooks/L4/modules.ipynb 159 | notebooks/L4/gcp-4-writing-scripts.ipynb 160 | lessons/L4/exercise-4 161 | 162 | .. toctree:: 163 | :maxdepth: 2 164 | :caption: Lesson 5 165 | 166 | lessons/L5/overview 167 | lessons/L5/pandas-overview.rst 168 | notebooks/L5/exploring-data-using-pandas.ipynb 169 | notebooks/L5/processing-data-with-pandas.ipynb 170 | lessons/L5/exercise-5 171 | 172 | .. toctree:: 173 | :maxdepth: 2 174 | :caption: Lesson 6 175 | 176 | lessons/L6/overview 177 | notebooks/L6/advanced-data-processing-with-pandas.ipynb 178 | notebooks/L6/errors.ipynb 179 | notebooks/L6/gcp-5-assertions.ipynb 180 | notebooks/L6/debugging.ipynb 181 | lessons/L6/exercise-6 182 | 183 | .. toctree:: 184 | :maxdepth: 2 185 | :caption: Lesson 7 186 | 187 | lessons/L7/overview 188 | notebooks/L7/python-plotting.ipynb 189 | notebooks/L7/basic-plotting.ipynb 190 | notebooks/L7/subplots.ipynb 191 | notebooks/L7/line-plots.ipynb 192 | lessons/L7/exercise-7 193 | 194 | .. toctree:: 195 | :maxdepth: 2 196 | :caption: Final exercise 197 | 198 | final-exercise/overview 199 | final-exercise/grading.ipynb 200 | 201 | .. toctree:: 202 | :maxdepth: 2 203 | :caption: Resources 204 | 205 | course-info/python-vocabulary 206 | course-info/installing-miniconda 207 | course-info/resources 208 | -------------------------------------------------------------------------------- /source/lessons/L1/course-environment-components.rst: -------------------------------------------------------------------------------- 1 | Course environment 2 | ================== 3 | 4 | During this course, we will use different tools and applications for programming and communication: 5 | 6 | 1. `JupyterLab`_ for programming 7 | 2. `Cloud computing environments`_ Binder or CSC Noppe 8 | 3. `Git and GitHub`_ for version control and documentation 9 | 4. `Voting / polling <#voting-and-polling>`_ for interactive questions during the lectures 10 | 5. `Discord`_ for communicating among UH students 11 | 12 | JupyterLab 13 | ---------- 14 | 15 | `JupyerLab `__ is an open-source web-based application for doing data science. 16 | The JupyterLab interface consists of different components such as a file browser, terminal, image viewer, console, text editor, etc. 17 | 18 | **Jupyter Notebooks** (file extension ``.ipynb``) are documents inside the JupyterLab environment that contain computer code and rich text elements (e.g., figures, links, etc.). 19 | Jupyter Notebooks are excellent for documenting a data science workflow in an interactive format. 20 | 21 | **We use JupyterLab/Jupyter Notebooks as the default programming environment during this course**. 22 | All of the course materials are available in a JupyterLab environment via the `cloud computing environments`_ (Binder or CSC Noppe). 23 | 24 | .. figure:: img/Binder_launcher.png 25 | :alt: Binder Jupyter Notebook 26 | :width: 700px 27 | 28 | Basic view of JupyterLab 29 | 30 | .. figure:: img/JupyterLab.png 31 | :alt: A Jupyter Notebook open in JupyterLab 32 | :width: 700px 33 | 34 | A Jupyter Notebook open in JupyterLab 35 | 36 | Cloud computing environments 37 | ---------------------------- 38 | 39 | We will use cloud-based computing environments (Binder or CSC Noppe) to access interactive online version of the lesson materials and to work on the weekly exercises. You can use the cloud computing environments with any computer as long as it has a reasonably fast internet connection and a web browser. 40 | 41 | Please note that the cloud computing environments are **temporary**. Always remember to push your changes to GitHub (and / or download a local copy) We will cover how to save files on GitHub.com in the second week of the course.. 42 | 43 | .. figure:: img/launch-buttons.png 44 | :alt: Launch buttons 45 | :width: 700px 46 | 47 | Different options for making the lesson interactive 48 | 49 | Each interactive lesson and exercise will have a launch button for both Binder and CSC Noppe. 50 | The CSC Noppe environment is only accessible to students from Finnish universities and research institutes. 51 | 52 | Binder 53 | ~~~~~~ 54 | 55 | Binder (https://mybinder.org/) runs Jupyter Notebooks in your web browser in a customized environment. The original files (notebooks) are hosted on GitHub. 56 | Binder does not require the user to log in, you can just click on the link in the lesson / exercise and start working. 57 | 58 | .. figure:: img/Binder_loading.png 59 | :alt: Binder loading 60 | :width: 700px 61 | 62 | Binder takes a few moments to load 63 | 64 | Once the instance is ready, you can navigate to the lesson folders and start working with existing notebooks or create a new one. 65 | 66 | **Remember to download your work when using Binder**! The Binder instance is temporary, and all your files will be lost after the session. 67 | 68 | Also, note that **Binder instances will die after around 10 minutes without any activity** (e.g., running a code cell). When this happens you may lose your work! 69 | 70 | CSC Noppe 71 | ~~~~~~~~~ 72 | 73 | Noppe (formerly Notebooks) by CSC (https://noppe.csc.fi) is a computing environment hosted by the Finnish IT Center for Science (CSC). Similar to Binder, the CSC Notebooks platform is used for running Jupyter Notebooks in a customized environment. 74 | CSC Notebooks is available only for students who are affiliated with Finnish universities and research institutes (via the Haka user authentication). 75 | 76 | .. note:: **When using the CSC Notebooks for the first time, you need to join the group created for this course:** 77 | 78 | 1. Log in at https://noppe.csc.fi/ 79 | 2. Select Haka for the authentication provider 80 | 3. Enter your Finnish university login credentials 81 | 4. Click on the **Join workspace** button on the top left 82 | 5. Join the Geo-Python workspace using the join code ``geo-fuv8y5h2`` 83 | 84 | After joining the group, you should be able to view the course environments called `Geopython-2024` at the top of the Application list. 85 | 86 | .. figure:: img/CSC_join_group.png 87 | :alt: Join Group in CSC Notebooks 88 | 89 | .. figure:: img/CSC_launch_new.png 90 | :alt: Launch new Jupyter Lab instance 91 | 92 | Launching the instance takes a few moments. 93 | 94 | .. note:: **After launching the Geo-Python 2024 workspace the first time:** 95 | 96 | 1. Double-click on the ``my-work`` folder in the file navigator on the left side of the Jupyter Lab window 97 | 2. Click on the Git icon on the left side 98 | 3. Click on the **Clone a Repository** button 99 | 4. Enter the address ``https://github.com/geo-python/notebooks.git`` and click **Clone** 100 | 5. You can now access the lesson notebooks in the ``my-work/notebooks`` folder 101 | 102 | .. figure:: img/clone-notebooks.png 103 | :alt: Cloning the lesson notebook folder 104 | 105 | .. note:: **Repeat these steps every time when starting to work on a programming task using the CSC Noppe platform:** 106 | 107 | 1. Log in at https://noppe.csc.fi/ 108 | 2. Select Haka for the authentication provider 109 | 3. Enter your Finnish university login credentials 110 | 4. Click on the **Start session** button for the Geopython-2024 workspace 111 | 5. Navigate to the ``my-work/notebooks`` directory, click on the Git icon on the left and click the **Pull latest changes** 112 | 113 | .. figure:: img/pull-changes.png 114 | :alt: Pulling the latest notebook changes 115 | 116 | **Remember to save your work!** 117 | 118 | Using your own computer 119 | ----------------------- 120 | 121 | We recommend everyone to use the available `cloud computing environments`_ during this course. 122 | In case you want to work on your own computer, you need to `install Python <../../course-info/installing-miniconda.html>`_. 123 | 124 | Git and GitHub 125 | -------------- 126 | 127 | One of the core goals of this course (besides learning programming) is to learn how to use `version control `__ with `Git `__ and storing your codes (privately) on `GitHub `__. 128 | 129 | `Git `__ is a version control software (developed by a rather famous Finn named Linus Torvalds - he also created Linux!) that is used to track and store changes in your files (often source code for programs) without losing the history of past changes. 130 | Files in Git are stored in a repository, which you can simply think of as a directory containing files (or other directories) related to a single 'project'. Git is widely used by professionals to keep track of what they’ve done and to collaborate with other people. 131 | 132 | `GitHub `__ is a web based Git repository hosting service and social network. 133 | It is the largest online storage space of collaborative works that exists in the world. 134 | It is a place where you can share your code openly to the entire world or alternatively only to your collaborators working on the same project. 135 | GitHub provides a nice web-interface to your files that is easy to use. 136 | It is a nice way for exploring the codes and documentation or e.g., teaching materials such as those in our course. 137 | 138 | Both Git and GitHub provide many more features than the ones mentioned here, but for now we are happy to understand the basic idea of what they are. 139 | 140 | Voting and polling 141 | ------------------ 142 | 143 | During the lectures we will ask you questions by using an easy-to-use polling-system and show you the results in real-time. 144 | You can access the polling system of our course from ``__ 145 | 146 | .. note:: 147 | 148 | The polling system is active only **during** the lessons. If you access the website outside the lecture times, you 149 | will most probably see only a white page without any content. 150 | 151 | Discord 152 | ------- 153 | 154 | During the course we will use actively an application called `Discord `__ for discussion and questions about the lessons and exercises. 155 | All enrolled students have received an invite link to the `geo-Python2024` workspace at the start of the course. 156 | :doc:`Read more about Discord `. 157 | 158 | Page summary 159 | ------------ 160 | 161 | Now you should have (at least) a basic idea about the different components of our course environment and what they mean. 162 | You don't need to understand everything fully at this point as they will become clearer when we start using the course environment. -------------------------------------------------------------------------------- /source/lessons/L1/discord-usage.rst: -------------------------------------------------------------------------------- 1 | Communicating with Discord 2 | ========================== 3 | 4 | .. figure:: img/Discord-logo.png 5 | :width: 250px 6 | :class: dark-light 7 | 8 | During this course we will use `Discord `__ for discussion and questions about the lessons and exercises. 9 | 10 | Accessing the workspace in Discord 11 | ---------------------------------- 12 | 13 | We will send an invitation link for all enrolled students to the Discord Team called ``geoPython-2024``. 14 | Before you can start using Discord, you should create a new account for Discord (if you don't have one already) and accept the invitation you have received. 15 | 16 | **After accepting the invitation, you can access the course Discord team via this link:** ``__ 17 | 18 | Overview of Discord 19 | ------------------- 20 | 21 | Using Discord for communication is easy. It works in a similar manner to any chatting application (such as WhatsApp). However, the benefits of Discord are: 22 | 23 | - discussions are grouped into separate topics (called ``channels``) that keeps discussions nicely organized 24 | - it is easy to find stuff with good search functionality 25 | - you can notify different users by using the ``@`` character (e.g. ``@user1``) 26 | - you can start threads for specific question, for example, and add comments in that thread (keeps comments nicely grouped under the question) 27 | - works nicely in browser and has applications for all major operating systems (Android, iOS, Windows, macOS, etc.) 28 | 29 | Basic usage of Discord 30 | ---------------------- 31 | 32 | When entering to our Discord Team you should see something like following where you have: 33 | 34 | - all channels listed on the left panel 35 | - on the right you have the selected channel where you can start discussing about the topics for that week: 36 | 37 | .. figure:: img/discord-basic-view.png 38 | :alt: Basic view of Discord 39 | :width: 550px 40 | 41 | Basic view of Discord 42 | 43 | Notifying a user 44 | ~~~~~~~~~~~~~~~~ 45 | 46 | If you want to ask a question from specific user (or target a comment for him/her), it is possible to notify the user by using the ``@`` symbol. 47 | 48 | The example below shows how to do this. 49 | 50 | .. figure:: img/notifying-user.PNG 51 | :alt: You can notify a user 52 | :width: 550px 53 | 54 | You can target your question/answer to speficic user with the ``@`` character. 55 | 56 | 57 | Using threads 58 | ~~~~~~~~~~~~~ 59 | 60 | You can further organize and group the discussion by starting a new thread for selected post. 61 | Start a new thread by keeping your mouse over the post that you want to start discussing about and press the # icon to create a new thread. 62 | 63 | .. figure:: img/start-thread-discord.PNG 64 | :alt: Organizing discussion with threads. 65 | :width: 550px 66 | 67 | Organizing discussion with threads. 68 | 69 | You can view the active thread by pressing the thread that has some replies. 70 | The thread opens up as a new panel on the right side where you will see all the discussion that is relevant for the topic or question at hand. 71 | 72 | 73 | General guidelines for communication 74 | ------------------------------------ 75 | 76 | Here we have few general guidelines for using Discord to keep things well organized. 77 | 78 | .. important:: 79 | 80 | 1. **You should always select the right channel for your question!** 81 | 82 | - If you have question related to the lesson or exercise in week 2, ask your question in the ``#week-2`` channel. 83 | - If you want to share a funny GIF you found online, you can post it in the ``#random`` channel. 84 | 85 | 2. Use threads to maintain the discussion of a specific topic under the same question / comment. 86 | 87 | 3. **Ask!** If something seems to be tricky or difficult in the course, don't hesitate to ask a question. Your fellow students or the instructors can help you out. 88 | 89 | 4. **Discuss and comment!** If you see a question and you know how to help, we encourage you to comment and help your fellow students. 90 | 91 | 5. **HOWEVER, DON'T PROVIDE READY ANSWERS** in the discussion (such as all necessary codes for a given problem). This does not help your other students to learn. 92 | 93 | 6. And finally, please **be aware of our working hours**. The instructors and course assistants aim to be responsive to your messages, but please do not expect immediate replies to messages posted outside of typical working hours. 94 | 95 | With these guidelines we keep our discussion well organized and it is easy for everybody to find help and relevant discussion about specific lessons / exercises. 96 | 97 | That's it! Now you know how to communicate during the course. 98 | -------------------------------------------------------------------------------- /source/lessons/L1/exercise-1.rst: -------------------------------------------------------------------------------- 1 | Exercise 1 2 | ========== 3 | 4 | .. admonition:: Deadline 5 | 6 | Please complete this exercise **by the start of the next lesson (9:15 on 9 September 2024)**. 7 | 8 | The exercise for this week has three parts: 9 | 10 | 1. **Creating an account on GitHub.com**. 11 | 2. **Sharing your GitHub username with us via Discord**. 12 | 3. **Cooking up some Python** using the skills you learned during the first lesson! 13 | 14 | Part 1 - Sign up for GitHub 15 | --------------------------- 16 | 17 | 1. Open a web browser and navigate to https://www.github.com. 18 | 2. On the `GitHub.com `__ home page, click on **Sign up** on the top right. 19 | 20 | .. figure:: img/GitHub.png 21 | :width: 600px 22 | :align: center 23 | :alt: Signing up for GitHub.com 24 | 25 | The GitHub.com homepage 26 | 27 | 3. Enter a username, email address, and password. Click Create an account. 28 | 4. When prompted to select a plan, choose the free option. 29 | 30 | Part 2 - Discord 31 | ---------------- 32 | 33 | *This part is only for registered students. We have sent an invite link to Discord to all registered participants before the first lesson.* 34 | *Please contact the course instructors via email in case you are registered for the course, but don't have access to Discord.* 35 | 36 | .. figure:: img/Discord-logo.png 37 | :width: 250px 38 | :class: dark-light 39 | 40 | 1. Go to our **Discord** page at https://discord.com/channels/1277536922608074772/1277536922608074775. 41 | 2. **Post a new message** in the ``#week-1`` channel with your **full name, GitHub username, course code** (GEOK3001 or GEOG-329-1). 42 | 43 | For example, ``Dave Whipp, davewhipp, GEOK3001`` or ``Kamyar Hasanzadeh, kamyar68, GEOG-329-1`` (please use comma to separate the different parts). 44 | This will help us know you were able to create your account, that you have also figured out how to use Discord, and we'll know who is who on GitHub :). 45 | 46 | Students from other universities: you can add the name of your home institution (Aalto / Turku / Oulu) instead of the course code like this: ``Tua Nylén, tuanylen, Turku``. 47 | 48 | .. note:: 49 | 50 | In case you're curious, we need your GitHub user name in order to access your exercise repositories in GitHub for grading and feedback. 51 | 52 | Part 3 - Cooking up some Python 53 | ------------------------------- 54 | 55 | .. image:: https://img.shields.io/badge/launch-binder-red.svg 56 | :target: https://mybinder.org/v2/gh/Geo-Python-2024/Binder/main?urlpath=lab 57 | 58 | .. 59 | .. image:: https://img.shields.io/badge/launch-CSC%20notebook-blue.svg 60 | :target: https://notebooks.csc.fi/#/blueprint/1b4c5cbce4ab4acb8976e93a1f4de3dc 61 | 62 | 63 | .. admonition:: Start your assignment 64 | 65 | **You can start working on your copy of Exercise 1 by** `accepting the GitHub Classroom assignment `__. 66 | 67 | 68 | 1. Start the coding exercise by accepting the GitHub Classroom assignment (click on the link above). 69 | 2. Read the instructions from the repository. 70 | 3. Launch a new JupyterLab instance. *You can use Binder for this.* 71 | 4. Cook up some Python according to the instructions! *Remember to save your work ;) !* 72 | 5. Download your solution, and upload it to GitHub.com into your personal Exercise 1 repository. 73 | 74 | *This week, we upload the exercise manually to GitHub. Next week, you will learn how to pull and push the exercises directly from GitHub to Jupyter Lab using git!* 75 | 76 | .. note:: 77 | 78 | Each week, you will create a personal copy of the exercise repository on GitHub.com by clicking on the GitHub classroom link. 79 | 80 | You can also take a look at the template repository on GitHub: https://github.com/Geo-Python-2024/Exercise-1 . 81 | Note that you are only able to make changes in your personal repository generated via GitHub Classroom. 82 | 83 | Summary (what to submit) 84 | ------------------------ 85 | 86 | 1. Post a message in the ``#week-1`` channel in Discord at https://discord.com/channels/1277536922608074772/1277538199937482885 with your name, GitHub username, and course. 87 | 2. Accept Exercise-1 in Github classroom and upload the Jupyter notebook (the filename should be ``Exercise-1.ipynb``) containing your solutions for Part 3. 88 | 89 | .. admonition:: Private repositories 90 | 91 | The exercise repositories are private. They are visible only to you and the course instructors. 92 | 93 | 94 | .. warning:: 95 | 96 | Some instructions on this page are specific to students at the University of Helsinki. 97 | Others can skip the Discord step and proceed to solving the Exercise 1 problems! 98 | Please note that **we are only able to provide assignment feedback to students enrolled in the course taught at the University of Helsinki**. -------------------------------------------------------------------------------- /source/lessons/L1/img/Binder_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/Binder_launcher.png -------------------------------------------------------------------------------- /source/lessons/L1/img/Binder_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/Binder_loading.png -------------------------------------------------------------------------------- /source/lessons/L1/img/CSC_join_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/CSC_join_group.png -------------------------------------------------------------------------------- /source/lessons/L1/img/CSC_launch_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/CSC_launch_new.png -------------------------------------------------------------------------------- /source/lessons/L1/img/Discord-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/Discord-logo.png -------------------------------------------------------------------------------- /source/lessons/L1/img/GitHub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/GitHub.png -------------------------------------------------------------------------------- /source/lessons/L1/img/JupyterLab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/JupyterLab.png -------------------------------------------------------------------------------- /source/lessons/L1/img/LaunchButtons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/LaunchButtons.png -------------------------------------------------------------------------------- /source/lessons/L1/img/Slack-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/Slack-logo.png -------------------------------------------------------------------------------- /source/lessons/L1/img/Thebe_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/Thebe_launcher.png -------------------------------------------------------------------------------- /source/lessons/L1/img/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/Thumbs.db -------------------------------------------------------------------------------- /source/lessons/L1/img/answering-thread.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/answering-thread.PNG -------------------------------------------------------------------------------- /source/lessons/L1/img/clone-notebooks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/clone-notebooks.png -------------------------------------------------------------------------------- /source/lessons/L1/img/discord-basic-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/discord-basic-view.png -------------------------------------------------------------------------------- /source/lessons/L1/img/launch-buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/launch-buttons.png -------------------------------------------------------------------------------- /source/lessons/L1/img/notifying-user.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/notifying-user.PNG -------------------------------------------------------------------------------- /source/lessons/L1/img/pull-changes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/pull-changes.png -------------------------------------------------------------------------------- /source/lessons/L1/img/slack-basic-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/slack-basic-view.png -------------------------------------------------------------------------------- /source/lessons/L1/img/start-thread-discord.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/start-thread-discord.PNG -------------------------------------------------------------------------------- /source/lessons/L1/img/start-thread.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L1/img/start-thread.PNG -------------------------------------------------------------------------------- /source/lessons/L1/motivation.rst: -------------------------------------------------------------------------------- 1 | Motivation for the course 2 | ========================= 3 | 4 | The main part of the first half of this course is to learn to program in Python. 5 | However, in addition to learning to program, we hope to help you learn a number of other skills related to open science. 6 | These include: 7 | 8 | 1. Writing programs that are easy to understand and share 9 | 2. Keeping a log of the changes you make to your programs 10 | 3. Creating programs that ensure your science is reproducible 11 | 4. Producing simple, effective data visualizations that make your results accessible and easy to understand 12 | 13 | Lesson materials 14 | ---------------- 15 | 16 | In this lesson we will explore `a motivating example `_ from the first chapter of the forthcoming textbook `Introduction to Python for Geographic Data Analysis `_. 17 | -------------------------------------------------------------------------------- /source/lessons/L1/overview.rst: -------------------------------------------------------------------------------- 1 | Lesson overview 2 | =============== 3 | 4 | In this lesson we will have our first taste of programming in Python. 5 | In order to start learning Python, however, we need to introduce you how we will work during the course using different tools including a dedicated computing environment, which is based on the principles of `cloud computing `__. 6 | This first tutorial will introduce you to the basic components of the course environment, guide you through how they are used, and conclude with a hands-on introduction to some key concepts and elements of programming in Python. 7 | The main components of today's lesson can be found in the navigation bar to the left. 8 | 9 | .. note:: 10 | 11 | There is a lot of material here but don't worry, you will become familiar with all of these things once we start working in practice. 12 | 13 | Learning goals 14 | -------------- 15 | 16 | After this weeks lesson your should be able to: 17 | 18 | - know what kind of tools we are using during the course 19 | - explain the basic concepts of a computer, a program, and a programming language 20 | - define and use variables 21 | - describe the concept of a data type 22 | - determine the data type of a variable in Python 23 | 24 | Lesson videos 25 | ------------- 26 | 27 | .. admonition:: Lesson 1.1 - Course introduction and computing basics 28 | :class: admonition-youtube 29 | 30 | .. youtube:: T09uwbl42N8 31 | 32 | Kamyar Hasanzadeh & Dave Whipp, University of Helsinki @ `Geo-Python channel on Youtube `_. 33 | 34 | .. admonition:: Lesson 1.2 - Course environment and a taste of Python 35 | :class: admonition-youtube 36 | 37 | .. youtube:: FcifInKjmxw 38 | 39 | Kamyar Hasanzadeh & Dave Whipp, University of Helsinki @ `Geo-Python channel on Youtube `_. 40 | 41 | .. admonition:: GCP 1 - Selecting "good" variable names 42 | :class: admonition-youtube 43 | 44 | .. youtube:: G0FZkgbQYGg 45 | 46 | Dave Whipp & Vuokko Heikinheimo, University of Helsinki @ `Geo-Python channel on Youtube `_. 47 | 48 | Lecture slides 49 | -------------- 50 | 51 | .. admonition:: Lesson slides 52 | 53 | `Slides for Lecture 1 (PDF) <../../_static/01-Computers-and-programs.pdf>`__ 54 | -------------------------------------------------------------------------------- /source/lessons/L1/slack-usage.rst: -------------------------------------------------------------------------------- 1 | Communicating with Slack 2 | ======================== 3 | 4 | .. figure:: img/Slack-logo.png 5 | :width: 150px 6 | 7 | During this course we will use `Slack `__ for discussion and questions about the lessons and exercises. 8 | 9 | Accessing the workspace in Slack 10 | -------------------------------- 11 | 12 | We will send an invitation link for all enrolled students to the Slack Team called ``Geo-Python 2022``. 13 | Before you can start using Slack, you should create a new account for Slack (if you don't have one already) and accept the invitation you have received. 14 | 15 | **After accepting the invitation, you can access the course Slack team via this link:** ``__ 16 | 17 | Overview of Slack 18 | ----------------- 19 | 20 | Using Slack for communication is easy. It works in a similar manner as any chatting application (such as WhatsApp). However, the benefits of Slack are: 21 | 22 | - the discussions are grouped into separate topics (called ``channels``) that keeps discussions well organized 23 | - easy to find stuff with good search functionality 24 | - you can notify different users by using @ character (e.g. @user1) 25 | - you can start threads e.g. for specific question and add comments into that thread (keeps comments nicely grouped under the question) 26 | - works nicely in browser and has phone applications for all major operating systems (Android, iOS, Windows Phone) 27 | 28 | Basic usage of Slack 29 | -------------------- 30 | 31 | When entering to our Slack Team you should see something like following where you have: 32 | 33 | - all channels listed on the left panel 34 | - on the right you have the selected channel where you can start discussing about the topics for that week: 35 | 36 | .. figure:: img/slack-basic-view.png 37 | :alt: Basic view of Slack 38 | :width: 550px 39 | 40 | Basic view of Slack 41 | 42 | Notifying a user 43 | ~~~~~~~~~~~~~~~~ 44 | 45 | If you want to ask a question from specific user (or target a comment for him/her), it is possible to notify the user by using ``@`` symbol. 46 | 47 | The example below shows how to do this: 48 | 49 | .. figure:: img/notifying-user.PNG 50 | :alt: You can notify a user 51 | :width: 550px 52 | 53 | You can target your question/answer to speficic user with ``@`` -character. 54 | 55 | 56 | Using threads 57 | ~~~~~~~~~~~~~ 58 | 59 | You can further organize and group the discussion by starting a new thread for selected post. Start a new thread by keeping your mouse over the post that you want 60 | to start discussing about and press button in the middle that creates a new thread: 61 | 62 | .. figure:: img/start-thread.PNG 63 | :alt: Organizing discussion with threads. 64 | :width: 550px 65 | 66 | Organizing discussion with threads. 67 | 68 | You can view the active thread by pressing the thread that has some replies. 69 | The thread opens up as a new panel on the right side where you will see all the discussion that is relevant for the question at hand. 70 | You can send your comments into that thread by putting your comment on the text box on the right: 71 | 72 | .. figure:: img/answering-thread.PNG 73 | :alt: Viewing and answering to a specific thread can be done with dedicated panel on the right. 74 | :width: 550px 75 | 76 | Viewing and answering to a specific thread can be done with dedicated panel on the right. 77 | 78 | General guidelines for communication 79 | ------------------------------------ 80 | 81 | Here we have few general guidelines for using Slack to keep things well organized. 82 | 83 | .. important:: 84 | 85 | 1. **You should always select the right channel for your question!** 86 | 87 | - If you have question related to week 2 lesson or exercise, you make your question in channel ``#week-2``. 88 | - If you want to share a funny GIF you found online, you can post it into channel ``#random``. 89 | 90 | 2. Use threads to maintain the discussion of specific topic under the same question / comment. 91 | 92 | 3. **Ask!** If something seems to be tricky and difficult, don't hesitate to ask a question. Your fellow students or we instructors can help you out. 93 | 94 | 4. **Discuss and comment!** If you see a question and you know how to help, we encourage you to comment and help your friend. 95 | 96 | 5. **HOWEVER: DON'T PROVIDE READY ANSWERS** in the discussion (such as all necessary codes for given problem), it does not help your friend to learn. 97 | 98 | With these guidelines we keep our discussion well organized and it is easy for everybody to find help and relevant discussion about specific lessons / exercises. 99 | 100 | That's it! Easy, now you know how to communicate during the course. 101 | -------------------------------------------------------------------------------- /source/lessons/L2/GitHub-classroom.rst: -------------------------------------------------------------------------------- 1 | Using Classroom for Github 2 | ========================== 3 | 4 | As you have seen last week we will be using `Classroom for GitHub `__ for the exercises in the course. 5 | Here, we'll give you a sense of how Classroom for GitHub works and what you need to do to accept your assignments. 6 | 7 | Classroom for GitHub 8 | -------------------- 9 | 10 | Classroom for GitHub is basically an application that helps you make private copies of an assignment that you can modify and submit as your answers for the exercises. 11 | We will create a template repository for each assignment, and GitHub classroom takes care of the student copies. 12 | The exercise repositories normally include the following: 13 | 14 | - A basic description of the assignment 15 | - A list of problems for you to solve/answer 16 | - "Starter" Jupyter notebook or Python code that you need to modify for the assignment 17 | - Data files to use with the code 18 | 19 | You can find the GitHub classroom link for each exercise on these web pages in 20 | the **Start your assignment** info box on the exercise pages. 21 | 22 | .. figure:: img/start-assignment.png 23 | 24 | When you click the GitHub classroom link, you will be taken to a web page where you can accept the assignment. 25 | 26 | .. note:: 27 | 28 | Note that the first time you accept an assignment you will need to authorize the application on Github. This will not work if you have not verified your email address for your Github account. 29 | 30 | .. figure:: img/github_classroom_create_repository.png 31 | :alt: Creating an exercise repository using GitHub Classroom 32 | 33 | Creating an exercise repository using GitHub Classroom 34 | 35 | When you accept the assignment a copy of it will be made in your personal GitHub repositories (a repository on Github is basically like a folder for a given assignment/project), and you will be asked to make changes to the Python code and main document for each assignment. 36 | 37 | -------------------------------------------------------------------------------- /source/lessons/L2/exercise-2.rst: -------------------------------------------------------------------------------- 1 | Exercise 2 2 | ========== 3 | 4 | .. note:: 5 | 6 | Please complete this exercise by **the start of the next lesson**. 7 | 8 | .. admonition:: Start your assignment 9 | 10 | **You can start working on your copy of Exercise 2 by** `accepting the GitHub Classroom assignment `__. 11 | 12 | You can also take a look at the template repository for `Exercise 2 on GitHub `__ (does not require logging in). 13 | Note that you should not try to make changes to this copy of the exercise, but rather only to the copy available via GitHub Classroom. 14 | 15 | .. admonition:: Pair programming 16 | 17 | Students attending the course in Helsinki, **note that we are working in pairs on this exercise**. 18 | We will only grade the repository of the member of your pair that is responsible for this week's exercise (i.e., the driver). 19 | See more information in Discord and on the course page under `Why are we working in pairs? `_ 20 | 21 | Cloud computing environments 22 | ---------------------------- 23 | 24 | .. image:: https://img.shields.io/badge/launch-binder-red.svg 25 | :target: https://mybinder.org/v2/gh/Geo-Python-2024/Binder/main?urlpath=lab 26 | 27 | .. image:: https://img.shields.io/badge/launch-CSC%20Noppe-blue.svg 28 | :target: https://noppe.csc.fi/ 29 | 30 | Exercise 2 hints 31 | ---------------- 32 | 33 | Here are a few things that may be helpful in completing Exercise 2. 34 | 35 | Git 36 | ~~~ 37 | 38 | You can find step-by-step instructions for using Git on the course page titled :doc:`git-basics`. 39 | Remember to commit your changes after each major edit! Also, it's better to push your changes to GitHub frequently, rather than only at the very end of the exercise. 40 | 41 | Indentation woes 42 | ~~~~~~~~~~~~~~~~ 43 | 44 | We have not really run into this problem in the lessons, but Python codes are sensitive to how much you indent the start of each line. 45 | This is perhaps easiest to see with an example. 46 | 47 | .. code:: python 48 | 49 | name = 'Dave' 50 | dogs = 0 51 | print('My name is', name, 'and I own', dogs, 'dogs.') 52 | 53 | If you copy and paste this code into a **Jupyter Notebook** cell and run it, you will see that is gives an ``IndentationError``. 54 | 55 | .. code:: python 56 | 57 | dogs = 0 58 | ^ 59 | IndentationError: unexpected indent 60 | 61 | We will see examples later of why indentation matters, but for now just be sure you don't indent lines to different levels. 62 | Thus, the fix is simply to remove the spaces on the second line. 63 | 64 | .. code:: python 65 | 66 | name = 'Dave' 67 | dogs = 0 68 | print('My name is', name, 'and I own', dogs, 'dogs.') 69 | 70 | Now, running the code results in the expected output. 71 | 72 | .. code:: python 73 | 74 | My name is Dave and I own 0 dogs. 75 | -------------------------------------------------------------------------------- /source/lessons/L2/img/1_classroom_invitation.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/1_classroom_invitation.PNG -------------------------------------------------------------------------------- /source/lessons/L2/img/Git-Logo-2Color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/Git-Logo-2Color.png -------------------------------------------------------------------------------- /source/lessons/L2/img/Git-Logo-Black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/Git-Logo-Black.png -------------------------------------------------------------------------------- /source/lessons/L2/img/GitHub_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/GitHub_Logo.png -------------------------------------------------------------------------------- /source/lessons/L2/img/GitHub_clone_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/GitHub_clone_link.png -------------------------------------------------------------------------------- /source/lessons/L2/img/Git_illustration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/Git_illustration.png -------------------------------------------------------------------------------- /source/lessons/L2/img/Preview-changes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/Preview-changes.png -------------------------------------------------------------------------------- /source/lessons/L2/img/Raw-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/Raw-button.png -------------------------------------------------------------------------------- /source/lessons/L2/img/Spyder-editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/Spyder-editor.png -------------------------------------------------------------------------------- /source/lessons/L2/img/Spyder-play-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/Spyder-play-button.png -------------------------------------------------------------------------------- /source/lessons/L2/img/Spyder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/Spyder.png -------------------------------------------------------------------------------- /source/lessons/L2/img/Terminal_git_status1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/Terminal_git_status1.png -------------------------------------------------------------------------------- /source/lessons/L2/img/choose-file.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/choose-file.PNG -------------------------------------------------------------------------------- /source/lessons/L2/img/commit_message.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/commit_message.PNG -------------------------------------------------------------------------------- /source/lessons/L2/img/committed_file.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/committed_file.PNG -------------------------------------------------------------------------------- /source/lessons/L2/img/download-starter-script.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/download-starter-script.PNG -------------------------------------------------------------------------------- /source/lessons/L2/img/drag-and-drop.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/drag-and-drop.PNG -------------------------------------------------------------------------------- /source/lessons/L2/img/driver-navigator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/driver-navigator.png -------------------------------------------------------------------------------- /source/lessons/L2/img/edit-readme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/edit-readme.png -------------------------------------------------------------------------------- /source/lessons/L2/img/edit-testMD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/edit-testMD.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-commit-credentials.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-commit-credentials.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-copy-url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-copy-url.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-changed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-changed.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-clone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-clone.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-commit-message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-commit-message.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-commit-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-commit-ok.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-commit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-commit.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-credentials.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-credentials.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-discard-changes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-discard-changes.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-history1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-history1.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-pull-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-pull-ok.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-pull-push-buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-pull-push-buttons.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-pull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-pull.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-push-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-push-ok.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-push.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-push.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-stage-changes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-stage-changes.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-staged-changes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-staged-changes.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-start-cloning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-start-cloning.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-status1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-status1.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-tracked-changes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-tracked-changes.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin-version-history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin-version-history.png -------------------------------------------------------------------------------- /source/lessons/L2/img/git-plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/git-plugin.png -------------------------------------------------------------------------------- /source/lessons/L2/img/github_classroom_create_repository.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/github_classroom_create_repository.png -------------------------------------------------------------------------------- /source/lessons/L2/img/open-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/open-terminal.png -------------------------------------------------------------------------------- /source/lessons/L2/img/play-changes.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/play-changes.PNG -------------------------------------------------------------------------------- /source/lessons/L2/img/pull-push-illustration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/pull-push-illustration.png -------------------------------------------------------------------------------- /source/lessons/L2/img/start-assignment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/start-assignment.png -------------------------------------------------------------------------------- /source/lessons/L2/img/terminal-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/terminal-icon.png -------------------------------------------------------------------------------- /source/lessons/L2/img/test_doc.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/test_doc.PNG -------------------------------------------------------------------------------- /source/lessons/L2/img/token_expiration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/token_expiration.png -------------------------------------------------------------------------------- /source/lessons/L2/img/token_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/token_name.png -------------------------------------------------------------------------------- /source/lessons/L2/img/token_scopes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/token_scopes.png -------------------------------------------------------------------------------- /source/lessons/L2/img/upload_files.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/upload_files.PNG -------------------------------------------------------------------------------- /source/lessons/L2/img/upload_files_button.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/upload_files_button.PNG -------------------------------------------------------------------------------- /source/lessons/L2/img/version_control_motivation_comics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L2/img/version_control_motivation_comics.png -------------------------------------------------------------------------------- /source/lessons/L2/log-in-GitHub.rst: -------------------------------------------------------------------------------- 1 | Logging into GitHub 2 | =================== 3 | 4 | If you're reading this, you have presumably found your way to GitHub, but perhaps you have not logged in. 5 | 6 | 1. You can log in to GitHub by clicking the **Sign In** button at the top right of this page. 7 | 2. Enter the user name and password for your GitHub account. 8 | -------------------------------------------------------------------------------- /source/lessons/L2/overview.rst: -------------------------------------------------------------------------------- 1 | Lesson overview 2 | =============== 3 | 4 | During the second week we will dive into Python and learn some basic elements of Python programming language. 5 | We will also continue learning how to use the Course Environment and version control with Git + GitHub. 6 | The main components of today's lesson can be found in the navigation bar to the left. 7 | 8 | Learning goals 9 | -------------- 10 | 11 | After this week you will be able to: 12 | 13 | - conduct basic data type conversions 14 | - store and access values in a list 15 | - explain the concept of an index value 16 | - understand the basics of version control 17 | - use Git and GitHub to record changes to your files 18 | - use Jupyter notebooks for writing and documenting your code 19 | 20 | Lesson videos 21 | ------------- 22 | 23 | 24 | .. admonition:: Lesson 2.1 - Python basics I 25 | :class: admonition-youtube 26 | 27 | .. youtube:: rSlbEEDRdeU 28 | 29 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 30 | 31 | .. admonition:: Lesson 2.2 - Python basics II and version control 32 | :class: admonition-youtube 33 | 34 | .. youtube:: 6gOYqr6fdH0 35 | 36 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 37 | -------------------------------------------------------------------------------- /source/lessons/L2/why-pairs.rst: -------------------------------------------------------------------------------- 1 | Why are we working in pairs? 2 | ============================ 3 | 4 | For Exercises 2 and beyond, you will be working with a partner as a pair. 5 | Here, we briefly explain why we're doing this, and how we feel this group work should go. 6 | 7 | Why pairs? 8 | ---------- 9 | 10 | As it turns out, the idea of programming in pairs is not something unique, or an idea we've come up with. 11 | `Pair programming `__ is an established technique for writing code together with another person, and part of an approach called `agile software development `__. 12 | The basic idea is that one person has their hands on the keyboard writing the code (the driver), while the other person (the navigator) looks over their shoulder and reviews each line that is written. 13 | This helps catch small typographical mistakes quickly, as well as having both people being able to discuss the code as it is being written. 14 | 15 | How we will use pairs 16 | --------------------- 17 | 18 | .. figure:: img/driver-navigator.png 19 | :alt: Rally driver and navigator 20 | :width: 800px 21 | 22 | A rally car driver and navigator in action. 23 | 24 | We don't intend to implement all aspects of pair programming in our pairs, but we want to capture the essence of the practice. 25 | Here is how we suggest you work in your pairs: 26 | 27 | - One person will be designated as the *driver* each week, and the other person will be the *navigator* 28 | 29 | - You will alternate roles each week 30 | 31 | - The driver will clone the GitHub repository and be responsible for the version of the exercise solutions that will be graded 32 | - When working, the driver should open the exercise on their computer and arrange for the navigator to be able to view their screen 33 | 34 | - This can be done in person or via screen sharing in Zoom (or other similar software) 35 | 36 | - The driver will write the Python and/or Markdown code, while the navigator follows on their screen 37 | - The navigator should be actively involved in suggesting ideas, corrections, and otherwise interacting with the driver to help jointly generate the code 38 | - The driver should regularly commit their modified exercise code to GitHub, and the navigator can help remind the driver to do this 39 | - Once finished, the driver should ensure the final version of the exercise has been committed to their GitHub repository, as only this version will be graded (we will not grade the navigator's exercise) 40 | 41 | Our hopes 42 | --------- 43 | 44 | We hope that coding in this way will help you feel you have support in learning to code in Python, and that you will spend less time stuck when working on the exercises. 45 | We also hope that this will be a fun way to learn from one another, while putting a real-world coding practice into action! 46 | 47 | A few final notes 48 | ----------------- 49 | 50 | We would like to remind you that: 51 | 52 | - Only the driver's GitHub repository will be graded 53 | 54 | - The navigator is welcome to make their own copy of the exercise if they would like to complete the exercise themselves for practice, however we will not grade the navigator's exercise 55 | 56 | - The driver *can* add the navigator as a private collaborator in GitHub, but we would prefer that only the driver make changes to the exercise code in their GitHub repository 57 | -------------------------------------------------------------------------------- /source/lessons/L3/exercise-3.rst: -------------------------------------------------------------------------------- 1 | Exercise 3 2 | ========== 3 | 4 | .. note:: 5 | 6 | Please complete this exercise by **the start of the next lesson**. 7 | 8 | .. admonition:: Start your assignment 9 | 10 | **You can start working on your copy of Exercise 3 by** `accepting the GitHub Classroom assignment `__. 11 | 12 | You can also take a look at the template repository for `Exercise 3 on GitHub `__ (does not require logging in). 13 | Note that you should not try to make changes to this copy of the exercise, but rather only to the copy available via GitHub Classroom. 14 | 15 | .. admonition:: Pair programming 16 | 17 | Students attending the course in Helsinki, **note that we continue working in pairs**. 18 | We will only grade the repository of the member of your pair that is responsible for this week's exercise. 19 | See more information in Slack, and in week 2: `Why are we working in pairs? `_ 20 | 21 | Cloud computing environments 22 | ---------------------------- 23 | 24 | .. image:: https://img.shields.io/badge/launch-binder-red.svg 25 | :target: https://mybinder.org/v2/gh/Geo-Python-2024/Binder/main?urlpath=lab 26 | 27 | .. image:: https://img.shields.io/badge/launch-CSC%20Noppe-blue.svg 28 | :target: https://noppe.csc.fi 29 | 30 | Exercise 3 hints 31 | ---------------- 32 | 33 | Here are a few things that may be helpful in completing Exercise 3. 34 | 35 | Tests 36 | ~~~~~ 37 | 38 | The exercise notebook contains some tests help you see if your code is working correctly. Some code cells contain 39 | a line that says: `raise NotImplementedError()`. Always remove this piece of code from your submission and replace 40 | it with your own code. The error tells us if you have not started the exercise. 41 | 42 | Combining strings 43 | ~~~~~~~~~~~~~~~~~ 44 | 45 | In case you have forgotten, string variables can be added together. For example, 46 | 47 | .. code-block:: python 48 | 49 | a = "Taco " 50 | b = "time" 51 | c = a + b 52 | print(c) 53 | 54 | Nested if statements 55 | ~~~~~~~~~~~~~~~~~~~~ 56 | 57 | In some cases it might be useful to have nested if statements, meaning that you have another layer of 58 | conditions after the first condition resolves to True. 59 | 60 | Take a look of following example: 61 | 62 | .. code-block:: python 63 | 64 | season = "Winter" 65 | temperature = 10 66 | 67 | if season == "Winter": 68 | 69 | if temperature > 7: 70 | print("No need for winter jacket!") 71 | 72 | else: 73 | print("It might be cold! Wear a proper jacket!") 74 | 75 | elif season == "Summer": 76 | 77 | if temperature > 20: 78 | print("It's warm! Time to wear shorts!") 79 | 80 | else: 81 | print("Well this is Finland, better wear long trousers!") 82 | else: 83 | print("Check the weather forecast!") 84 | -------------------------------------------------------------------------------- /source/lessons/L3/overview.rst: -------------------------------------------------------------------------------- 1 | Lesson overview 2 | =============== 3 | 4 | This week we will focus on repeating tasks and making decisions in Python. 5 | Both of these concepts are part of the larger computing idea called *control flow*, which refers to how the execution of different parts of a computer program is determined. 6 | We will learn how to alter the execution of our notebooks using (1) *loops*, which are used to repeat execution of parts of a program, and (2) *conditional statements*, which use basic logical tests to determine which parts of a program will be run. 7 | The main components of today's lesson can be found in the navigation bar to the left. 8 | 9 | Learning goals 10 | -------------- 11 | 12 | After this weeks lesson your should be able to: 13 | 14 | - Create a ``for`` loop and use it to repeat a section of code 15 | - Use ``if``, ``elif``, and ``else`` statements to make decisions in your programs 16 | - Explain how values can be compared using comparison operators 17 | 18 | Lesson videos 19 | ------------- 20 | 21 | .. admonition:: Lesson 3.1 - Repeating tasks with loops 22 | :class: admonition-youtube 23 | 24 | .. youtube:: SSoEpgKAvl8 25 | 26 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 27 | 28 | .. admonition:: Lesson 3.2 - Conditional statements 29 | :class: admonition-youtube 30 | 31 | .. youtube:: yyE26GU5wLk 32 | 33 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 34 | -------------------------------------------------------------------------------- /source/lessons/L4/exercise-4.rst: -------------------------------------------------------------------------------- 1 | Exercise 4 2 | ========== 3 | 4 | .. note:: 5 | 6 | Please complete this exercise by **the start of the next lesson**. 7 | 8 | .. admonition:: Start your assignment 9 | 10 | **You can start working on your copy of Exercise 4 by** `accepting the GitHub Classroom assignment `__. 11 | 12 | You can also take a look at the template repository for `Exercise 4 on GitHub `__ (does not require logging in). 13 | Note that you should not try to make changes to this copy of the exercise, but rather only to the copy available via GitHub Classroom. 14 | 15 | .. admonition:: Pair programming 16 | 17 | Students attending the course in Helsinki, **note that we continue working in pairs**. 18 | We will only grade the repository of the member of your pair that is responsible for this week's exercise. 19 | See more information in Slack, and in week 2: `Why are we working in pairs? `_ 20 | 21 | Cloud computing environments 22 | ---------------------------- 23 | 24 | .. image:: https://img.shields.io/badge/launch-binder-red.svg 25 | :target: https://mybinder.org/v2/gh/Geo-Python-2024/Binder/main?urlpath=lab 26 | 27 | .. image:: https://img.shields.io/badge/launch-CSC%20Noppe-blue.svg 28 | :target: https://noppe.csc.fi/ 29 | 30 | 31 | Exercise 4 hints 32 | ---------------- 33 | 34 | Here are a few things that may be helpful in completing Exercise 4. 35 | 36 | Importing variables from a script 37 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 38 | 39 | In the lesson materials we saw how to `import functions from a script <../../notebooks/L4/functions.html#calling-functions-from-a-script-file>`__. 40 | 41 | In a similar manner you can also import any variable that has been defined in another script, hence, it is not limited 42 | to functions that you can import. 43 | 44 | Counting values from a list 45 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 46 | 47 | In some cases it might be useful to know how many times certain value exists in a list. Consider following example: 48 | 49 | .. code-block:: python 50 | 51 | my_list = ['car', 'bus', 'bike', 'car', 'car', 'bike'] 52 | car_count = my_list.count('car') 53 | print("There are", car_count, "cars in my list!") -------------------------------------------------------------------------------- /source/lessons/L4/overview.rst: -------------------------------------------------------------------------------- 1 | Lesson overview 2 | =============== 3 | 4 | In this lesson we will learn how to create and use functions, one of the most powerful concepts in programming. 5 | A :term:`function (funktio)` makes it easy to use and re-use of a part of a program. 6 | We will also introduce you to the concept of a :term:`module (moduuli)` (also known as a :term:`library (ohjelmakirjasto)` in other programming languages), which you can think of as a toolbox for a specific purpose. 7 | Each module contains specific functionalities (i.e., functions) that you can use for different tasks. 8 | Thus, functions and modules are closely related. 9 | 10 | In this lesson, we also review the use of AI and LLM (e.g., ChatGPT) in generating code and discuss the pros and cons. 11 | The main components of today's lesson can be found in the navigation bar to the left. 12 | 13 | Learning goals 14 | -------------- 15 | 16 | After this weeks lesson your should be able to: 17 | 18 | - Explain how functions are used and their benefits 19 | - Describe the pros and cons of using AI and LLM in generating code 20 | - Create your own functions to calculate an output value based on an input value 21 | - Save functions to a script file for future use 22 | 23 | Lesson videos 24 | ------------- 25 | 26 | .. admonition:: Lesson 4.1 - Introduction to functions 27 | :class: admonition-youtube 28 | 29 | .. youtube:: t_MrgYSrxZI 30 | 31 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 32 | 33 | .. admonition:: Lesson 4.2 - Coding with ChatGPT, script files and modules 34 | :class: admonition-youtube 35 | 36 | .. youtube:: k7ulXIYAj4M 37 | 38 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 39 | -------------------------------------------------------------------------------- /source/lessons/L5/exercise-5.rst: -------------------------------------------------------------------------------- 1 | Exercise 5 2 | ========== 3 | 4 | .. note:: 5 | 6 | Please complete this exercise by **the start of the next lesson**. 7 | 8 | .. admonition:: Start your assignment 9 | 10 | **You can start working on your copy of Exercise 5 by** `accepting the GitHub Classroom assignment `__. 11 | 12 | You can also take a look at the template repository for `Exercise 5 on GitHub `__ (does not require logging in). 13 | Note that you should not try to make changes to this copy of the exercise, but rather only to the copy available via GitHub Classroom. 14 | 15 | .. admonition:: Pair programming (optional!) 16 | 17 | Students attending the course in Helsinki, **if you wish, you can continue working in pairs**. 18 | See more information in Slack, and in week 2: `Why are we working in pairs? `_. 19 | Those students who want to submit their own solutions, please contact the course assistant that is grading your assignments (see list in Slack). 20 | 21 | Cloud computing environments 22 | ----------------------------- 23 | 24 | .. image:: https://img.shields.io/badge/launch-binder-red.svg 25 | :target: https://mybinder.org/v2/gh/Geo-Python-2024/Binder/main?urlpath=lab 26 | 27 | .. image:: https://img.shields.io/badge/launch-CSC%20notebook-blue.svg 28 | :target: https://notebooks.csc.fi/ 29 | 30 | Exercise 5 hints 31 | ---------------- 32 | 33 | Below are some tips for working on Exercise 5. 34 | 35 | Selecting date ranges 36 | ~~~~~~~~~~~~~~~~~~~~~ 37 | 38 | In the Part 3 of Problem 3, the aim is to select rows that belong to certain month. The key here is to understand that 39 | the data values in the ``YR--MODAHRMN`` column are integer numbers using a format ``YYYYMMDDHHmm`` where ``YYYY`` is the 40 | year of the observation, ``MM`` is the month, ``DD`` is the day, ``HH`` is the hour, and ``mm`` is the minute. 41 | 42 | Using these values it is possible to make simple mathematical queries such as finding the values starting from the beginning of August, 2017: 43 | 44 | .. code-block:: python 45 | 46 | august_values = data.loc[data['YR--MODAHRMN'] >= 201708010000] 47 | 48 | Here, the value ``201708010000`` corresponds to the first day of August at the hour 00:00. -------------------------------------------------------------------------------- /source/lessons/L5/img/first-line-of-text.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L5/img/first-line-of-text.PNG -------------------------------------------------------------------------------- /source/lessons/L5/img/pandas_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L5/img/pandas_logo.png -------------------------------------------------------------------------------- /source/lessons/L5/img/second-line-of-text-fixed.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L5/img/second-line-of-text-fixed.PNG -------------------------------------------------------------------------------- /source/lessons/L5/img/second-line-of-text.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L5/img/second-line-of-text.PNG -------------------------------------------------------------------------------- /source/lessons/L5/img/third-line-of-text.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L5/img/third-line-of-text.PNG -------------------------------------------------------------------------------- /source/lessons/L5/midterm-feedback.rst: -------------------------------------------------------------------------------- 1 | Summary of mid-term course feedback 2 | =================================== 3 | 4 | Is the pace of the lessons too fast, too slow, or about right? 5 | -------------------------------------------------------------- 6 | 7 | *27 responses* 8 | 9 | - In general, the pace is about right to slightly too fast 10 | - Too much material is presented in individual lessons and maybe some could be cut to focus on the basics 11 | - More time for some of the demos would be good 12 | - It can be too fast sometimes, but rewatching with the lesson videos and pausing them helps 13 | 14 | Is the content of the lessons too simple, too difficult, or about right? 15 | ------------------------------------------------------------------------ 16 | 17 | *27 responses* 18 | 19 | - Seems to be about right for many 20 | - Some more time to understand the concepts could be helpful 21 | - Nice to work at the same time with the teacher 22 | - More about principles and concepts would be Nice 23 | - Students with earlier programming experience feel its a bit simple 24 | - More examples would be helpful 25 | - More time to learn about the course tools (GitHub, Slack, etc.) would be helpful 26 | - Sometimes it feels like there is a bit too much material in the lessons 27 | - Easier than the exercises 28 | 29 | Is the content of the exercises too simple, too difficult, or about right? 30 | -------------------------------------------------------------------------- 31 | 32 | *27 responses* 33 | 34 | - Some new programmers feel they are pushing being too hard, others find them about right 35 | - Too difficult to complete on my own 36 | - Slack helps with getting answers to questions 37 | - Maybe a bit too hard. I know what to do on some level, but the answers don't come to me. 38 | - It might be nice to start with a 'warm up' exercise from the previous week before going into the new material 39 | - Shorter and simpler problems (and maybe more of them) would be better 40 | - Challenging, but not too challenging 41 | - Way more difficult than the material in the lessons. I need help from others in the course to complete them. 42 | 43 | Which aspect(s) of the course is/are most helpful to you? 44 | --------------------------------------------------------- 45 | 46 | *27 responses* 47 | 48 | - Website is good, but part of lesson on functions and variable names was not as good as the rest of the lessons 49 | - Slack 50 | - Lessons and optional readings 51 | - Having an experienced programming partner :) 52 | - Refreshing git practices and learning new tools (JupyterLab) 53 | - Learning new Python tricks (e.g., f-strings) 54 | - Good coding practices 55 | - Lesson videos 56 | - I did not like the idea of having a partner at first, but now I am enjoying it 57 | - Exercises 58 | - Teachers and course assistants 59 | - How to use Python in GIS 60 | - The way the course prepares for working with files in a scripted manner 61 | 62 | Which aspect(s) of the course is/are least helpful to you? 63 | ---------------------------------------------------------- 64 | 65 | *21 responses* 66 | 67 | - Lessons are a bit slow, I just use the website 68 | - Exercises are too difficult 69 | - Interactive part of the lessons. I just prefer to read the course page. 70 | - Slack 71 | - Online teaching 72 | - Many new sites and tools 73 | - The lessons 74 | - Strict rules for the exercises, such as no copy/paste of the exercise cells 75 | - The exercise groups 76 | - The schedule for the course. It would be nice to be more flexible. 77 | - Weeks when I am not the driver for the exercise 78 | 79 | Useful parts of the course 80 | -------------------------- 81 | 82 | On a scale from 1 to 5, how useful do you find the different elements of this course? (1=not at all useful, 5=very useful): 83 | 84 | - Interactive lessons in Zoom: 4.05 ± 1.24 (21 responses) 85 | - Recorded lesson videos: 4.24 ± 1.00 (21 responses) 86 | - Exercise sessions in Zoom: 3.63 ± 0.92 (8 responses) 87 | - Pair programming: 4.74 ± 0.56 (19 responses) 88 | - Slack: 3.46 ± 1.24 (26 responses) 89 | 90 | What suggestions do you have for improving this course? Comments related to online teaching would be especially useful! 91 | ----------------------------------------------------------------------------------------------------------------------- 92 | 93 | *21 responses* 94 | 95 | - Introducing the instructors with photos during the first lesson would be nice so you know what they look like for the exercise sessions 96 | - Links to useful coding videos 97 | - More repetition to help with learning. More easy examples in the lessons and additional easy problems in the exercises. 98 | - More suggestions about alternative ways to do things in Python. If you already know this, you can read more about how to use something else at ... 99 | - Course should require past Python experience in order to get into GIS operations more quickly 100 | - Lessons and exercises could possibly be integrated more. Some tasks from the lessons could be left for the exercises as individual tasks with a 'final task' to do in pairs. 101 | - Getting feedback more quickly on the exercises would be helpful 102 | - Easier exercises! 103 | - Human comments on the exercises 104 | - Lessons could be longer, or in two parts 105 | - More time in the lessons for doing the parts you should do on your own 106 | - Automated grading could be available all the time for everyone 107 | - Two breaks during the lessons 108 | - Intro to GitHub could be slower 109 | - Pacing of the lessons and exercise sessions could be more spread out so there is time after the lessons before the exercise sessions 110 | - More exercises 111 | 112 | Do you have any other general comments about the course? 113 | -------------------------------------------------------- 114 | 115 | *12 responses* 116 | 117 | - *Many positive comments, thanks!* 118 | - Great introductory course! 119 | - Great course for my future career! 120 | - Nice to have exercise sessions available in person, and working in pairs 121 | - Would be nice to do the final exercise in pairs, if possible 122 | - Nice online course and good teaching 123 | - Comments on the exercises would help with the learning 124 | - Well organized course 125 | - Thanks for making all of the materials available online! -------------------------------------------------------------------------------- /source/lessons/L5/overview.rst: -------------------------------------------------------------------------------- 1 | Lesson overview 2 | =============== 3 | 4 | In this lesson we will learn the basics of reading and writing data from/to a file, and to do some basic data manipulation and analysis. 5 | We will start using `pandas `__, which is a modern and feature-rich data analysis framework for 6 | Python designed to make data analysis and manipulation straightforward and powerful using easy-to-use data structures and operations. 7 | The main components of today's lesson can be found in the navigation bar to the left. 8 | 9 | Learning goals 10 | -------------- 11 | 12 | After this weeks lesson your should be able to: 13 | 14 | - Read and explore tabular data in Python (using the ``pandas`` library) 15 | - Do simple data analysis using ``pandas`` data structures and functions 16 | - Write data to a ``.csv`` text file 17 | 18 | Lesson videos 19 | ------------- 20 | 21 | .. admonition:: Lesson 5.1 - Getting started with data analysis using pandas 22 | :class: admonition-youtube 23 | 24 | .. youtube:: gYAb0AHU9cE 25 | 26 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 27 | 28 | .. admonition:: Lesson 5.2 - Common tabular operations in pandas 29 | :class: admonition-youtube 30 | 31 | .. youtube:: cuPH12fIesI 32 | 33 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 34 | -------------------------------------------------------------------------------- /source/lessons/L5/pandas-overview.rst: -------------------------------------------------------------------------------- 1 | What is pandas? 2 | =============== 3 | 4 | .. figure:: img/pandas_logo.png 5 | :class: dark-light 6 | :width: 300px 7 | 8 | Source: `Medium.com `__ 9 | 10 | `pandas `__ is a modern, powerful and feature-rich library that is designed for doing data analysis in Python. 11 | It is a mature data analytics framework (originally written by Wes McKinney) that is widely used among different fields of science. 12 | Thus, documentation and many good examples exist that can help you get rolling with your data analysis tasks. 13 | 14 | Easy-to-use data structures 15 | --------------------------- 16 | 17 | In ``pandas``, the data is typically stored in a data structure called a ``DataFrame`` that looks like a typical table with rows and columns 18 | (+ indices and column names), where columns can contain data of different data types. 19 | Thus, it is similar in some sense to how data is stored in Excel or in R, which also uses a concept of a data frame. 20 | In fact, Wes McKinney first developed ``pandas`` as an alternative for R to deal with different complex data structures. 21 | 22 | Combines functionalities from many Python modules 23 | ------------------------------------------------- 24 | 25 | ``pandas`` takes advantage of the `NumPy `__ module under the hood, which is mostly written in C. 26 | This makes it a fast and powerful library that can efficiently handle even very large datasets. 27 | ``pandas`` offers an easier and more intuitive syntax to do data analysis and manipulation using either ``numpy`` functionalities in the background or dedicated functionalities written explicitly for ``pandas``. 28 | However, ``pandas`` is much more than an easier-to-use ``numpy`` as it also combines many functionalities from other Python libraries such as `Matplotlib (plotting) `__ and `SciPy (mathematics, science, engineering) `__. 29 | Thus, you can use many of the features included in those packages without importing them at all. 30 | 31 | Supports data read/write from multiple formats 32 | ---------------------------------------------- 33 | 34 | One of the most useful features of ``pandas`` is its ability to read data from numerous different data formats directly. 35 | For example, ``pandas`` supports reading and writing data from/to: 36 | 37 | - CSV 38 | - JSON 39 | - HTML 40 | - MS Excel 41 | - HDF5 42 | - Stata 43 | - SAS 44 | - Python Pickle format 45 | - SQL (Postgresql, MySQL, Oracle, MariaDB, etc.) 46 | 47 | You can view the full list of supported data formats from the `pandas documentation `__. 48 | -------------------------------------------------------------------------------- /source/lessons/L6/exercise-6.rst: -------------------------------------------------------------------------------- 1 | Exercise 6 2 | ========== 3 | 4 | .. note:: 5 | 6 | Please complete this exercise by **the start of the next lesson**. 7 | 8 | .. admonition:: Start your assignment 9 | 10 | **You can start working on your copy of Exercise 6 by** `accepting the GitHub Classroom assignment `__. 11 | 12 | You can also take a look at the template repository for `Exercise 6 on GitHub `__ (does not require logging in). 13 | Note that you should not try to make changes to this copy of the exercise, but rather only to the copy available via GitHub Classroom. 14 | 15 | .. admonition:: Pair programming (optional!) 16 | 17 | Students attending the course in Helsinki, **if you wish, you can continue working in pairs**. 18 | See more information in Discord, and in week 2: `Why are we working in pairs? `_. 19 | Those students who want to submit their own solutions, please contact the course assistant that is grading your assignments (see list in Discord). 20 | 21 | Cloud computing environments 22 | ----------------------------- 23 | 24 | .. image:: https://img.shields.io/badge/launch-binder-red.svg 25 | :target: https://mybinder.org/v2/gh/Geo-Python-2024/Binder/main?urlpath=lab 26 | 27 | .. image:: https://img.shields.io/badge/launch-CSC%20Noppe-blue.svg 28 | :target: https://noppe.csc.fi/ 29 | 30 | Exercise 6 hints 31 | ----------------- 32 | 33 | Data format for problems 1-3 34 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | 36 | The first 5 rows of the data file look like the following: 37 | 38 | .. code:: python 39 | 40 | STATION ELEVATION LATITUDE LONGITUDE DATE PRCP TAVG TMAX TMIN 41 | ----------------- ---------- ---------- ---------- -------- -------- -------- -------- -------- 42 | GHCND:FIE00142080 51 60.3269 24.9603 19520101 0.31 37 39 34 43 | GHCND:FIE00142080 51 60.3269 24.9603 19520102 -9999 35 37 34 44 | GHCND:FIE00142080 51 60.3269 24.9603 19520103 0.14 33 36 -9999 45 | 46 | As you can see, we have rainfall data (``PRCP``) in inches, and temperature data (``TAVG``, ``TMAX``, and ``TMIN``) in degrees Fahrenheit. 47 | Dates of the observations are given in the format YYYYMMDD. 48 | No-data values are indicated with ``-9999``. 49 | 50 | Reading in fixed-width text files 51 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 52 | 53 | Rather than having separation by commas, our data file this week has a variable number of spaces between values. 54 | Previously, we read in comma-separated values using the option ``sep=','`` for the Pandas ``read_csv()`` function. 55 | For a variable number of spaces we can either use the ``sep`` or ``delim_whitespace parameter``; ``sep='\s+'`` or ``delim_whitespace=True`` will work, but not both. 56 | In this case, we suggest using ``delim_whitespace``. 57 | 58 | Skipping the second row of a file 59 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 60 | 61 | The ``skiprows=n`` option of the Pandas ``read_csv()`` function is an easy way to skip the first *n* rows of a file when reading it. 62 | If we wanted to skip the first two rows of our data file, we could thus use ``skiprows=2``. 63 | The value for ``n``, however, need not be a single value, but can also be given in the form of a list. 64 | In this way, one can skip reading the second row of a file using a list with an index value for the second row. 65 | In other words, you can use ``skiprows=[1]``. 66 | 67 | Joining data from one DataFrame to another 68 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 69 | 70 | One quite useful functionality in Pandas is the ability to conduct a **table join** 71 | where data from one DataFrame is merged with another DataFrame based on a common **key**. 72 | Hence, making a table join requires that you have at least one common variable in both 73 | of the DataFrames that can be used to combine the data together. 74 | 75 | Consider a following example. Let's first create some test data to our DataFrames. 76 | 77 | .. ipython:: python 78 | :suppress: 79 | 80 | import pandas as pd 81 | 82 | .. ipython:: python 83 | 84 | data1 = pd.DataFrame(data=[['20170101', 'Pluto'], ['20170102', 'Panda'], ['20170103', 'Snoopy']], columns=['Time', 'Favourite_dog']) 85 | data2 = pd.DataFrame(data=[['20170101', 1], ['20170101', 2], ['20170102', 3], ['20170104', 3], ['20170104', 8]], columns=['Time', 'Value']) 86 | data1 87 | data2 88 | 89 | As we can see here, there different number of rows in the DataFrames. Important thing to notice is that there seems to be a common column called ``Time`` that we can use to 90 | join these DataFrames together. In Pandas we can conduct a table join with ``merge`` -function. Consider following example where we join the data **from** ``data2`` DataFrame **to** ``data1`` DataFrame. 91 | 92 | .. ipython:: python 93 | 94 | join1 = data1.merge(data2, on='Time') 95 | join1 96 | 97 | Ahaa! Now we can see that we managed to get the ``Value`` column from ``data2`` in our ``data1`` DataFrame (here we just assigned those values to a new variable ``join1``). 98 | Notice also that the ``Pluto`` is two times in the joined DataFrame although, it was only once in the original one. Hence, Pandas automatically duplicates the values in such 99 | columns where there are more matching values in one DataFrame compared to the other. 100 | 101 | However, it is important to notice that there were more values in the ``data2`` DataFrame than in ``data1``. The result ``join1``, does not contain the values ``3 and 8`` that were from day ``20170104`` and they were omitted. 102 | This might be okey, but in some cases it is useful to also bring **all** values from another DataFrame even though there would not be a matching value in the column that used for making the join (i.e. the ``key``). 103 | 104 | We can bring all the values from another DataFrame by specifyin parameter ``how='outer'``, i.e. we will make an **outer** join. 105 | Let's consider another example with the outer join. 106 | 107 | .. ipython:: python 108 | 109 | join2 = data1.merge(data2, on='Time', how='outer') 110 | join2 111 | 112 | Cool! Nowe we have all the values included from both DataFrames and if Pandas did not find a common value in the ``key`` column, it still kept them and inserted ``NaN`` values into ``Favourite_dog`` column and ``Value`` column. 113 | Overall, knowing how to conduct a table join can be really handy in many different situations. 114 | See more examples and documentation from `official documentation of Pandas `__. 115 | 116 | Breaking loops after a certain number of iterations 117 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | 119 | We had a question during the lesson about breaking out of a loop after a certain number of iterations. 120 | As you may recall, the ``break`` can be used to exit a loop. 121 | We provided examples of how to break out of a ``for`` loop after a single iteration, but what if you want to loop 5 times and then break? 122 | This can be done by creating a counter variable (``count`` in this case) and using that to break after a certain number of iterations as follows: 123 | 124 | .. ipython:: python 125 | 126 | # Initialize counter variable 127 | count = 0 128 | # Create a list of months 129 | months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] 130 | # Loop over months and print them 131 | for month in months: 132 | print('The current month is', month) 133 | # Increment counter variable 134 | count = count + 1 135 | # Exit if the month counter equals 5 136 | if count == 5: 137 | break 138 | 139 | As you can see, here our code will exit the loop when the month counter is equal to 5. 140 | This can be a handy way to break after a fixed number of iterations. 141 | -------------------------------------------------------------------------------- /source/lessons/L6/img/Kiira-storm.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L6/img/Kiira-storm.PNG -------------------------------------------------------------------------------- /source/lessons/L6/img/read-csv-varying-spaces.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/lessons/L6/img/read-csv-varying-spaces.PNG -------------------------------------------------------------------------------- /source/lessons/L6/overview.rst: -------------------------------------------------------------------------------- 1 | Lesson overview 2 | =============== 3 | 4 | This week we will continue to work with `pandas `__, a modern, feature-rich, and powerful data analysis framework for Python that is designed to make data analysis and manipulation straightforward using easy-to-use data structures and operations. 5 | 6 | In the second half of the lesson we will focus on debugging. Many new programmers struggle with fixing problems in their code (debugging) because they start randomly making changes without a clear picture of what is wrong or even what the code should do! By learning a few basic ideas about debugging and interpreting error messages, we hope to save you time and frustration as your code becomes more complex. 7 | 8 | Learning goals 9 | -------------- 10 | 11 | After this weeks lesson your should be able to: 12 | 13 | - Analyze data in Python using pandas 14 | - Repeat an analysis workflow for several input files 15 | - Understand common Python errors 16 | - Follow a simple set of guidelines to debug programs efficiently 17 | 18 | Lesson videos 19 | ------------- 20 | 21 | .. admonition:: Lesson 6.1 - Data analysis with pandas 22 | :class: admonition-youtube 23 | 24 | .. youtube:: A93Gjg_66YI 25 | 26 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 27 | 28 | .. admonition:: Lesson 6.2 - Data analysis with pandas (ctd.), debugging 29 | :class: admonition-youtube 30 | 31 | .. youtube:: sK3XiNGiWuU 32 | 33 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 34 | -------------------------------------------------------------------------------- /source/lessons/L7/exercise-7.rst: -------------------------------------------------------------------------------- 1 | Exercise 7 2 | ========== 3 | 4 | .. note:: 5 | 6 | Exercise 7 is due by **23:59 on Monday, October 21st, 2024**. 7 | 8 | .. admonition:: Start your assignment 9 | 10 | **You can start working on your copy of Exercise 7 by** accepting the `GitHub Classroom assignment `__ 11 | 12 | You can also take a look at the template repository for `Exercise 7 on GitHub `__ (does not require logging in). 13 | Note that you should not try to make changes to this copy of the exercise, but rather only to the copy available via GitHub Classroom. 14 | 15 | .. admonition:: Pair programming (optional!) 16 | 17 | Students attending the course in Helsinki, **if you wish, you can continue working in pairs**. 18 | See more information in Discord, and in week 2: `Why are we working in pairs? `_. 19 | Those students who want to submit their own solutions, please contact the course assistant that is grading your assignments (see list in Discord). 20 | 21 | Cloud computing environments 22 | ----------------------------- 23 | 24 | .. image:: https://img.shields.io/badge/launch-binder-red.svg 25 | :target: https://mybinder.org/v2/gh/Geo-Python-2024/Binder/main?urlpath=lab 26 | 27 | .. image:: https://img.shields.io/badge/launch-CSC%20Noppe-blue.svg 28 | :target: https://noppe.csc.fi/ 29 | 30 | Hints for Exercise 7 31 | -------------------- 32 | 33 | Generating random numbers 34 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | 36 | We can generate random numbers using using a method ``random.rand()`` from the `NumPy package `__. This example generates 10 random values: 37 | 38 | .. code-block:: python 39 | 40 | import numpy as np 41 | random_numbers = np.random.rand(10) 42 | 43 | This produces an array object ``random_numbers`` that could look, for example, like this (each time you run the code you get a different set of random numbers!): 44 | 45 | .. code-block:: python 46 | 47 | array([0.30888937, 0.02648327, 0.62740074, 0.75795089, 0.41083545, 48 | 0.91937694, 0.90100588, 0.33312242, 0.39950947, 0.8181788 ] 49 | 50 | You can insert this array into a column in a pandas DataFrame as follows, assuming that the array length and DataFrame length match: 51 | 52 | .. code-block:: python 53 | 54 | ... 55 | 56 | data["new_column"] = random_numbers 57 | 58 | Formatting your plots 59 | ~~~~~~~~~~~~~~~~~~~~~ 60 | 61 | - You can control the marker size using the parameter ``markersize`` when plotting. The example plot in Problem 2 uses ``markersize=3``. 62 | - You can add grid lines to your plot using ``plt.grid()`` -------------------------------------------------------------------------------- /source/lessons/L7/overview.rst: -------------------------------------------------------------------------------- 1 | Lesson overview 2 | =============== 3 | 4 | This week we will introduce you to data visualization and some different modules that can be used to make data plots in Python. 5 | You can create simple plots directly from `pandas `__, for example, but in order to control many aspects of those plots we need to also know how to use the plotting module called `Matplotlib `__. 6 | Matplotlib is an extremely powerful and flexible plotting module, as you will see. 7 | 8 | Learning goals 9 | -------------- 10 | 11 | After this weeks lesson your should be able to: 12 | 13 | - Make basic *x*-*y* plots of data using pandas/Matplotlib 14 | - Manipulate plot formatting 15 | - Create plots in Jupyter notebooks and/or save them as image files 16 | 17 | Lesson videos 18 | ------------- 19 | 20 | .. admonition:: Lesson 7.1 - Plotting in Python using pandas/Matplotlib 21 | :class: admonition-youtube 22 | 23 | .. youtube:: yNLo_sX-YQs 24 | 25 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. 26 | 27 | .. admonition:: Lesson 7.2 - Creating subplots with pandas/Matplotlib 28 | :class: admonition-youtube 29 | 30 | .. youtube:: I6R0J6fi2PM 31 | 32 | Dave Whipp & Kamyar Hasanzadeh, University of Helsinki @ `Geo-Python channel on Youtube `_. -------------------------------------------------------------------------------- /source/notebooks/L1/a-taste-of-python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "deletable": true, 7 | "editable": true 8 | }, 9 | "source": [ 10 | "# A taste of Python\n", 11 | "\n", 12 | "```{attention}\n", 13 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 14 | "\"CSC\n", 15 | "\n", 16 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 17 | "```\n", 18 | "\n", 19 | "This first lesson is designed to introduce a few essential topics for programming in Python and give you an opportunity to try them out.\n", 20 | "\n", 21 | "## Lesson materials\n", 22 | "\n", 23 | "Materials for this lesson are from Chapter 2 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the [materials in Chapter 2.1 (Getting started with Python)](https://pythongis.org/part1/chapter-02/nb/00-python-basics.html)." 24 | ] 25 | } 26 | ], 27 | "metadata": { 28 | "anaconda-cloud": {}, 29 | "kernelspec": { 30 | "display_name": "Python 3 (ipykernel)", 31 | "language": "python", 32 | "name": "python3" 33 | }, 34 | "language_info": { 35 | "codemirror_mode": { 36 | "name": "ipython", 37 | "version": 3 38 | }, 39 | "file_extension": ".py", 40 | "mimetype": "text/x-python", 41 | "name": "python", 42 | "nbconvert_exporter": "python", 43 | "pygments_lexer": "ipython3", 44 | "version": "3.11.6" 45 | } 46 | }, 47 | "nbformat": 4, 48 | "nbformat_minor": 4 49 | } 50 | -------------------------------------------------------------------------------- /source/notebooks/L1/gcp-1-variable-naming.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "tags": [ 7 | "raises-exception" 8 | ] 9 | }, 10 | "source": [ 11 | "# GCP 1 - Selecting \"good\" variable names\n", 12 | "\n", 13 | "```{note}\n", 14 | "A video for this good coding practice can be found on the {doc}`overview page for Lesson 1<../../lessons/L1/overview>`.\n", 15 | "```\n", 16 | "\n", 17 | "This course aims to introduce you to programming in Python, but also to *good programming practices*. These comprise practical tips based on practices used by professional programmers that help them write better programs that are easier to understand and share with others. To say it differently, there are many ways to learn to program, and we want to help you learn how to program the right way!\n", 18 | "\n", 19 | "This week our good programming practice (GCP) is about selecting \"good\" variable names. \n", 20 | "\n", 21 | "## Some \"not-so-good\" variable names\n", 22 | "\n", 23 | "To illustrate the point, consider a few not-so-good examples below." 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 1, 29 | "metadata": {}, 30 | "outputs": [], 31 | "source": [ 32 | "s = \"101533\"" 33 | ] 34 | }, 35 | { 36 | "cell_type": "markdown", 37 | "metadata": {}, 38 | "source": [ 39 | "or" 40 | ] 41 | }, 42 | { 43 | "cell_type": "code", 44 | "execution_count": 2, 45 | "metadata": {}, 46 | "outputs": [], 47 | "source": [ 48 | "sid = \"101533\"" 49 | ] 50 | }, 51 | { 52 | "cell_type": "markdown", 53 | "metadata": {}, 54 | "source": [ 55 | "Any idea what these variables are for? Of course not, the variables ``s`` and ``sid`` are too short and cannot communicate what they should be used for in the code. You might think you know what they are for now, but imagine not looking at the code for a few months. Would you know then? What about if you share the code with a friend? Would they know? Probably not.\n", 56 | "\n", 57 | "Let's look at another example." 58 | ] 59 | }, 60 | { 61 | "cell_type": "code", 62 | "execution_count": 3, 63 | "metadata": {}, 64 | "outputs": [], 65 | "source": [ 66 | "finnishmeteorlogicalinstituteobservationstationidentificationnumber = \"101533\"" 67 | ] 68 | }, 69 | { 70 | "cell_type": "markdown", 71 | "metadata": {}, 72 | "source": [ 73 | "OK, so now we have another issue. The variable name ``finnishmeteorologicalinstituteobservationstationidentificationnumber`` potentially provides more information about what the variable represents (the identification number of an FMI observation station), but it does so in a format that is not easy to read, nor something you're likely to want to type more than once. The previous example was too short, and now we have a variable name that is too long (and hard to read as a result)." 74 | ] 75 | }, 76 | { 77 | "cell_type": "markdown", 78 | "metadata": {}, 79 | "source": [ 80 | "## Selecting \"good\" variable names\n", 81 | "\n", 82 | "A good variable name should:\n", 83 | "\n", 84 | "1. Be clear and concise. \n", 85 | "\n", 86 | "2. Be written in English. A general coding practice is to write code with variable names in English, as that is the most likely common language between programmers. Thus, variable names such as ``muuttuja`` (which is also not a good name on other levels) should be avoided.\n", 87 | "\n", 88 | "3. Not contain special characters. Python supports use of special characters by way of various encoding options that can be given in a program. That said, it is better to avoid variables such as ``lämpötila`` because encoding issues can arise in some cases. Better to stick to the [standard printable ASCII character set](https://en.wikipedia.org/wiki/ASCII#Printable_characters) to be safe.\n", 89 | "\n", 90 | "4. Not conflict with any [Python keywords](https://www.pythonforbeginners.com/basics/keywords-in-python), such as ``for``, ``True``, ``False``, ``and``, ``if``, or ``else``. These are reserved for speical operations in Python and cannot be used as variable names.\n", 91 | "\n", 92 | "With this in mind, let's now look at a few better options for variable names." 93 | ] 94 | }, 95 | { 96 | "cell_type": "markdown", 97 | "metadata": {}, 98 | "source": [ 99 | "## Formatting \"good\" variable names\n", 100 | "\n", 101 | "There are several possibilities for \"good\" variable name formats, of which we'll consider two:\n", 102 | "\n", 103 | "### Recommendation 1: pothole_case_naming\n", 104 | "\n", 105 | "*pothole_case_naming* uses lowercase words separated by underscores ``_``. This is our suggested format as the underscores make it easy to read the variable, and don't add too much to the length of the variable name. As an example, consider the variable ``temp_celsius``. " 106 | ] 107 | }, 108 | { 109 | "cell_type": "code", 110 | "execution_count": 4, 111 | "metadata": {}, 112 | "outputs": [], 113 | "source": [ 114 | "fmi_station_id = \"101533\"" 115 | ] 116 | }, 117 | { 118 | "cell_type": "markdown", 119 | "metadata": {}, 120 | "source": [ 121 | "Here, our new variable name conveys all of the essential information we need, while remaining easy to read." 122 | ] 123 | }, 124 | { 125 | "cell_type": "markdown", 126 | "metadata": {}, 127 | "source": [ 128 | "### Recommendation 2: camelCase naming\n", 129 | "\n", 130 | "*camelCase* or *CamelCase* uses capitalization of the first letter of words in a variable name to make it easier to read. In some cases the first letter of the variable may be capitalized. The variable ``tempFahrenheit`` was one example of camelCase." 131 | ] 132 | }, 133 | { 134 | "cell_type": "code", 135 | "execution_count": 5, 136 | "metadata": {}, 137 | "outputs": [], 138 | "source": [ 139 | "fmiStationID = \"101533\"" 140 | ] 141 | }, 142 | { 143 | "cell_type": "code", 144 | "execution_count": 6, 145 | "metadata": {}, 146 | "outputs": [], 147 | "source": [ 148 | "stationID = \"101533\"" 149 | ] 150 | }, 151 | { 152 | "cell_type": "markdown", 153 | "metadata": {}, 154 | "source": [ 155 | "Again, this variable name is clear and easy to read.\n", 156 | "\n", 157 | "Our preference in the course is for pothole_case_naming, mostly because we feel it is the easiest to read and seems to be most common amongst Python programmers. We are happy with you using either option, as long as you are consistent in the use. It might take an extra second of thought, but could make a big difference in the ease of use of your programs!" 158 | ] 159 | } 160 | ], 161 | "metadata": { 162 | "kernelspec": { 163 | "display_name": "Python 3 (ipykernel)", 164 | "language": "python", 165 | "name": "python3" 166 | }, 167 | "language_info": { 168 | "codemirror_mode": { 169 | "name": "ipython", 170 | "version": 3 171 | }, 172 | "file_extension": ".py", 173 | "mimetype": "text/x-python", 174 | "name": "python", 175 | "nbconvert_exporter": "python", 176 | "pygments_lexer": "ipython3", 177 | "version": "3.8.10" 178 | } 179 | }, 180 | "nbformat": 4, 181 | "nbformat_minor": 4 182 | } 183 | -------------------------------------------------------------------------------- /source/notebooks/L2/Python-basic-elements.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Basic elements of Python\n", 8 | "\n", 9 | "```{attention}\n", 10 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 11 | "\"CSC\n", 12 | "\n", 13 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 14 | "```\n", 15 | "\n", 16 | "In this lesson we will learn how data can be stored in Python lists, some useful ways of using and modifying Python lists, and how to make different data types work together in Python.\n", 17 | "\n", 18 | "## Lesson materials\n", 19 | "\n", 20 | "Materials for this lesson are from Chapter 2 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 2.2 (Lists and indices)](https://pythongis.org/part1/chapter-02/nb/01-lists-and-indices.html) and [Chapter 2.3 (Working with text and numbers)](https://pythongis.org/part1/chapter-02/nb/02-text-and-numbers.html)." 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3 (ipykernel)", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.11.6" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 4 45 | } 46 | -------------------------------------------------------------------------------- /source/notebooks/L3/conditional-statements.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Conditional statements\n", 8 | "\n", 9 | "```{attention}\n", 10 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 11 | "\"CSC\n", 12 | "\n", 13 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 14 | "```\n", 15 | "\n", 16 | "In this lesson we will learn how to make choices in our code using conditional statements (`if`, `elif`, `else`) and Boolean values (`True`, `False`).\n", 17 | "\n", 18 | "## Lesson materials\n", 19 | "\n", 20 | "Materials for this lesson are from Chapter 2 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 2.5 (Conditional statements)](https://pythongis.org/part1/chapter-02/nb/04-conditional-statements.html)." 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3 (ipykernel)", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.11.6" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 4 45 | } 46 | -------------------------------------------------------------------------------- /source/notebooks/L3/for-loops.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# for loops\n", 8 | "\n", 9 | "```{attention}\n", 10 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 11 | "\"CSC\n", 12 | "\n", 13 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 14 | "```\n", 15 | "\n", 16 | "In this lesson we introduce loops as a way of repeating parts of a Python program, such as iterating over all of the items in a list and performing a calculation using each item.\n", 17 | "\n", 18 | "## Lesson materials\n", 19 | "\n", 20 | "Materials for this lesson are from Chapter 2 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 2.4 (for loops)](https://pythongis.org/part1/chapter-02/nb/03-for-loops.html)." 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3 (ipykernel)", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.11.6" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 4 45 | } 46 | -------------------------------------------------------------------------------- /source/notebooks/L4/functions.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Functions\n", 8 | "\n", 9 | "```{attention}\n", 10 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 11 | "\"CSC\n", 12 | "\n", 13 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 14 | "```\n", 15 | "\n", 16 | "In this lesson we introduce functions as a way of making blocks of code for a specific task that are easy to use and re-use in your programs.\n", 17 | "\n", 18 | "## Lesson materials\n", 19 | "\n", 20 | "Materials for this lesson are from Chapter 2 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 2.6 (Functions)](https://pythongis.org/part1/chapter-02/nb/05-functions.html)." 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3 (ipykernel)", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.11.6" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 4 45 | } 46 | -------------------------------------------------------------------------------- /source/notebooks/L4/img/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/notebooks/L4/img/Thumbs.db -------------------------------------------------------------------------------- /source/notebooks/L4/img/chatgpt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/notebooks/L4/img/chatgpt.png -------------------------------------------------------------------------------- /source/notebooks/L4/img/chatgpt_signup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/notebooks/L4/img/chatgpt_signup.png -------------------------------------------------------------------------------- /source/notebooks/L4/modules.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Loading and using modules\n", 8 | "\n", 9 | "```{attention}\n", 10 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 11 | "\"CSC\n", 12 | "\n", 13 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 14 | "```\n", 15 | "\n", 16 | "In this lesson we introduce you to how to load and use modules to expand what you can do with your Python code.\n", 17 | "\n", 18 | "## Lesson materials\n", 19 | "\n", 20 | "Materials for this lesson are from Chapter 2 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 2.8 (Loading and using modules)](https://pythongis.org/part1/chapter-02/nb/07-modules.html)." 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3 (ipykernel)", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.11.6" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 4 45 | } 46 | -------------------------------------------------------------------------------- /source/notebooks/L4/script-files.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "269d17fd-9edf-4bc6-ae60-1dd089219748", 6 | "metadata": { 7 | "tags": [] 8 | }, 9 | "source": [ 10 | "# Using script files\n", 11 | "\n", 12 | "```{attention}\n", 13 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 14 | "\"CSC\n", 15 | "\n", 16 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 17 | "```\n", 18 | "\n", 19 | "In this lesson we introduce you to how to put your functions in a script file for convenient use in notebooks or other script files.\n", 20 | "\n", 21 | "## Lesson materials\n", 22 | "\n", 23 | "Materials for this lesson are from Chapter 2 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 2.7 (Writing script files)](https://pythongis.org/part1/chapter-02/nb/06-writing-scripts.html)." 24 | ] 25 | } 26 | ], 27 | "metadata": { 28 | "kernelspec": { 29 | "display_name": "Python 3 (ipykernel)", 30 | "language": "python", 31 | "name": "python3" 32 | }, 33 | "language_info": { 34 | "codemirror_mode": { 35 | "name": "ipython", 36 | "version": 3 37 | }, 38 | "file_extension": ".py", 39 | "mimetype": "text/x-python", 40 | "name": "python", 41 | "nbconvert_exporter": "python", 42 | "pygments_lexer": "ipython3", 43 | "version": "3.11.6" 44 | } 45 | }, 46 | "nbformat": 4, 47 | "nbformat_minor": 5 48 | } 49 | -------------------------------------------------------------------------------- /source/notebooks/L5/data/kumpula-summer-2024.txt: -------------------------------------------------------------------------------- 1 | # Data file contents: Daily temperatures (TEMP1 (10AM), TEMP2 (4PM), min, max) 2 | # for Kumpula, Helsinki for June 1 - August 31, 2024 3 | # Data source: Finnish Meteorological Institute - downloaded from open data 4 | # portal https://en.ilmatieteenlaitos.fi/download-observations 5 | # Data processing: Extracted temperatures from raw data file, converted to 6 | # comma-separated format, extracted TEMP1 and TEMP2, and created YEARMODA column 7 | # 8 | # Processed by Kamyar Hasanzadeh 15.09.2024 9 | 10 | YEARMODA,MAX,MIN,TEMP1,TEMP2 11 | 20240601,26.2,18.4,24.2,23.2 12 | 20240602,24.4,17.1,20.7,24.2 13 | 20240603,25.7,15.2,22.5,23.1 14 | 20240604,24.6,15.7,19.3,24.6 15 | 20240605,23.4,12.8,20.3,23.2 16 | 20240606,19.3,13.6,19.2,14.9 17 | 20240607,18.5,9.2,16.6,17.5 18 | 20240608,17.6,8.9,14.1,17.0 19 | 20240609,15.5,11.3,12.8,15.4 20 | 20240610,17.6,8.2,13.5,17.6 21 | 20240611,18.5,10.5,15.1,17.8 22 | 20240612,17.9,11.1,14.9,17.5 23 | 20240613,17.7,11.5,15.2,17.7 24 | 20240614,,11.5,15.7,18.1 25 | 20240615,19.0,9.0,16.1,18.9 26 | 20240616,21.5,14.0,18.0,20.2 27 | 20240617,22.9,15.4,19.7,20.6 28 | 20240618,21.7,14.7,18.6,21.4 29 | 20240619,17.8,12.8,16.1,16.8 30 | 20240620,20.8,13.2,15.5,20.5 31 | 20240621,22.2,11.5,18.7,22.1 32 | 20240622,21.4,10.8,18.6,20.9 33 | 20240623,23.1,11.6,20.4,22.5 34 | 20240624,,16.7,19.2,21.0 35 | 20240625,25.7,12.3,20.6,25.0 36 | 20240626,25.7,15.9,22.2,25.5 37 | 20240627,,15.3,22.9,26.9 38 | 20240628,27.2,17.0,25.4,27.2 39 | 20240629,23.9,16.6,19.5,22.0 40 | 20240630,22.7,14.2,20.1,21.1 41 | 20240701,21.4,16.8,19.9,19.9 42 | 20240702,23.4,14.0,19.8,23.4 43 | 20240703,17.4,13.1,14.2,16.6 44 | 20240704,20.6,13.5,17.7,20.2 45 | 20240705,19.6,14.0,18.3,19.0 46 | 20240706,19.0,11.3,11.4,18.7 47 | 20240707,19.7,15.0,16.6,18.5 48 | 20240708,21.3,13.8,18.6,21.3 49 | 20240709,,13.0,19.1,22.5 50 | 20240710,,12.5,20.1,22.0 51 | 20240711,,17.0,19.7,20.9 52 | 20240712,22.7,17.2,19.2,22.2 53 | 20240713,24.7,16.3,23.1,24.5 54 | 20240714,21.3,17.3,18.9,20.1 55 | 20240715,22.3,14.9,19.5,22.0 56 | 20240716,24.3,15.4,20.6,24.3 57 | 20240717,24.3,17.9,21.6,23.5 58 | 20240718,22.5,16.9,19.1,22.5 59 | 20240719,20.7,16.1,17.7,20.0 60 | 20240720,22.8,16.1,19.3,19.9 61 | 20240721,,16.7,19.0,20.7 62 | 20240722,25.1,16.9,22.3,24.7 63 | 20240723,,19.5,22.3,24.9 64 | 20240724,,20.2,22.4,24.2 65 | 20240725,26.1,18.5,22.3,26.1 66 | 20240726,26.7,17.9,24.3,26.4 67 | 20240727,25.1,,22.7,24.8 68 | 20240728,23.7,,20.9,23.6 69 | 20240729,24.9,,20.2,24.9 70 | 20240730,23.5,17.6,18.8,22.7 71 | 20240731,23.2,14.6,18.9,21.4 72 | 20240801,21.7,13.7,16.7,21.0 73 | 20240802,21.7,14.7,16.8,21.7 74 | 20240803,22.5,14.9,17.8,18.3 75 | 20240804,21.8,15.3,17.8,19.9 76 | 20240805,21.0,15.0,19.3,19.6 77 | 20240806,22.3,16.6,18.8,22.3 78 | 20240807,22.3,13.3,18.7,21.3 79 | 20240808,24.0,14.2,21.4,23.9 80 | 20240809,24.1,17.1,22.2,24.1 81 | 20240810,21.0,16.5,17.4,21.0 82 | 20240811,21.0,14.0,18.0,15.2 83 | 20240812,17.4,12.7,14.7,16.0 84 | 20240813,23.9,12.2,19.2,23.4 85 | 20240814,23.8,13.9,20.4,23.8 86 | 20240815,23.9,14.3,20.7,23.9 87 | 20240816,21.2,18.3,19.5,20.9 88 | 20240817,22.6,16.9,20.0,21.4 89 | 20240818,21.2,12.5,18.5,21.2 90 | 20240819,22.3,15.1,18.8,22.3 91 | 20240820,21.0,10.4,17.2,20.9 92 | 20240821,22.3,16.0,20.8,20.6 93 | 20240822,22.1,,19.7,20.8 94 | 20240823,20.3,13.0,18.7,18.2 95 | 20240824,19.1,15.4,17.8,18.6 96 | 20240825,25.9,14.4,19.0,25.9 97 | 20240826,20.0,14.5,17.3,19.7 98 | 20240827,20.5,15.3,17.9,20.4 99 | 20240828,21.6,14.2,18.7,21.3 100 | 20240829,21.9,,16.6,21.8 101 | 20240830,24.6,16.0,20.7,23.5 102 | 20240831,,13.7,13.9,18.7 103 | -------------------------------------------------------------------------------- /source/notebooks/L5/exploring-data-using-pandas.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "deletable": true, 7 | "editable": true 8 | }, 9 | "source": [ 10 | "# Exploring data using pandas\n", 11 | "\n", 12 | "```{attention}\n", 13 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 14 | "\"CSC\n", 15 | "\n", 16 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 17 | "```\n", 18 | "\n", 19 | "In this section we introduce how to read, write, and explore tabular data using `pandas`.\n", 20 | "\n", 21 | "## Lesson materials\n", 22 | "\n", 23 | "Materials for this lesson are from Chapter 3 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 3.1 (Getting started with data analysis)](https://pythongis.org/part1/chapter-03/nb/00-pandas-basics.html). A brief description of the data used in this lesson can also be found below.\n", 24 | "\n", 25 | "### Input data: Weather statistics\n", 26 | "\n", 27 | "Our input data is a text file containing weather observations from Kumpula, Helsinki, Finland retrieved from the [Finnish Meteorlogical Institute (FMI)](https://en.ilmatieteenlaitos.fi):\n", 28 | "\n", 29 | "- File name: [`kumpula-summer-2024.txt`](kumpula-summer-2024.txt) (have a look at the file before reading it in using `pandas`!)\n", 30 | "- The file is available in Binder and the CSC Noppe platforms in the `L5/data` \n", 31 | "- The data file contains observed daily temperatures recorded twice per day (TEMP1: 10AM, TEMP2: 4PM) as well as minimum, and maximum temperatures from Summer 2024 (1.6.2024 - 31.8.2024) recorded from the Kumpula weather observation station in Helsinki.\n", 32 | "- There are 92 rows of data in this sample data set.\n", 33 | "- The data has been derived from a data file of daily temperature measurements downloaded from the [FMI data service](https://en.ilmatieteenlaitos.fi/open-data). The structure of the data in the file has been modified for use in this lesson." 34 | ] 35 | } 36 | ], 37 | "metadata": { 38 | "anaconda-cloud": {}, 39 | "kernelspec": { 40 | "display_name": "Python 3 (ipykernel)", 41 | "language": "python", 42 | "name": "python3" 43 | }, 44 | "language_info": { 45 | "codemirror_mode": { 46 | "name": "ipython", 47 | "version": 3 48 | }, 49 | "file_extension": ".py", 50 | "mimetype": "text/x-python", 51 | "name": "python", 52 | "nbconvert_exporter": "python", 53 | "pygments_lexer": "ipython3", 54 | "version": "3.11.7" 55 | } 56 | }, 57 | "nbformat": 4, 58 | "nbformat_minor": 4 59 | } 60 | -------------------------------------------------------------------------------- /source/notebooks/L5/processing-data-with-pandas.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "deletable": true, 7 | "editable": true 8 | }, 9 | "source": [ 10 | "# Processing data with pandas\n", 11 | "\n", 12 | "```{attention}\n", 13 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 14 | "\"CSC\n", 15 | "\n", 16 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 17 | "```\n", 18 | "\n", 19 | "In this section we continue with basic data manipulation and analysis methods such calculations and selections using `pandas`.\n", 20 | "\n", 21 | "## Lesson materials\n", 22 | "\n", 23 | "Materials for this lesson are from Chapter 3 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 3.2 (Common tabular operations in pandas)](https://pythongis.org/part1/chapter-03/nb/01-data-manipulation.html). A brief description of the data used in this lesson can also be found below.\n", 24 | "\n", 25 | "### Input data: Weather statistics\n", 26 | "\n", 27 | "Our input data is a text file containing weather observations from Kumpula, Helsinki, Finland retrieved from the [Finnish Meteorlogical Institute (FMI)](https://en.ilmatieteenlaitos.fi):\n", 28 | "\n", 29 | "- File name: [`kumpula-summer-2024.txt`](kumpula-summer-2024.txt) (have a look at the file before reading it in using `pandas`!)\n", 30 | "- The file is available in Binder and the CSC Noppe platforms in the `L5/data` \n", 31 | "- The data file contains observed daily temperatures recorded twice per day (TEMP1: 10AM, TEMP2: 4PM) as well as minimum, and maximum temperatures from Summer 2024 (1.6.2024 - 31.8.2024) recorded from the Kumpula weather observation station in Helsinki.\n", 32 | "- There are 92 rows of data in this sample data set.\n", 33 | "- The data has been derived from a data file of daily temperature measurements downloaded from the [FMI data service](https://en.ilmatieteenlaitos.fi/open-data). The structure of the data in the file has been modified for use in this lesson." 34 | ] 35 | } 36 | ], 37 | "metadata": { 38 | "anaconda-cloud": {}, 39 | "kernelspec": { 40 | "display_name": "Python 3 (ipykernel)", 41 | "language": "python", 42 | "name": "python3" 43 | }, 44 | "language_info": { 45 | "codemirror_mode": { 46 | "name": "ipython", 47 | "version": 3 48 | }, 49 | "file_extension": ".py", 50 | "mimetype": "text/x-python", 51 | "name": "python", 52 | "nbconvert_exporter": "python", 53 | "pygments_lexer": "ipython3", 54 | "version": "3.11.7" 55 | } 56 | }, 57 | "nbformat": 4, 58 | "nbformat_minor": 4 59 | } 60 | -------------------------------------------------------------------------------- /source/notebooks/L6/debugging.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Debugging your Python code\n", 8 | "\n", 9 | "```{attention}\n", 10 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 11 | "\"CSC\n", 12 | "\n", 13 | "Others can follow the lesson and fill in their student notebooks using Binder.
\n", 14 | "\"Binder\n", 15 | "```\n", 16 | "\n", 17 | "Debugging your code can be time consuming, and probably already uses most of the time you devote to working on it. There is no way to avoid spending time fixing bugs, especially when you're learning to program and simply may not yet know how to solve a given programming problem. That said, there are ways to be more effective when debugging, which can save you time and frustration. Below, we review some tips for debugging.\n", 18 | "\n", 19 | "## Source\n", 20 | "\n", 21 | "This lesson is based in part on the [Software Carpentry group's lesson on debugging](https://swcarpentry.github.io/python-novice-inflammation/11-debugging.html).\n", 22 | "\n", 23 | "## General recommendations\n", 24 | "\n", 25 | "Our main recommendations for debugging your Python codes are:\n", 26 | "\n", 27 | "1. Test your code with known outputs\n", 28 | "2. Make your code crash quickly and regularly\n", 29 | "3. Make small changes and track them\n", 30 | "\n", 31 | "We expand on these points further in the text below." 32 | ] 33 | }, 34 | { 35 | "cell_type": "markdown", 36 | "metadata": {}, 37 | "source": [ 38 | "## Test your code with known outputs\n", 39 | "\n", 40 | "One of the biggest challenges to debugging your code once you solve the syntax issues is knowing whether or not the code actually works like it should. In order to be able to assess this, we need to know the \"answer\" the code should produce. In many cases this means *some form* of calculating a known value using simplified data or test cases.\n", 41 | "\n", 42 | "### Testing with a simplified data file\n", 43 | "\n", 44 | "Let's consider an example of calculating the maximum difference in daily temperature in Helsinki using observations for the past 50 years. First off, we don't know the answer in advance so we cannot simply work on the code until it gives the expected temperature difference. Secondly, we can expect that we should have more than 18 000 observations in our data file for the past 50 years, so it will be hard to confirm we get the right answer because of the size of the dataset. One thing that can be helpful here is to test your program using some small subset of the data. For instance, we could take the top 5 lines of data from the file, which might look like the following:\n", 45 | "\n", 46 | "```\n", 47 | "STATION ELEVATION LATITUDE LONGITUDE DATE PRCP TAVG TMAX TMIN \n", 48 | "----------------- ---------- ---------- ---------- -------- -------- -------- -------- -------- \n", 49 | "GHCND:FIE00142080 51 60.3269 24.9603 19520101 0.31 37 39 34 \n", 50 | "GHCND:FIE00142080 51 60.3269 24.9603 19520102 -9999 35 37 34 \n", 51 | "GHCND:FIE00142080 51 60.3269 24.9603 19520103 0.14 33 36 -9999 \n", 52 | "GHCND:FIE00142080 51 60.3269 24.9603 19520104 0.05 29 30 25 \n", 53 | "GHCND:FIE00142080 51 60.3269 24.9603 19520105 0.06 27 30 25 \n", 54 | "```\n", 55 | "\n", 56 | "From this, we know two things:\n", 57 | "\n", 58 | "1. We should expect the code to be able to handle no data values equal to `-9999`, and to not include days with no data values when calculating the maximum temperature difference (`TMAX` - `TMIN`).\n", 59 | "2. The maximum temperature difference if we test our code with this data file should be 5°.\n", 60 | "\n", 61 | "In this case, we now know that if we can get our code to return the correct answer with the small test file, perhaps the same can be done for the full dataset. In other cases, we may actually know the expected answer, in which case debugging should be a bit easier." 62 | ] 63 | }, 64 | { 65 | "cell_type": "markdown", 66 | "metadata": {}, 67 | "source": [ 68 | "## Make your code crash quickly and regularly\n", 69 | "\n", 70 | "This may sound silly, but it is a good thing when your code crashes the same way every time you run it. If you have different behaviors when you run your code several times without making changes to the code, it will be much more difficult to isolate the source of the problem. What we ideally want in a code is to see behavior that is **consistent**.\n", 71 | "\n", 72 | "In addition, if you expect to debug your program efficiently, you can't afford to wait 30 minutes every time you run it in order for it to crash. If your code crashes when processing a massive data file, you can consider testing with some smaller part of the file. Does the code still crash? If not, why not? Are there some parts of the code that seem to run just fine every time? If you can reduce the time needed for a crash, and isolate where in the code the problem lies (perhaps in memory if you're dealing with really large datasets), you will save yourself time debugging." 73 | ] 74 | }, 75 | { 76 | "cell_type": "markdown", 77 | "metadata": {}, 78 | "source": [ 79 | "## Make small changes and track them\n", 80 | "\n", 81 | "We're teaching you to use [GitHub.com](https://github.com/) to store your work, and to commit your changes regularly. This is for two reasons. First, by keeping track of the changes, you will have a better chance of isolating a problem if you find that suddenly your code doesn't work. You can simply go back to a version of the code that worked and look at what has changed in the version that doesn't work. **This is probably the greatest thing about version control**. Secondly, if you make small changes to the code it is easier to see exactly what changed and where. When it comes to debugging, this is one of the keys to solving problems quickly.\n", 82 | "\n", 83 | "It is worth noting that often we don't keep track and commit every single small change to our codes, but rather commit when things are working as we expected. This means that when you debug, you might not keep track of every little change you make. This is fine, but it is important when you are debugging that you make small changes in one part of the code, then re-test. You should change one thing at a time, test the code, and make more changes if needed. Changing several things at once might be appealing, but it will make it harder to see exactly what is causing the problem because you can't isolate the issue to a single line of the program." 84 | ] 85 | } 86 | ], 87 | "metadata": { 88 | "kernelspec": { 89 | "display_name": "Python 3 (ipykernel)", 90 | "language": "python", 91 | "name": "python3" 92 | }, 93 | "language_info": { 94 | "codemirror_mode": { 95 | "name": "ipython", 96 | "version": 3 97 | }, 98 | "file_extension": ".py", 99 | "mimetype": "text/x-python", 100 | "name": "python", 101 | "nbconvert_exporter": "python", 102 | "pygments_lexer": "ipython3", 103 | "version": "3.11.6" 104 | } 105 | }, 106 | "nbformat": 4, 107 | "nbformat_minor": 4 108 | } 109 | -------------------------------------------------------------------------------- /source/notebooks/L6/img/error-message-annotated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/notebooks/L6/img/error-message-annotated.png -------------------------------------------------------------------------------- /source/notebooks/L6/img/fmi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/notebooks/L6/img/fmi.png -------------------------------------------------------------------------------- /source/notebooks/L6/img/yle-summer-2024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/notebooks/L6/img/yle-summer-2024.png -------------------------------------------------------------------------------- /source/notebooks/L7/basic-plotting.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Basic plotting with pandas and matplotlib\n", 8 | "\n", 9 | "```{attention}\n", 10 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 11 | "\"CSC\n", 12 | "\n", 13 | "We do not recommended using Binder for this lesson.\n", 14 | "```\n", 15 | "\n", 16 | "In this lesson we explore how to create basic plots using `pandas` and `matplotlib`, and provide an example of how to create interactive plots at the end of the lesson using `hvplot`.\n", 17 | "\n", 18 | "## Lesson materials\n", 19 | "\n", 20 | "Materials for this lesson are from Chapter 4 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 4.2 (Plotting with pandas and matplotlib)](https://pythongis.org/part1/chapter-04/nb/01-basic-plotting.html)." 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3 (ipykernel)", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.11.6" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 4 45 | } 46 | -------------------------------------------------------------------------------- /source/notebooks/L7/img/matplotlib-gallery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/notebooks/L7/img/matplotlib-gallery.png -------------------------------------------------------------------------------- /source/notebooks/L7/img/subplots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geo-python/site/7b35a62331d938ed81a75074a85c97cee8aec961/source/notebooks/L7/img/subplots.png -------------------------------------------------------------------------------- /source/notebooks/L7/line-plots.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "d7feb898-b7d7-435f-aeda-3798949fbf75", 6 | "metadata": {}, 7 | "source": [ 8 | "# Effective line plots\n", 9 | "\n", 10 | "```{attention}\n", 11 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 12 | "\"CSC\n", 13 | "\n", 14 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 15 | "```\n", 16 | "\n", 17 | "In this section we describe how to create line plots that are inclusive for viewers with colorbilindness or when printed in grayscale.\n", 18 | "\n", 19 | "## Lesson materials\n", 20 | "\n", 21 | "Materials for this lesson are from Chapter 4 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 4.4 (Effective plot design: line plots)](https://pythongis.org/part1/chapter-04/nb/03-plot-formatting.html)." 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 3 (ipykernel)", 28 | "language": "python", 29 | "name": "python3" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 3 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython3", 41 | "version": "3.11.6" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 5 46 | } 47 | -------------------------------------------------------------------------------- /source/notebooks/L7/metadata/6367598020644stn.txt: -------------------------------------------------------------------------------- 1 | USAF-WBAN_ID STATION NAME COUNTRY STATE LATITUDE LONGITUDE ELEVATION 2 | ------------ ------------------------------ -------------------------------------------------- ------------------------------ -------- --------- --------- 3 | 028360 99999 SODANKYLA FINLAND +67.395 +026.619 +0183.5 4 | 028690 99999 KUUSAMO FINLAND +65.988 +029.239 +0264.0 5 | 028750 99999 OULU FINLAND +64.930 +025.355 +0014.3 6 | 028970 99999 KAJAANI FINLAND +64.285 +027.692 +0147.2 7 | 029070 99999 KALAJOKI ULKOKALLA FINLAND +64.333 +023.450 +0005.0 8 | 029110 99999 VAASA FINLAND +63.051 +021.762 +0005.8 9 | 029170 99999 KUOPIO FINLAND +63.007 +027.798 +0098.5 10 | 029350 99999 JYVASKYLA FINLAND +62.399 +025.678 +0139.9 11 | 029440 99999 TAMPERE PIRKKALA FINLAND +61.414 +023.604 +0118.9 12 | 029500 99999 PARAINEN FAGERHOLM FINLAND +60.117 +021.700 +0004.5 13 | 029700 99999 MARIEHAMN FINLAND +60.122 +019.898 +0005.2 14 | 029720 99999 TURKU FINLAND +60.514 +022.263 +0049.1 15 | 029740 99999 HELSINKI VANTAA FINLAND +60.317 +024.963 +0054.6 16 | 029810 99999 PARAINEN UTO FINLAND +59.783 +021.367 +0006.8 17 | 029820 99999 HANKO RUSSARO FINLAND +59.767 +022.950 +0006.5 18 | -------------------------------------------------------------------------------- /source/notebooks/L7/python-plotting.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "27ffe4d7-f4f7-491a-85c3-594974e5cb85", 6 | "metadata": {}, 7 | "source": [ 8 | "# Plotting in Python\n", 9 | "\n", 10 | "```{attention}\n", 11 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 12 | "\"CSC\n", 13 | "\n", 14 | "Others can follow the lesson and fill in their student notebooks using Binder. Binder can be launched using the interactive code tools (rocket icon) on the lesson page linked below.\n", 15 | "```\n", 16 | "\n", 17 | "In this lesson we introduce a selection of libraries available for plotting in Python and some common features of plots.\n", 18 | "\n", 19 | "## Lesson materials\n", 20 | "\n", 21 | "Materials for this lesson are from Chapter 4 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 4.1 (Plotting in Python)](https://pythongis.org/part1/chapter-04/nb/00-plotting-in-python.html)." 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 3 (ipykernel)", 28 | "language": "python", 29 | "name": "python3" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 3 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython3", 41 | "version": "3.11.6" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 5 46 | } 47 | -------------------------------------------------------------------------------- /source/notebooks/L7/subplots.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Creating subplots\n", 8 | "\n", 9 | "```{attention}\n", 10 | "Finnish university students are encouraged to use the CSC Noppe platform.
\n", 11 | "\"CSC\n", 12 | "\n", 13 | "We do not recommended using Binder for this lesson.\n", 14 | "```\n", 15 | "\n", 16 | "In this lesson we introduce you to creating multi-panel plots using the `.subplots()` function from `matplotlib.`\n", 17 | "\n", 18 | "## Lesson materials\n", 19 | "\n", 20 | "Materials for this lesson are from Chapter 4 of the forthcoming textbook [*Introduction to Python for Geographic Data Analysis*](https://pythongis.org/). In this lesson we cover the materials from [Chapter 4.3 (Creating subplots)](https://pythongis.org/part1/chapter-04/nb/02-subplots.html)." 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3 (ipykernel)", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.11.6" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 4 45 | } 46 | -------------------------------------------------------------------------------- /source/rtd_requirements.txt: -------------------------------------------------------------------------------- 1 | jupyter-book 2 | sphinx 3 | sphinx-book-theme 4 | jupyter-sphinx 5 | pydata-sphinx-theme 6 | IPython 7 | jupyter_client 8 | ipykernel 9 | git+https://github.com/jelmer/googleanalytics.git@master 10 | MyST-NB 11 | matplotlib 12 | pandas 13 | pandas-bokeh 14 | imageio 15 | nbconvert 16 | sphinxcontrib-youtube 17 | --------------------------------------------------------------------------------