 ;; grid.
 
 (defn travel
-  "travel along a grid with cellsize `step` in the direction
-  given by `dir` from an initial position `start` to a position
-  `pos` which is intended to be, for most applications, row or
-  column within the grid.  Note that this takes you to the
-  centroid of the row or column position that you specify."
+  "travel along a grid with cellsize `step` in the direction given by
+  `dir` from an initial position `start` to a position `pos` which is
+  intended to be, for most applications, row or column within the
+  grid.  Note that this takes you to the centroid of the row or column
+  position that you specify."
   [step dir start pos]
   (-> start (dir (* pos step)) (dir (/ step 2))))
 


(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."
  [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)]

       (apply m/latlon->modis m-res)))

(defn downsample
  "This query is for a point grid at higher resolution than the
  reference grid, which is the MODIS grid in this case. (This is a
  constraining assumption, since MODIS is hard-coded into this
  function.  The aggregator function should be called as follows:
  c/sum, c/max, where c is the prefix refering to cascalog.ops."
  [dataset m-res ascii-info grid-source agg]
  (<- [?dataset ?m-res ?t-res ?mod-h ?mod-v ?sample ?line ?outval]
      (grid-source ?row ?col ?val)
