Changes the location associated with an existing time series. This will update
the following fields in monitor$meta: longitude, latitude,
locationID and deviceDeploymentID, as well as the column name of
this time series in monitor$data.
monitor_move(
monitor,
id = NULL,
longitude = NULL,
latitude = NULL,
precision = 10
)mts_monitor object.
deviceDeploymentID for a single time series found in
monitor. Optional if monitor contains only a single time series.
New longitude of the time series.
New latitude of the time series.
precision argument used when creating the geohash-based
locationID.
A mts_monitor object. (A list with meta and data
dataframes.)
New locations are assigned geohash-based locationID values.
If another time series exists with the same geohash-based location identifier,
monitor_combine() will be used to join them into a single time series.
Combination will be performed with replaceMeta = TRUE and
overlapStrategy = "replace na" so that data and metadata associated
with the moved time series take precedence where appropriate.
A typical use case would involve a monitor whose location metadata was updated or corrected after data collection had already started. This can result in two separate time series that need to be combined.
Legacy monitors may contain digest-based locationID values. New
locations are always assigned geohash-based locationID values because
digest-based location identifiers are no longer supported by
MazamaCoreUtils.
As a result, monitor_combine() may not recognize a legacy
digest-based location and a geohash-based location as representing the same
physical location.
library(AirMonitor)
# Move Carmel Valley monitor over a bit
names(Carmel_Valley$data)
#> [1] "datetime" "a9572a904a4ed46d_840060530002"
Carmel_Valley$meta %>%
dplyr::select(longitude, latitude, locationID, deviceDeploymentID) %>%
dplyr::glimpse()
#> Rows: 1
#> Columns: 4
#> $ longitude <dbl> -121.7333
#> $ latitude <dbl> 36.48187
#> $ locationID <chr> "a9572a904a4ed46d"
#> $ deviceDeploymentID <chr> "a9572a904a4ed46d_840060530002"
moved_monitor <- monitor_move(
Carmel_Valley,
id = Carmel_Valley$meta$deviceDeploymentID,
longitude = Carmel_Valley$meta$longitude + 0.001,
latitude = Carmel_Valley$meta$latitude + 0.001
)
names(moved_monitor$data)
#> [1] "datetime" "9q3rtct0p5_840060530002"
moved_monitor$meta %>%
dplyr::select(longitude, latitude, locationID, deviceDeploymentID) %>%
dplyr::glimpse()
#> Rows: 1
#> Columns: 4
#> $ longitude <dbl> -121.7323
#> $ latitude <dbl> 36.48287
#> $ locationID <chr> "9q3rtct0p5"
#> $ deviceDeploymentID <chr> "9q3rtct0p5_840060530002"