ocmw.core.timeFuncs module¶
Basic time variable manipulation functions.
The format conversion functions take a single input timestamp value and convert to the requested format. To convert an array of values dtvals, use an embedded for loop around the function. For example to convert a list of date strings (dateStrList[])to a python datetime object use:
>>> dt = [datetimeFromStr(ds) for ds in dateStrList]
Generates a python datetime object from a date string with a format defined by timeFmt. |
|
Generates a python datetime object from a date number assuming the python default epoch 0001-01-01 00:00:00. |
|
Generates a date string from a python datetime object with the format defined by timeFmt. |
|
Generates a date string from a date number assuming the python default epoch of 0001-01-01 00:00:00, using the fromat defined by timeFmt. |
|
Generates a date number from a date string using the format defined by timeFmt, and python default epoch 0001-01-01 00:00:00. |
|
Converts a date number from the default python epoch 0001-01-01 00:00:00 to days from the epoch define in epochStr. |
|
Converts a date number based on the python default epoch 0001-01-01 00:00:00 to the matlab default epoch 0000-01-01 00:00:00. |
|
Converts a date number based on the matlab default epoch 0000-01-01 00:00:00 to the python default epoch 0001-01-01 00:00:00. |
|
Object used to determine if any part of a time record lies within a time bound defined by timeStart and timeEnd |
Basic time variable manipulation functions.
- class ocmw.core.timeFuncs.temporalCoverage(timeStart, timeEnd)[source]¶
Bases:
objectObject used to determine if any part of a time record lies within a time bound defined by timeStart and timeEnd
- ocmw.core.timeFuncs.datetimeFromStr(dateStr, timeFmt='%Y-%m-%d %H:%M:%S')[source]¶
Generates a python datetime object from a date string with a format defined by timeFmt.
- ocmw.core.timeFuncs.datetimeFromNum(dateNum)[source]¶
Generates a python datetime object from a date number assuming the python default epoch 0001-01-01 00:00:00.
- ocmw.core.timeFuncs.dateStrFromDatetime(dtime, timeFmt='%Y-%m-%d %H:%M:%S')[source]¶
Generates a date string from a python datetime object with the format defined by timeFmt.
- ocmw.core.timeFuncs.dateNumFromDatetime(dtime)[source]¶
Generates a date number from a python datetime object assuming the python default epoch of 0001-01-01 00:00:00.
- ocmw.core.timeFuncs.dateStrFromDateNum(dateNum, timeFmt='%Y-%m-%d %H:%M:%S')[source]¶
Generates a date string from a date number assuming the python default epoch of 0001-01-01 00:00:00, using the fromat defined by timeFmt.
- ocmw.core.timeFuncs.dateNumFromDateStr(dateStr, timeFmt='%Y-%m-%d %H:%M:%S')[source]¶
Generates a date number from a date string using the format defined by timeFmt, and python default epoch 0001-01-01 00:00:00.
- ocmw.core.timeFuncs.dateNumFromEpoch(dateNum, epochStr='0001-01-01 00:00:00')[source]¶
Converts a date number from the default python epoch 0001-01-01 00:00:00 to days from the epoch define in epochStr.