pywr / pywr-next

An experimental repository exploring ideas for a major revision to Pywr using Rust as a backend.
6 stars 4 forks source link

feat: updates to use of durations when resampling and aligning timeseries #205

Closed Batch21 closed 2 weeks ago

Batch21 commented 3 weeks ago

Main change is to switch to using milliseconds as the main unit for comparison and resampling. polars is also updated to v0.40.0

Batch21 commented 3 weeks ago

switching the units to milliseconds simplifies the code a bit and IMO the precision of using nanoseconds was probably unnecessary. What do you think?

Batch21 commented 2 weeks ago

I've removed the unused error.

I don't think the reference to nanoseconds in generate_timesteps_from_frequency can be removed completely as the polars Duration uses them internally to store a proportion of the stochastics. We could convert to milliseconds when creating the new datetime, but this seem a bit unnecessary:

+ TimeDelta::milliseconds(duration.nanoseconds() / NANOSECS_IN_MILLISECOND)