Skip to content

Commit 7fe3d3a

Browse files
author
Vincent Landau
committed
fix some typos/issues in the example
1 parent 4db7f42 commit 7fe3d3a

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

docs/src/examples.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Habitat Corridor Mapping
44

5-
In this example, we'll map a habitat corridor in cnetral Maryland. We'll use
5+
In this example, we'll map a habitat corridor in central Maryland. We'll use
66
SpatialGraphs.jl to convert the landscape into a graph, then calculate cost
77
distances, and finally convert the result back into a raster to display a
88
least cost corridor in space.
@@ -30,8 +30,8 @@ nothing
3030

3131
Now, let's download the land cover map that we'll use as the basis for defining
3232
the weights of our graph, and plot it. Graph weights correspond to the cost of
33-
an animal moving from one graph vertex to another. This is also commonly refered
34-
to as resistance in the context of connectivity modeling.
33+
an animal moving from one graph vertex to another. This is also commonly
34+
referred to as "resistance" in the context of connectivity modeling.
3535

3636
```julia
3737
url_base = "https://raw.githubusercontent.com/Circuitscape/datasets/main/"
@@ -51,8 +51,8 @@ plot(Raster("nlcd_2016_frederick_md.tif"), title = "Land Cover Type",
5151
<img src='../figs/mdlc.png' width=500><br>
5252
```
5353

54-
Load the land cover data as a Raster, convert it to Float64, and read it into
55-
memory.
54+
Load the land cover data as a Raster, read it into memory, then convert it to
55+
Float64.
5656

5757
```@example corridors
5858
landcover = convert.(
@@ -103,7 +103,7 @@ end
103103

104104
Now that we have a resistance raster, we can start using SpatialGraphs.jl!
105105

106-
Convert the resistance raster into a `WeightedRasterGraph`:
106+
Convert the resistance raster into a [`WeightedRasterGraph`](@ref WeightedRasterGraph):
107107

108108
```@example corridors
109109
wrg = weightedrastergraph(resistance)
@@ -117,7 +117,7 @@ the second argument to `dijkstra_shortest_paths`, correspond to the values in
117117
wrg.vertex_raster.
118118

119119
First, we'll use `dijkstra_shortest_paths` to calculate to total cost distance
120-
from each vertex of interest to all other vertices in the graph
120+
from each vertex of interest to all other vertices in the graph.
121121

122122
```@example corridors
123123
cd_1 = dijkstra_shortest_paths(wrg, 1)
@@ -126,7 +126,9 @@ cd_2 = dijkstra_shortest_paths(wrg, 348021)
126126

127127
Now, create placeholder rasters to store the cost distance values for each
128128
vertex, and populate them using the cost distances calculated
129-
above. Finally, we'll sum the
129+
above. Finally, we'll sum the rasters to enable us to delineate a corridor.
130+
The value at each pixel corresponds to the total cost distance of the least cost
131+
path between vertices 1 and 348021 that intersects that pixel.
130132

131133
```@example corridors
132134
# Create rasters
@@ -160,10 +162,10 @@ the cost distance. Let's get rid of those by setting them to the NoData value
160162
of our raster.
161163

162164
```@example corridors
163-
cwd_sum[cwd_sum .== Inf] .= -9999.
165+
cwd_sum[cwd_sum .== Inf] .= cwd_sum.missingval
164166
```
165167

166-
Finally, let's plot the result! We'll use a threshold the set pixels above
168+
Finally, let's plot the result! We'll use a threshold to set pixels above
167169
a certain value to NoData, so we will only retain the pixels within our
168170
"corridor".
169171

0 commit comments

Comments
 (0)