You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto-generated via `{sandpaper}`
Source : df9bde8
Branch : main
Author : Ou Ku <o.ku@esciencecenter.nl>
Time : 2026-04-13 12:40:22 +0000
Message : Merge pull request carpentries-incubator#182 from esciencecenter-digital-skills/access_data
Access data
Copy file name to clipboardExpand all lines: 05-access-data.md
+19-3Lines changed: 19 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,11 +17,14 @@ exercises: 15
17
17
- Open satellite imagery as raster data and save it to disk.
18
18
:::
19
19
20
+
::::::::::::::::::::::::::::::::::::: instructor
20
21
21
-
## Considerations for the position of this episode in the workshop
22
+
###Considerations for the position of this episode in the workshop
22
23
23
24
*When this workshop is taught to learners with limited prior knowledge of Python, it might be better to place this episode after episode 11 and before episode 12. This episode contains an introduction to working with APIs and dictionaries, which can be perceived as challenging by some learners. Another consideration for placing this episode later in the workshop is when it is taught to learners with prior GIS knowledge who want to perform GIS-like operations with data they have already collected or for learners interested in working with raster data but less interested in satellite images.*
24
25
26
+
:::::::::::::::::::::::::::::::::::::
27
+
25
28
## Introduction
26
29
27
30
A number of satellites take snapshots of the Earth's surface from space. The images recorded by these remote sensors
@@ -197,6 +200,17 @@ print(search.matched())
197
200
You will notice that more than 500 scenes match our search criteria. We are however interested in the period right before and after the wildfire of Rhodes. In the following exercise you will therefore have to add a time filter to
198
201
our search criteria to narrow down our search for images of that period.
199
202
203
+
::::::::::::::: instructor
204
+
205
+
### Extra attention for the following exercise
206
+
207
+
- The exercise **Exercise: Search satellite scenes using metadata filters** needs extra attention. Its output `search.json` is required for the later episodes. Therefore we recommend:
208
+
- Do not skip this exercise;
209
+
- Think twice when you would like to change the query arguments in this exercise;
210
+
- Make sure all the audience have the output `search.json` before continuing.
211
+
212
+
::::::::::::::::
213
+
200
214
::: challenge
201
215
## Exercise: Search satellite scenes with a time filter
202
216
@@ -567,11 +581,13 @@ The authentication procedure for dataset with restricted access might differ dep
567
581
NASA CMR, follow these steps in order to access data using Python:
568
582
569
583
* Create a NASA Earthdata login account [here](https://urs.earthdata.nasa.gov);
570
-
* Set up a netrc file with your credentials, e.g. by using [this script](https://git.earthdata.nasa.gov/projects/LPDUR/repos/daac_data_download_python/browse/EarthdataLoginSetup.py);
571
-
* Define the following environment variables:
584
+
* Set up a netrc file with your credentials, e.g. by using [earthaccess](https://earthaccess.readthedocs.io/en/latest/user/authenticate/), which can be executed interactively in a Jupyter session, and creates a `.netrc` file in your home directory;
585
+
* Define the following environment variables in your Jupyter session:
572
586
573
587
```python
574
588
import os
589
+
# These variables are needed by rasterio.open_rasterio function, which calls GDAL in the background
Copy file name to clipboardExpand all lines: instructor-notes.md
-7Lines changed: 0 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,6 @@ title: Instructor Notes
4
4
5
5
## Instructor notes
6
6
7
-
### Episode 1
8
-
9
-
- The exercise **Exercise: Search satellite scenes using metadata filters** needs extra attention. Its output `search.json` is required for the later episodes. Therefore we recommend:
10
-
- Do not skip this exercise;
11
-
- Think twice when you would like to change the query arguments in this exercise;
12
-
- Make sure all the audience have the output `search.json` before continuing.
13
-
14
7
### Episode 3
15
8
16
9
-`brpgewaspercelen_definitief_2020_small.gpkg` was created because the original file was too large to download and load. Original file, which was ~500Mb could take several minutes to load, and could crash the Jupyter terminal.
1. Open [https://www.anaconda.com/download][anaconda-windows] with your web browser.
42
+
### Linux / MacOS
47
43
48
-
2. Download the Anaconda for Windows installer with Python 3.
49
-
50
-
3. Install Python 3 by running the Anaconda Installer, using all of the defaults for installation *except* make sure that:
51
-
***Register Anaconda as my default Python 3.x** option is checked (it should be in the latest version of Anaconda).
52
-
***Add Anaconda to my PATH environment variable** is selected.
53
-
54
-
55
-
:::::::::::::::::::::::::
56
-
57
-
:::::::::::::::: solution
44
+
Open a terminal and install `uv` following the [official installation instructions](https://docs.astral.sh/uv/getting-started/installation/):
58
45
59
-
### Mac OS
46
+
```sh
47
+
curl -LsSf https://astral.sh/uv/install.sh | sh
48
+
```
60
49
61
-
[Video tutorial][video-mac]
50
+
Then make sure you are inside the `geospatial-python` directory you created during the data setup step by doing:
62
51
63
-
1. Open [https://www.anaconda.com/download][anaconda-mac] with your web browser.
52
+
```sh
53
+
cd~/Desktop/geospatial-python
54
+
```
64
55
65
-
2. Download the Anaconda installer with Python 3 for OS X. These instructions assume that you use the "Graphical Installer" `.pkg` file
56
+
Finally, run the following command to create a virtual environment and install the required dependencies:
66
57
67
-
3. Follow the Python 3 installation instructions. Make sure that the install location is set to **Install only for me** so Anaconda will install its files locally, relative to your home directory. Installing the software for all users tends to create problems in the long run and should be avoided.
Note that the following installation steps require you to work from the shell.
77
-
If you run into any difficulties, please request help before the workshop begins.
78
-
79
-
1. Open [https://www.anaconda.com/download][anaconda-linux] with your web browser.
80
-
81
-
2. Download the Anaconda installer with Python 3 for Linux.
67
+
### Windows
82
68
83
-
3. Open a terminal window and navigate to the directory where the executable is downloaded (e.g., `cd ~/Downloads`).
69
+
On Windows, first we install `uv` using PowerShell following the [official installation instructions](https://docs.astral.sh/uv/getting-started/installation/):
After the installation, you may see suggestions on the PowerShell terminal like `$env:Path = "C:\Users\username\.local\bin;$env:Path"` This means you need to manually add the `uv` executable to your system's PATH variable. Please run the suggested command in your PowerShell terminal to add `uv` to your PATH. Otherwise PowerShell will not recognize the `uv` command in the next step.
90
76
91
-
and press "Tab" to autocomplete the full file name. The name of file you just downloaded should appear.
77
+
Then make sure you are inside the `geospatial-python` directory you created during the data setup step by doing:
92
78
93
-
5. Press "Enter" (or "Return" depending on your keyboard).
79
+
```powershell
80
+
cd \Users\<Username>\Desktop\geospatial-python
81
+
```
94
82
95
-
6. Follow the text-only prompts. When the license agreement appears (a colon will be present at the bottom of the screen) press "Spacebar" until you see the bottom of the text. Type `yes` and press "Enter" to approve the license. Press "Enter" again to approve the default location for the files. Type `yes` and press "Enter" to prepend Anaconda to your `PATH` (this makes the Anaconda distribution your user's default Python).
83
+
And replace the `<Username>` pattern (including the angle brackets `<>`) with your Windows username.
84
+
Finally, run the following command to create a virtual environment and install the required dependencies:
After the installation, a `.venv` directory will be created in the current directory, which contains the virtual environment with all the required dependencies.
101
93
102
-
### Setting up the workshop environment
103
-
104
-
If Anaconda was properly installed, you should have access to the `conda`
105
-
command in your terminal (use the **Anaconda prompt** on **Windows**).
106
-
107
-
1. Test that `conda` is correctly installed by typing:
108
-
109
-
```bash
110
-
conda --version
111
-
```
94
+
### Testing the installation
112
95
113
-
which should print the version of conda that is currently installed, e.g. :
96
+
In order to follow the lesson, you should launch JupyterLab. Let's try it now to make sure everything is set up correctly. You should run the following command in your terminal from the `geospatial-python` directory:
114
97
115
-
```output
116
-
conda 22.9.0
117
-
```
118
-
119
-
2. Run the following command:
120
-
121
-
```bash
122
-
conda install -c conda-forge mamba
123
-
```
124
-
125
-
IMPORTANT: If your terminal responds to the above command with `conda: command not found` see the [Troubleshooting section](#troubleshooting-conda-command-not-found).
126
-
127
-
3. Create the Python environment for the workshop by running:
IMPORTANT: If you close the terminal, you will need to reactivate this
165
-
environment with `conda activate geospatial` to use the Python libraries
166
-
required for the lesson and to start JupyterLab, which is also installed in the
167
-
`geospatial` environment.
168
-
169
-
### Starting JupyterLab
170
-
171
-
In order to follow the lesson, you should launch JupyterLab. After activating the
172
-
geospatial conda environment, enter the following command in your terminal (use the **Anaconda prompt** on **Windows**):
173
-
174
-
```bash
175
-
jupyter lab
99
+
uv run jupyter lab
176
100
```
177
101
178
102
Once you have launched JupyterLab, create a new Python 3 notebook, type the following code snippet in a cell and press the "Play" button:
@@ -183,42 +107,11 @@ import rioxarray
183
107
184
108
If all the steps above completed successfully you are ready to follow along with the lesson!
185
109
186
-
### Troubleshooting `conda: command not found`
187
-
188
-
***Mac OS and Linux users:**
189
-
190
-
1. First, find out where Anaconda is installed.
191
-
192
-
The typical install location is in your `$HOME` directory (i.e., `/Users/your-username/`) so use `ls ~` to check whether an `anaconda3` directory is present in your home directory:
193
-
194
-
```bash
195
-
ls ~
196
-
```
197
-
198
-
```output
199
-
Applications Downloads Pictures
200
-
anaconda3 Library Public
201
-
Desktop Movies
202
-
Documents Music
203
-
```
204
-
205
-
If, like above, you see a directory called `anaconda3`in the output we're in good shape. If not, **contact the instructor for help**.
206
-
207
-
2. Activate the `conda` command-line program by entering the following command:
208
-
209
-
```bash
210
-
source ~/anaconda3/bin/activate
211
-
```
212
-
If all goes well, nothing will print to the terminal and your prompt will now have `(base)` floating around somewhere
213
-
on the left. This is an indication that you are in the base Anaconda environment.
110
+
::: callout
214
111
215
-
Continue from the beginning of step 3 to complete the creation of the `geospatial` virtual environment.
112
+
### Alternative: software setup using Anaconda
216
113
114
+
If you prefer to use Anaconda, you can follow the alternative setup instructions on [this
0 commit comments