Created
August 21, 2024 02:57
-
-
Save njtierney/1f55bf906570949be363086daeaf97ac to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# from https://thredds.nci.org.au/thredds/catalog/gb6/BRAN/BRAN2020/daily/catalog.html?dataset=gb6/BRAN/BRAN2020/daily/ocean_temp_1995_06.nc | |
library(tidyverse) | |
library(terra) | |
nci_url <- "https://thredds.nci.org.au/thredds/fileServer/gb6/BRAN/BRAN2020/daily/ocean_temp_1995_06.nc" | |
vsi <- function(url) glue::glue("/vsicurl/{url}") | |
sf::gdal_utils("info", vsi(nci_url)) | |
ncdf4::nc_open() | |
# SST data of Antarctica | |
# can we start at a station | |
# can we scale that up | |
# SST from now (ish) until 1st Sept 1981 every day | |
# template the year, month, actual day | |
# always same format | |
sst_url <- "https://www.ncei.noaa.gov/data/sea-surface-temperature-optimum-interpolation/v2.1/access/avhrr/202408/oisst-avhrr-v02r01.20240801.nc" | |
curl::curl_download(sst_url, basename(sst_url)) | |
sst_file <- "oisst-avhrr-v02r01.20240801.nc" | |
subdata <- function(filename, | |
varname = NULL, | |
driver = "NetCDF") { | |
stopifnot(!is.null(varname)) | |
glue::glue('{driver}:"{filename}":{varname}') | |
} | |
subdata(sst_file, "sst") | |
sst_aug <- subdata(sst_file, "sst") |> rast() | |
plot(sst_aug) | |
sst_aug <- rast(subdata(vsi(sst_url))) | |
date <- as.Date("2024-01-01") | |
aug <- rast("~/Downloads/oisst-avhrr-v02r01.20240801.nc") | |
aug | |
"20240801" | |
underway_url <- "https://github.com/mdsumner/nuyina.underway/raw/main/data-raw/nuyina_underway.parquet" | |
curl::curl_download(underway_url, basename(underway_url)) | |
data_underway <- nanoparquet::read_parquet( | |
basename(underway_url) | |
) | |
data_underway$datetime - 1 | |
library(tidyverse) | |
past_week_of_data <- data_underway |> | |
filter(between(as.Date(datetime), date - 7, date + 7 ) | |
) | |
data_underway |> | |
filter(between(as.Date(datetime), date - 7, date + 7 ) | |
) | |
data_underway$verysouth <- data_underway$latitude < -60 | |
data_underway$segment <- c(0, cumsum(abs(diff(data_underway$verysouth)))) | |
data_underway$segment[!data_underway$verysouth] <- NA | |
plot(data_underway$datetime, data_underway$latitude, pch = ".", col = sample(palr::d_pal(data_underway$segment))) | |
plot(data_underway$datetime, data_underway$sea_water_temperature, pch = ".") | |
library(duckdb) | |
dbConnect(duckdb(), "nuyina_underway.parquet") |
oh sorry, you can't install raadtools - you have to be on our system/s for now - which I meant to do. I'm just keeping notes here, but I'll make you an account and email deets :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, @mdsumner !
I'm getting this error for
raadtools
, do I need to install something? Or is this perhaps a GDAL thing?