1
1
"""
2
- make_vertex_raster(A::GeoArray )
2
+ make_vertex_raster(A::Raster )
3
3
4
4
Constuct a vertex raster (a raster where the value of each pixel corresponds
5
- to its ID in a graph, and 0s correspond to NoData). Returns a GeoArray . This
5
+ to its ID in a graph, and 0s correspond to NoData). Returns a Raster . This
6
6
function is recommended for internal use only.
7
7
8
8
## Parameters
9
- `A`: The GeoArray from which a graph will be built, which is used as the
9
+ `A`: The Raster from which a graph will be built, which is used as the
10
10
reference for building the vertex raster. Pixels with NoData (`A.missingval`)
11
11
are skipped (no vertex is assigned). Pixels with NoData will get a value of 0 in
12
12
the vertex raster.
13
13
"""
14
- function make_vertex_raster (A:: GeoData.GeoArray )
14
+ function make_vertex_raster (A:: Raster )
15
15
# Make an array of unique node identifiers
16
16
nodemap = zeros (Int64, size (A. data))
17
17
is_node = (A. data .!= A. missingval) .&
18
18
((! ). (isnan .(A. data)))
19
19
20
20
nodemap[is_node] = 1 : sum (is_node)
21
21
22
- nodemap = GeoData . GeoArray (nodemap, dims (A))
22
+ nodemap = Raster (nodemap, dims (A))
23
23
24
24
nodemap
25
25
end
26
26
27
27
28
28
"""
29
29
weightedrastergraph(
30
- weight_raster::GeoArray ;
30
+ weight_raster::Raster ;
31
31
directed::Bool = false,
32
- condition_raster::GeoArray = weight_raster,
32
+ condition_raster::Raster = weight_raster,
33
33
condition::Function = is_data,
34
34
cardinal_neighbors_only::Bool = false,
35
35
connect_using_avg_weights::Bool = true
@@ -42,7 +42,7 @@ on vertices, edge weights are calculated as the average of the weights for each
42
42
vertex.
43
43
44
44
## Parameters
45
- `weight_raster`: A GeoData.GeoArray contained values that, where applicable
45
+ `weight_raster`: A Rasters.Raster contained values that, where applicable
46
46
based on other arguments, determines which pixels to connect and the edge
47
47
weights between pixels. Any pixel in `weight_raster` with a value not equal to
48
48
`weight_raster.missingval` will be assigned a vertex in the graph (corresponding
@@ -90,9 +90,9 @@ neighbors) of the weights in `weight_raster` is used.
90
90
91
91
"""
92
92
function weightedrastergraph (
93
- weight_raster:: GeoArray ;
93
+ weight_raster:: Raster ;
94
94
directed:: Bool = false ,
95
- condition_raster:: GeoArray = weight_raster,
95
+ condition_raster:: Raster = weight_raster,
96
96
condition:: Function = is_data,
97
97
cardinal_neighbors_only:: Bool = false ,
98
98
connect_using_avg_weights:: Bool = true
120
120
121
121
"""
122
122
RasterGraph(
123
- raster::GeoArray ;
123
+ raster::Raster ;
124
124
directed::Bool = true,
125
125
condition::Function = is_data,
126
126
cardinal_neighbors_only::Bool = false
@@ -130,7 +130,7 @@ Construct a `RasterGraph` or `RasterDiGraph` (if
130
130
`directed = true`) from a raster dataset.
131
131
132
132
## Parameters
133
- `raster`: A GeoData.GeoArray on which to base the graph. Any pixel in `raster`
133
+ `raster`: A Rasters.Raster on which to base the graph. Any pixel in `raster`
134
134
with a value not equal to `raster.missingval` will be assigned a vertex
135
135
in the graph (corresponding to its centroid). The values in the raster can also
136
136
be used to determine which vertices to connect. See `condition` below for more
@@ -162,7 +162,7 @@ increased distance between them (as compared to the distance between cardinal
162
162
neighbors) is accounted for.
163
163
"""
164
164
function rastergraph (
165
- raster:: GeoArray ;
165
+ raster:: Raster ;
166
166
condition:: Function = is_data,
167
167
directed:: Bool = true ,
168
168
cardinal_neighbors_only:: Bool = false ,
@@ -187,10 +187,10 @@ end
187
187
188
188
"""
189
189
make_weighted_raster_graph(
190
- weight_raster::GeoArray ,
191
- vertex_raster::GeoArray ;
190
+ weight_raster::Raster ,
191
+ vertex_raster::Raster ;
192
192
directed::Bool = false,
193
- condition_raster::GeoArray = weight_raster,
193
+ condition_raster::Raster = weight_raster,
194
194
condition::Function = is_data,
195
195
cardinal_neighbors_only::Bool = false,
196
196
connect_using_avg_weights::Bool = true,
@@ -206,13 +206,13 @@ vertex. Since edges are between rather than on vertices, edge weights are
206
206
calculated as the average of the weights for each vertex being connected.
207
207
208
208
## Parameters
209
- `weight_raster`: A `GeoData.GeoArray ` containing values that, where applicable
209
+ `weight_raster`: A `Rasters.Raster ` containing values that, where applicable
210
210
based on other arguments, determine which pixels to connect and the edge
211
211
weights between pixels. Any pixel in `weight_raster` with a value not equal to
212
212
`weight_raster.missingval` will be assigned a vertex in the graph (corresponding
213
213
to its centroid).
214
214
215
- `vertex_raster`: A `GeoData.GeoArray ` with integer values ranging from 1:n,
215
+ `vertex_raster`: A `Rasters.Raster ` with integer values ranging from 1:n,
216
216
where n is the number of unique vertices in the graph.
217
217
218
218
## Arguments
@@ -256,10 +256,10 @@ of vertices, how should the weight be chosen? Defaults to `min`. See the docs
256
256
for `SparseArrays.sparse()` for more information.
257
257
"""
258
258
function make_weighted_raster_graph (
259
- weight_raster:: GeoArray ,
260
- vertex_raster:: GeoArray ;
259
+ weight_raster:: Raster ,
260
+ vertex_raster:: Raster ;
261
261
directed:: Bool = false ,
262
- condition_raster:: GeoArray = weight_raster,
262
+ condition_raster:: Raster = weight_raster,
263
263
condition:: Function = is_data,
264
264
cardinal_neighbors_only:: Bool = false ,
265
265
connect_using_avg_weights:: Bool = true ,
289
289
290
290
"""
291
291
make_simple_raster_graph(
292
- raster::GeoArray ,
293
- vertex_raster::GeoArray ;
292
+ raster::Raster ,
293
+ vertex_raster::Raster ;
294
294
directed::Bool = false,
295
295
condition::Function = is_data,
296
296
cardinal_neighbors_only::Bool = false,
@@ -305,13 +305,13 @@ in the graph, and `raster` is used to construct the graph and determine which
305
305
vertices to connect.
306
306
307
307
## Parameters
308
- `raster`: A GeoData.GeoArray on which to base the graph. Any pixel in `raster`
308
+ `raster`: A Rasters.Raster on which to base the graph. Any pixel in `raster`
309
309
with a value not equal to `raster.missingval` will be assigned a vertex
310
310
in the graph (corresponding to its centroid). The values in the raster can also
311
311
be used to determine which vertices to connect. See `condition` below for more
312
312
information.
313
313
314
- `vertex_raster`: A `GeoData.GeoArray ` with integer values ranging from 1:n,
314
+ `vertex_raster`: A `Rasters.Raster ` with integer values ranging from 1:n,
315
315
where n is the number of unique vertices in the graph.
316
316
317
317
## Arguments
@@ -355,8 +355,8 @@ of vertices, how should the weight be chosen? Defaults to `min`. See the docs
355
355
for `SparseArrays.sparse()` for more information.
356
356
"""
357
357
function make_simple_raster_graph (
358
- raster:: GeoArray ,
359
- vertex_raster:: GeoArray ;
358
+ raster:: Raster ,
359
+ vertex_raster:: Raster ;
360
360
directed:: Bool = false ,
361
361
condition:: Function = is_data,
362
362
cardinal_neighbors_only:: Bool = false ,
@@ -378,11 +378,11 @@ end
378
378
379
379
380
380
function make_raster_graph (
381
- raster:: GeoArray ,
382
- vertex_raster:: GeoArray ;
381
+ raster:: Raster ,
382
+ vertex_raster:: Raster ;
383
383
directed:: Bool = false ,
384
384
weighted:: Bool = true ,
385
- condition_raster:: GeoArray = raster,
385
+ condition_raster:: Raster = raster,
386
386
condition:: Function = is_data,
387
387
cardinal_neighbors_only:: Bool = false ,
388
388
connect_using_avg_weights:: Bool = true ,
@@ -410,7 +410,7 @@ function make_raster_graph(
410
410
# Add the edges
411
411
# Only need to do neighbors down or to the right for undirected graphs
412
412
# because edge additions will be redundant.
413
- # Cardinal directions are in quotes since sometimes GeoArray are permuted
413
+ # Cardinal directions are in quotes since sometimes Raster are permuted
414
414
# such that the top row doesn't necessarily correspond to the northern-most
415
415
# pixels
416
416
for row in 1 : dims[1 ]
0 commit comments