Skip to content

Instantly share code, notes, and snippets.

View lkilcher's full-sized avatar

Levi Kilcher lkilcher

  • National Renewable Energy Lab
  • Golden, CO
View GitHub Profile
*********************************
Checking data for AWAC_test01... OK!
*********************************
Checking data for AWAC_test01_earth2inst...
TIME OK!
env.c_sound OK!
env.pressure OK!
env.temp OK!
from wave_resource_data import load as wrd_load
hs =
{"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",
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 January 30, 2016 01:24
Bugs related to NumPy's new __numpy_ufunc__ hook.
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 November 3, 2015 18:41
PyTurbSim Windows Anaconda install error
------------------------------------------------------------
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 August 29, 2015 14:10 — forked from orome/Segmented Plot
Segmented Plot as Class

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.

@lkilcher
lkilcher / Segmented Plot as Func.md
Last active August 29, 2015 14:10 — forked from orome/Segmented Plot
Segmented Plot

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.

@lkilcher
lkilcher / mcve_example.py
Created October 31, 2014 19:03
numpy.shape Issue
importy numpy
strat = numpy.ones((100, 100, 100))
p = strat.shape[0]
mutator = numpy.random.randint(0, 2, (p, p, p))
@lkilcher
lkilcher / test_sparse.py
Created October 23, 2014 21:57
test_sparse
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