Skip to content

Instantly share code, notes, and snippets.

View zarch's full-sized avatar

Pietro Zambelli zarch

  • Eurac research / SynapsEES
  • italy
View GitHub Profile
@zarch
zarch / subplot_weekdata.py
Created April 18, 2012 10:46
Plot week data as subplots
# -*- coding: utf-8 -*-
"""
____________________________________________________________
| +--------------------------------------------------------+ |
| ! ^ ___ --- ! |
| ! / \ _--_ / \ /\ / \ ! |
| ! / \__/ \ / \_-___-- \ / \ ! |
| ! / \___/ --__/ --__- ! |
| +-------+-------+-------+-------+-------+-------+--------+ |
| 04/02 04/03 04/04 04/02 04/03 04/04 04/04 |
@zarch
zarch / array_and_function.c
Created April 19, 2012 08:40
Arrays and pointers in C
#include <stdio.h>
#include <stdlib.h>
#define NROWS 8
#define NCOLS 3
/*
*
* This sample code is taken from:
*
* http://www.ibiblio.org/pub/languages/fortran/append-c.html
*
@zarch
zarch / pointer.c
Created April 20, 2012 14:30
Cycle for, for a 2d array given the pointer to the first element of the array
#include <math.h>
#include <stdio.h>
typedef struct __move__
{
short int length;
short int *mv;
short int *dir;
double *dist;
} move;
@zarch
zarch / .pylintrc
Created July 11, 2012 09:27
Pylint rc file for GRASS
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Profiled execution.
@zarch
zarch / announcement.rst
Created October 10, 2012 09:43
pygrass announcement

pygrass announcement

I am pleased to announce that the pygrass library, developed during the Google Summer of Code 2012, is now on GRASS trunk and need to be tested.

Before to continue the announcement, if you prefer the html version of this message please see: https://gist.github.com/gists/3864411

import sys
from imposm.parser import OSMParser
from time import time
from datetime import datetime
class NavTagsCounter(object):
turnrestrictions = 0
meanwayversion = 0
firstobject = datetime.max
@zarch
zarch / multiproc.py
Created April 1, 2013 22:38
using multiprocessing
import multiprocessing as mltp
def work(x, y):
return x * y
def worker(queue):
while True:
args = queue.get()
@zarch
zarch / error_grass_cython
Created April 8, 2013 11:06
Error compiling with Cython.
$ python2 setup.py build_ext -i
running build_ext
cythoning raster.pyx to raster.c
Error compiling Cython file:
------------------------------------------------------------
...
ctypedef stat STRUCT_STAT
@zarch
zarch / resample_array.py
Created March 26, 2014 13:18
resample a numpy array
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 25 22:55:20 2014
@author: pietro
"""
import itertools
import numpy as np
@zarch
zarch / mkclusters.py
Created July 9, 2014 15:43
make cluster using vector position with GRASS GIS and sklearn
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 8 15:31:10 2014
@author: pietro
"""
import numpy as np
from sklearn.cluster import (MeanShift, MiniBatchKMeans, Ward, KMeans,
SpectralClustering, DBSCAN, AffinityPropagation)