Skip to content

Commit

Permalink
metadata dl function added, manual removal of bad data, reproc tempeval
Browse files Browse the repository at this point in the history
  • Loading branch information
fawda123 committed Aug 6, 2024
1 parent ba8e2db commit 43efc3c
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 77 deletions.
Binary file modified data/tempdat.RData
Binary file not shown.
112 changes: 56 additions & 56 deletions docs/tempeval.html

Large diffs are not rendered by default.

26 changes: 5 additions & 21 deletions r/dat_proc.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,7 @@ fls <- drive_ls(gdrive_pth) %>%

# site metadata -------------------------------------------------------------------------------

metadat <- fls %>%
filter(grepl('OTB_TEMP_LOGGER_DATA', name)) %>%
pull(id) %>%
read_sheet(na = c('', 'NA'), col_types = 'ccDcDcnnnnnncnc') %>%
clean_names %>%
select(
deploy_date,
logger = logger_id,
site = site_id,
stratum,
lat,
long,
depthm = depth_m
) %>%
filter(!is.na(logger)) %>%
mutate(
yr = year(deploy_date),
logger = sprintf('%04d', logger)
) %>%
unite('yr_site_logger', yr, site, logger, sep = '_', remove = F) %>%
st_as_sf(coords = c('long', 'lat'), crs = 4326)
metadat <- dlmetadat_fun(fls)

save(metadat, file = here('data/metadat.RData'))

Expand All @@ -50,4 +30,8 @@ load(file = here('data/metadat.RData'))

tempdat <- dltempdat_fun(fls, metadat)

# remove non-deployment data
tempdat <- tempdat %>%
filter(!(yr_site_logger %in% c('2024_4NWB3_7775') & datetime > ymd_hms('2024-07-15 11:11:00', tz = 'America/New_York')))

save(tempdat, file = here('data/tempdat.RData'))
28 changes: 28 additions & 0 deletions r/funcs.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,34 @@ mpplo_dd <- function(metadat, dd){

}

dlmetadat_fun <- function(fl){

out <- fls %>%
filter(grepl('OTB_TEMP_LOGGER_DATA', name)) %>%
pull(id) %>%
read_sheet(na = c('', 'NA'), col_types = 'ccDcDcnnnnnncnc') %>%
clean_names %>%
select(
deploy_date,
logger = logger_id,
site = site_id,
stratum,
lat,
long,
depthm = depth_m
) %>%
filter(!is.na(logger)) %>%
mutate(
yr = year(deploy_date),
logger = sprintf('%04d', logger)
) %>%
unite('yr_site_logger', yr, site, logger, sep = '_', remove = F) %>%
st_as_sf(coords = c('long', 'lat'), crs = 4326)

return(out)

}

dltempdat_fun <- function(fls, metadat){

flexts <- file.exists(here('data/tempdat.RData'))
Expand Down

0 comments on commit 43efc3c

Please sign in to comment.