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 -*- | |
""" | |
@author: mthh | |
Convert a csv file (containing WKT geometry) into a shapefile | |
""" | |
from osr import SpatialReference | |
import ogr | |
from csv import DictReader | |
import sys |
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 -*- | |
# The MIT License (MIT) | |
# | |
# « Copyright (c) 2015, mthh | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is |
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 -*- | |
""" | |
@author: mthh | |
""" | |
import geopandas as gpd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import gpd_lite_toolbox as glt |
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 -*- | |
""" | |
@author: mthh | |
------------- | |
Example of loading node coordinates from an osrm or osrm.node file | |
in order to search the nearest OSRM node of an input points dataset. | |
""" | |
import csv | |
import sys | |
import numpy as np |
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 Rscript | |
require(base) | |
require(methods) | |
require(stats) | |
require(pbdZMQ) | |
require(jsonlite) | |
startServer_test <- function(port){ | |
ctx = zmq.ctx.new() | |
socket = zmq.socket(ctx, .pbd_env$ZMQ.ST$REP) |
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
require(pbdZMQ) | |
require(methods) | |
require(stats) | |
require(base) | |
R_Worker <- function(identifiant, worker_url = 'ipc:///tmp/feeds/workers'){ | |
ctx = zmq.ctx.new() | |
socket = zmq.socket(ctx, .pbd_env$ZMQ.ST$REQ) | |
zmq.setsockopt(socket, .pbd_env$ZMQ.SO$IDENTITY, identifiant) | |
zmq.connect(socket, worker_url) |
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 -*- | |
""" | |
R client (through Rpy2) trying to be used in a background for a WebPage | |
providing a R interactive console. | |
@author: mz | |
""" | |
import threading | |
import time | |
import zmq | |
import sys |
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 -*- | |
""" | |
@author: mz | |
""" | |
import threading | |
import time | |
import zmq | |
import sys | |
import os | |
import pickle |
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
getHexGrid <- function(spdf, cellsize){ | |
boundingBox <- bbox(spdf) | |
boundingBox[1,1] <- boundingBox[1,1] - cellsize | |
boundingBox[2,1] <- boundingBox[2,1] - cellsize | |
boundingBox[2,2] <- boundingBox[2,2] + cellsize | |
cols = ceiling(((boundingBox[1,2] - boundingBox[1,1]) + 3 * cellsize) / cellsize) | |
rows = ceiling((boundingBox[2,2] - boundingBox[2,1]) / cellsize) | |
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 -*- | |
""" | |
Some helpers functions to try some (one dimension) data classification methods. | |
""" | |
import numpy as np | |
from operator import ge, le | |
from math import floor, log10 | |
def head_tail_break(values, direction="head"): |
OlderNewer