 (defmain PreprocessAscii
   "TODO: This is only good for hansen datasets looking to be combined
   Tidy up. This needs to be combined with PreprocessStatic."
-  [dataset ascii-path pail-path & countries]
-  {:pre [(#{"hansen" "vcf"} dataset)]}
+  [dataset ascii-path pail-path s-res & countries]
+  {:pre [(#{"hansen" "vcf"} dataset)
+         (string? s-res)]}
   (with-fs-tmp [_ tmp-dir]
     (let [line-tap (hfs-textline ascii-path)
           pix-tap  (->> countries
                         (map read-string)
                         (apply tile-set)
-                        (p/pixel-generator tmp-dir "1000"))]
+                        (p/pixel-generator tmp-dir s-res))]
       (->> (s/static-modis-chunks static/chunk-size
                                   dataset
                                   ({"vcf" c/min "hansen" c/sum} dataset c/max)


(defn rain-chunker
  "Like `modis-chunker`, for NOAA PRECL data files."
  [m-res chunk-size tile-seq path pail-path]
  (with-fs-tmp [fs tmp-dir]
    (let [file-tap  (io/hfs-wholefile path)
          pix-tap   (p/pixel-generator tmp-dir m-res tile-seq)
          ascii-map (:precl static/static-datasets)]
      (->> (r/rain-chunks m-res ascii-map chunk-size file-tap pix-tap)
           (to-pail pail-path)))))

(defmain PreprocessRain
  "See project wiki for example usage."
  [path pail-path & countries]
  (let [countries (map read-string countries)]
    (rain-chunker "1000"
                  static/chunk-size
                  (apply tile-set countries)
                  path
                  pail-path)))

(defn static-chunker
  [m-res chunk-size tile-seq dataset agg ascii-path pail-path]
  (with-fs-tmp [_ tmp-dir]
    (let [line-tap (hfs-textline ascii-path)


(defmain PreprocessStatic
  "See project wiki for example usage."
  [dataset ascii-path output-path s-res & countries]
  {:pre [(string? s-res)]}
  (static-chunker s-res
                  static/chunk-size
                  (->> countries
                       (map read-string)
