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
def cokriging_in_r(self, x, y, z): | |
''' | |
Cokriging (and ordinary kriging) is quite fast in R. | |
This would anyway be more pragmatic than rewriting/porting it to Python. | |
For the moment this will be the 'best' way as R makes it very easy to | |
use kriging without fitting a variogram model, but using a standard | |
variogram. | |
''' | |
import rpy2 | |
import rpy2.robjects as robj |
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 waterqmap.maps.models import Map,MapDate | |
from django.contrib import admin | |
class MapDateInline(admin.TabularInline): | |
#this is the foreignkey | |
model = MapDate | |
class MapAdmin(admin.ModelAdmin): | |
prepopulated_field = {"slug": ("title",)} | |
inlines = [MapDateInline] |
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 urllib2, simplejson | |
# Hier de respons van de website als je de query opent. | |
response = simplejson.dumps(urllib2.urlopen("http://search.twitter.com/search.json?geocode=51.985263,5.663259,5km&q=forum").readline()) | |
# Format de website zo dat python het kan lezen als python objecten ipv JSON | |
# de 5 en de 1 slaan op de indexing van de response. Het 5e item zijn de tweets zelf in deze request, kan misschien verschillen per search. | |
loadaspy = simplejson.loads(simplejson.loads(response)).items()[4][1] |
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
class Points(models.Model): | |
routes = models.ForeignKey(Routes) | |
categories = models.ForeignKey(Categories) | |
attribution = models.CharField(max_length=255) | |
title = models.CharField(max_length=65) | |
lat = models.FloatField() | |
lon = models.FloatField() | |
imageURL = models.URLField(verify_exists=True) | |
line2 = models.CharField(max_length=40) | |
line3 = models.CharField(max_length=40, blank=True, null=True) |
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.db import models | |
from django.contrib import admin | |
from django.contrib.admin import widgets | |
from django.forms import ModelForm | |
from django import forms | |
import datetime | |
TITLE_CHOICES = ( | |
('Dhr', 'Dhr.'), | |
('Mw', 'Mw.'), |
NewerOlder