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

Documentation #10

Closed
3 tasks done
meztez opened this issue Nov 27, 2021 · 20 comments
Closed
3 tasks done

Documentation #10

meztez opened this issue Nov 27, 2021 · 20 comments

Comments

@meztez
Copy link
Collaborator

meztez commented Nov 27, 2021

  • Document individual R functions
  • Document individual C++
  • Produce beautiful package vignettes that explain how to use package
@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

@cmahony start poking around

@cmahony
Copy link
Collaborator

cmahony commented Mar 23, 2022

@meztez great to see the progress. i'm out of commission for the next couple of days, but can have a look on friday. Is there a way for me to test the package yet?

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

@cmahony https://github.com/bcgov/climR-pnw, check README.

@cmahony
Copy link
Collaborator

cmahony commented Mar 23, 2022

@meztez
ERROR: lazy loading failed for package 'climRpnw'

  • removing 'C:/Users/CMAHONY/Documents/R/win-library/4.0/climRpnw'
    Error: Failed to install 'climRpnw' from GitHub:
    (converted from warning) installation of package ‘C:/Users/CMAHONY/AppData/Local/Temp/Rtmpc3QKBS/file560c39d15653/climRpnw_0.0.0.9000.tar.gz’ had non-zero exit status

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

Wondering if it is a missing dependency from another package. Do you have the full log?

> remotes::install_github("bcgov/climR-pnw")
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo bcgov/climR-pnw@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?
  
  1: All                            
2: CRAN packages only             
3: None                           
4: rlang (1.0.1 -> 1.0.2  ) [CRAN]
5: Rcpp  (1.0.8 -> 1.0.8.3) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 3checking for file/tmp/RtmpJ12RPH/remotes4eeb45760d67/bcgov-climR-pnw-e8cb238/DESCRIPTION...preparingclimRpnw:checking DESCRIPTION meta-information ...checking for LF line-endings in source and make files and shell scriptschecking for empty or unneeded directoriesbuildingclimRpnw_0.0.0.9000.tar.gzInstalling package into/home/bruno/R/x86_64-pc-linux-gnu-library/4.1’
(aslibis unspecified)
* installing *source* packageclimRpnw...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (climRpnw)

Will post Windows results, in a bit

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

Windows

> remotes::install_github("bcgov/climR-pnw")
Downloading GitHub repo bcgov/climR-pnw@HEAD
Installing 23 packages: fastmap, rlang, sys, askpass, R6, openssl, mime, jsonlite, curl, glue, Rcpp, cachem, ini, httr, gitcreds, cli, terra, sp, memoise, gh, data.table, ncdf4, raster
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/fastmap_1.1.0.zip'
Content type 'application/zip' length 215411 bytes (210 KB)
downloaded 210 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/rlang_1.0.2.zip'
Content type 'application/zip' length 1719584 bytes (1.6 MB)
downloaded 1.6 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/sys_3.4.zip'
Content type 'application/zip' length 59816 bytes (58 KB)
downloaded 58 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/askpass_1.1.zip'
Content type 'application/zip' length 243690 bytes (237 KB)
downloaded 237 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/R6_2.5.1.zip'
Content type 'application/zip' length 84256 bytes (82 KB)
downloaded 82 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/openssl_2.0.0.zip'
Content type 'application/zip' length 3994824 bytes (3.8 MB)
downloaded 3.8 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/mime_0.12.zip'
Content type 'application/zip' length 48094 bytes (46 KB)
downloaded 46 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/jsonlite_1.8.0.zip'
Content type 'application/zip' length 1155893 bytes (1.1 MB)
downloaded 1.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/curl_4.3.2.zip'
Content type 'application/zip' length 4322463 bytes (4.1 MB)
downloaded 4.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/glue_1.6.2.zip'
Content type 'application/zip' length 171998 bytes (167 KB)
downloaded 167 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/Rcpp_1.0.8.3.zip'
Content type 'application/zip' length 3356433 bytes (3.2 MB)
downloaded 3.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/cachem_1.0.6.zip'
Content type 'application/zip' length 79002 bytes (77 KB)
downloaded 77 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/ini_0.3.1.zip'
Content type 'application/zip' length 15750 bytes (15 KB)
downloaded 15 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/httr_1.4.2.zip'
Content type 'application/zip' length 518572 bytes (506 KB)
downloaded 506 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/gitcreds_0.1.1.zip'
Content type 'application/zip' length 97514 bytes (95 KB)
downloaded 95 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/cli_3.2.0.zip'
Content type 'application/zip' length 1256437 bytes (1.2 MB)
downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/terra_1.5-21.zip'
Content type 'application/zip' length 41915570 bytes (40.0 MB)
downloaded 40.0 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/sp_1.4-6.zip'
Content type 'application/zip' length 2200739 bytes (2.1 MB)
downloaded 2.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/memoise_2.0.1.zip'
Content type 'application/zip' length 50284 bytes (49 KB)
downloaded 49 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/gh_1.3.0.zip'
Content type 'application/zip' length 141809 bytes (138 KB)
downloaded 138 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/data.table_1.14.2.zip'
Content type 'application/zip' length 2599534 bytes (2.5 MB)
downloaded 2.5 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/ncdf4_1.19.zip'
Content type 'application/zip' length 3271923 bytes (3.1 MB)
downloaded 3.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/raster_3.5-15.zip'
Content type 'application/zip' length 4123748 bytes (3.9 MB)
downloaded 3.9 MB

packagefastmapsuccessfully unpacked and MD5 sums checked
packagerlangsuccessfully unpacked and MD5 sums checked
packagesyssuccessfully unpacked and MD5 sums checked
packageaskpasssuccessfully unpacked and MD5 sums checked
packageR6successfully unpacked and MD5 sums checked
packageopensslsuccessfully unpacked and MD5 sums checked
packagemimesuccessfully unpacked and MD5 sums checked
packagejsonlitesuccessfully unpacked and MD5 sums checked
packagecurlsuccessfully unpacked and MD5 sums checked
packagegluesuccessfully unpacked and MD5 sums checked
packageRcppsuccessfully unpacked and MD5 sums checked
packagecachemsuccessfully unpacked and MD5 sums checked
packageinisuccessfully unpacked and MD5 sums checked
packagehttrsuccessfully unpacked and MD5 sums checked
packagegitcredssuccessfully unpacked and MD5 sums checked
packageclisuccessfully unpacked and MD5 sums checked
packageterrasuccessfully unpacked and MD5 sums checked
packagespsuccessfully unpacked and MD5 sums checked
packagememoisesuccessfully unpacked and MD5 sums checked
packageghsuccessfully unpacked and MD5 sums checked
packagedata.tablesuccessfully unpacked and MD5 sums checked
packagencdf4successfully unpacked and MD5 sums checked
packagerastersuccessfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\gen01914\AppData\Local\Temp\RtmpED1ofq\downloaded_packages
Running `R CMD build`...
* checking for file 'C:\Users\gen01914\AppData\Local\Temp\RtmpED1ofq\remotes2ed853f469e\bcgov-climR-pnw-e8cb238/DESCRIPTION' ... OK
* preparing 'climRpnw':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'climRpnw_0.0.0.9000.tar.gz'
* installing *source* package 'climRpnw' ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'climRpnw'
    finding HTML links ... done
    append_calc                             html  
    baseline                                html  
    cache_exists                            html  
    cache_path                              html  
    calc_DD_above_18                        html  
    calc_DD_above_5                         html  
    calc_DD_below_0                         html  
    calc_DD_below_18                        html  
    calc_EMT                                html  
    calc_EXT                                html  
    calc_FFP                                html  
    calc_NFFD                               html  
    calc_PAS                                html  
    calc_RH                                 html  
    calc_bFFP                               html  
    calc_eFFP                               html  
    content_get                             html  
    data_delete                             html  
    data_download                           html  
    data_get                                html  
    data_path                               html  
    data_update                             html  
    downscale                               html  
    future                                  html  
    lapse_rate                              html  
    lapse_rate_mem                          html  
    list_data                               html  
    list_dem                                html  
    list_gcm                                html  
    list_normal                             html  
    list_parse                              html  
    list_period                             html  
    list_ssp                                html  
    list_unique                             html  
    list_variables                          html  
    variables                               html  
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (climRpnw)

@cmahony
Copy link
Collaborator

cmahony commented Mar 23, 2022

@meztez it's tripping up on package 'curl'. i'm troubleshooting it but see below in bold.

remotes::install_github("bcgov/climR-pnw")
Downloading GitHub repo bcgov/climR-pnw@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All
2: CRAN packages only
3: None
4: glue (1.4.2 -> 1.6.2 ) [CRAN]
5: Rcpp (1.0.6 -> 1.0.8.3) [CRAN]
6: cachem (1.0.3 -> 1.0.6 ) [CRAN]
7: cli (3.0.1 -> 3.2.0 ) [CRAN]
8: sp (1.4-5 -> 1.4-6 ) [CRAN]
9: memoise (2.0.0 -> 2.0.1 ) [CRAN]
10: gh (1.2.0 -> 1.3.0 ) [CRAN]
11: data.table (1.13.6 -> 1.14.2 ) [CRAN]
12: ncdf4 (1.17 -> 1.19 ) [CRAN]
13: raster (3.4-5 -> 3.5-15 ) [CRAN]

Enter one or more numbers, or an empty line to skip updates:1
curl (NA -> 4.3.2 ) [CRAN]
glue (1.4.2 -> 1.6.2 ) [CRAN]
Rcpp (1.0.6 -> 1.0.8.3) [CRAN]
cachem (1.0.3 -> 1.0.6 ) [CRAN]
cli (3.0.1 -> 3.2.0 ) [CRAN]
sp (1.4-5 -> 1.4-6 ) [CRAN]
memoise (2.0.0 -> 2.0.1 ) [CRAN]
gh (1.2.0 -> 1.3.0 ) [CRAN]
data.table (1.13.6 -> 1.14.2 ) [CRAN]
ncdf4 (1.17 -> 1.19 ) [CRAN]
raster (3.4-5 -> 3.5-15 ) [CRAN]
Installing 11 packages: curl, glue, Rcpp, cachem, cli, sp, memoise, gh, data.table, ncdf4, raster
Installing packages into ‘C:/Users/CMAHONY/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/curl_4.3.2.zip'
Content type 'application/zip' length 4322353 bytes (4.1 MB)
downloaded 4.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/glue_1.6.2.zip'
Content type 'application/zip' length 172003 bytes (167 KB)
downloaded 167 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/Rcpp_1.0.8.3.zip'
@meztez I'm troubleshooting a problem with the Package 'curl'. see highlighted lines.

Content type 'application/zip' length 3355085 bytes (3.2 MB)
downloaded 3.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/cachem_1.0.6.zip'
Content type 'application/zip' length 78891 bytes (77 KB)
downloaded 77 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/cli_3.2.0.zip'
Content type 'application/zip' length 1256771 bytes (1.2 MB)
downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/sp_1.4-6.zip'
Content type 'application/zip' length 2198811 bytes (2.1 MB)
downloaded 2.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/memoise_2.0.1.zip'
Content type 'application/zip' length 50145 bytes (48 KB)
downloaded 48 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/gh_1.3.0.zip'
Content type 'application/zip' length 141472 bytes (138 KB)
downloaded 138 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/data.table_1.14.2.zip'
Content type 'application/zip' length 2600495 bytes (2.5 MB)
downloaded 2.5 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/ncdf4_1.19.zip'
Content type 'application/zip' length 3271626 bytes (3.1 MB)
downloaded 3.1 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/raster_3.5-15.zip'
Content type 'application/zip' length 4117613 bytes (3.9 MB)
downloaded 3.9 MB

package ‘curl’ successfully unpacked and MD5 sums checked
Error: Failed to install 'climRpnw' from GitHub:
(converted from warning) cannot remove prior installation of package ‘curl’

@cmahony
Copy link
Collaborator

cmahony commented Mar 23, 2022

@meztez i got it to work by restarting r

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

That's a classic on windows. It fails because remotes is already using curl to download packages. On Windows, packages with C dll object cannot be replaced while they are used, unlike linux.

What I suggest is just installing climRpnw, without updating your existing packages.

You can always do that with update.packages().

@cmahony
Copy link
Collaborator

cmahony commented Mar 23, 2022

roger that. something for documentation.

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

That's a classic on windows. It fails because remotes is already using curl to download packages. On Windows, packages with C dll object cannot be replaced while they are used, unlike linux.

What I suggest is just installing climRpnw, without updating your existing packages.

You can always do that with update.packages().

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

@meztez

Create a baseline

normal <- baseline()

Select GCM

gcm <- future(

  • gcm = c("BCC-CSM2-MR", "CanESM5", "IPSL-CM6A-LR"),
  • ssp = c("ssp126", "ssp245"),
  • period = "2041_2060",
  • max_run = 3
  • )
    Error in R_nc4_open: Invalid argument
    Error in ncdf4::nc_open(filename, readunlim = FALSE, suppress_dimvals = TRUE) :
    Error in nc_open trying to open file C:\Users\CMAHONY\AppData\Local\R\cache\R\climRpnw\inputs\gcm\BCC-CSM2-MR\gcmData.BCC-CSM2-MR.pr.nc (return_on_error= FALSE )

Wondering if there was a hiccup during data_update(). Could you send me a copy the file at the location: C:\Users\CMAHONY\AppData\Local\R\cache\R\climRpnw\inputs\gcm\BCC-CSM2-MR\gcmData.BCC-CSM2-MR.pr.nc

@cmahony
Copy link
Collaborator

cmahony commented Mar 23, 2022

sent by email

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

sent by email

I was able to reproduce the problem on Windows. Give me a second.

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

@cmahony do a data_delete(), reinstall climRpnw, reload session, load climRpnw and redo data_update(). Sorry for the delays, depending on machine configuration, Windows does not always download file in binary mode. I've explicitly configured it this time.

@cmahony
Copy link
Collaborator

cmahony commented Mar 23, 2022

data_delete()
Error in winDialog("yesnocancel", msg) : invalid 'message' argument

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

@cmahony All right. Let me test some more on Windows. I'll circle back to you.

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

@cmahony It works with the latest commit. Still investigating performance issue on Windows.

Also you might get

Error in x$.self$finalize() : attempt to apply non-function
Error in (function (x)  : attempt to apply non-function
Error in (function (x)  : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function
Error in x$.self$finalize() : attempt to apply non-function

These messages can be ignored per terra package maintainer comments. But they are annoying and I'm not done shusing them all.

@cmahony
Copy link
Collaborator

cmahony commented Mar 23, 2022

@meztez wow you are a true magic man. running well and with the test i did it was 25x faster than climateBC. I will send this to Will and Kiri and do a more thorough review on Friday. what is the best way for us to provide you with itemized feedback?

@meztez
Copy link
Collaborator Author

meztez commented Mar 23, 2022

@cmahony keep them in a separate. I'm not done with speed up. Most of the time was spent on computing lapse rate. I'm moving that somewhere as the caching does not want to cooperate due to Error mentioned in my previous comment.

@meztez meztez closed this as completed Mar 23, 2022
R package for downscaled monthly climate normals automation moved this from To do to Done Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants