This file contains 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
# Find Cholesky decomposition | |
cvalue = numpy.linalg.cholesky( covar_matrix ) | |
# Locally store size of matrix | |
dims = covar_matrix.shape | |
# Add normal deviate to value, preserving lower triangular | |
covar_proposed = numpy.multiply( cvalue + random_update, numpy.tri(dims[0])) | |
# Square and replace | |
covar_proposed = covar_proposed*transpose(covar_proposed) |
This file contains 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
# -*- coding: utf-8 -*- | |
import numpy, pylab | |
pylab.plot (numpy.arange(10), numpy.arange(10,0,-1), 'o') | |
ax = pylab.gca() | |
ax.set_xticks( (2, 4, 6, 8) ) | |
labels = ax.set_xticklabels(('Martin', 'deKauwe', 'Jose', 'Gomez')) | |
for l in labels: | |
l.set_rotation(45) | |
l.set_fontsize(12) | |
This file contains 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 ctypes | |
""" | |
The Coord struct in C-land | |
typedef struct | |
{ | |
double lon,lat; | |
double area; | |
} Coord; | |
The Config struct in C-land |
This file contains 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
.read init_spatialite-2.3.sql utf-8 | |
.loadshp <path> <table> <utf-8> <srid> <column_name> | |
SELECT AddGeometryColumn('<my_table>', 'geom', 4326, 'POLYGON', 2); | |
UPDATE my_table SET geom=( SELECT g.geom FROM my_table d, my_shape g WHERE d.grid_id=g.id) ; |
This file contains 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 matplotlib,numpy | |
import pylab | |
# A random colormap for matplotlib | |
cmap = matplotlib.colors.ListedColormap ( numpy.random.rand ( 256,3)) | |
pylab.imshow ( Z, cmap = cmap) | |
pylab.show() |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
Created on Tue May 18 12:18:12 2010 | |
This script takes 2 or three input parameters: | |
* shapefile name | |
* FieldName1 to aggregate on | |
* FieldName2 to aggregate (Optional) | |
It opens the shapefile, and iterates through features |
This file contains 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 process_LST_files(self, modis_sd, lon, lat, view_zenith_angle): | |
UNDEF = 0 | |
sds_name = {'lst':'LST_Day_1km', 'qc': 'QC_Day', | |
'view':'Day_view_time', 'angle':'Day_view_angl', | |
'lstnight': 'LST_Night_1km', 'qcnight': 'QC_Night', \ | |
'viewnight':'Night_view_time', | |
'anglenight':'Night_view_angl' } | |
data = dict(zip ( [var for var in sds_name.iterkeys()], \ | |
[ modis_sd.select(layer).get() \ |
This file contains 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 __future__ import division | |
from scikits.audiolab import flacread | |
from numpy.fft import rfft, irfft | |
from numpy import argmax, sqrt, mean, diff, log | |
from matplotlib.mlab import find | |
from scipy.signal import blackmanharris, fftconvolve | |
from time import time | |
import sys | |
# Faster version from http://projects.scipy.org/scipy/browser/trunk/scipy/signal/signaltools.py |
This file contains 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
# Version from SciPy.signal | |
def correlate(in1, in2, mode='full'): | |
"""Cross-correlate two N-dimensional arrays. | |
Description: | |
Cross-correlate in1 and in2 with the output size determined by mode. | |
Inputs: |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
""" | |
A script to create daily averae values from NCEP reanalysis netcdf data. | |
Saves the data as GeoTIFFs with daily | |
:version: 1 | |
:author: Jose Gomez-Dans < [email protected]> | |
""" |
OlderNewer