@@ -104,24 +104,46 @@ As long as `relativedelta` objects rather than `datetime.timedelta` objects are
104
104
or the 365-day calendar.
105
105
106
106
<h2 > Implementation: Capability of incrementing dates by a number of years and/or months <br >
107
- Date last modified: 2017/02/06 <br >
107
+ Date last modified: 2017/02/09 <br >
108
108
Contributors: Xylar Asay-Davis
109
109
</h2 >
110
110
111
111
The implementation is on the branch:
112
112
https://github.com/xylar/MPAS-Analysis/tree/timekeeping_reorg
113
113
and in PR #102
114
114
115
- The proposed implementation uses ` dateutil.relativedelta.relativedelta ` to compute the expected
115
+ The proposed implementation adds a new class MpasRelativeDelta derived from
116
+ ` dateutil.relativedelta.relativedelta ` to compute the expected
116
117
increments in years and months (as well as days, hours, minutes and seconds, as needed).
117
- The function for converting a date string to a ` relativedelta ` is documented as follows:
118
+ The class is documented as follows
119
+ ``` python
120
+ class MpasRelativeDelta (relativedelta ):
121
+ """
122
+ MpasRelativeDelta is a subclass of dateutil.relativedelta for relative time
123
+ intervals with different MPAS calendars.
124
+
125
+ Only relative intervals (years, months, etc.) are supported and not the
126
+ absolute date specifications (year, month, etc.). Addition/subtraction
127
+ of datetime.datetime objects (but not other MpasRelativeDelta,
128
+ datetime.timedelta or other related objects) is supported.
129
+
130
+ Author
131
+ ------
132
+ Xylar Asay-Davis
133
+
134
+ Last Modified
135
+ -------------
136
+ 02/09/2017
137
+ ```
138
+
139
+ The function for converting a date string to a `MpasRelativeDelta` is documented as follows:
118
140
```python
119
141
from dateutil.relativedelta import relativedelta
120
142
...
121
143
def stringToRelativedelta(dateString, calendar='gregorian'):
122
144
"""
123
145
Given a date string and a calendar, returns an instance of
124
- `dateutil.relativedelta.relativedelta `
146
+ `MpasRelativeDelta `
125
147
126
148
Parameters
127
149
----------
@@ -147,7 +169,7 @@ def stringToRelativedelta(dateString, calendar='gregorian'):
147
169
148
170
Returns
149
171
------ -
150
- relativedelta : A `dateutil.relativedelta.relativedelta ` object
172
+ relativedelta : An `MpasRelativeDelta ` object
151
173
152
174
Raises
153
175
------
@@ -174,7 +196,9 @@ Analysis will be run on Edison with all available configurations found in `confi
174
196
are currently no plans to run with the `gregorian` calendar option, we do not have test runs that use this
175
197
calendar. If this situation changes in the future, we'll test at that time.
176
198
177
- Regression tests previously for ` Date ` has been modified to test the new utility functions.
199
+ Regression tests previously for `Date` has been modified to test the new utility functions. New tests
200
+ have been added to test that dates with both `gregorian` and `gregorian_noleap` calendars behave as
201
+ expected, particularly around the leap day.
178
202
179
203
<h1> Testing </h1>
180
204
<h2> Testing and Validation: Capability of incrementing dates by a number of years and/or months <br>
0 commit comments