Skip to content

Instantly share code, notes, and snippets.

@robinkraft
Created April 10, 2012 05:53
Show Gist options
  • Save robinkraft/2348543 to your computer and use it in GitHub Desktop.
Save robinkraft/2348543 to your computer and use it in GitHub Desktop.
sample Cascalog query FOSS4G
(defn modis->latlon
  "Converts the supplied MODIS coordinates into `[lat, lon]` based on
the supplied resolution.
Example usage:
(modis->latlon \"1000\" 8 6 12 12)
;=> (29.89583333333333 -115.22901262147285)"
  [res mod-h mod-v sample line]
  (->> (modis->global-mags res mod-h mod-v sample line)
       (apply global-mags->sinu-xy)
       (apply sinu-xy->latlon)))
(let [spatial-res "500"
src (hfs-seqfile "s3n://formadata/pixelcoords")
out-loc (hfs-seqfile "s3n://formadata/reprojected" :sinkfile :replace)]
(?<- out-loc [?mod-h ?mod-v ?sample ?line ?lat ?lon]
(src ?mod-h ?mod-v ?sample ?line)
(modis->latlon spatial-res ?mod-h ?mod-v ?sample ?line)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment