Downloads and returns information about SNIRH monitoring stations for surface water quality. This function can be used to check station status, get available station IDs, or validate stations before data conversion.
Value
A data.table with station information containing:
- station_id
Station identifier (corresponds to "Código" in SNIRH)
- status
Station status (e.g., "ATIVA", "DESATIVADA", "EXTINTA")
Details
Downloads the latest station information from the SNIAmb WFS service. It requires an internet connection.
The download/parsing step uses the 'sf' package internally; if 'sf' is not installed, the function will abort with a clear message.
The station database includes information about:
Station location (coordinates)
Station status (active/inactive)
Station metadata
Station Status
Stations can have different status values:
- ATIVA
Station is active and can receive new data
- DESATIVADA
Station is inactive (historical data only)
- EXTINTA
Station is permanently suspended and has no data
See also
convert_to_snirh for the main conversion function
check_station_status for checking specific stations
Examples
# \donttest{
# Get all surface water stations
all_stations <- get_snirh_stations("surface.water")
print(head(all_stations))
#> station_id status
#> <char> <char>
#> 1: 01F/01 ATIVA
#> 2: 01F/02 ATIVA
#> 3: 01F/03 ATIVA
#> 4: 01F/04 DESATIVADA
#> 5: 01F/05 DESATIVADA
#> 6: 01F/06 ATIVA
# Get only active stations
active_stations <- get_snirh_stations("surface.water", active_only = TRUE)
print(paste("Active stations:", nrow(active_stations)))
#> [1] "Active stations: 3147"
# Check if specific stations are active
my_stations <- c("07H/50", "25G/07")
station_info <- get_snirh_stations("surface.water")
station_status <- station_info[station_id %in% my_stations]
print(station_status)
#> station_id status
#> <char> <char>
#> 1: 07H/50 ATIVA
#> 2: 25G/07 ATIVA
# }
