Skip to content

Commit 465d253

Browse files
authored
Merge pull request #9 from gabrieletijunaityte/master
Minor fixes
2 parents 9eaabfa + 80a1a15 commit 465d253

File tree

2 files changed

+383
-377
lines changed

2 files changed

+383
-377
lines changed

index.Rmd

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ with open('data/AHN3_05m_DTM.tif', 'wb') as file:
144144
file.write(response.read())
145145
```
146146

147-
Before continuing, please check if this step was successful.
147+
Before continuing, please check if this step was successful (*Hint: you can check if files have been written into corresponding directory*).
148148

149149
## From a file with GDAL
150150
[GDAL](https://gdal.org/) handles raster and vector geospatial data formats with Python, Java, R and C APIs. When opening a raster file in gdal, the object has a hierarchical structure starting at the Dataset level. A Dataset has a Geotransform (metadata) and can contain one or more Bands. Each Band has a Data array and potentially Overviews.
@@ -156,6 +156,7 @@ Before continuing, please check if this step was successful.
156156
</center>
157157
</figure>
158158

159+
159160
Let us open the file we just saved. You will see you first get the dataset, and need to access the band (even though there is only one), before the data array can be accessed.
160161

161162
```{python, eval=FALSE}
@@ -177,12 +178,12 @@ ds = None
177178

178179
```{block, type="alert alert-success"}
179180
> **Question 1**: Why do we set ds to None at the end of your script? What may happen if you do not do that?
180-
181-
```
182181
<details>
183-
<summary>**Click for answer**</summary>
182+
<summary>*Click for answer*</summary>
184183
Keeping files open may leave you vulnerable to losing data, (Geo)Pandas manage resources under the hood so you don't explicitly need to close files, but for the case of GDAL, and as you will later see, Rasterio, it's important to close your files or open them with a context manager `with open ...`
185184
</details>
185+
```
186+
186187

187188

188189
The GDAL Python API is not the best documented Python module. Therefore, Rasterio is explained as an alternative raster data handling module.
@@ -217,11 +218,12 @@ show(dsm, title='Digital Surface Model', cmap='gist_ncar')
217218

218219
```{block, type="alert alert-success"}
219220
> **Question 2**: Adjust the code above to take a look at the DTM. Note the gaps that appear. What are these gaps?
220-
```
221221
<details>
222-
<summary>**Click for answer**</summary>
222+
<summary>*Click for answer*</summary>
223223
These are buildings.
224224
</details>
225+
```
226+
225227

226228

227229
The metadata shows the driver (GDAL's way of knowing how to function with a specific file format), datatype, nodata value, width of raster in number of cells, height of raster in number of cells, number of raster bands in the dataset, coordinate reference system, and transformation values.
@@ -289,11 +291,12 @@ with rasterio.open('data/AHN3_05m_CHM.tif', 'w', **kwargs) as file:
289291

290292
```{block, type="alert alert-success"}
291293
> **Question 3**: Where is the CHM the highest in the study area? Is it what you expected?
292-
```
293294
<details>
294-
<summary>**Click for answer**</summary>
295+
<summary>*Click for answer*</summary>
295296
Think about where you have the most forests on campus.
296297
</details>
298+
```
299+
297300

298301

299302
We have now applied the basic concepts of creating a Canopy Height Model!
@@ -368,11 +371,12 @@ plt.show()
368371

369372
```{block, type="alert alert-success"}
370373
> **Question 4**: Why do we want an equal scale in the x and y direction for this figure?
371-
```
372374
<details>
373-
<summary>**Click for answer**</summary>
375+
<summary>*Click for answer*</summary>
374376
To visualize the buildings properly, otherwise their geometries will be skewed.
375377
</details>
378+
```
379+
376380

377381

378382
## Other functionality
@@ -471,11 +475,12 @@ plt.show()
471475

472476
```{block, type="alert alert-success"}
473477
> **Question 5**: What is represented on the x and y axis? The default axis labels are DN (x) and Frequency (y); if you were to change them, what labels would you pick to better reflect the content of the plots?
474-
```
475478
<details>
476-
<summary>**Click for answer**</summary>
477-
The y axis represents the count of pixels. Meanwhile the x axis represents the pixel's DN(digital value), in this tutorial since we are looking at elevation this value is actually meters. For example, in the first plot (DSM) you can see that most pixel values are in the 10 to 15 meter range
479+
<summary>*Click for answer*</summary>
480+
The y axis represents the count of pixels. Meanwhile the x axis represents the pixel's DN (digital value), in this tutorial since we are looking at elevation this value is actually meters. For example, in the first plot (DSM) you can see that most pixel values are in the 10 to 15 meter range
478481
</details>
482+
```
483+
479484

480485

481486
# More info

index.html

Lines changed: 365 additions & 364 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)