malaria-atlas-project / malariaAtlas

An R interface to open-access malaria data, hosted by the Malaria Atlas Project.
https://malariajournal.biomedcentral.com/articles/10.1186/s12936-018-2500-5
Other
43 stars 21 forks source link

getRaster fails for default PR due to multiple Plasmodium falciparum PR2-10 titles #33

Closed OJWatson closed 5 years ago

OJWatson commented 5 years ago

Hi there,

Noticed the following that used to work, now errors as follows:

ken <- malariaAtlas::getShp("Kenya")
#> OGR data source with driver: ESRI Shapefile 
#> Source: "/tmp/RtmpMaNcl9/shp/shp413a46542f0d/mapadmin_0_2018.shp", layer: "mapadmin_0_2018"
#> with 1 features
#> It has 8 fields
raster <- malariaAtlas::getRaster(shp=ken,year = 2008:2015,surface = "Plasmodium falciparum PR2-10")
#> Downloading list of available rasters...
#> All specified surfaces are available to download.
#> Checking if the following Surface-Year combinations are available to download:
#> 
#>     RASTER CODE  YEAR
#>   - Plasmodium falciparum PR2-10:  2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
#> Error in year[[which(raster_code_list == i)]]: subscript out of bounds

I had a debug and seems to be because there are multiple rasters with the title Plasmodium falciparum PR2-10 - c("2015_Nature_Africa_PR","2018_Global_PfPR"), which then causes issues later when trying to match the years to the second raster.

Let me know if there is anything else that would be useful for debugging.


Session Info ```r sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Linux Mint 19 Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1 locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] raster_2.8-4 sp_1.3-1 forcats_0.3.0 stringr_1.3.1 dplyr_0.8.0.1 purrr_0.2.5 readr_1.3.1 tidyr_0.8.2 tibble_2.0.1 ggplot2_3.1.0 [11] tidyverse_1.2.1 loaded via a namespace (and not attached): [1] xfun_0.4 tidyselect_0.2.5 haven_2.0.0 lattice_0.20-38 malariaAtlas_0.0.3 colorspace_1.4-0 generics_0.0.2 htmltools_0.3.6 [9] rlang_0.3.1 pillar_1.3.1 glue_1.3.0 withr_2.1.2 modelr_0.1.2 readxl_1.2.0 plyr_1.8.4 munsell_0.5.0 [17] gtable_0.2.0 cellranger_1.1.0 rvest_0.3.2 codetools_0.2-16 evaluate_0.12 knitr_1.21 callr_3.1.1 ps_1.3.0 [25] curl_3.2 broom_0.5.1 Rcpp_1.0.0 clipr_0.4.1 scales_1.0.0 backports_1.1.3 jsonlite_1.6 fs_1.2.6 [33] digest_0.6.18 hms_0.4.2 packrat_0.5.0 stringi_1.2.4 processx_3.2.1 grid_3.5.2 rgdal_1.3-6 cli_1.0.1 [41] tools_3.5.2 magrittr_1.5 lazyeval_0.2.1 whisker_0.3-2 crayon_1.3.4 pkgconfig_2.0.2 data.table_1.11.8 xml2_1.2.0 [49] reprex_0.2.1 lubridate_1.7.4 assertthat_0.2.0 rmarkdown_1.11 httr_1.4.0 rstudioapi_0.8 R6_2.3.0 nlme_3.1-137 [57] compiler_3.5.2 ```
timcdlucas commented 5 years ago

Hi, thank you very much. We're were in the middle of trying to sort this already!

We have recently disabled the PfPR raster data which caused the initial issue. Now backtracking and not quite sorted it yet.

OJWatson commented 5 years ago

Cool - glad it's already been picked up.

timcdlucas commented 5 years ago

This is fixed now. Thanks again!