 ;; ##Constants
 
 (def
-  #^{:doc "Map between symbols and chosen substrings of MODIS subdataset keys."}
+  #^{:doc "Map between symbols and chosen substrings of
+MODIS subdataset keys."}
   *modis-subsets*
   {:evi "monthly EVI"
    :qual "VI Quality"

  (let [path (.toString hdf-file)]
    (metadata (gdal/Open path) "SUBDATASETS")))

;; ##Cascalog Custom Functions
;; These guys actually get called by the queries inside of core.

(defmapop
  #^{:doc "Generates metadata values for a given unpacked MODIS Dataset and a seq of keys."}
  [meta-values [meta-keys]] [modis]
  (let [metadata (metadata modis "")]
    (map #(.get metadata %) meta-keys)))

(defmapcatop
  #^{:doc "Stateful approach to unpacking HDF files. Registers all gdal formats,
Creates a temp directory, then saves the byte array to disk. This byte
array is processed with gdal, and then the temp directory is destroyed.
Function returns the decompressed MODIS file as a 1-tuple."}
  unpack {:stateful true}
  ([]
     (do

(ns forma.hdf
  (:use cascalog.api)
  (:import [org.gdal.gdal gdal Dataset Band]
           [org.gdal.gdalconst gdalconstConstants]
           [org.apache.hadoop.io BytesWritable])
  (:require [cascalog [ops :as c] [workflow :as w] [io :as io]]
            [clojure.contrib [math :as m] [io :as i] [string :as s]]))
