Hello, NOAA's Ocean Prediction Center (https://ocean.weather.gov/) serves the US Navy's almost-daily estimate of the locations of the north and south walls of the Gulf Stream in the North Atlantic (https://ocean.weather.gov/gulf_stream_latest.txt). The also serve an archive via a FTP server (https://ftp.opc.ncep.noaa.gov/grids/experimental/GStream) for downloads by year. The dataset provides manually estimated of locations along the so-called north and south walls of the Gulf Stream, although there is ongoing research and debate about the best way to define the Gulf Stream. My colleagues and I have been slowly pulling together a small package to make working with this data easier (https://github.com/BigelowLab/gstream).
This dataset provides an interesting spatial puzzle because the points for a specific wall on a given date are not ordered. Assuming that the points could be ordered into LINESTRING, the problem is how to do it. We probably can use sfnetworks package (https://luukvdmeer.github.io/sfnetworks/) extensive tools to follow a shortest path... but first one of the two endpoints must be found. Eeek! How does one do that programmatically? The plot attached shows the points for the north wall on 2020-12-19. Also shown are the first and last points in the record which are clearly not the endpoints of a path we might assemble from the points. #### START suppressPackageStartupMessages({ library(sf) library(readr) library(dplyr) }) file = "https://raw.githubusercontent.com/BigelowLab/gstream/main/inst/examples/2020-12-19-north.csv" x = readr::read_csv(file, col_types = "nn") |> sf::st_as_sf(coords = c("X", "Y"), crs = 4326) |> sf::st_as_sf() p = sf::st_cast(dplyr::select(x, attr(x, "sf_column")), "POINT") plot(sf::st_geometry(x), type = "b", axes = TRUE, reset = FALSE) plot(dplyr::slice(p,1), col = "orange", add = TRUE, pch = 2, cex = 1.5) plot(dplyr::slice(p,nrow(x)), col = "orange", add = TRUE, pch = 6, cex = 1.5) ### END -- Ben Tupper he/him Research Associate Bigelow Laboratory for Ocean Sciences ––––––––––––––––––––––––––––––––––––––––––––––––––– E btup...@bigelow.org O 207-315-2567 ––––––––––––––––––––––––––––––––––––––––––––––––––– Bold Science for Our Blue Planet | BIGELOW.ORG 60 BIGELOW DRIVE | EAST BOOTHBAY, MAINE 04544 USA _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo