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 / ccsm.log.160401-205640
Last active April 1, 2016 21:17
CESM/VIC debugging (2016-04-01)
PE 0: MPICH processor detected:
PE 0: GenuineIntel (6:62:4) (family:model:stepping)
MPI VERSION : CRAY MPICH version 6.3.1 (ANL base 3.0.3)
BUILD INFO : Built Mon Apr 7 21:04:59 2014 (svn rev 10100) RT-G CPR-R
PE 0: MPICH environment settings:
PE 0: MPICH_ENV_DISPLAY = 1
PE 0: MPICH_VERSION_DISPLAY = 1
PE 0: MPICH_ABORT_ON_ERROR = 1
PE 0: MPICH_CPUMASK_DISPLAY = 0
PE 0: MPICH_RANK_REORDER_METHOD = 1
@jhamman
jhamman / hydra.makefile
Created March 31, 2016 21:28
Custom VIC 5 Makefiles
##############################################################################
# @section DESCRIPTION
#
# VIC Image Driver Makefile
#
# @section LICENSE
#
# The Variable Infiltration Capacity (VIC) macroscale hydrological model
# Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil
# and Environmental Engineering, University of Washington.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhamman
jhamman / example.py
Last active February 11, 2016 19:11
grids for Diana
from acf.raster import grid_info
#----------------------------------------------#
fnames = os.listdir(force_dir)
lons = np.empty(len(fnames))
lats = np.empty(len(fnames))
for i, fname in enumerate(fnames):
pre, lat, lon = fname.split('_')
@jhamman
jhamman / vic_global_options.py
Created February 5, 2016 23:52
Parsing VIC global parameter files in Python
import warnings
from collections import namedtuple, OrderedDict
class Forcing(object):
def __init__(self, *args, version='4'):
# initialize variables
self.name = None
self.path = None
self.types = []
@jhamman
jhamman / header.h
Last active August 29, 2015 14:26
VIC python driver preprocessed header
typedef float float_t;
typedef double double_t;
extern int __math_errhandling(void);
extern int __fpclassifyf(float);
extern int __fpclassifyd(double);
extern int __fpclassifyl(long double);
extern __inline __attribute__((__gnu_inline__)) __attribute__ ((__always_inline__)) int __inline_isfinitef(float);
extern __inline __attribute__((__gnu_inline__)) __attribute__ ((__always_inline__)) int __inline_isfinited(double);
extern __inline __attribute__((__gnu_inline__)) __attribute__ ((__always_inline__)) int __inline_isfinitel(long double);
@jhamman
jhamman / 1.Summary (RASM.1.0-broken)
Last active August 29, 2015 14:23
Atmospheric Decoupling VIC Changes: RASM.1.0
Breaking the land-atmosphere coupling in RASM.1.0
========
To "break" the surface layer in RASM, we need to remove the upper stability limit to the aerodynamic resistance calculation in both `Fixed calc_surf_energy_bal.c` and `SnowPackEnergyBalance`.
This limit was established c.RACM33.
These changes are shown here.
@jhamman
jhamman / 0.Summary (RACM.33-fixed)
Last active August 29, 2015 14:23
Fixed Atmospheric Decoupling VIC Changes in RACM.33
Fixing the land-atmosphere coupling in RACM 33
========
To "fix" the surface layer in RACM. We need to add an upper stability limit to the aerodynamic resistance calculation in both `Fixed calc_surf_energy_bal.c` and `SnowPackEnergyBalance`.
These changes, along with the addition of the constant limit in `vicNl_def.h` are shown here.
@jhamman
jhamman / monseasmean.py
Created January 22, 2015 02:36
Seasonal means from monthly data
import datetime
import xray
import pandas as pd
import numpy as np
from collections import OrderedDict
dpm = {'noleap': [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
'365_day': [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
'standard': [0, 31, 28.25, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
'gregorian': [0, 31, 28.25, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
@jhamman
jhamman / cmap_discretize.py
Last active August 29, 2015 14:09
pcolor subplots using matplotlib.basemap
import numpy as np
import matplotlib as mpl
from matplotlib import cm
def cmap_discretize(cmap, N=10):
cmap = cm.get_cmap(eval(cmap))
colors_i = np.concatenate((np.linspace(0, 1., N), (0.,0.,0.,0.)))
colors_rgba = cmap(colors_i)
indices = np.linspace(0, 1., N+1)