 (ns forma.hadoop.jobs.cdm
   "Functions and Cascalog queries for converting data into map tile coordinates."
   (:use [cascalog.api]
+        [cartodb.playground :only (insert-rows delete-all)]
+        [forma.source.gadmiso :only (gadm->iso)]
         [forma.gfw.cdm :only (latlon->tile, read-latlon, latlon-valid?)]
         [forma.utils :only (positions)])
   (:require [forma.postprocess.output :as o]

    series - A vector of numbers.

  Example usage:
    > (first-hit 5 [1 2 3 4 5 6 7 8 9 10])
    > 4
  "
  [thresh series]
  (first (positions (partial <= thresh) series)))


        (- ?period-new-res epoch :> ?rp)
        (min-period ?rp :> ?p)
        (r/modis->latlon ?sres ?modh ?modv ?s ?l :> ?lat ?lon)
        (latlon-valid? ?lat ?lon)
        (latlon->tile ?lat ?lon zoom :> ?x ?y ?z))))
