This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests # http://docs.python-requests.org/en/latest/ | |
| import json | |
| def upsert_records(records, ckan_url, resource_id, ckan_api_key=None): | |
| """Send a list of records to CKAN Datastore and return a requests.Response | |
| object (see http://docs.python-requests.org/en/latest/api/#requests.Response). | |
| Example: | |
| url = "http://mysite.org/ckan" | |
| resource_id = "7d33cafe-0118-4b9a-8d8d-e82d1935e2ea" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import dballe | |
| from itertools import groupby | |
| import sys | |
| def do_report(db, station, date, records): | |
| """Create a report from a list of records of the same station,date.""" | |
| keyfoo = lambda r: ( | |
| r.get("timerange"), r.get("level") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.dispatch import receiver | |
| from django.db import models | |
| from django.contrib.auth.models import User | |
| @receiver(models.signals.post_migrate) | |
| def create_superuser(sender, **kwargs): | |
| if not User.objects.filter(username='admin').first(): | |
| User.objects.create_superuser('admin', 'admin@localhost', 'admin') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js"></script> | |
| <script> | |
| var map = null; | |
| var macroarea = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding: utf-8 | |
| import tornado.httpserver | |
| import tornado.iostream | |
| import tornado.ioloop | |
| import tornado.web | |
| import tornado.process | |
| import tornado.concurrent | |
| import concurrent.futures | |
| import subprocess |
NewerOlder