Error in `load_deter` - "deter_amz"
Closed this issue · 0 comments
The latest DETER data, still from the same url, has a new naming convention.
It all comes in a .zip file named deter-amz-public-2023set12.zip, which used to contain four files named "deter-public.xxx". This was the case for both "deter_amz" and "deter_cerrado".
But now the "deter_amz" files have an added prefix, now named "deter-amz-deter-public.xxx". This leads to the error below:
install.packages("datazoom.amazonia")
#> Installing package into 'C:/Users/igorr/AppData/Local/R/win-library/4.3'
#> (as 'lib' is unspecified)
#> package 'datazoom.amazonia' successfully unpacked and MD5 sums checked
#>
#> The downloaded binary packages are in
#> C:\Users\igorr\AppData\Local\Temp\Rtmp2Lfw7o\downloaded_packages
library(datazoom.amazonia)
load_deter(dataset = "deter_amz")
#> Error: Cannot open "C:\Users\igorr\AppData\Local\Temp\Rtmp2Lfw7o/deter_public.shp"; The file doesn't seem to exist.
Created on 2023-09-11 with reprex v2.0.2
which happens because there is in fact no more "deter-public.shp" file for "deter_amz", it has been renamed "deter-amz-deter-public.shp". Meanwhile, "deter_cerrado" still works just fine.
Simple fix, line 623 of download.R has the following code
if (param$source == "deter") {
dat <- sf::read_sf(file.path(dir, "deter_public.shp"))
}
This has to be split up by dataset to account for the different new names.