Skip to content

Instantly share code, notes, and snippets.

@robinkraft
robinkraft / humid.json
Created July 10, 2013 23:27
Two geojson files (humid tropics and countries), grouped on map.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@robinkraft
robinkraft / _.md
Created July 8, 2013 22:45
Tributary inlet
@robinkraft
robinkraft / _.md
Created June 20, 2013 19:23
uk geo hackery
@robinkraft
robinkraft / _.md
Created June 20, 2013 19:23
uk geo
@robinkraft
robinkraft / gist:5784896
Last active December 18, 2015 12:48
Sample output (sans name fields) for API. The first object is the output coming from CartoDB, while the second is the final output the user will see, after post-processing with Python. This is current as of https://github.com/wri/forma-api/commit/7fbfa35b453ec13ef7978c697716e8cab66346da
{
"url": "localhost:8080/api/counts/idn/10/91?range=2006-01-01,2010-01-01"
}
{
"time":0.056,
"sql":"SELECT id1,id2,iso,'[' || trim(Array_agg(to_char(date, 'YYYY-MM-DD'))::text, '{}\"') || ']' dates,'[' || trim(Array_agg(alerts)::text, '{}') || ']' sum FROM forma_gadm_50 WHERE iso='IDN' AND id1=10 AND id2=91 AND date >= '2006-01-01' AND date <= '2010-01-01' GROUP BY id1,id2,iso",
"total_rows":1,
"rows":[
{
@robinkraft
robinkraft / config.sh
Last active December 17, 2015 20:19
Generate credentials files for Vertnet data processing
echo "Configuring CartoDB. Please have your credentials ready and press 'enter' to continue."
read na
echo "Oauth key:"
read OAUTH_KEY
echo "Oauth secret:"
read OAUTH_SECRET
echo "Username:"
read USERNAME
echo "Password:"
read CDB_PASSWORD
@robinkraft
robinkraft / gist:5453802
Created April 24, 2013 17:15
Vertnet country list
United States 1336504
USA 1092987
717455
Mexico 411213
Canada 232908
Philippines 113397
Costa Rica 107979
Ecuador 104345
Peru 103994
Papua New Guinea 90493
cascading.tuple.TupleException: operation added the wrong number of fields, expected: ['?pubdate', '?url', '?eml', '?dwca', '?title', '?icode', '?description', '?contact', '?orgname', '?email', '?rights-extra', '?icode-extra', '?count', '?id', '?associatedmedia', '?associatedoccurrences', '?associatedreferences', '?associatedsequences', '?associatedtaxa', '?basisofrecord', '?bed', '?behavior', '?catalognumber', '?collectioncode', '?collectionid', '?continent', '?coordinateprecision', '?coordinateuncertaintyinmeters', '?country', '?countrycode', '?county', '?datageneralizations', '?dateidentified', '?day', '?decimallatitude', '?decimallongitude', '?disposition', '?earliestageorloweststage', '?earliesteonorlowesteonothem', '?earliestepochorlowestseries', '?earliesteraorlowesterathem', '?earliestperiodorlowestsystem', '?enddayofyear', '?establishmentmeans', '?eventattributes', '?eventdate', '?eventid', '?eventremarks', '?eventtime', '?fieldnotes', '?fieldnumber', '?footprintspatialfit', '?footprintwkt', '?format
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/cartodb/impl/SecuredCartoDBClient : Unsupported major.minor version 51.0, compiling:(core.clj:1)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3387)
at clojure.lang.Compiler.compile1(Compiler.java:7035)
at clojure.lang.Compiler.compile1(Compiler.java:7025)
at clojure.lang.Compiler.compile(Compiler.java:7097)
at clojure.lang.RT.compile(RT.java:387)
at clojure.lang.RT.load(RT.java:427)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
@robinkraft
robinkraft / gist:5424034
Created April 19, 2013 23:53
Investigating issue where optional fields aren't getting serialized. The optional param-break field is getting lost on serialization. Making it required solves the problem.
(use 'forma.hadoop.jobs.runner-test)
(in-ns 'forma.hadoop.jobs.runner-test)
(def ts-dc
"FormaValues wrapped in a TimeSeries object wrapped in a DataChunk"
(let [[forma-vals] (series->forma-values nil [1. 2.] [2. 3.] [3. 4.] [4. 5.])
loc (apply thrift/ModisPixelLocation* pix-loc)
ts (thrift/TimeSeries* 827 forma-vals)
dc (thrift/DataChunk* "trends" loc ts t-res)]
dc))