 
 (def map-dimensions [180 360])
 (def forma-res 0.5)
+
+(defn sqr
+  "Returns the square of x."
+  [x] (* x x))
 
 (defn dimensions-at-res
   "returns the pixel dimensions at the specified pixel width (in degrees)."

        (.reset stream)
        stream))))

(defmulti little-stream
  "Converts argument into a DataInputStream, with little endian byte
    order. Argument may be an Input Stream, File, String, byte array,
    or another LittleEndianDataInputStream. If the latter is true,
    acts as identity."
  type)

(derive java.lang.String ::fileable)
(derive java.io.File ::fileable)

(defmethod little-stream LittleEndianDataInputStream [x] x)

(defmethod little-stream InputStream [x]
  (LittleEndianDataInputStream. x))

(defmethod little-stream ::fileable [x]
  (little-stream (input-stream (io/file x))))

(defmethod little-stream io/*byte-array-type* [b]
  (little-stream (input-stream b)))

;; ## Data Extraction



(defn input-stream
  "Attempts to coerce the given argument to an InputStream, with added
  support for gzipped files. If the input argument does point to a
  gzipped file, the default buffer will be sized to fit one NOAA
  PREC/L binary data file at 0.5 degree resolution, or 24 groups of (*
  360 720) floats. To make sure that the returned GZIPInputStream will
  fully read into a supplied byte array, see forma.rain/force-fill."
  [arg]
  (let [^InputStream stream (io/input-stream arg)
        rainbuf-size (* 24 (floats-for-res forma-res))]
