   "Returns a vector containing the fire value, short drop,
   long drop and t-stat fields of the supplied `FormaValue`.
 
-  Example:
-  (unpack-forma-val {:fire-value
+    (unpack-forma-val {:fire-value
                        {:count 4, :conf-50 0, :temp-330 1, :both-preds 3},
-                     :short-drop -2.7,
-                     :long-drop -1.2,
-                     :t-stat 1.725})
-
-  ({:count 4, :conf-50 0, :temp-330 1, :both-preds 3} -2.7 -1.2 1.725)"
+                       :short-drop -2.7,
+                       :long-drop -1.2,
+                       :t-stat 1.725})
+
+    ;=> [{:count 4, :conf-50 0, :temp-330 1, :both-preds 3} -2.7 -1.2 1.725]"
   [forma-val]
   (map forma-val [:fire-value :short-drop :long-drop :t-stat]))
 

(defn unpack-pixel-location
  "Unpacks pixel-location object into a tuple.


   Example:
    (unpack-pixel-location
     {:spatial-res \"1000\", :mod-h 28, :mod-v 9, :sample 1199, :line 10})

    [\"1000\" 28 9 1199 10]"
  [loc]
  (map loc [:spatial-res :mod-h :mod-v :sample :line]))

(defn chunkloc->pixloc
  "Accepts a chunk location and a pixel index within that location and
   returns a pixel location.

  Example: 
   (chunkloc->pixloc
    {:spatial-res "1000", :mod-h 28, :mod-v 9, :index 59, :size 24000}
     23999)

   {:spatial-res "1000", :mod-h 28, :mod-v 9, :sample 1199, :line 1199}
   "

  [{:keys [spatial-res size index mod-h mod-v]} pix-idx]
  (apply pixel-location spatial-res mod-h mod-v
         (r/tile-position spatial-res size index pix-idx)))

(defn forma-value
  "Creates forma object containing various characteristics of pixel timeseries

    (forma-value {:temp-330 1, :conf-50 0, :both-preds 3, :count 4}
                  -2.7
                  -1.2
                  1.725)
    ;=> {:fire-value
         {:count 4, :conf-50 0, :temp-330 1, :both-preds 3},
         :short-drop -2.7,
         :long-drop -1.2,
         :t-stat 1.725}"
  [fire short long t-stat]
  {:fire-value (or fire (fire-value 0 0 0 0))
   :short-drop short
