Skip to content

Interface to the LAke multi-scaled GeOSpatial & temporal database 🌎

Notifications You must be signed in to change notification settings

cont-limno/LAGOSUS

Repository files navigation

Project Status: Active – The project has reached a stable, usable state and is being actively developed. R build status CRAN_Status_Badge CRAN RStudio mirror downloads

LAGOSUS

The LAGOSUS package provides an R interface to download LAGOS-US data, store this data locally, and perform a variety of filtering and subsetting operations.

LAGOS-US contains data for 479,950 lakes and reservoirs larger than 1 ha in continental US. The database includes 4 data modules for: lake location and physical characteristics for all lakes; ecological context (i.e., the land use, geologic, climatic, and hydrologic setting of lakes) for all lakes; in situ measurements of lake water quality for a subset of the lakes from the past 3 decades for approximately Y-Z lakes depending on the variable (see References); and depth for a subset of all lakes (forthcoming).

Installation

# install development version from Github
# install devtools if not found - install.packages("devtools")
devtools::install_github("cont-limno/LAGOSUS", dependencies = TRUE)

Data

General users currently have public access to the locus and depth modules. They can be downloaded and stored to your local system with the following command (note that an attempt will be made to download all public modules, those that already exist will be skipped unless an “overwrite” argument is specified):

library(LAGOSUS)

# only the locus and depth modules are currently public:
lagosus_get(dest_folder = lagosus_path())

Currently only the “locus” and “depth” modules of LAGOS-US has been released in a public repository. Members of the development team who have access to unreleased modules (limno, geo, etc), will need to use the the lagosus_compile function (not lagosus_get) and supply the path to their local locus, limno, geo, or depth data folders. Replace the paths in the example below with the path to each respective folder on your system. Most people will have access to these folders through Dropbox. For example, the locus_folder would be assigned to something like: C:/Users/FWL/Dropbox/CL_LAGOSUS_exports/LAGOSUS_LOCUS

# an example for members of the dev team to specify local data folder paths
lagosus_compile(
  locus_version = "1.0",
  locus_folder = "~/Downloads/LAGOSUS_LOCUS/LOCUS_v1.0",
  limno_version = "2.1",
  limno_folder = "~/Downloads/LAGOSUS_LIMNO/US/LIMNO_v2.1/Final exports",
  depth_version = "0.1",
  depth_folder = "~/Downloads/LAGOSUS_DEPTH/DEPTH_v0.1",
  geo_version = "1.0",
  geo_folder = "~/Downloads/LAGOSUS_GEO/GEO_EXPORT_BETA_v1",
  dest_folder = lagosus_path())

Usage

Load Package

library(LAGOSUS)

Load data

The lagosus_load function returns a named list of data.frame objects. Use the names() function to see a list of available data frames names(lg).

lg <- lagosus_load(modules = c("locus"))
names(lg)

Preview a table

head(lg$locus$lake_characteristics)

Preview a specific lake

lake_info(name = "Pine Lake", state = "California")
# or using a lagoslakeid
# lake_info(lagoslakeid = 4389)

Map specific lakes

library(mapview)
mapview(coordinatize(lake_info(name = "Pine Lake", state = "California")))

Read table metadata

# lookup which table(s) contain a column name
query_lagos_names("ws_meanwidth", dt = lg)
# load help file for a table
?lake_watersheds

Legacy Versions

To install versions of LAGOSUS compatible with older versions of LAGOS-US data modules, review the Changelog to find to package version associated with your desired module version. Run the following command where ref is set to your desired version (in the example, it is version 0.0.1):

# install devtools if not found
# install.packages("devtools")
devtools::install_github("cont-limno/LAGOSUS", ref = "v0.0.1")

References

Cheruvelil, K.S., Soranno, P.A., McCullough, I.M., Webster, K.E., Rodriguez, L.K. and Smith, N.J., 2021. LAGOS-US LOCUS v1.0: Data module of location, identifiers, and physical characteristics of lakes and their watersheds in the conterminous US. Limnology and Oceanography Letters, 6(5), pp.270-292. https://doi.org/10.1002/lol2.10203