Skip to content

Instantly share code, notes, and snippets.

@danhammer
Created July 2, 2012 15:15
Show Gist options
  • Save danhammer/3033727 to your computer and use it in GitHub Desktop.
Save danhammer/3033727 to your computer and use it in GitHub Desktop.
(ns forma-local.core
(:use forma.thrift
cascalog.api
[forma.hadoop.pail :only (?pail- split-chunk-tap)])
(:require [incanter.core :as i]
[cascalog.ops :as c]
[forma.trends.analysis :as analyze]
[forma.thrift :as thrift]
[forma.classify.logistic :as log])
(:import [backtype.hadoop.pail Pail]))
(def ts-path "/mnt/hgfs/Dropbox/local/timeseries")
(def static-path "/mnt/hgfs/Dropbox/local/masterpail")
(defn dynamic-src [pail-path]
(let [src (split-chunk-tap pail-path ["ndvi"])]
(<- [?h ?v ?s ?l ?ndvi-ts]
(src _ ?x)
(unpack ?x :> ?dataset ?pixel-chunk ?ts ?tres _)
(unpack ?pixel-chunk :> ?sres ?h ?v ?s ?l)
(unpack ?ts :> _ _ ?ndvi)
(unpack* ?ndvi :> ?ndvi-ts))))
(defn vcf-src [pail-path]
(let [src (split-chunk-tap pail-path ["vcf"])]
(??<- [?h ?v ?s ?l ?vcf]
(src _ ?x)
(unpack ?x :> _ ?loc ?vcf-obj _ _)
(unpack ?loc :> _ ?h ?v ?s ?l)
(get-field-value ?vcf-obj :> ?vcf)
(>= ?vcf 25))))
(defn hansen-src [pail-path]
(let [src (split-chunk-tap pail-path ["hansen"])]
(??<- [?h ?v ?s ?l ?han-int]
(src _ ?x)
(unpack ?x :> _ ?loc ?hansen-obj _ _)
(unpack ?loc :> _ ?h ?v ?s ?l)
(get-field-value ?hansen-obj :> ?hansen)
(i/div ?hansen 100 :> ?han-int))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment