 
 (defn index-textfile
   "Prepend a row index to a text file `old-file-name`, located at `base-path`,
-  and save in the same directory with new name `new-file-name`. The `num-drop`
-  parameter specifies the number of lines to drop from the beginning of the 
-  text file.  Note that indexing begins with the first textline not dropped,
-  and starts at 0. This function was originally written to clean an ASCII
-  raster file for input into the sampling functions."
+  and save in the same directory with new name `new-file-name`. The
+  `num-drop` parameter specifies the number of lines to drop from the
+  beginning of the text file.  Note that indexing begins with the
+  first textline not dropped, and starts at 0. This function was
+  originally written to clean an ASCII raster file for input into the
+  sampling functions."
   [base-path old-file-name new-file-name num-drop]
   (let [old-file (str base-path old-file-name)
         new-file (str base-path new-file-name)]

;; direction, between modis and wgs84. Replace with a calculation.

(defn sample-modis
  "This function is based on the reference MODIS grid (currently at 1000m res).  The
  objective of the function is to tag each MODIS pixel with a value from an input
  ASCII grid.  The process diverges based on whether the ASCII grid is at coarser or
  finer resolution than the MODIS grid.  If higher, then each ASCII point is assigned
  a unique MODIS identifier, and the duplicate values are aggregated based on an input
  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) static-datasets)
           grid-source (ascii-source ascii-path)]

  (map-indexed vector row))

(defn ascii-source [path]
  "create a source out of a pre-cleaned ASCII grid, which is
  associated with a map of characteristic values, such as resolution
  and extent.  The cleaned grid is located at `path` and has the row
  index values prepended on the rows, with the ASCII prelude (which is
  automatically added by Arc) already stripped and cataloged in the
  map of characteristic values."
  (let [source (hfs-textline path)]
    (<- [?row ?col ?val]
        (source ?line)
