AI4S2S / s2spy

A high-level python package integrating expert knowledge and artificial intelligence to boost (sub) seasonal forecasting
https://ai4s2s.readthedocs.io/
Apache License 2.0
20 stars 7 forks source link

Decide on setter/getter methods for the Calendar classes #69

Closed BSchilperoort closed 1 year ago

BSchilperoort commented 2 years ago

In PR #60 the AdventCalendar is refactored to be a child of a BaseCalendar.

However, setter and getter methods have not been explicitly implemented, allowing users to modify the calendar as such:

>>> cal = AdventCalendar(anchor=(25, 12), freq='1d')
>>> cal.freq = '5d'
>>> cal.show()
# will show calendar with 5-day frequency

The calendar will actually use the changed frequency, but the frequency is actually not checked for validity. The following will not immediately raise an error:

cal.freq = 'abc'

The anchor also cannot be changed directly, but can be changed as such:

cal.day = 31

We should decide if we will allow modifying the calendar after initialization, or if we want to make the attributes read-only.

BSchilperoort commented 1 year ago

Implemented in #113