Skip to content

Ranges made from CFTime Period can have floating point length #73

@rafaqz

Description

@rafaqz

length should really always be an Int to follow the AbstractArray interface... something is going wrong.

using CFTime , Dates
import CFTime: Period

# A DateTime360Day backed by a Float64 Period (which is what NCDatasets
# produces when reading a CF time variable from a 360-day-calendar netCDF file).
P  = Period{Float64, Val{86400}(), Val{0}()}      # 1-day unit, Float64-backed
DT = DateTime360Day{P, Val{(2001, 1, 1)}()}

start = DT(P(0.0))
stop  = DT(P(86400.0 * 23))
step_ = P(86400.0)
r = start:step_:stop
length(r)

Output:

24.0

Version:

(tmp) pkg> status
Status `/tmp/Project.toml`
  [179af706] CFTime v0.2.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions