sbegueria / SPEI

An R package for computing the Standardized Precipitation-Evapotranspiration Index (SPEI), Penman-Monteith and other reference evapotranspiration, SPI, etc.
78 stars 34 forks source link

Calculation of declination angle in Thornthwaite #29

Closed nikhil003 closed 2 years ago

nikhil003 commented 2 years ago

We are currently using the SPEI package for calculating drought indicators in our project. While doing so, we realised a slight difference in the implementation of thornthwaite PET specifically how declination angle is used.

In Vicente-Serrano et. al. (2010), the equations are given as

which is then used in computing hourly angle of sun rising

However, when looking at the implementation in thornthwaite.R, we noticed

    tanDelta <- c(-0.37012566,-0.23853358,-0.04679872,0.16321764, 0.32930908,0.40677729,0.3747741,0.239063,
                      0.04044485,-0.16905776,-0.33306377,-0.40743608)

which is a vector of values though we assumed that it would be a vector of values. This is identified after verifying that the values assigned to are just values of .

Seeing that the equations for declination angle and hourly angle of sun rising are standard equations, it seems that there is a small implementation issue.

sbegueria commented 2 years ago

Delta and tan(Delta) are computed instead of being hard-coded, resulting in slightly different results as tanDelta used before was a bad approximation. This will be consolidated in the upcoming version of the SPEI package. Resulting PET values are nearly identical, but the code is more clear and correct now.