Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions notebooks/clear_all_notebooks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import pathlib as pl
from pathlib import Path
import json
import subprocess

Expand All @@ -20,7 +20,7 @@
]

if __name__ == "__main__":
nbdir = pl.Path(".")
nbdir = Path(".")
nbs = nbdir.rglob("*.ipynb")
for nb in nbs:
if ('solutions' not in str(nb) and
Expand Down
2 changes: 1 addition & 1 deletion notebooks/part0_python_intro/01_functions_scripts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "pyclass",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
}
Expand Down
14 changes: 1 addition & 13 deletions notebooks/part0_python_intro/03_useful-std-library-modules.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1254,21 +1254,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "pyclass",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.11"
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions notebooks/part0_python_intro/04_files_and_strings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"outputs": [],
"source": [
"import sys\n",
"import pathlib as pl\n",
"from pathlib import Path\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# set up the path to our data\n",
"pthnb = pl.Path('data') / 'fileio'\n",
"pthnb = Path('data') / 'fileio'\n",
"assert pthnb.is_dir()"
]
},
Expand Down Expand Up @@ -259,7 +259,7 @@
"# the current working directory; now we use pathlib\n",
"# os.getcwd()\n",
"\n",
"cwd = pl.Path.cwd()\n",
"cwd = Path.cwd()\n",
"print(cwd)"
]
},
Expand Down Expand Up @@ -816,7 +816,7 @@
"metadata": {},
"source": [
"### Class Activity 4\n",
"Let's use the `file_filter` function to remove the comment lines from `'FileWithComments.txt'` and create `'FileWithOutComments.txt'`. Use one of the approaches discussed above to open, read, and print data in both files after calling the `file_filter` function. Remember to use the pl.Path() approach to access the file in the `pthnb` directory. \n",
"Let's use the `file_filter` function to remove the comment lines from `'FileWithComments.txt'` and create `'FileWithOutComments.txt'`. Use one of the approaches discussed above to open, read, and print data in both files after calling the `file_filter` function. Remember to use the Path() approach to access the file in the `pthnb` directory. \n",
"\n",
"Use the blank code block below to complete this activity."
]
Expand Down
8 changes: 4 additions & 4 deletions notebooks/part0_python_intro/06_matplotlib.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"source": [
"from IPython.display import clear_output, display\n",
"\n",
"import pathlib as pl\n",
"from pathlib import Path\n",
"\n",
"output_path = pl.Path(\"./data/matplotlib\")\n",
"output_path = Path(\"./data/matplotlib\")\n",
"output_path.mkdir(exist_ok=True, parents=True)"
]
},
Expand Down Expand Up @@ -1151,7 +1151,7 @@
"metadata": {},
"outputs": [],
"source": [
"path = pl.Path(f\"{output_path}/multipage_pdf.pdf\")\n",
"path = Path(f\"{output_path}/multipage_pdf.pdf\")\n",
"y = np.sin(x * np.pi)\n",
"\n",
"with PdfPages(path) as pdf:\n",
Expand All @@ -1177,7 +1177,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "lisus_p2",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
}
Expand Down
10 changes: 8 additions & 2 deletions notebooks/part0_python_intro/06b_matplotlib_animation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@
"source": []
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
8 changes: 7 additions & 1 deletion notebooks/part0_python_intro/07a_Theis-exercise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@
"source": []
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
4 changes: 2 additions & 2 deletions notebooks/part0_python_intro/09_b_Geopandas_ABQ.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"outputs": [],
"source": [
"import geopandas as gp\n",
"import pathlib as pl\n",
"from pathlib import Path\n",
"import fiona\n",
"fiona.drvsupport.supported_drivers['libkml'] = 'rw' # enable KML support which is disabled by default\n",
"fiona.drvsupport.supported_drivers['LIBKML'] = 'rw' # enable KML support which is disabled by default\n"
Expand All @@ -39,7 +39,7 @@
"metadata": {},
"outputs": [],
"source": [
"datapath = pl.Path('./data/geopandas/abq/')"
"datapath = Path('./data/geopandas/abq/')"
]
},
{
Expand Down
16 changes: 2 additions & 14 deletions notebooks/part0_python_intro/10a_Rasterio_intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"import rasterio\n",
"from rasterio.plot import show\n",
"import matplotlib.pyplot as plt\n",
"import pathlib as pl"
"from pathlib import Path"
]
},
{
Expand All @@ -33,7 +33,7 @@
"metadata": {},
"outputs": [],
"source": [
"data_path = pl.Path(\"data/rasterio\") # set path to raster data folder"
"data_path = Path(\"data/rasterio\") # set path to raster data folder"
]
},
{
Expand Down Expand Up @@ -815,18 +815,6 @@
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
16 changes: 2 additions & 14 deletions notebooks/part0_python_intro/10b_Rasterio_advanced.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"from rasterio import features\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib.colors import LightSource\n",
"import pathlib as pl\n",
"from pathlib import Path\n",
"\n",
"# for elevation hillshade if we want to use it\n",
"ls = LightSource(azdeg=315, altdeg=45)"
Expand All @@ -73,7 +73,7 @@
"metadata": {},
"outputs": [],
"source": [
"data_path = pl.Path(\"data/rasterio\")\n",
"data_path = Path(\"data/rasterio\")\n",
"\n",
"dem_file_1970 = data_path / \"19700901_ned1_2003_adj_warp.tif\"\n",
"dem_file_2008 = data_path / \"20080901_rainierlidar_30m-adj.tif\"\n",
Expand Down Expand Up @@ -983,18 +983,6 @@
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.13"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3568,7 +3568,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"outputs": [],
"source": [
"import sys\n",
"import pathlib as pl\n",
"from pathlib import Path\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# set up the path to our data\n",
"pthnb = pl.Path('../data/fileio')\n",
"pthnb = Path('../data/fileio')\n",
"assert pthnb.is_dir()"
]
},
Expand Down Expand Up @@ -361,7 +361,7 @@
"# the current working directory; now we use pathlib\n",
"# os.getcwd()\n",
"\n",
"cwd = pl.Path.cwd()\n",
"cwd = Path.cwd()\n",
"print(cwd)"
]
},
Expand Down Expand Up @@ -1159,7 +1159,7 @@
"metadata": {},
"source": [
"### Class Activity 4\n",
"Let's use the `file_filter` function to remove the comment lines from `'FileWithComments.txt'` and create `'FileWithOutComments.txt'`. Use one of the approaches discussed above to open, read, and print data in both files after calling the `file_filter` function. Remember to use the pl.Path() approach to access the file in the `pthnb` directory. \n",
"Let's use the `file_filter` function to remove the comment lines from `'FileWithComments.txt'` and create `'FileWithOutComments.txt'`. Use one of the approaches discussed above to open, read, and print data in both files after calling the `file_filter` function. Remember to use the Path() approach to access the file in the `pthnb` directory. \n",
"\n",
"Use the blank code block below to complete this activity."
]
Expand Down Expand Up @@ -1197,7 +1197,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"source": [
"from IPython.display import clear_output, display\n",
"\n",
"import pathlib as pl\n",
"from pathlib import Path\n",
"\n",
"output_path = pl.Path(\"../data/matplotlib\")\n",
"output_path = Path(\"../data/matplotlib\")\n",
"output_path.mkdir(exist_ok=True, parents=True)"
]
},
Expand Down Expand Up @@ -1618,7 +1618,7 @@
"metadata": {},
"outputs": [],
"source": [
"path = pl.Path(f\"{output_path}/multipage_pdf.pdf\")\n",
"path = Path(f\"{output_path}/multipage_pdf.pdf\")\n",
"y = np.sin(x * np.pi)\n",
"\n",
"with PdfPages(path) as pdf:\n",
Expand Down Expand Up @@ -1657,7 +1657,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"import rasterio\n",
"from rasterio.plot import show\n",
"import matplotlib.pyplot as plt\n",
"import pathlib as pl"
"from pathlib import Path"
]
},
{
Expand All @@ -33,7 +33,7 @@
"metadata": {},
"outputs": [],
"source": [
"data_path = pl.Path(\"../data/rasterio\") # set path to raster data folder"
"data_path = Path(\"../data/rasterio\") # set path to raster data folder"
]
},
{
Expand Down Expand Up @@ -1198,7 +1198,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.12.11"
}
},
"nbformat": 4,
Expand Down
Loading
Loading