ropensci / rerddap

R client for working with ERDDAP servers
https://docs.ropensci.org/rerddap
Other
40 stars 14 forks source link

Fish Data: Error code 500; column "date_tagged" does not exist #106

Closed John-Brandon closed 2 years ago

John-Brandon commented 2 years ago

Hi: I'm new to using this package (looks very nice -- thanks!), and thought the issue shown below might be of interest.

library(rerddap)
cache_delete_all()
fish <- tabledap('FED_JSATS_taggedfish', url = "https://oceanview.pfeg.noaa.gov/erddap/")
#> Error: Error {
#>     code=500;
#>     message="Internal Server Error: ERROR from data source: org.postgresql.util.PSQLException: ERROR: column \"date_tagged\" does not exist
#>   Position: 59";
#> }

# Same error as above, but different "Position". Noting 'date_tagged' is not returned in `vars_1` below
vars_1 = info('FED_JSATS_taggedfish')$variables$variable_name
('date_tagged' %in% vars_1)  
#> [1] FALSE
fish_1 = tabledap('FED_JSATS_taggedfish', fields = vars_1, url = "https://oceanview.pfeg.noaa.gov/erddap/")
#> Error: Error {
#>     code=500;
#>     message="Internal Server Error: ERROR from data source: org.postgresql.util.PSQLException: ERROR: column \"date_tagged\" does not exist
#>   Position: 17";
#> }

# This works as expected
vars_2 = c('fish_id', 'tag_model', 'tag_weight')
fish_2 = tabledap('FED_JSATS_taggedfish', fields = vars_2, url = "https://oceanview.pfeg.noaa.gov/erddap/")
fish_2  
#> <ERDDAP tabledap> FED_JSATS_taggedfish
#>    Path: [/Users/jbrandon/Library/Caches/R/rerddap/0f9ec4f9d8d724db321984a6fd13fef5.csv]
#>    Last updated: [2022-05-26 08:39:21]
#>    File size:    [0.82 mb]
#> # A tibble: 29,774 × 3
#>    fish_id      tag_model tag_weight
#>    <chr>        <chr>     <chr>     
#>  1 ACSH2016-001 SS300     320.0     
#>  2 ACSH2016-002 SS300     320.0     
#>  3 ACSH2016-003 SS300     320.0     
#>  4 ACSH2016-004 SS300     320.0     
#>  5 ACSH2016-005 SS300     320.0     
#>  6 ACSH2016-006 SS300     320.0     
#>  7 ACSH2016-007 SS300     320.0     
#>  8 ACSH2016-008 SS300     320.0     
#>  9 ACSH2016-009 SS300     320.0     
#> 10 ACSH2016-010 SS300     320.0     
#> # … with 29,764 more rows
sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur 10.16
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] rerddap_0.8.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.7        compiler_4.1.2    pillar_1.7.0      highr_0.9        
#>  [5] tools_4.1.2       ncdf4_1.19        digest_0.6.29     jsonlite_1.7.2   
#>  [9] evaluate_0.14     lifecycle_1.0.1   tibble_3.1.6      pkgconfig_2.0.3  
#> [13] rlang_1.0.1       reprex_2.0.1      cli_3.2.0         DBI_1.1.1        
#> [17] rstudioapi_0.13   crul_1.2.0        curl_4.3.2        yaml_2.2.1       
#> [21] xfun_0.29         fastmap_1.1.0     xml2_1.3.2        withr_2.5.0      
#> [25] dplyr_1.0.8       stringr_1.4.0     knitr_1.37        rappdirs_0.3.3   
#> [29] generics_0.1.2    fs_1.5.2          vctrs_0.3.8       triebeard_0.3.0  
#> [33] tidyselect_1.1.2  glue_1.6.2        httpcode_0.3.0    data.table_1.14.0
#> [37] R6_2.5.1          fansi_1.0.2       rmarkdown_2.11    hoardr_0.5.2     
#> [41] purrr_0.3.4       magrittr_2.0.2    urltools_1.7.3    htmltools_0.5.2  
#> [45] ellipsis_0.3.2    assertthat_0.2.1  utf8_1.2.2        stringi_1.7.6    
#> [49] crayon_1.5.0

Created on 2022-05-26 by the reprex package (v2.0.1)

rmendels commented 2 years ago

@John-Brandon Thanks for the info. If you look a the long title of that dataset it says:

" Under Development: JSATS California Fish Tracking: Tagged Fish table only"

so things in that dataset or their links may not be completely setup or tested. In your example, the problem is a mis-link of some sort between the web page and the underlying database.

John-Brandon commented 2 years ago

Makes sense @rmendels ; Thanks for the clarification