Skip to content

Instantly share code, notes, and snippets.

View tucotuco's full-sized avatar

John Wieczorek tucotuco

  • Museum of Vertebrate Zoology
  • UC Berkeley
View GitHub Profile
#!/usr/bin/env python
#
# Copyright 2011 Jante LLC and University of Kansas
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@tucotuco
tucotuco / collectionsmetadata.json
Created May 17, 2011 00:29
Second pass at collections metadata JSON from Dan and Tuco
{
"collection":{
"source":"World Wildlife Fund (WWF)",
"type":"Ecoregion",
"name":"World Ecoregions",
"description":"The WWF's Conservation Science Program (CSP) has developed a biogeographic regionalization of the Earth's terrestrial biodiversity. WWF termed the biogeographic units ecoregions, defined as relatively large units of land or water containing distinct assemblages of natural communities sharing a large majority of species, dynamics, and environmental conditions. Ecoregions represent the original distribution of distinct assemblages of species and communities.",
"url":"http://www.worldwildlife.org/science/ecoregions/item1267.html",
"agreements":{
"0":"http://www.worldwildlife.org/agreement.html"
},
@tucotuco
tucotuco / gist:984026
Created May 20, 2011 23:44
Ecoregion item JSON example
{
"item":{
"source":"World Wildlife Fund (WWF)",
"type":"Ecoregion",
"name":"Admiralty Island lowland rain forests",
"description":"",
"storage":{
"location":"G:/MoL/....",
"format":"esri-shape"
},
@tucotuco
tucotuco / gist:984271
Created May 21, 2011 05:13 — forked from DanRosauer/collectionsmetadata.json
Ecoregion collection JSON example
{
"collection":{
"source":"World Wildlife Fund (WWF)",
"type":"Ecoregion",
"name":"World Ecoregions",
"description":"The WWF's Conservation Science Program (CSP) has developed a biogeographic regionalization of the Earth's terrestrial biodiversity. WWF termed the biogeographic units ecoregions, defined as relatively large units of land or water containing distinct assemblages of natural communities sharing a large majority of species, dynamics, and environmental conditions. Ecoregions represent the original distribution of distinct assemblages of species and communities.",
"url":"http://www.worldwildlife.org/science/ecoregions/item1267.html",
"agreements":{
"0":{"url": "http://www.worldwildlife.org/agreement.html"
"text": "A brief overview of the TOS",
vlsb-4172-1:metadata tuco$ ./iucnranges.py -d /Users/tuco/Data/MoL/mol-data/range/shp/animalia/species/ -u http://localhost:8080/metadataloader
INFO:root:Working directory: /Users/tuco/Data/MoL/mol-data/range/shp/animalia/species/
INFO:root:URL: http://localhost:8080/metadataloader
Traceback (most recent call last):
File "./iucnranges.py", line 199, in <module>
response = urllib2.urlopen(req)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 124, in urlopen
return _opener.open(url, data, timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 383, in open
if __name__== '__main__':
logging.basicConfig(level=logging.DEBUG)
options = _getoptions()
logging.info('Working directory: %s' %options.datadir)
logging.info('URL: %s' %options.url)
os.chdir(options.datadir)
url = options.url
values = dict(
payload=simplejson.dumps(newCollection()),
key_name='range/mol/animalia/species/1')
@tucotuco
tucotuco / gist:1107215
Created July 26, 2011 16:53
Metadata template for Jetz Bird Range Maps
{
"source":"International Union for Conservation of Nature (IUCN)",
"type":"Range",
"name":"Digital Distribution Maps of The IUCN Red List of Threatened Species",
"description":"This dataset contains distribution information of species assessed for The IUCN Red List of Threatened Species. The maps are developed as part of a comprehensive assessment of global biodiversity in order to highlight taxa threatened with extinction, and thereby promote their conservation.",
"url":"http://www.iucnredlist.org/spatial-data/2010.4/GISData/RLSpatial_metadata_Oct2010.pdf",
"agreements":{},
"creationDate": "2009-11",
"uploadDate": str(datetime.datetime.now()),
"changeDate": "2010-10",
class MultiPolygonLoader(BaseHandler):
""" Loads MultiPolygons from scripts in /utilities/metadata.
Example:
./iucnranges.py -d /Users/tuco/Data/MoL/mol-data/range/shp/animalia/species/ -u http://tuco.mol-lab.appspot.com/multipolygonloader -k MultiPolygon
"""
def post(self):
payload = self.request.get('payload')
name=self.request.get('name')
subname=self.request.get('subname')
source=self.request.get('source')
SELECT
i_feature_footprint.feature_id, geom_y, geom_x, radius, displayname,
i_scheme_term.term, g_collection.name, g_collection.mapaccuracyinmeters,
g_collection.coordprecision
FROM
i_feature_footprint,
g_feature,
g_feature_displayname,
i_scheme_term,
i_classification,
@tucotuco
tucotuco / gist:1130968
Created August 8, 2011 00:14
Proposed aliases for Worldclim variable names
WC_ALIAS = dict(
tmean1='m1',
tmean2='m2',
tmean3='m3',
tmean4='m4',
tmean5='m5',
tmean6='m6',
tmean7='m7',
tmean8='m8',
tmean9='m9',