From d1a1e52d7af89ae000e0b23dec18e1eecffd2038 Mon Sep 17 00:00:00 2001 From: Egor Kotov Date: Fri, 9 Aug 2024 12:35:54 +0200 Subject: [PATCH] move data type check after the version detection --- R/download_data.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/download_data.R b/R/download_data.R index 9a9edde..10101b3 100644 --- a/R/download_data.R +++ b/R/download_data.R @@ -39,10 +39,6 @@ spod_download_data <- function( quiet = FALSE, return_output = TRUE ) { - # convert english data type names to spanish words used in the default data paths - type <- match.arg(type) - type <- spod_match_data_type(type = type, ver = ver) - # convert english zone names to spanish words used in the default data paths zones <- match.arg(zones) zones <- spod_zone_names_en2es(zones) @@ -56,6 +52,10 @@ spod_download_data <- function( ver <- spod_infer_data_v_from_dates(dates_to_use) # this leads to a second call to an internal spod_get_valid_dates() which in turn causes a second call to spod_available_data_v1() or spod_get_metadata(). This results in reading the xml files with metadata for the second time. This is not optimal and should be fixed. if (isFALSE(quiet)) message("Data version detected from dates: ", ver) + # convert english data type names to spanish words used in the default data paths + type <- match.arg(type) + type <- spod_match_data_type(type = type, ver = ver) + # get the available data list while checking for files already cached on disk