Skip to content

Instantly share code, notes, and snippets.

View jhamman's full-sized avatar
🔨
Building Earthmover!

Joe Hamman jhamman

🔨
Building Earthmover!
View GitHub Profile
@jhamman
jhamman / check_for_vic_nans.bash
Created September 26, 2014 19:07
check_for_vic_nans.bash
#!/usr/bin/env bash
# Test VIC output for nans
branch="upstream/develop"
testdir="...path with global file..."
vic_repo="...path to /src/ directory in VIC repo..."
cd $vic_repo
# set number of commits to loop through
@jhamman
jhamman / mount_remote
Created January 27, 2014 04:40
Remote mounting of unix file system
# mounting remote file systems
# References:
# http://www.larkinweb.co.uk/computing/mounting_file_systems_over_two_ssh_hops.html
# http://www.neverstopbuilding.com/mount-ssh-on-osx
export MOUNTS=$HOME/mounts
mount_remote() {
echo "Trying to mount to: $1"
if [ "$1" == "1hopmachine" ] ; then

IPython Notebook on an SGE cluster

This guide documents how we set up an easy workflow for using the IPython Notebook on our compute cluster managed with Sun Grid Engine (SGE).

Summary: We provide a script to the cluster users that runs qrsh to schedule an ipython notebook job using SSL and password protection.

Installing IPython

This file has been truncated, but you can view the full file.
{
"metadata": {
"name": "rasm_cpl_plots"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@jhamman
jhamman / read_netcdf.py
Last active December 12, 2015 03:59
A simple way to read in all (or some) variables from a netcdf file.
#!/usr/local/bin/python
import numpy as np
from netCDF4 import Dataset
##################################################################################
## Read netCDF Inputs
## Read data from input netCDF.
##################################################################################
def read_netcdf(ncFile,vars = [],coords = False, verbose = False):
@jhamman
jhamman / find_nearest.py
Created February 4, 2013 22:38
Simple way to find the 1D index location of a single value in a numpy array. I often use this to find the location of a lat/lon pair in numpy arrays.
#!/usr/local/bin/python
import numpy as np
##################################################################################
## Find Indicies
## Given an input lat or lon, the function returns the nearest index location
##################################################################################
def find_nearest(array,value):
""" Find the index location in (array) with value nearest to (value)"""
idx = (np.abs(array-value)).argmin()