Learn R Programming

snirh.lab (version 0.1.0)

check_station_status: Check status of specific SNIRH stations

Description

Validates specific station IDs against the SNIRH database and returns their current status. This is useful for checking stations before running the full conversion process.

Usage

check_station_status(station_ids, matrix = "surface.water", timeout = 30)

Value

A data.table with the following columns:

station_id

The station ID that was checked

found

Logical indicating if station exists in SNIRH

status

Station status if found, NA if not found

active

Logical indicating if station is active (status = "ATIVA")

Arguments

station_ids

Character vector of station IDs to check.

matrix

Character string specifying the matrix type. Currently supports "surface.water" and "biota". Default is "surface.water".

timeout

Numeric. Timeout in seconds for downloading data. Default is 30.

Details

This function is particularly useful for:

  • Pre-validating station IDs before data conversion

  • Checking why certain stations fail validation

  • Getting an overview of station status for reporting

See Also

get_snirh_stations for getting all station information

convert_to_snirh for the main conversion function

Examples

Run this code
# \donttest{
# Check status of specific stations
my_stations <- c("07G/50", "25G/07", "INVALID_ID")
status_check <- check_station_status(my_stations)
print(status_check)

# Check which stations are not active
inactive <- status_check[active == FALSE | is.na(active)]
if (nrow(inactive) > 0) {
  print("Stations requiring attention:")
  print(inactive)
  }

# Check only active stations
active_stations <- status_check[active == TRUE]
# }

Run the code above in your browser using DataLab