   [(reduce min (map first tuples))])
 
 (defn first-hit
-  "Returns the index of the first value in a vector of numbers that is greater
-  than or equal to a threshold.
-
-  Arguments:
-    thresh - The threshold value.
-    series - A vector of numbers.
+  "Returns the index of the first value in a vector of numbers that is
+  greater than or equal to a threshold. `thresh` - The threshold
+  value.  `series` - A vector of numbers.
 
   Example usage:
     (first-hit 5 [1 2 3 4 5 6 7 8 9 10]) => 4"

        (latlon->tile ?lat ?lon zoom :> ?x ?y ?z))))

(defn forma->cdm
  "Returns a Cascalog query that transforms FORMA data into map tile coordinates.

  Arguments:
    start - Start period date string.
    src - The source tap for FORMA data.
    gadm-src - a sequence file source with mod-h, mod-v, sample, line, and gadm
    thresh - The threshold number for valid detections.
    tres - The temporal resolution as a string.
    tres-out - The output temporal resolution as a string.
    zoom - The map zoom level."
  [src gadm-src zoom tres tres-out start thresh]
  (let [epoch (date/datetime->period tres-out "2000-01-01")
        start-period (date/datetime->period tres start)]

  (first (positions (partial <= thresh) series)))

(defn hansen->cdm
  "Returns a Cascalog query that transforms Hansen data into map tile
  coordinates. `src` - The source tap.  `zoom` - The map zoom level.
  `tres` - The temporal resolution."
  [src zoom tres]
  (let [epoch (date/datetime->period tres "2000-01-01")
        hansen (date/datetime->period tres "2010-12-31")
