Skip to content

Instantly share code, notes, and snippets.

@pyRobShrk
pyRobShrk / invdisttree.py
Created February 10, 2018 18:31
Inverse Distance & K-D Tree Interpolation
""" invdisttree.py: inverse-distance-weighted interpolation using KDTree
fast, solid, local
https://stackoverflow.com/a/3119544
"""
from __future__ import division
import numpy as np
from scipy.spatial import cKDTree as KDTree
# http://docs.scipy.org/doc/scipy/reference/spatial.html
__date__ = "2010-11-09 Nov" # weights, doc
@martinapugliese
martinapugliese / boto_dynamodb_methods.py
Last active June 30, 2024 10:00
Some wrapper methods to deal with DynamoDB databases in Python, using boto3.
# Copyright (C) 2016 Martina Pugliese
from boto3 import resource
from boto3.dynamodb.conditions import Key
# The boto3 dynamoDB resource
dynamodb_resource = resource('dynamodb')
def get_table_metadata(table_name):
@mfouesneau
mfouesneau / knn_interp.py
Created February 27, 2015 12:34
KDTree+RbF interpolator
import numpy as np
from scipy.spatial import cKDTree
from bary import RbfInterpolator
class KDTreeInterpolator(object):
"""
KDTreeInterpolator(points, values)
Nearest-neighbours (barycentric) interpolation in N dimensions.