@aspina , I was trying to use the codes in R handbook to import my weather data using the read_stars() and file_path() options .
## define path to weather folder
file_paths <- list.files(
here::here("data", "weather"),
full.names = TRUE)
## only keep those with the current name of interest
file_paths <- file_paths[str_detect(file_paths, "Lankien_weather")]
# read the weather data
data <- stars::read_stars(file_paths)
this hits an error of:
**Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: The dataset has several variables that could be identified as vector fields, but not all share the same primary dimension. Consequently they will be ignored.Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: The dataset has several variables that could be identified as vector fields, but not all share the same primary dimension. Consequently they will be ignored.Warning: GDAL Message 1: dimension #1 (expver) is not a Time dimension.Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: The dataset has several variables that could be identified as vector fields, but not all share the same primary dimension. Consequently they will be ignored.Warning: GDAL Message 1: dimension #1 (expver) is not a Time dimension.Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".t2m, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1tp, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1
Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".t2m, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1tp, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1
Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".t2m, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1tp, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1
Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".t2m, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1tp, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1
Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".t2m, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1tp, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1
Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".t2m, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1tp, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1
Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".t2m, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1tp, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1
Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".t2m, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1tp, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1
Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: The dataset has several variables that could be identified as vector fields, but not all share the same primary dimension. Consequently they will be ignored.t2m, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: The dataset has several variables that could be identified as vector fields, but not all share the same primary dimension. Consequently they will be ignored.Warning: GDAL Message 1: dimension #1 (expver) is not a Time dimension.Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1tp, Warning: GDAL Message 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".Warning: GDAL Message 1: The dataset has several variables that could be identified as vector fields, but not all share the same primary dimension. Consequently they will be ignored.Warning: GDAL Message 1: dimension #1 (expver) is not a Time dimension.Warning: GDAL Message 1: 1-pixel width/height files not supported, xdim: 1 ydim: 1**
and never imported my data
I managed to import the weather data files one by one (using the read_stars and read_ncdf) and bind the rows after changing to DF and all worked fine.
# OR
# Import files individual either using read_stars() or read_ncdf()
data0 <- read_ncdf(here("data", "weather","Lankien_weather2014.nc"))
data1 <- read_ncdf(here("data", "weather","Lankien_weather2015.nc"))
data2 <- read_ncdf(here("data", "weather","Lankien_weather2016.nc"))
data3 <- read_ncdf(here("data", "weather","Lankien_weather2017.nc"))
data4 <- read_ncdf(here("data", "weather","Lankien_weather2018.nc"))
data5 <- read_ncdf(here("data", "weather","Lankien_weather2019.nc"))
data6 <- read_ncdf(here("data", "weather","Lankien_weather2020.nc"))
data7 <- read_ncdf(here("data", "weather","Lankien_weather2021.nc"))
data8 <- read_ncdf(here("data", "weather","Lankien_weather2022.nc"))
# then bind rows
data<-bind_rows(as_tibble(data0,data1,data2,data3,data4,data5,data6,data7,data8))
I wonder why the ```read_stars(file_paths) is not working and what the error means?
I have searched stack overflow as well but none of them explained what this error could be. J curious.