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

Possible to set the threshold for frost day indices? #5

Open
catubela opened this issue Feb 25, 2021 · 5 comments
Open

Possible to set the threshold for frost day indices? #5

catubela opened this issue Feb 25, 2021 · 5 comments

Comments

@catubela
Copy link

I was wondering if it is possible to change the 0 degree threshold for the calculation of frost days? In the calculation of certain frost events, particularly in relation to plant damage, other thresholds are commonly used. It would be great to have the option to set the threshold for the "FD" index. Muchas gracias por tu ayuda!

@miturbide
Copy link
Member

Hi catubela, climate4R.climdex is a wrapper of the climdex package (implementing the ETCCDI core climate indices). The climate4R.indices package provides the option you describe together with other additional indices.

@catubela
Copy link
Author

catubela commented Feb 25, 2021

That great! I tried the install though and it was unsuccessful. It didn't work using the zip file either. Would you have any suggestions? This is what I got:
devtools::install_github(c("SantanderMetGroup/climate4R.indices"))
Downloading GitHub repo SantanderMetGroup/climate4R.indices@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: magrittr (1.5 -> 2.0.1 ) [CRAN]
5: transformeR (c1d2788df... -> 8d0e2325d...) [GitHub]

Enter one or more numbers, or an empty line to skip updates:1
magrittr (1.5 -> 2.0.1 ) [CRAN]
transformeR (c1d2788df... -> 8d0e2325d...) [GitHub]
Skipping 1 packages not available: convertR
Installing 2 packages: magrittr, convertR
Installing packages into ‘Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Error: Failed to install 'climate4R.indices' from GitHub:
(converted from warning) package ‘convertR’ is not available (for R version 4.0.2)

@jbedia
Copy link
Member

jbedia commented Feb 26, 2021

Hi. It seems that you need to install package convertR. It depends on external libraries (UDUNITS) required to ensure the unit consistency when computing multivariable indices. You will find some guidance in the convertR README. I hope this helps.

@catubela
Copy link
Author

catubela commented Mar 2, 2021

I wanted to post here to help anyone else in the same situation. I spent a lot of time trying to install the udunits library with cmake in Ubuntu. Ultimately, I managed to download convertR with a few commands in Ubuntu and R.
First in Ubuntu (Description: Ubuntu 20.04.1 LTS, Release:20.04), instead of trying to install udunits from source like I did, just input:

sudo apt install udunits-bin
sudo apt-get install libudunits2-0

If you get any warning about missing EXPAT or SSL libraries use the commands below and try again:

sudo apt update
sudo apt install libssl-dev
sudo apt-get install libexpat1-dev

Then, back in R, try: devtools::install_github("SantanderMetGroup/convertR")

If you get an error like this (As I did):

Error: (converted from warning) package 'udunits2' was built under R version 4.0.3
Execution halted
ERROR: lazy loading failed for package 'convertR'
* removing 'C:/Users/Documents/R/win-library/4.0/convertR'

It seems that the warnings are being converted to errors and causing the install to fail (see discussion here:r-lib/remotes#434)
Then input: Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS=TRUE)
Then you can try the install again and it will (hopefully) be successful (my install was):
devtools::install_github("SantanderMetGroup/convertR")
devtools::install_github(c("SantanderMetGroup/climate4R.indices"))

@catubela
Copy link
Author

catubela commented Mar 3, 2021

@miturbide The index.grid with index.code = "TNth" option is very useful thank you. Is there any functionality that I have missed that allows for getting the date-index for events (for example the first or last date when the minimum temperature <TNth)?

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

3 participants