Type: Package
Title: Sea Currents to Connectivity Transformation
Version: 0.1.2
Maintainer: Christos Adam <econp266@econ.soc.uoc.gr>
Description: Transformation of sea currents to connectivity data. Two files of horizontal and vertical currents flows are transformed into connectivity data in the form of sfnetwork, shapefile, edge list and adjacency matrix. An application example is shown at Nagkoulis et al. (2025) <doi:10.1016/j.dib.2024.111268>.
License: GPL-3
Encoding: UTF-8
URL: https://github.com/cadam00/SeaGraphs, https://cadam00.github.io/SeaGraphs/
BugReports: https://github.com/cadam00/SeaGraphs/issues
Imports: sfnetworks, sf, terra, leaflet, leaflet.minicharts, leaflet.extras2, methods, stats
Depends: R (≥ 4.1.0)
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr, rmarkdown
NeedsCompilation: no
Packaged: 2025-05-28 09:47:17 UTC; Administrator
Author: Nikolaos Nagkoulis ORCID iD [aut], Christos Adam ORCID iD [aut, cre], Ioannis G. Mamoutos ORCID iD [aut], Antonios D. Mazaris ORCID iD [aut], Stelios Katsanevakis ORCID iD [aut]
Repository: CRAN
Date/Publication: 2025-05-30 09:20:15 UTC

Antpath plot

Description

Antpath plot of connections

Usage

antpath_sfn(result, lowcut = NULL, uppcut = NULL)

Arguments

result

SeaGraph object (i.e. output of seagraph) or sfnetwork or sf object containing 'from', 'to' and 'weight' column names.

lowcut

Optional percentile of threshold for not plotting connections below this value.

uppcut

Optional percentile of threshold for not plotting connections above this value.

Value

A leaflet antmap map output.

Examples

graph_result <- seagraph(component_u    = get_component_u(),
                         component_v    = get_component_v(),
                         mask_shapefile = NULL,
                         k_neighbors    = 7)

antpath_sfn(graph_result)

antpath_sfn(graph_result, lowcut = 0.1, uppcut = 0.9)

Flow plot

Description

Flow plot of connections

Usage

flows_sfn(result, lowcut = NULL, uppcut = NULL)

Arguments

result

SeaGraph object (i.e. output of seagraph) or sfnetwork or sf object containing 'from', 'to' and 'weight' column names.

lowcut

Optional percentile of threshold for not plotting connections below this value.

uppcut

Optional percentile of threshold for not plotting connections above this value.

Value

A leaflet flow map output.

Examples

graph_result <- seagraph(component_u    = get_component_u(),
                         component_v    = get_component_v(),
                         mask_shapefile = NULL,
                         k_neighbors    = 7)

flows_sfn(graph_result)

flows_sfn(graph_result, lowcut = 0.1, uppcut = 0.9)

Example component u

Description

Example horizontal direction raster.

Usage

get_component_u()

Details

Example of input component_u used for functions. It is a cropped area of yearly aggregated and normalized horizontal component at Black Sea.

Value

SpatRaster object.

References

Lima, L., Aydogdu, A., Escudier, R., Masina, S., Ciliberti, S. A., Azevedo, D., Peneva, E. L., Causio, S., Cipollone, A., Clementi, E., Cretí, S., Stefanizzi, L., Lecci, R., Palermo, F., Coppini, G., Pinardi, N., and Palazov, A. (2020). Black Sea Physical Reanalysis (CMEMS BS-Currents) (Version 1) [Data set]. Copernicus Monitoring Environment Marine Service (CMEMS). doi:10.25423/CMCC/BLKSEA_MULTIYEAR_PHY_007_004. Last Access: 07/11/2024.

Schulzweida, U. (2023). CDO User Guide (23.0). Zenodo. doi:10.5281/zenodo.10020800.

See Also

get_component_v, get_mask_shapefile

Examples

component_u <- get_component_u()
terra::plot(component_u)

Example component v

Description

Example vertical direction raster.

Usage

get_component_v()

Details

Example of input component_v used for functions. It is a cropped area of yearly aggregated and normalized vertical component at Black Sea.

Value

SpatRaster object.

References

Lima, L., Aydogdu, A., Escudier, R., Masina, S., Ciliberti, S. A., Azevedo, D., Peneva, E. L., Causio, S., Cipollone, A., Clementi, E., Cretí, S., Stefanizzi, L., Lecci, R., Palermo, F., Coppini, G., Pinardi, N., and Palazov, A. (2020). Black Sea Physical Reanalysis (CMEMS BS-Currents) (Version 1) [Data set]. Copernicus Monitoring Environment Marine Service (CMEMS). doi:10.25423/CMCC/BLKSEA_MULTIYEAR_PHY_007_004. Last Access: 07/11/2024.

Schulzweida, U. (2023). CDO User Guide (23.0). Zenodo. doi:10.5281/zenodo.10020800.

See Also

get_component_u, get_mask_shapefile

Examples

component_v <- get_component_v()
terra::plot(component_v)

Example mask shapefile

Description

Example mask shapefile.

Usage

get_mask_shapefile()

Details

Example of input mask_shapefile used for functions. It is a bounding box subset of get_component_u and get_component_v SpatRaster objects.

Value

sf and data.frame object.

Examples

mask_shapefile <- get_mask_shapefile()
plot(mask_shapefile)

Sea Currents To Connectivity Transformation

Description

Sea Currents To Connectivity Transformation

Usage

seagraph(component_u, component_v, mask_shapefile = NULL, k_neighbors = 7L)

Arguments

component_u

SpatRaster object with horizontal direction.

component_v

SpatRaster object with vertical direction.

mask_shapefile

Optional sf or SpatVector object for masking component_u and component_v SpatRaster objects. The default value is NULL, indicating that no mask is performed.

k_neighbors

integer object with the number k of nearest neighbors to use. The default is 7L.

Details

Sea currents data of the input are transformed into weighted directed graph connectivity data. Each centroid of component_u and component_v is considered as a separate graph node. These connectivity data are provided in sfnetwork, sf, edge list and adjacency matrix form. An additional data.frame with correspondence between indices and coordinates for edge list and adjacency matrix is returned as well. The weights in all outputs are minmax-scaled in [0-1].

Extent, resolution and coordinate system of both must have the same for both component_u and component_v; otherwise an error stops the function's execution. In case that a mask_shapefile is provided, then it is internally assured that it has the same resolution or coordinates with component_u and a warning is prompted.

Value

SeaGraph object, which is a list containing the following elements:

References

Nagkoulis, N., Adam, C., Mamoutos, I., Katsanevakis, S., and Mazaris, A. D. (2025). An ecological connectivity dataset for Black Sea obtained from sea currents. Data in Brief, 58, 111268. doi:10.1016/j.dib.2024.111268

See Also

antpath_sfn, flows_sfn

Examples

graph_result <- seagraph(component_u    = get_component_u(),
                         component_v    = get_component_v(),
                         k_neighbors    = 7)
## Example of mask usage
masked_result <- seagraph(component_u    = get_component_u(),
                          component_v    = get_component_v(),
                          mask_shapefile = get_mask_shapefile(),
                          k_neighbors    = 7)