e-baumer/standard_precip

@oliverangelil @iameztoy The newest lmoment3 package

Opened this issue · 1 comments

          @oliverangelil @iameztoy 

Really sorry for the delay. I recently had some time to go back to this and look. I was fitting distributions using Scipy and I didn't really take the time to understand how they were fitting the distributions. The R-package and the NCAR program are using l-moments to fit the distribution.

I implemented the lmoments3 package and now the results are consistent with R and NCAR.

Thank you guys for pointing this out and I'm really sorry this took so long.

from standard_precip import spi
import numpy as np  

SPI = spi.SPI()    
rainfall_data = np.genfromtxt('data/rainfall_test2.csv', delimiter=',')
SPI.set_rolling_window_params(span=10, window_type='boxcar', center=False)
SPI.set_distribution_params(dist_type='gam')
result = SPI.calculate(rainfall_data, starting_month=1)
print (result[-10:].T)

>>> [[ 1.22413246  1.51489351  1.44305272  1.4146816   1.72507352  1.6718702
   1.83455935  1.53496329  0.76220079 -0.09562831]]

Also, I've updated for pep8 compliance and started adding testing. Please keep looking at the code and let me know if there are any other issues.

Thanks!!

Originally posted by @e-baumer in #2 (comment)

Hi! The lmoment3 have already upgraded 1.0.6 version which supports fit 'glo' distribution based on lmoments. Request a replacement.