| | 80 | def test_convert_to_annual(self): |
| | 81 | "Test convert_to_annual" |
| | 82 | base = dict(D=1, H=24, T=24*60, S=24*3600) |
| | 83 | #for fq in ('D', 'H', 'T', 'S'): |
| | 84 | # Don't test for minuTe and Second frequency, too time consuming. |
| | 85 | for fq in ('D', 'H'): |
| | 86 | dates = date_array(start_date=Date(fq, '2001-01-01 00:00:00'), |
| | 87 | end_date=Date(fq, '2004-12-31 23:59:59')) |
| | 88 | bq = base[fq] |
| | 89 | series = time_series(range(365*bq)*3+range(366*bq), |
| | 90 | dates=dates) |
| | 91 | control = ma.masked_all((4, 366*bq), dtype=series.dtype) |
| | 92 | control[0, :58*bq] = range(58*bq) |
| | 93 | control[0, 59*bq:] = range(58*bq, 365*bq) |
| | 94 | control[[1, 2]] = control[0] |
| | 95 | control[3] = range(366*bq) |
| | 96 | test = convert_to_annual(series) |
| | 97 | assert_equal(test, control) |
| | 98 | |