bfast2 / bfast2/bfast

bfastts: error if time series contains leap day

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
R
Stars
53
Forks
16
PR merge metrics
No merged PRs in 30d

Description

If we have the leap day (Feb 29) and also the day after (March 1) in the time series, `bfastts` fails with an error:
```
Error in merge.zoo(zoo(coredata(x), tt), zoo(, tt2)) :
series cannot be merged with non-unique index entries in a series
In addition: Warning messages:
1: In zoo(data, 1900 + as.POSIXlt(dates)$year + (yday365(dates) - 1)/365, :
some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique
```

MWE:
Fails:
```r
a = c(as.Date("2016-02-29"), as.Date("2016-03-01"))
b = 1:2
bfastts(b, a, type="irregular")
```
Works if we set it to be one day later:

```r
a = c(as.Date("2016-02-29"), as.Date("2016-03-01"))
b = 1:2
bfastts(b, a+1, type="irregular")
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.