-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiod.R
More file actions
27 lines (20 loc) · 758 Bytes
/
Copy pathiod.R
File metadata and controls
27 lines (20 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(tidyverse)
download.file("ftp://ftp.bom.gov.au/anon/gen/clim_data/IDCK000081.zip",
"temp.zip")
unzip("temp.zip", exdir="./temp")
files <- c("nino_1"="Nino1",
"nino_2"="Nino2",
"nino_3"="Nino3",
"nino_3.4"="Nino3+4",
"nino_4"="Nino4",
"iod"="IOD",
"soi"="SOI")
data <- imap(files, \(x, idx)
read_csv(paste("./temp/", idx, ".csv", sep="")) |>
mutate(date = as.Date(as.character(end_date), "%Y%m%d"),
series = x) |>
rename(anon=.data[[idx]]) |>
select(date, anon, series))
data$soi <- data$soi |> filter(date %in% data$nino_1$date)
write_csv(bind_rows(data), "allnino.csv")
unlink(c("temp.zip", "./temp"), recursive=TRUE)