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

get_ereefs_ts: "Error in if (location_latlon[[1]] == "mmp") { : the condition has length > 1" #34

Open
marine-ecologist opened this issue Mar 9, 2023 · 0 comments

Comments

@marine-ecologist
Copy link

marine-ecologist commented Mar 9, 2023

The three examples in the get_ereefs_ts() function are throwing seperate errors:


get_ereefs_ts('Chl_a_sum', location_latlon=data.frame(latitide=c(-23.39189,-18), longitude=c(150.88852, 147.5)), layer='surface', start_date=c(2010,12,31),end_date=c(2011,1,5), input_file=2)

> Error in if (location_latlon[[1]] == "mmp") { : 
>   the condition has length > 1

get_ereefs_ts(var_names=c('Tricho_N', 'DIP', 'TP'), location_latlon=data.frame(latitide=c(-23.39189,-18), longitude=c(150.88852, 147.5)), layer='bottom', start_date="2012-07-03",end_date="2012-07-05", input_file='GBR4_BGC-v2.0 Chyb Dcrt')

> Error in if (start_date > end_date) { : 
>   missing value where TRUE/FALSE needed
> In addition: Warning messages:
> 1: In convert.dates(dates., format = format[[1]], origin. = origin.) :
>   days(s) out of range in positions 1 set to NA
> 2: In convert.dates(dates., format = format[[1]], origin. = origin.) :
>   days(s) out of range in positions 1 set to NA

get_ereefs_ts(var_names=c('ZooL_N', 'ZooS_N'), location_latlon=data.frame(latitide=c(-23.39189,-18), longitude=c(150.88852, 147.5)), layer=45, start_date=c(2010,12,31),end_date=c(2011,1,5), input_file="http://dapds00.nci.org.au/thredds/dodsC/fx3/gbr4_bgc_GBR4_H2p0_B2p0_Cpre_Dcrt/gbr4_bgc_simple_2016-06.nc")

> Error in if (location_latlon[[1]] == "mmp") { : 
>   the condition has length > 1

The third example still gives an error with the location_latlon when correcting latitide with latitude - changing location_latlon[[1]] to location_latlon[[1]][1] on line 19 is a temp fix to get around the data.frame issue:

 location_latlon=data.frame(latitide=c(-23.39189,-18), longitude=c(150.88852, 147.5))

 if (location_latlon[[1]][1] == "mmp") {
        location_latlon <- data.frame(latitude = mmp_sites$latitude, 
            longitude = mmp_sites$longitude)
        mmp <- TRUE
    }
    else {
        mmp <- FALSE
    }

> Error in if (location_latlon[[1]] == "mmp") { : 
>   the condition has length > 1

sessionInfo() below:

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.2.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

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

other attached packages:
[1] ereefs_3.2.4

loaded via a namespace (and not attached):
 [1] fansi_1.0.4      assertthat_0.2.1 utf8_1.2.3       dplyr_1.0.10     R6_2.5.1         DBI_1.1.3        lifecycle_1.0.3  magrittr_2.0.3   pillar_1.8.1     rlang_1.0.6      cli_3.6.0        vctrs_0.5.2     
[13] generics_0.1.3   glue_1.6.2       compiler_4.2.1   pkgconfig_2.0.3  tidyselect_1.2.0 tibble_3.1.8    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant