Skip to content

Commit d826157

Browse files
committed
Fix chelsa metadata data
1 parent cc4019c commit d826157

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

R/dwf_chelsa_prepare.R

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ chelsa_prepare <- function(
127127
climate_scenario = climate_scenario)
128128
}
129129
return(out)
130-
})
131-
) %>%
130+
})) %>%
132131
tidyr::unnest_wider("model_scenario") %>%
133132
# Files for 2011-2040/UKESM1-0-LL/ssp126 are duplicated
134133
dplyr::filter(
@@ -143,7 +142,7 @@ chelsa_prepare <- function(
143142
stringr::str_remove_all(
144143
string = path_file,
145144
pattern = paste0(
146-
"_r1i1p1f1_w5e5_|_norm|chelsa_|V.2.1|_V\\.2\\.1|", time_period,
145+
"_r1i1p1f1_w5e5_|_norm|CHELSA_|V.2.1|_V\\.2\\.1|", time_period,
147146
"|.", extension, "|", climate_scenario)) %>%
148147
stringr::str_remove_all(
149148
pattern = stringr::str_glue(
@@ -154,8 +153,7 @@ chelsa_prepare <- function(
154153
) %>%
155154
stringr::str_remove_all(pattern = "__|___") %>%
156155
stringr::str_remove_all(pattern = "^_|_$")
157-
})
158-
) %>%
156+
})) %>%
159157
# Process only selected variables
160158
dplyr::filter(stringr::str_detect(variable, selected_vars)) %>%
161159
dplyr::mutate(
@@ -189,8 +187,7 @@ chelsa_prepare <- function(
189187
stringr::str_replace(
190188
pattern = "1981-2010_current_current",
191189
replacement = "1981-2010_current")
192-
})
193-
) %>%
190+
})) %>%
194191
dplyr::select(-"path_dir") %>%
195192
dplyr::left_join(IASDT.R::chelsa_variables, by = "variable")
196193

0 commit comments

Comments
 (0)