Skip to content

Instantly share code, notes, and snippets.

View arbennett's full-sized avatar
🎯
Playing darts

Andrew Bennett arbennett

🎯
Playing darts
View GitHub Profile
#!/usr/bin/env Rscript
# Attempt at a somewhat complicated plot layout
# @author arbennett
dataset_1 <- rnorm(10)
dataset_2 <- rnorm(10)
dataset_3 <- rnorm(10)
dataset_4 <- rnorm(10)
@arbennett
arbennett / ncdump_numpy_test.py
Last active May 2, 2019 14:52
Comparison of ncdump vs numpy for comparing datasets
#!/usr/bin/python2
import os
import sys
import time
import numpy as np
import subprocess
import matplotlib.pyplot as plt
from netCDF4 import Dataset
# Method one, just use numpy
@arbennett
arbennett / stacked_bar_subplots.py
Created May 22, 2016 23:46
Script to do multiple stacked bar subplots
"""
Script to do multiple stacked bar subplots
"""
import matplotlib.pyplot as plt
data = [[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]]
colors=['r','g','b','y']
n_bars = len(data)
class scdict(dict):
"""
Separate chaining dictionary implementation allows
for multiple values to be assigned to a single key
in a list.
"""
def __setitem__(self, key, val):
"""
Sets a value to a key, and if the key already exists,
make a list of all of the values assigned
@arbennett
arbennett / multiprocessing_test.py
Created May 29, 2016 21:44
Just testing for efficiency across various synchronization schemes for multiprocessing datastructures
"""
Just testing for efficiency across various synchronization schemes
for multiprocessing datastructures
"""
import time
import queue
import multiprocessing as mp
def dict_increments(d, q, s):
""" Incrementally add to a dictionary """
@arbennett
arbennett / Ising2d.py
Last active November 3, 2016 00:37
For an animation of the run see: http://imgur.com/a/zpTFJ
'''
2d Implementation of the Lenz-Ising Model
Created on May 13, 2014
Updated on Nov 02, 2016
@author: Andrew Bennett
The Ising model can be used to calculate the ground state energy of a spin lattice. You can think
of a spin lattice as a grid of particles with a property called spin, which can be plus or minus 1.
@arbennett
arbennett / GeoTiff to MPEG
Last active December 5, 2016 06:58 — forked from patchdynamics/GeoTiff to MPEG
Stuff for making a movie out of a sequence of GeoTIFFs
#!/usr/bin/env bash
mogrify -format jpg *.tif
convert xc:black xc:red xc:orange xc:yellow xc:green1 xc:cyan xc:blue xc:blueviolet xc:white +append -filter Cubic -flop rainbow_lut.png
find *.jpg -exec convert {} -colorspace gray rainbow_lut.png -clut {}.colored.jpg \;
convert -antialias -delay 1x15 *.colored.jpg output.mpeg
#!/usr/bin/env python
"""
Select out the necessary locations from a larger domain file
and output the pared down file for use in MetSim. This script
is intended to be used when using ascii or binary input. The
usage can be found by running `./build_domain.py -h` or simply
by inspecting the USAGE command.
This script requires the input domain file to have the 'elev'
field filled out, and the forcing files to be a subset of

Preprocessing

Forcing data

Disaggregation

The forcing data is generated based on the 1/16 degree Livneh forcing dataset. The original Livneh dataset is obtained at HYDRA:/raid/blivneh/forcings/outputs/CONUS/asc.v.1.2.b/data_${latitude}_${longitude}. A copy of the data has been placed at HYAK:/civil/hydro/michaelou/summaProj/summaData/blivneh/asc.v.1.2.b. The daily forcing data is disaggregated to a hourly basis by running VIC_4.1.2. The results of disaggregation are placed at HYAK:/civil/hydro/michaelou/summaProj/summaData/blivneh/workdir.

Converting to SUMMA inputs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.