Skip to content

Commit

Permalink
Update course material (#11)
Browse files Browse the repository at this point in the history
* update notebooks

* remove metadata from cells during tests

* update content and contextily installation

* add descartes

* typo

* update installation manual

* update gitignore

* move groundwater model directory

* update gitignore

* restructure and update practical examples

* last update for now

* add cbs_data analyse

* update twitter analysis

* reinstate some files to be ignored

* remove error in camel_bananas function

* update camel problem
  • Loading branch information
OnnoEbbens authored Nov 15, 2020
1 parent 719d9e7 commit 35cfa26
Show file tree
Hide file tree
Showing 54 changed files with 991 additions and 66,774 deletions.
22 changes: 11 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,27 +106,27 @@ venv.bak/

# specifically for course_material
**/_chat_df*
Practical_examples/data_analysis/groundwater_model/model
Practical_examples/modelling/groundwater_model/results/*
!Practical_examples/modelling/groundwater_model/results/.gitkeep
Practical_examples/congress_twitter_analysis/data/*
Practical_examples/groundwater_model/model
Practical_examples/groundwater_model/results/*
!Practical_examples/groundwater_model/results/.gitkeep
Exercise_notebooks/On_topic/01_Pandas/aangepaste_tabel.csv
Exercise_notebooks/On_topic/01_Pandas/statistiek.csv
Exercise_notebooks/On_topic/01_Pandas/locaties*
Exercise_notebooks/On_topic/09_code_Quality/measurements*
Exercise_notebooks/On_topic/19-bokeh/plot.svg
Exercise_notebooks/On_topic/19-bokeh/plot.html
Exercise_notebooks/On_topic/20-folium/results/*
Exercise_notebooks/On_topic/23_webscraping/turnstile_*
Exercise_notebooks/On_topic/24_pastas/data/background
Exercise_notebooks/On_topic/24_pastas/pastas_project.pas
Exercise_notebooks/On_topic/08_databases/people.db
Exercise_notebooks/On_topic/12_databases/people.db
Exercise_notebooks/On_topic/09_code_Quality/04_idiomatic/tmp.txt
Exercise_notebooks/On_topic/06_GIS/shapefiles/Rotterdam_centraal*
Exercise_notebooks/On_topic/07_read_write_text_files/my_diary.txt
Exercise_notebooks/On_topic/07_read_write_text_files/my_diary_mod.txt
Exercise_notebooks/On_topic/07_read_write_text_files/file2_mod.txt
Exercise_notebooks/On_topic/07_read_write_text_files/dir_structure.pptx
Exercise_notebooks/On_topic/07_read_write_text_files/~$dir_structure.pptx
Exercise_notebooks/On_topic/08_GIS/shapefiles/Rotterdam_centraal*
Exercise_notebooks/On_topic/09_read_write_text_files/my_diary.txt
Exercise_notebooks/On_topic/09_read_write_text_files/my_diary_mod.txt
Exercise_notebooks/On_topic/09_read_write_text_files/file2_mod.txt
Exercise_notebooks/On_topic/09_read_write_text_files/dir_structure.pptx
Exercise_notebooks/On_topic/09_read_write_text_files/~$dir_structure.pptx
Exercise_notebooks/personal_application/readme.md


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@
"\n",
"There is a desert, one camel and 3000 bananas.\n",
" \n",
"The camel has to transport as many bananas as possible over 1 km (1000 m) to a market. \n",
"However each meter, the camel eats one banana. \n",
"Also the camel can only carry 1000 bananas at the same time\n",
"The camel has to transport as many bananas as possible over 1000 km to a market. \n",
"However each kilometer, the camel eats one banana. \n",
"Also the camel can only carry 1000 bananas at the same time.\n",
"\n",
"What is the maximum number of bananas the camel can bring to the other side?\n",
"\n",
"Note: The camel can eat a banana at the point of departure or arrival that doesn't matter. \n",
"\n",
"---- \n",
"We can generalize this for b bananas, x km while being able to carry k bananas \n",
Expand Down Expand Up @@ -168,7 +169,7 @@
"outputs": [],
"source": [
"# test if your functions works with the code below\n",
"if camel_bananas(3000, 1000) == 533:\n",
"if camel_bananas(3000, 1000) == 534:\n",
" print('works!!!!')"
]
},
Expand Down
37 changes: 23 additions & 14 deletions Exercise_notebooks/On_topic/08_GIS/Geopandas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
"2. [Importing geopandas](#2)\n",
"3. [Reading shapefiles](#3)\n",
"4. [Viewing attribute table](#4)\n",
"5. [Plotting data](#5)\n",
"6. [Add basemap to plot](#6)"
"5. [Geodataframe from DataFrame](#5)\n",
"6. [Plotting data](#plot)\n",
"7. [Add basemap to plot](#7)"
]
},
{
Expand All @@ -33,26 +34,28 @@
"There are two methods of getting geopandas that have worked consistently on my PC. The first uses `conda` which is available if you have installed the Anaconda Python distribution or Miniconda distribution. The second uses precompiled packages (called wheels) from a website.\n",
"\n",
"### Using conda\n",
"This step assumes you have `conda` installed, via the Anaconda Python Distribution or Miniconda, and it's quite straightforward. Type `conda install geopandas` into the Anaconda Prompt, and wait. Confirm the installation by pressing `y` when prompted. Afterwards start a new Anaconda Prompt, type `python` and then once Python has started up, type `import geopandas`. If you don't see any errors, congratulations, this worked so you can continue to step 2.\n",
"This step assumes you have `conda` ins|talled, via the Anaconda Python Distribution or Miniconda, and it's quite straightforward. Type `conda install geopandas` into the Anaconda Prompt, and wait. Confirm the installation by pressing `y` when prompted. Afterwards start a new Anaconda Prompt, type `python` and then once Python has started up, type `import geopandas`. If you don't see any errors, congratulations, this worked so you can continue to step 2.\n",
"\n",
"If you do see an error you could try to install geopandas from the conda-forge channel (a different location from which to get python packages). You can do this by typing `conda install -c conda-forge geopandas` into the Anaconda Prompt.\n",
"\n",
"### Using wheels and pip\n",
"Download the following packages from this [Christoph Gohlke's website](https://www.lfd.uci.edu/~gohlke/pythonlibs):\n",
"- GDAL\n",
"- Fiona\n",
"- shapely\n",
"- geopandas\n",
"\n",
"Use CTRL+F to find the download link on the page. Be sure to download the correct version of the package. The Python version should match your Python version (see Help > About in the Jupyter Notebook if you're not sure which Python version you have). Also the architecture should match (i.e. 64bits vs 32bits). For example:\n",
"\n",
"- GDAL‑2.3.3‑cp37‑cp37m‑win_amd64.whl\n",
"- GDAL‑3.1.4‑cp37‑cp37m‑win_amd64.whl\n",
"\n",
"This is the latest GDAL version as of writing this notebook for Python 3.7 (as can be seen from the cp37 in the name), for 64-bits Python (as derived from the amd64 in the name). This is usually the one you want (latest Python, 64 bits).\n",
"This is the latest GDAL version as of writing this notebook (november 2020) for Python 3.7 (as can be seen from the cp37 in the name), for 64-bits Python (as derived from the amd64 in the name). This is usually the one you want (latest Python, 64 bits).\n",
"\n",
"Once you have downloaded the correct files, open Anaconda Prompt, and navigate to the directory in which you saved your downloads. Now type the following commands (the order is important):\n",
"1. `pip install GDAL‑2.3.3‑cp37‑cp37m‑win_amd64.whl`\n",
"2. `pip install Fiona‑1.8.5‑cp37‑cp37m‑win_amd64.whl`\n",
"3. `pip install geopandas‑0.4.1‑py2.py3‑none‑any.whl` (Note that the geopandas download is not python or archtecture specific)\n",
"1. `pip install GDAL‑X.X.X‑cpXX‑cpXXm‑winXXX.whl`\n",
"2. `pip install Fiona‑X.X.X‑cpXX‑cpXXm‑winXXX.whl`\n",
"3. `pip install Shapely‑X.X.X‑cpXX‑cpXXm‑winXXX.whl`\n",
"4. `pip install geopandas‑X.X.X‑py3‑none‑any.whl` (Note that the geopandas download is not python or archtecture specific)\n",
"\n",
"If these steps complete succesfully, open a new Anaconda Prompt, start Python and try to `import geopandas`. If it works without any error messages, congrats and move to step 2.\n"
]
Expand Down Expand Up @@ -340,17 +343,23 @@
"metadata": {},
"source": [
"\n",
"## 7. [Add a basemap](#top)<a id=\"6\"></a>\n",
"## 7. [Add a basemap](#top)<a id=\"7\"></a>\n",
"\n",
"You can add a basemap to your plot with the `contextily` package. Before you install `contextily` you have to install `cartopy`. \n",
"You can add a basemap to your plot with the `contextily` package. Before you install `contextily` you have to install `cartopy`, `rasterio` and `descartes`. \n",
"\n",
"Just like `gdal`, `fiona` and `geopandas` you can download `cartopy` from [Christoph Gohlke's website](https://www.lfd.uci.edu/~gohlke/pythonlibs) and install with:<br><br>\n",
"Just like `gdal`, `fiona` and `geopandas` you can download `cartopy` and `rasterio` from [Christoph Gohlke's website](https://www.lfd.uci.edu/~gohlke/pythonlibs) and install with:<br><br>\n",
"`pip install Cartopy‑0.17.0‑cp37‑cp37m‑win_amd64.whl`\n",
"\n",
"Once you've installed this succesfully you can install `contextily` with:<br><br>\n",
"`pip install contextily==1.0rc2`\n",
"`pip install rasterio‑1.1.8‑cp37‑cp37m‑win_amd64.whl`\n",
"\n",
"We specify the version (`1.0rc2`) because it contains the functions we want to use. The latest official release (`v0.99.0`) does not yet contain these functions.\n",
"\n",
"\n",
"\n",
"Once you've installed this succesfully you can install `descartes` and `contextily` with:<br><br>\n",
"\n",
"`pip install descartes`\n",
"\n",
"`pip install contextily`.\n",
"\n",
"\n",
"Adding a basemap requires just the following steps:\n",
Expand Down

Large diffs are not rendered by default.

58 changes: 30 additions & 28 deletions Practical_examples/GIS/Presentatie_samen_programmeren-done.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 35cfa26

Please sign in to comment.