   (in-days
    (interval (date-time (year a))
              a)))
+
+;; the julian function complements the other "date-piece"
+;; functions supplied by the clj-time library; day, month, year, and
+;; the others each allow for extraction of that particular element of
+;; a date. We define the delta function to allow us to take the
+;; difference
+;;
+;;    (delta julian a b)
+;;
+;; returns the difference between the julian day values of the two
+;; supplied dates. (Note that `(partial delta julian)` ignores the
+;; year value of each of the dates. That function returns the same
+;; value for a = Jan 1st, 2000, b = Feb 25th, 2000 and b = Feb 25th,
+;; 2002.
 
 (defn delta [f a b] (- (f b) (f a)))
 


;; In developing the time period conversion functions, we noticed that
;; as long as the time period remained consistent from dataset to
;; dataset, the ability to 0-index became irrelevant.  Our choice of
;; January 1st, 2000 ensures that, regardless of the date on which the
;; specific MODIS product became active, datasets at the same temporal
;; resolution will match up. With that in mind, we chose January 1st
;; 2000.

(def ref-date (date-time 2000))


    (+ (* years (per-year unit span))
       (quot units span))))

;; The following partial functions take care of the issue with delta
;; above, by calculating the span in periods across years.

(def months (partial delta-periods month 1))
(def sixteens (partial delta-periods julian 16))
(def eights (partial delta-periods julian 8))

;; We currently choose the period-func based on the resolution of the
;; data. This will have to be amended, as some datasets at different
;; temporal resolutions do indeed have the same spatial resolution.

(def period-func
  {"1000" months
