Last active
December 14, 2022 02:35
-
-
Save cboettig/9819d94ae9f89336f5e0acfd75baa622 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#url <- "https://dap.tern.org.au/thredds/ncss/ecosystem_process/ozflux/AdelaideRiver/2022_v2/L5/default/AdelaideRiver_L5_20071017_20090524.nc" | |
library(tidync) | |
library(lubridate) | |
library(dplyr) | |
url <- "https://dap.tern.org.au/thredds/dodsC/ecosystem_process/ozflux/AdelaideRiver/2022_v2/L5/default/AdelaideRiver_L5_20071017_20090524.nc" | |
# peek at metadata for time units | |
nc_atts(url) |> filter(variable=="time") |> mutate(value = unlist(value)) | |
decimal_day <- function(time) { | |
as.POSIXct.numeric(time*60*60*24, | |
tz="UTC", | |
origin = as.POSIXct("1800-01-01")) | |
} | |
x <- tidync(url) | |
y <- activate(x, "D1,D0,D3") |> | |
hyper_tibble(select_var =c("CO2", "Ta", "RH", "Ts")) |> | |
mutate(datetime = decimal_day(time)) | |
## for L3 data, NAs coded as negatives | |
y |> | |
filter(CO2 > 0) |> | |
ggplot(aes(datetime, CO2)) + geom_point(shape="+", alpha=.1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment