-
-
Save sritchie/9363935ac77cc8ef2f5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmulti julian->period | |
"Converts a given input date into an interval from the MODIS | |
beginnings, as specified by modis-start. Accepts DateTime objects, | |
strings that can be coerced into dates, or an arbitrary number of | |
integer pieces. See clj-time's date-time and from-string for more | |
information." | |
(fn [x & _] (type x))) | |
(defmethod julian->period DateTime | |
[date] | |
(in-periods (interval modis-start date))) | |
(defmethod julian->period String | |
[str] | |
(julian->period (from-string str))) | |
(defmethod julian->period Integer | |
[& int-pieces] | |
(julian->period (apply date-time int-pieces))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment