When I using my own data, the error appearing. I think maybe it cause by "gran == ‘sec'". My another data "gran == 'hr'" is no problem.  