Skip to content

Instantly share code, notes, and snippets.

Avatar

Levi Kilcher lkilcher

  • National Renewable Energy Lab
  • Golden, CO
View GitHub Profile
View wave_resource_api.py
from wave_resource_data import load as wrd_load
hs =
View wave_hsds_attrs.json
{"attrs":
{"Dir":{"description":"Direction Normal to the Wave Crests",
"units":"deg",
"src_name":"Dir",
"SWAN_name":"DIR",
"IEC_name":"Sigma"},
"Hsig":{"description":"Calculated as the zeroth spectral moment (i.e., H_m0)",
"units":"m",
"src_name":"Hsig",
"SWAN_name":"HSIGN",
View hist_scatter.py
import numpy as np
import matplotlib.pyplot as plt
def map_hist(x, y, h, bins):
xi = np.digitize(x, bins[0]) - 1
yi = np.digitize(y, bins[1]) - 1
inds = np.ravel_multi_index((xi, yi),
(len(bins[0]) - 1, len(bins[1]) - 1),
mode='clip')
@lkilcher
lkilcher / test_power.py
Last active Jan 30, 2016
Bugs related to NumPy's new __numpy_ufunc__ hook.
View test_power.py
import numpy as np
class buggy(object):
def __init__(self, arr):
self.arr = arr
def __pow__(self, other):
print "In __pow__"
@lkilcher
lkilcher / pip.log
Created Nov 3, 2015
PyTurbSim Windows Anaconda install error
View pip.log
------------------------------------------------------------
C:\Users\jrinker\AppData\Local\Continuum\Anaconda\Scripts\pip-script.py run on 11/02/15 08:48:10
Downloading/unpacking PyTurbSim
Getting page https://pypi.python.org/simple/PyTurbSim/
URLs to search for versions for PyTurbSim:
* https://pypi.python.org/simple/PyTurbSim/
Analyzing links from page https://pypi.python.org/simple/pyturbsim/
Found link https://pypi.python.org/packages/source/P/PyTurbSim/PyTurbSim-0.3.5.tar.gz#md5=d3cce66bc697d3b27fe5c5dd2e12a350 (from https://pypi.python.org/simple/pyturbsim/), version: 0.3.5
Found link https://pypi.python.org/packages/source/P/PyTurbSim/PyTurbSim-0.3.6.tar.gz#md5=26fc1a96aa0f0e951e5f042163bd7bb6 (from https://pypi.python.org/simple/pyturbsim/), version: 0.3.6
Found link https://pypi.python.org/packages/source/P/PyTurbSim/PyTurbSim-0.3.7.tar.gz#md5=9a99b0d454d967bfc6a0f7e410957dda (from https://pypi.python.org/simple/pyturbsim/), version: 0.3.7
@lkilcher
lkilcher / Segmented Plot as Class.md
Last active Aug 29, 2015 — forked from orome/Segmented Plot
Segmented Plot as Class
View Segmented Plot as Class.md

This file sets the title of this gist.

This gist gives an example of how to implement SO question 27138751 by defining a 'segment_plot' class.

View Segmented Plot as Func.md

This file sets the title of this gist.

This gist gives an example of how to implement SO question 27138751 by defining a 'segment_plot' function.

View mcve_example.py
importy numpy
strat = numpy.ones((100, 100, 100))
p = strat.shape[0]
mutator = numpy.random.randint(0, 2, (p, p, p))
View test_sparse.py
from scipy import sparse as sps
import numpy as np
z = np.arange(10)
N = len(z)
c = np.tile(z[:, None], (1, 10)).astype(int)
# Change some values:
c[:, 3] = 0