 
 (defn low-res-sample
   "sample values off of a lower resolution grid than the MODIS grid."
-  [dataset ascii-info mod-source grid-source]
+  [dataset m-res ascii-info pixel-tap grid-source]
   (<- [?dataset ?m-res ?t-res ?mod-h ?mod-v ?sample ?line ?outval]
       (grid-source ?row ?col ?outval)
       (identity dataset :> ?dataset)
       (identity "00" :> ?t-res)
-      (mod-source ?m-res ?mod-h ?mod-v ?sample ?line)
-      (modis-sample ascii-info ?m-res ?mod-h ?mod-v ?sample ?line :> ?row ?col)))
+      (pixel-tap ?mod-h ?mod-v ?sample ?line)
+      (modis-sample ascii-info m-res ?mod-h ?mod-v ?sample ?line :> ?row ?col)))
 
 ;; TODO: Right now, we use the 0.1 as an indicator for conversion
 ;; direction, between modis and wgs84. Replace with a calculation.

                                   hv->tilestring)]
        [clojure.string :only (split)])
  (:require [cascalog.ops :as c]
            [clojure.contrib.duck-streams :as duck])
  (:gen-class))


  aggregator (sum, max, etc.).  If lower, each MODIS pixel is tagged with the ASCII
  grid cell that it falls within.  Note that the ASCII grid must be in WGS84, with row
  indices prepended and the ASCII header lopped off."
  ([m-res dataset pixel-tap ascii-path & [agg]]
     (let [ascii-info ((keyword dataset) datasets)
           grid-source (ascii-source ascii-path)]
       (if (>= (:cellsize ascii-info) 0.01)
         (low-res-sample dataset m-res ascii-info pixel-tap grid-source)
         (high-res-sample dataset m-res grid-source ascii-info agg)))))

;; THE JOB!
