Skip to content

Commit e8d8128

Browse files
committed
added answer to question for readers
1 parent 3a25843 commit e8d8128

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

05-raster-vector.qmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,13 @@ out_image_mask, out_transform_mask = rasterio.mask.mask(
9292
```
9393

9494
Note that we need to choose and specify a 'No Data' value, within the valid range according to the data type.
95-
Since `srtm.tif` is of type `uint16` (how can we check?), we choose `9999` (a positive integer that is guaranteed not to occur in the raster).
95+
Since `srtm.tif` is of type `uint16` (how can we check?[^answer_srtm_dtype]), we choose `9999` (a positive integer that is guaranteed not to occur in the raster).
9696
Also note that **rasterio** does not directly support **geopandas** data structures, so we need to pass a 'collection' of **shapely** geometries: a `GeoSeries` (see above) or a `list` of **shapely** geometries (see next example) both work.
9797
The output consists of two objects.
9898
The first one is the `out_image` array with the masked values.
9999

100+
[^answer_srtm_dtype]: The answer is `src_srtm.meta['dtype']`, which returns `'uint16'`.
101+
100102
```{python}
101103
out_image_mask
102104
```

0 commit comments

Comments
 (0)