Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aggregate_area function rework #78

Merged
merged 5 commits into from
Oct 3, 2024
Merged

aggregate_area function rework #78

merged 5 commits into from
Oct 3, 2024

Conversation

andybeet
Copy link
Member

@andybeet andybeet commented Oct 1, 2024

New functions

  • Added check_Argument_validation.r - some logic to determine conflicting argument parameter choices. To safeguard from running get_comland_data incorrectly.

Function changes

  • get_comland_data - Reduce two arguments into one. applyPropLand and applyPropValue into applyProp. Included section in function to explain how some arguments are dependent on others
  • aggregate_areas - rework code to use single applyProp argument
  • get_comland_raw_data - fixed default filteByArea to pull up to the curent year (if no year is supplied)

linked Discussion

@andybeet andybeet changed the title aggregate_area rework aggregate_area function rework Oct 1, 2024
@andybeet andybeet linked an issue Oct 1, 2024 that may be closed by this pull request
@andybeet andybeet linked an issue Oct 1, 2024 that may be closed by this pull request
@andybeet andybeet requested a review from sgaichas October 2, 2024 15:20
Copy link
Member

@sgaichas sgaichas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this all looks good but I may have introduced an error by upgrading to the latest sf package?

I can run get_comland_data(channel=channel) up to the point

Disaggregating little and winter skates from skates(ns)

when it errors out with

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/sgaichas/R/x86_64-pc-linux-gnu-library/4.3/sf/libs/sf.so':
  /home/sgaichas/R/x86_64-pc-linux-gnu-library/4.3/sf/libs/sf.so: undefined symbol: GEOSLineMergeDirected_r

I got the same error when trying to build the site with pkgdown, when it tries to build the ForeignCatchCompare21A21B.Rmd vignette:

The error ocurrs in that when I run this line

statAreas <- sf::st_read(system.file("extdata",package="comlandr"),layer="Statistical_Areas_2010",quiet=T)
sf::st_crs(statAreas) <- 4269

so it is possibly an issue with the sf package that I didn't have when I was running an older sf version

My current sf is

> packageVersion("sf")
[1] '1.0.17'

my current setup:

> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0

locale:
[1] C

time zone: EST
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] patchwork_1.2.0   magrittr_2.0.3    data.table_1.15.4 ROracle_1.3-1.1   DBI_1.2.3        
[6] comlandr_0.3.0   

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.1   viridisLite_0.4.2  dplyr_1.1.4        farver_2.1.2      
 [5] fastmap_1.1.1      tweenr_2.0.3       digest_0.6.35      survdat_1.0       
 [9] lifecycle_1.0.4    processx_3.8.4     compiler_4.3.1     rlang_1.1.3       
[13] tools_4.3.1        utf8_1.2.4         yaml_2.3.8         knitr_1.46        
[17] bit_4.0.5          classInt_0.4-10    xml2_1.3.6         KernSmooth_2.23-21
[21] withr_3.0.0        purrr_1.0.2        desc_1.4.3         grid_4.3.1        
[25] polyclip_1.10-4    fansi_1.0.6        dbutils_0.3.0      e1071_1.7-14      
[29] colorspace_2.1-0   ggplot2_3.5.1      scales_1.3.0       MASS_7.3-60       
[33] cli_3.6.2          rmarkdown_2.26     crayon_1.5.2       generics_0.1.3    
[37] rstudioapi_0.16.0  tzdb_0.4.0         cachem_1.0.8       ggforce_0.4.2     
[41] proxy_0.4-27       stringr_1.5.0      parallel_4.3.1     vctrs_0.6.5       
[45] jsonlite_1.8.8     callr_3.7.6        hms_1.1.3          bit64_4.0.5       
[49] systemfonts_1.0.6  tidyr_1.3.1        units_0.8-5        glue_1.7.0        
[53] pkgdown_2.0.7      ps_1.7.6           stringi_1.8.4      gtable_0.3.5      
[57] munsell_0.5.1      tibble_3.2.1       pillar_1.9.0       htmltools_0.5.8.1 
[61] R6_2.5.1           vroom_1.6.3        evaluate_0.23      kableExtra_1.4.0  
[65] readr_2.1.4        memoise_2.0.1      class_7.3-22       Rcpp_1.0.12       
[69] svglite_2.1.3      xfun_0.43          getPass_0.2-2      fs_1.6.4          
[73] pkgconfig_2.0.3   

I see there is no version for sf in the comlandr imports; which version are you running?

@andybeet
Copy link
Member Author

andybeet commented Oct 3, 2024

so i have 1.0.16 on my windows machine. it builds ok. The Rstudio container (linux) has 1.0.17. It builds ok.

I think you got the same error because in the dissaggregate_skate_hakes function, there is an identical line of code.

Do you have any other shapefiles on your machine (if not i'll point you to one)? Can you try to read a different one using sf::st_read and see if this is a general problem using this function?

@sgaichas
Copy link
Member

sgaichas commented Oct 3, 2024

probably me:

> sf::st_read("data/EPU_NOESTUARIES")
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/sgaichas/R/x86_64-pc-linux-gnu-library/4.3/sf/libs/sf.so':
  /home/sgaichas/R/x86_64-pc-linux-gnu-library/4.3/sf/libs/sf.so: undefined symbol: GEOSLineMergeDirected_r

@sgaichas
Copy link
Member

sgaichas commented Oct 3, 2024

why don't I go ahead and pull this into dev, this issue shouldn't stop you working on it

@sgaichas sgaichas merged commit 7e15429 into dev Oct 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants