esmf-org / esmf

The Earth System Modeling Framework (ESMF) is a suite of software tools for developing high-performance, multi-component Earth science modeling applications.
https://earthsystemmodeling.org/
Other
156 stars 75 forks source link

Add ESMF class corresponding to the ISO 8601 time interval string #96

Open darianboggs opened 1 year ago

darianboggs commented 1 year ago

ESMF needs a class to represent specific intervals in time.

Though ESMF has the ESMF_Time and ESMF_TimeInterval classes corresponding to ISO 8601 combined <date>T<time> strings and ISO 8601 time duration <duration> strings, respectively, there is no class corresponding to ISO 8601 time interval strings representing a specific interval in time representing a span from a start date and time to a end date and time. Though ISO 8601 allows four different strings,

<start>/<end>, <start>/<duration>, <duration>/<end>, and <duration>,

for such time intervals, an ESMF class for such a time interval would only need an internal representation using two ESMF_Time objects or a combination of an ESMF_Time object, a ESMF_TimeInterval object, and a flag indicating if the ESMF_Time object represents the start or end of the time interval.

oehmke commented 7 months ago

We added code to set a TimeInterval from a string, but that doesn't quite cover this case. We would need a way to parse an ISO string including a '/' to create a TimeInterval with a start time and a duration. @darianboggs would that be sufficient or do you also need a way to get an end time from a TimeInterval? (Or do you think that you need the entirely new class as you describe?)