| Title: | Download and Animate USGS Stream-Gage Camera Images |
|---|---|
| Description: | A tidy interface to the U.S. Geological Survey (USGS) National Imagery Management System (NIMS) API (<https://api.waterdata.usgs.gov/docs/nims/overview/>), which stores and serves images collected by stream-gage cameras at monitoring locations across the United States. Provides functions to discover cameras by NWIS site number or camera ID, list and filter available images by date and time, download images at multiple resolutions, and assemble downloaded frames into animated GIFs or MP4 videos. Integrates with the 'dataRetrieval' package (<https://doi-usgs.github.io/dataRetrieval/>) to enrich camera records with watershed metadata (drainage area, hydrologic unit code, state, county) and to retrieve co-located streamflow, stage, or water-quality time series — enabling direct comparison of visual stream conditions with measured observations. API authentication uses the 'API_USGS_PAT' environment variable shared with 'dataRetrieval', so a single key covers both packages. |
| Authors: | Connor Brown [aut, cre] (ORCID: <https://orcid.org/0000-0002-9680-8930>) |
| Maintainer: | Connor Brown <[email protected]> |
| License: | AGPL (>= 3) |
| Version: | 0.1.0.9000 |
| Built: | 2026-06-08 10:03:30 UTC |
| Source: | https://github.com/ConnorB/flowcam |
Combines a camera's base directory with one or more filenames returned by
list_images() to produce download-ready image URLs.
build_image_url(camera_row, filename, size = c("small", "overlay", "thumb"))build_image_url(camera_row, filename, size = c("small", "overlay", "thumb"))
camera_row |
A single-row tibble (or named list) from |
filename |
Character vector of one or more filenames from
|
size |
Image size. One of:
|
A character vector of full image URLs, one per element of
filename.
## Not run: cam <- find_cameras(cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire") imgs <- list_images(cam$camId[[1]], limit = 5) urls <- build_image_url(cam, imgs$filename, size = "small") ## End(Not run)## Not run: cam <- find_cameras(cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire") imgs <- list_images(cam$camId[[1]], limit = 5) urls <- build_image_url(cam, imgs$filename, size = "small") ## End(Not run)
Lists available images for a camera and downloads them to a local directory. Images are fetched directly from USGS S3 storage; no API key is required for the downloads themselves.
download_images( cam_id = NULL, dest_dir, size = "small", limit = 1000L, time = NULL, overwrite = FALSE, site_id = NULL )download_images( cam_id = NULL, dest_dir, size = "small", limit = 1000L, time = NULL, overwrite = FALSE, site_id = NULL )
cam_id |
Character. Camera identifier. Use |
dest_dir |
Character. Path to an existing local directory where images will be saved. |
size |
Image size passed to |
limit |
Integer between 1 and 50000. Page size for the internal
|
time |
POSIXct, Date, or character vector of length 1 or 2 used to
filter images by capture time. A length-1 value is treated as a start
(on or after). A length-2 vector sets the start and end; use |
overwrite |
Logical. If |
site_id |
Character. NWIS site number (e.g. |
Identify the camera with either cam_id or site_id — provide exactly one.
site_id accepts both bare NWIS numbers ("05366800") and the USGS-
prefixed form ("USGS-05366800"). When a site has multiple cameras,
specify the desired camera via cam_id instead.
A character vector of local file paths, invisibly. Failed downloads
are represented as NA.
## Not run: # By cam_id paths <- download_images( "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", dest_dir = tempdir(), limit = 5 ) # By USGS site ID paths <- download_images( site_id = "USGS-05366800", dest_dir = tempdir(), limit = 5 ) ## End(Not run)## Not run: # By cam_id paths <- download_images( "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", dest_dir = tempdir(), limit = 5 ) # By USGS site ID paths <- download_images( site_id = "USGS-05366800", dest_dir = tempdir(), limit = 5 ) ## End(Not run)
Returns a tibble of camera metadata from the USGS National Imagery Management System (NIMS). With no arguments, all cameras are returned. Filter by a NWIS site ID or a specific camera ID.
find_cameras(site_id = NULL, cam_id = NULL, return_fields = NULL)find_cameras(site_id = NULL, cam_id = NULL, return_fields = NULL)
site_id |
Character. NWIS site number (e.g. |
cam_id |
Character. Camera identifier (e.g.
|
return_fields |
Character vector of camera fields to include in the
response (e.g. |
A tibble with one row per camera. Columns depend on return_fields.
lat and lng are returned as numeric. Datetime columns are POSIXct
(UTC). The ingest column is a list-column containing each camera's
ingestion configuration.
## Not run: # All cameras find_cameras() # Cameras at a specific gage find_cameras(site_id = "05366800") # A specific camera find_cameras(cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire") # Only selected fields find_cameras(return_fields = c("camName", "newestImageDT")) ## End(Not run)## Not run: # All cameras find_cameras() # Cameras at a specific gage find_cameras(site_id = "05366800") # A specific camera find_cameras(cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire") # Only selected fields find_cameras(return_fields = c("camName", "newestImageDT")) ## End(Not run)
Calls find_cameras() for the given NWIS site ID, then joins the result
with site metadata from dataRetrieval::read_waterdata_monitoring_location().
Optionally appends a data_types list-column with the available time series
at the site via get_site_data_availability().
Requires the dataRetrieval package.
find_gage_cameras(site_id, include_availability = TRUE)find_gage_cameras(site_id, include_availability = TRUE)
site_id |
Character. A single 8-to-15-digit NWIS site number
(e.g. |
include_availability |
Logical. When |
A tibble with all camera columns from find_cameras() plus
these site metadata columns when available: monitoring_location_name,
state_name, county_name, hydrologic_unit_code, drainage_area
(total drainage area in square miles), and altitude (elevation in feet
above the stated vertical datum). When include_availability = TRUE,
a data_types list-column is also included; each element is a tibble
with columns from get_site_data_availability().
## Not run: # With available time series (default) find_gage_cameras("05366800") # Site metadata only, no data availability call find_gage_cameras("05366800", include_availability = FALSE) ## End(Not run)## Not run: # With available time series (default) find_gage_cameras("05366800") # Site metadata only, no data availability call find_gage_cameras("05366800", include_availability = FALSE) ## End(Not run)
Provides historical context for interpreting camera imagery — "is this flow high or low?" — by returning day-of-year percentile curves or period-of-record summaries.
get_flow_statistics( site_id = NULL, cam_id = NULL, parameter_code = "00060", type = c("daily_normals", "period_summary"), computation = "percentile", time = NULL )get_flow_statistics( site_id = NULL, cam_id = NULL, parameter_code = "00060", type = c("daily_normals", "period_summary"), computation = "percentile", time = NULL )
site_id |
Character. A single NWIS site number (e.g. |
cam_id |
Character. A camera identifier. If supplied, the function
resolves the associated NWIS site ID via |
parameter_code |
Character. One or more five-digit USGS parameter codes.
Default |
type |
Character. |
computation |
Character vector. One or more of |
time |
For |
Wraps dataRetrieval::read_waterdata_stats_por() (type = "daily_normals")
or dataRetrieval::read_waterdata_stats_daterange() (type = "period_summary").
A tibble. All types include columns:
site_idBare NWIS site number.
parameter_codeFive-digit parameter code.
unit_of_measureUnits string.
computationStatistical method (e.g. "percentile").
percentileInteger percentile (e.g. 50L); NA for
non-percentile computations.
valueNumeric statistic value.
sample_countNumber of observations used to compute the statistic.
type = "daily_normals" additionally includes:
month_dayCharacter MM-DD representing the day or month of year.
type = "period_summary" additionally includes:
interval_typeOne of "calendar_month", "calendar_year", or
"water_year".
start_dateDate. Start of the summary interval.
end_dateDate. End of the summary interval.
Returns a zero-row tibble (with correct column types) when no data are found. Requires the dataRetrieval package.
## Not run: # Day-of-year discharge percentile curves (the 10/25/50/75/90th percentiles) get_flow_statistics("05366800") # Annual and monthly discharge summaries get_flow_statistics("05366800", type = "period_summary") # Restrict period_summary to a specific date range get_flow_statistics( "05366800", type = "period_summary", time = c("2010-01-01", "2020-12-31") ) # Multiple computation types get_flow_statistics( "05366800", computation = c("minimum", "median", "maximum") ) # Overlay on a streamflow time series flow <- get_site_streamflow("05366800", time = "P1Y") stats <- get_flow_statistics("05366800") ## End(Not run)## Not run: # Day-of-year discharge percentile curves (the 10/25/50/75/90th percentiles) get_flow_statistics("05366800") # Annual and monthly discharge summaries get_flow_statistics("05366800", type = "period_summary") # Restrict period_summary to a specific date range get_flow_statistics( "05366800", type = "period_summary", time = c("2010-01-01", "2020-12-31") ) # Multiple computation types get_flow_statistics( "05366800", computation = c("minimum", "median", "maximum") ) # Overlay on a streamflow time series flow <- get_site_streamflow("05366800", time = "P1Y") stats <- get_flow_statistics("05366800") ## End(Not run)
Uses the USGS Network Linked Data Index (NLDI) to navigate upstream and/or downstream from a gage site, then returns all flowcam cameras found along the network within a specified distance.
get_network_cameras( site_id = NULL, cam_id = NULL, direction = c("upstream", "downstream", "both"), distance_km = 100 )get_network_cameras( site_id = NULL, cam_id = NULL, direction = c("upstream", "downstream", "both"), distance_km = 100 )
site_id |
Character. A single NWIS site number (e.g. |
cam_id |
Character. A camera identifier. If supplied, the function
resolves the associated NWIS site ID via |
direction |
Character. Navigation direction(s): |
distance_km |
Numeric. How far (in kilometres) to navigate along the
stream network from the origin site. Default |
Useful for anticipating flood wave arrival, comparing conditions across a watershed, or discovering monitoring locations on the same river system.
Wraps dataRetrieval::findNLDI().
A tibble with one row per camera (including the origin site) and columns:
site_idBare NWIS site number.
cam_idCamera identifier.
cam_nameHuman-readable camera name.
direction"origin", "upstream", or "downstream".
latLatitude (decimal degrees, WGS84).
lngLongitude (decimal degrees, WGS84).
Returns a zero-row tibble when no networked cameras are found (including the origin site if it has no camera). Requires the dataRetrieval package.
## Not run: # Cameras upstream of a site (within 100 km) get_network_cameras("05366800") # Cameras both upstream and downstream (150 km) get_network_cameras("05366800", direction = "both", distance_km = 150) # Via camera ID get_network_cameras( cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", direction = "downstream" ) ## End(Not run)## Not run: # Cameras upstream of a site (within 100 km) get_network_cameras("05366800") # Cameras both upstream and downstream (150 km) get_network_cameras("05366800", direction = "both", distance_km = 150) # Via camera ID get_network_cameras( cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", direction = "downstream" ) ## End(Not run)
Returns metadata about every time series recorded at a site — parameter
codes, units, and period of record — so you know exactly which codes to
pass to get_site_streamflow().
get_site_data_availability( site_id = NULL, cam_id = NULL, parameter_code = NA_character_ )get_site_data_availability( site_id = NULL, cam_id = NULL, parameter_code = NA_character_ )
site_id |
Character. A single NWIS site number (e.g. |
cam_id |
Character. A camera identifier. If supplied, the function
resolves the associated NWIS site ID via |
parameter_code |
Character. One or more five-digit USGS parameter codes
to filter results (e.g. |
Wraps dataRetrieval::read_waterdata_ts_meta().
A tibble with columns:
site_idBare NWIS site number (without USGS- prefix).
parameter_codeFive-digit parameter code.
parameter_nameHuman-readable parameter name.
unit_of_measureUnits string (e.g. "ft3/s").
begin_utcPOSIXct (UTC). Earliest observation in this time series.
end_utcPOSIXct (UTC). Most recent observation.
statistic_idFive-digit statistic code (e.g. "00003" for mean).
time_series_idUnique identifier for this time series.
Rows are sorted by parameter_code. Returns a zero-row tibble when no
time series are found. Requires the dataRetrieval package.
## Not run: # All parameters at a site get_site_data_availability("05366800") # Discharge only get_site_data_availability("05366800", parameter_code = "00060") # Via camera ID get_site_data_availability( cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire" ) # Chain with get_site_streamflow(): avail <- get_site_data_availability("05366800") flow <- get_site_streamflow("05366800", parameter_code = avail$parameter_code[1]) ## End(Not run)## Not run: # All parameters at a site get_site_data_availability("05366800") # Discharge only get_site_data_availability("05366800", parameter_code = "00060") # Via camera ID get_site_data_availability( cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire" ) # Chain with get_site_streamflow(): avail <- get_site_data_availability("05366800") flow <- get_site_streamflow("05366800", parameter_code = avail$parameter_code[1]) ## End(Not run)
Returns the record of in-person discharge measurements made by USGS hydrographers at a gage site. These manual measurements are the "ground truth" used to build stage-discharge rating curves, and they provide direct visual correlates to camera imagery taken at the same location and time.
get_site_field_measurements( site_id = NULL, cam_id = NULL, time = NULL, parameter_code = "00060" )get_site_field_measurements( site_id = NULL, cam_id = NULL, time = NULL, parameter_code = "00060" )
site_id |
Character. A single NWIS site number (e.g. |
cam_id |
Character. A camera identifier. If supplied, the function
resolves the associated NWIS site ID via |
time |
POSIXct, Date, or character vector of length 1 or 2 specifying
the time window. Follows the same semantics as |
parameter_code |
Character. One or more five-digit USGS parameter codes.
Default |
Wraps dataRetrieval::read_waterdata_field_measurements().
A tibble with columns:
site_idBare NWIS site number.
datetimePOSIXct (UTC) of the measurement.
valueNumeric measured value.
unitUnits of measure (e.g. "ft3/s").
parameter_codeFive-digit parameter code.
approval_status"Approved" or "Provisional".
measurement_ratedQuality rating of the measurement:
"Excellent" (≤2% error), "Good" (≤5%), "Fair" (≤8%),
or "Poor" (>8%).
control_conditionDescription of channel control conditions during the measurement.
Returns a zero-row tibble (with correct column types) when no measurements
are found. Compatible with get_site_streamflow() output via
dplyr::bind_rows() on the shared columns. Requires the dataRetrieval
package.
## Not run: # All discharge measurements at a site get_site_field_measurements("05366800") # Measurements during a specific period get_site_field_measurements( "05366800", time = c("2020-01-01", "2024-12-31") ) # Via camera ID get_site_field_measurements( cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire" ) # Compare field measurements against continuous sensor record field <- get_site_field_measurements("05366800", time = "P2Y") sensor <- get_site_streamflow("05366800", time = "P2Y") ## End(Not run)## Not run: # All discharge measurements at a site get_site_field_measurements("05366800") # Measurements during a specific period get_site_field_measurements( "05366800", time = c("2020-01-01", "2024-12-31") ) # Via camera ID get_site_field_measurements( cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire" ) # Compare field measurements against continuous sensor record field <- get_site_field_measurements("05366800", time = "P2Y") sensor <- get_site_streamflow("05366800", time = "P2Y") ## End(Not run)
Wraps dataRetrieval::read_waterdata_continuous() (instantaneous values)
or dataRetrieval::read_waterdata_daily() (daily mean values) for the
USGS gage associated with a flowcam camera. Returns a clean tibble aligned
with flowcam conventions.
get_site_streamflow( site_id = NULL, cam_id = NULL, time = NULL, parameter_code = "00060", type = c("continuous", "daily"), water_year = FALSE )get_site_streamflow( site_id = NULL, cam_id = NULL, time = NULL, parameter_code = "00060", type = c("continuous", "daily"), water_year = FALSE )
site_id |
Character. A single NWIS site number (e.g. |
cam_id |
Character. A camera identifier (e.g.
|
time |
POSIXct, Date, or character vector of length 1 or 2. Follows
the same semantics as the |
parameter_code |
Character. One or more five-digit USGS parameter
codes. Default |
type |
Character. |
water_year |
Logical. When |
A tibble with columns:
site_idBare NWIS site number (without USGS- prefix).
datetimePOSIXct (UTC) for type = "continuous"; Date for
type = "daily".
valueNumeric observation value.
unitUnits of measure (e.g. "ft3/s").
parameter_codeFive-digit parameter code.
approval_status"Approved" or "Provisional".
water_yearInteger water year (only present when
water_year = TRUE).
Returns a zero-row tibble (with correct column types) when no data are found. Requires the dataRetrieval package.
## Not run: # Instantaneous discharge for the last 7 days get_site_streamflow("05366800", time = "P7D") # Daily discharge for a calendar year get_site_streamflow( "05366800", time = c("2024-01-01", "2024-12-31"), type = "daily" ) # Water temperature from a camera ID get_site_streamflow( cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", parameter_code = "00010" ) # Multiple parameters at once get_site_streamflow("05366800", parameter_code = c("00060", "00065")) # Include water year column get_site_streamflow("05366800", time = "P1Y", water_year = TRUE) # Pair with image timestamps images <- list_images("05366800", time = c("2024-10-01", "2024-10-07"), raw_item = TRUE) flow <- get_site_streamflow("05366800", time = c("2024-10-01", "2024-10-07")) ## End(Not run)## Not run: # Instantaneous discharge for the last 7 days get_site_streamflow("05366800", time = "P7D") # Daily discharge for a calendar year get_site_streamflow( "05366800", time = c("2024-01-01", "2024-12-31"), type = "daily" ) # Water temperature from a camera ID get_site_streamflow( cam_id = "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", parameter_code = "00010" ) # Multiple parameters at once get_site_streamflow("05366800", parameter_code = c("00060", "00065")) # Include water year column get_site_streamflow("05366800", time = "P1Y", water_year = TRUE) # Pair with image timestamps images <- list_images("05366800", time = c("2024-10-01", "2024-10-07"), raw_item = TRUE) flow <- get_site_streamflow("05366800", time = c("2024-10-01", "2024-10-07")) ## End(Not run)
Queries the camera's metadata from NIMS and constructs the URL to its timelapse video file (720p MP4). Issues a warning if timelapse is not enabled for the camera.
get_timelapse_url(cam_id)get_timelapse_url(cam_id)
cam_id |
Character. Camera identifier. |
A single character string with the full timelapse video URL.
## Not run: get_timelapse_url("WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire") ## End(Not run)## Not run: get_timelapse_url("WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire") ## End(Not run)
Returns a tibble of image filenames (or raw image metadata) for the
specified camera. Use the filenames with build_image_url() to construct
full image URLs.
list_images( cam_id = NULL, limit = 1000L, recent = TRUE, time = NULL, raw_item = FALSE, site_id = NULL )list_images( cam_id = NULL, limit = 1000L, recent = TRUE, time = NULL, raw_item = FALSE, site_id = NULL )
cam_id |
Character. Camera identifier. Use |
limit |
Integer between 1 and 50000. Number of records fetched per
API request (page size). Default is |
recent |
Logical. If |
time |
POSIXct, Date, or character vector of length 1 or 2 used to
filter images by capture time. A length-1 value is treated as a start
(on or after). A length-2 vector sets the start and end; use |
raw_item |
Logical. If |
site_id |
Character. NWIS site number (e.g. |
Identify the camera with either cam_id or site_id — provide exactly one.
site_id accepts both bare NWIS numbers ("05366800") and the USGS-
prefixed form ("USGS-05366800"). When a site has multiple cameras,
specify the desired camera via cam_id instead.
A tibble. When raw_item = FALSE, one column: filename. When
raw_item = TRUE, four columns: camId, filename, timestamp, fs.
## Not run: # 10 most recent images by cam_id list_images("WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", limit = 10) # By USGS site ID (bare or prefixed) list_images(site_id = "05366800", limit = 10) list_images(site_id = "USGS-05366800", limit = 10) # Images in a date window list_images( "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", time = as.POSIXct(c("2025-06-01", "2025-06-02"), tz = "UTC") ) # Open-ended: on or after June 1 list_images( "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", time = c("2025-06-01", NA) ) # With metadata list_images("WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", limit = 5, raw_item = TRUE) ## End(Not run)## Not run: # 10 most recent images by cam_id list_images("WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", limit = 10) # By USGS site ID (bare or prefixed) list_images(site_id = "05366800", limit = 10) list_images(site_id = "USGS-05366800", limit = 10) # Images in a date window list_images( "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", time = as.POSIXct(c("2025-06-01", "2025-06-02"), tz = "UTC") ) # Open-ended: on or after June 1 list_images( "WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", time = c("2025-06-01", NA) ) # With metadata list_images("WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", limit = 5, raw_item = TRUE) ## End(Not run)
Downloads images for a camera over a specified time range and assembles them
into an animated GIF using the gifski package. Provide either cam_id or
site_id to identify the camera, and use time to restrict the range.
make_gif( cam_id = NULL, site_id = NULL, time = NULL, output = NULL, fps = 2, size = "small", limit = 1000L, dir = NULL, one_per_day = FALSE )make_gif( cam_id = NULL, site_id = NULL, time = NULL, output = NULL, fps = 2, size = "small", limit = 1000L, dir = NULL, one_per_day = FALSE )
cam_id |
Character. Camera identifier. Cannot be used with |
site_id |
Character. NWIS site number (e.g. |
time |
POSIXct, Date, or character vector of length 1 or 2. Same
semantics as |
output |
Character. File path for the output GIF. Defaults to
|
fps |
Positive number. Frames per second. Any positive value is
accepted. Default is |
size |
Image size passed to |
limit |
Integer. Page size for the internal |
dir |
Character. Path to a local directory of already-downloaded images.
When supplied, downloads are skipped and JPEG/PNG files are read from this
directory. |
one_per_day |
Logical. If |
When dir is supplied, images are read from that local directory instead of
being downloaded. You can still pass cam_id/site_id to select only files
belonging to a particular camera (matched by filename prefix) and time to
filter by timestamp embedded in the filename — useful when a directory
contains images from multiple cameras or a wider date range than needed.
JPEG frames are converted to PNG in a temporary directory before encoding
because gifski only accepts PNG input. The jpeg and png packages are
required when any frames are JPEG.
The output file path, invisibly.
## Not run: # Download and assemble images for a date range make_gif("WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", time = c("2025-06-01", "2025-06-02"), output = "chippewa.gif") # One frame per day from a local directory make_gif(cam_id = "NM_Pecos_Web_Camera_near_Roswell", time = c("2023-08-01", "2023-08-31"), dir = "~/Downloads/Pecos", one_per_day = TRUE, output = "pecos_august.gif") ## End(Not run)## Not run: # Download and assemble images for a date range make_gif("WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", time = c("2025-06-01", "2025-06-02"), output = "chippewa.gif") # One frame per day from a local directory make_gif(cam_id = "NM_Pecos_Web_Camera_near_Roswell", time = c("2023-08-01", "2023-08-31"), dir = "~/Downloads/Pecos", one_per_day = TRUE, output = "pecos_august.gif") ## End(Not run)
Downloads images for a camera over a specified time range and encodes them
into an MP4 video using the av package. Provide either cam_id or
site_id to identify the camera, and use time to restrict the range.
make_video( cam_id = NULL, site_id = NULL, time = NULL, output = NULL, fps = 2, size = "small", limit = 1000L, dir = NULL, one_per_day = FALSE )make_video( cam_id = NULL, site_id = NULL, time = NULL, output = NULL, fps = 2, size = "small", limit = 1000L, dir = NULL, one_per_day = FALSE )
cam_id |
Character. Camera identifier. Cannot be used with |
site_id |
Character. NWIS site number (e.g. |
time |
POSIXct, Date, or character vector of length 1 or 2. Same
semantics as |
output |
Character. File path for the output MP4. Defaults to
|
fps |
Positive number. Frames per second. Any positive value is
accepted. Default is |
size |
Image size passed to |
limit |
Integer. Page size for the internal |
dir |
Character. Path to a local directory of already-downloaded images.
When supplied, downloads are skipped and JPEG/PNG files are read from this
directory. |
one_per_day |
Logical. If |
When dir is supplied, images are read from that local directory instead of
being downloaded. You can still pass cam_id/site_id to select only files
belonging to a particular camera (matched by filename prefix) and time to
filter by timestamp embedded in the filename — useful when a directory
contains images from multiple cameras or a wider date range than needed.
The output file path, invisibly.
## Not run: # Download and assemble images for a date range make_video("WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", time = c("2025-06-01", "2025-06-02"), output = "chippewa.mp4") # One frame per day from a local directory make_video(cam_id = "NM_Pecos_Web_Camera_near_Roswell", time = c("2023-08-01", "2023-08-31"), dir = "~/Downloads/Pecos", one_per_day = TRUE, output = "pecos_august.mp4") ## End(Not run)## Not run: # Download and assemble images for a date range make_video("WI_Chippewa_River_at_Grand_Ave_at_Eau_Claire", time = c("2025-06-01", "2025-06-02"), output = "chippewa.mp4") # One frame per day from a local directory make_video(cam_id = "NM_Pecos_Web_Camera_near_Roswell", time = c("2023-08-01", "2023-08-31"), dir = "~/Downloads/Pecos", one_per_day = TRUE, output = "pecos_august.mp4") ## End(Not run)
Writes API_USGS_PAT to the user's ~/.Renviron file and applies it immediately in the
current session. The same variable is used by package dataRetrieval, so
one key can be shared across both packages.
set_usgs_api_key(key)set_usgs_api_key(key)
key |
A single non-empty character string containing your API key. |
Register for a free API key at https://api.waterdata.usgs.gov/signup/.
key, invisibly.
## Not run: set_usgs_api_key("my_api_key_here") ## End(Not run)## Not run: set_usgs_api_key("my_api_key_here") ## End(Not run)