delete_ts: Delete a time series item and its data

View source: R/delete_ts.R

delete_tsR Documentation

Delete a time series item and its data

Description

Deletes timeseries objects specified by all combinations of variable and site

Usage

delete_ts(var_src, site_name, files_only = FALSE, verbose = TRUE)

Arguments

var_src

the variable name, e.g., "doobs_nwis", for which you want the timeseries

site_name

the site ID, e.g. "nwis_02322688", whose folder you want to look in

files_only

logical. If TRUE, only the files will be deleted, leaving an empty ts item

verbose

logical. Should status messages be given?

Examples

## Not run: 
login_sb()
set_scheme("mda_streams_dev")

sites <- c("nwis_05406479", "nwis_05435950", "nwis_04087119")
files <- stage_nwis_ts(sites = sites, var = "doobs", 
  times = c('2014-01-01 00:00','2014-01-01 05:00'))
post_ts(files, on_exists='skip')
locate_ts("doobs_nwis", sites) # find the newly posted data online
sapply(locate_ts("doobs_nwis", sites), function(tsid) sbtools::item_list_files(tsid)$fname)

# items should all still be there, but with no files
mda.streams:::delete_ts("doobs_nwis", sites, files_only=TRUE)
locate_ts("doobs_nwis", sites, by="either") 
sapply(locate_ts("doobs_nwis", sites), function(tsid) sbtools::item_list_files(tsid)$fname)

# everything should disappear
post_ts(files, on_exists='replace')
mda.streams:::delete_ts("doobs_nwis", sites)
locate_ts("doobs_nwis", sites, by="either")
 
set_scheme("mda_streams")

## End(Not run)

USGS-R/mda.streams documentation built on June 3, 2023, 8:43 a.m.