ARCCSS-extremes / climpact

Calculate the ET-SCI climate extremes indices
GNU General Public License v3.0
42 stars 29 forks source link

ERROR 'x' and 'y' lengths differ #114

Closed aseemsharma1 closed 4 months ago

aseemsharma1 commented 4 months ago

When running the Climpact locally in windows for a station it calculates most of the indices but through error ''x' and 'y' lengths differ in calculating hw as in the screenshot below. Also below is the session info. I run into this error for my station but also when running the sample data included in the climpact.

XY error 2

Session info

xyerror_session_info
RTwaha commented 4 months ago

I have the same problem; did you fix it?

heroldn commented 4 months ago

@RTwaha what version of R are you using. Thanks @aseemsharma1 for the info, I'll have to get a Windows machine with something close to your version to check this. Were there any issues when running the install scripts? Is there a reason you're not using the online version? https://climpact-sci.org/

aseemsharma1 commented 4 months ago

@heroldn there were not any issues reported during installation. I am using the local machine as I have to run the app for 100+ stations. When tested with 1 sample station online, it works fine.

RTwaha commented 4 months ago

@heroldn sorry for the late reply, find the error and session info below, Error

> sessionInfo()
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 26052)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: Africa/Nairobi
tzcode source: internal

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

other attached packages:
 [1] climdex.pcic.ncdf_0.5-4 LMoFit_0.1.6            lmomco_2.4.11           SPEI_1.8.1             
 [5] climdex.pcic_1.1-11     PCICt_0.5-4.4           qpdf_1.3.2              shinyWidgets_0.8.1     
 [9] slickR_0.6.0            shinyBS_0.61.1          shinydashboard_0.7.2    ggplot2_3.4.4          
[13] corrplot_0.92           dplyr_1.1.2             servr_0.29              markdown_1.12          
[17] shinyjs_2.1.0           shinythemes_1.2.0       tcltk2_1.2-11           zyp_0.11-1             
[21] Kendall_2.2.1           zoo_1.8-12              shiny_1.7.4            

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0   fastmap_1.1.1      reshape_0.8.9      pracma_2.4.4       promises_1.2.0.1  
 [6] digest_0.6.31      timechange_0.2.0   mime_0.12          lifecycle_1.0.4    sf_1.0-13         
[11] ellipsis_0.3.2     lmom_3.0           magrittr_2.0.3     compiler_4.3.2     rlang_1.1.1       
[16] sass_0.4.6         tools_4.3.2        yaml_2.3.7         utf8_1.2.3         askpass_1.1       
[21] htmlwidgets_1.6.2  classInt_0.4-9     plyr_1.8.8         xml2_1.3.4         KernSmooth_2.23-22
[26] withr_2.5.2        Lmoments_1.3-1     grid_4.3.2         fansi_1.0.4        xtable_1.8-4      
[31] e1071_1.7-13       colorspace_2.1-0   scales_1.3.0       MASS_7.3-60        cli_3.6.1         
[36] generics_0.1.3     rstudioapi_0.14    commonmark_1.9.0   DBI_1.1.3          cachem_1.0.8      
[41] proxy_0.4-27       base64enc_0.1-3    vctrs_0.6.2        boot_1.3-28.1      jsonlite_1.8.4    
[46] TLMoments_0.7.5.3  fontawesome_0.5.1  jquerylib_0.1.4    snow_0.4-4         units_0.8-2       
[51] goftest_1.2-3      glue_1.6.2         lubridate_1.9.2    gtable_0.3.4       later_1.3.1       
[56] munsell_0.5.0      tibble_3.2.1       pillar_1.9.0       htmltools_0.5.5    R6_2.5.1          
[61] lattice_0.21-9     backports_1.4.1    memoise_2.0.1      httpuv_1.6.11      bslib_0.4.2       
[66] class_7.3-22       Rcpp_1.0.10        checkmate_2.3.0    xfun_0.42          pkgconfig_2.0.3 
heroldn commented 4 months ago

Hi both, I don't have direct access to a Windows machine, if the installation went fine my first guess is that there's been a change in one of the dependencies in recent versions of R (and you both seem to be on the latest). If this is urgent I'd ask you to try installing an older version of R, e.g. 4.0.5. Otherwise I'll try get around to this in the next week or so (that doesn't mean I'll solve it in that time though).

ManishaSingh12560 commented 4 months ago

Hi! I am facing the same issue. I tried to run the sample data as well, but got the same error of x and y length difference. I tried using the online version but that is also not working, it is showing the calculation of the indices but is not giving the option or any link to download the final results.

heroldn commented 4 months ago

Ok please try replacing line 109 of services/quality_control_checks.R with: metadata$date.years <- unique(format(as.Date(merge_data[, 1]), "%Y"))

Something seems to have changed in Base R in a recent update that's changed the outcome of that line. I will commit this edit at some point, but let me know if it doesn't work.

ThomasAbinun commented 4 months ago

Hi heroldn, I encountered the same error (x and y lengths differ) By modifying line 109 as indicated, it works perfectly now. Thank you very much for your help. Thomas.

ManishaSingh12560 commented 4 months ago

Hi Herold, Thank you so much for responding. I tried this and it works perfectly well now.