First read the rainfall data. I have the data in xls format, so I am using xlrd module to read the data, if you have data in any other format, you can use some other method.
>>> # read the data from xls file >>> book = xlrd.open_workbook('rainfall.xls') >>> sheet = book.sheet_by_name('Sheet1') >>> rf = np.zeros((5844,)) >>> for i in range(rf.shape[0]): >>> rf[i] = sheet.cell_value(i+1,1)
Now you should have the data in appropriate format. You can check the format of data.
>>> print(rf.shape) (5844,)
You should get the output in same format, the digit could be different. If you get some error, make sure that your data is in numpy array format and has only one dimension.
>>> from rain_disagg import RainDisagg >>> foo = RainDisagg(rf) # initialize the class >>> foo.logM # log(M) matrix >>> foo.log_lambda # log(lambad) matrix >>> rf_12 = foo.disaggregate(rf) # disaggregate the rainfall into two compartments (eg. from 24 hourly to 12 hourly) >>> rf_6 = foo.disaggregate(rf_12) # disaggregate the rainfall into two compartments (eg. from 12 hourly to 6 hourly)