     res - The spatial resolution.
     tileseq - Map of country ISO keywords to MODIS tiles (see: forma.source.tilesets)"
   [tmp-path res tileseq]
+  {:pre [(coll? tileseq) 
+         (string? res)]}
   (let [tap (:sink (hfs-seqfile tmp-path))]
     (with-open [^TupleEntryCollector collector
                 (-> (hadoop/job-conf (conf/project-conf))

      (mangle #"," ?textline :> ?country ?admin-s)
      (u/strings->floats ?admin-s :> ?admin)))

(def blossom-chunk
  "Returns a Cascalog predicate macro that emits MODIS pixel values for each
  element in a DataChunk array.

  A DataChunk Thrift object is composed with a DataValue Thrift object which is
  an array of pixel values representing values at different periods. This query
  emits a tuple for each element in that array.

  Input variables:
    ?chunk - A DataChunk Thrift object.

  Output variables:
    ?s-res - The spatial resolution in meters as a string.
    ?mod-h - The MODIS tile coordinate column.
    ?mod-v - The MODIS tile coordinate row.
    ?sample - The MODIS tile pixel row.
    ?line - The MODIS tile pixel column.
    ?val - The pixel value

  Example usage:

    (let [src [[dc]]] ;; dc is a DataChunk Thrift object
         (??<-
           [?s-res ?mod-h ?mod-v ?sample ?line ?val]
           (src ?chunk)
           (blossom-chunk ?chunk :> ?s-res ?mod-h ?mod-v ?sample ?line ?val)))"
  (<- [?chunk :> ?s-res ?mod-h ?mod-v ?sample ?line ?val]
      (index ?static-chunk :> ?pix-idx ?val)      
      (schema/chunk-locval ?chunk :> ?loc ?static-chunk)
      (schema/chunkloc->pixloc ?loc ?pix-idx :> ?pixloc)
      (schema/pixel-prop-location ?pixloc :> ?pixlocval)
      (schema/unpack-pixel-location ?pixlocval :> ?s-res ?mod-h ?mod-v ?sample ?line)))

(defn chunkify [chunk-size]
  (<- [?dataset !date ?s-res ?t-res ?mh ?mv ?chunkid ?chunk :> ?datachunk]
      (schema/chunk-location ?s-res ?mh ?mv ?chunkid chunk-size :> ?location)
      (schema/mk-data-value ?chunk :> ?data-val)
      (schema/chunk-value ?dataset ?t-res !date ?location ?data-val :> ?datachunk)))

(def break
  "Takes a source of textlines representing rows of a gridded

        [forma.reproject :only (pixels-at-res)])
  (:require [forma.utils :as u]
            [forma.schema :as schema]
            [forma.reproject :as r]
            [forma.thrift :as thrift]
            [forma.hadoop.io :as io]
            [clojure.string :as s]
            [cascalog.ops :as c]
