Skip to content

Instantly share code, notes, and snippets.

View jhamman's full-sized avatar
🔨
Building something new!

Joe Hamman jhamman

🔨
Building something new!
View GitHub Profile
@jhamman
jhamman / keybase.md
Created November 16, 2018 18:04
keybase.md

Keybase proof

I hereby claim:

  • I am jhamman on github.
  • I am jhamman (https://keybase.io/jhamman) on keybase.
  • I have a public key ASCa9ggHDxnpiQiIQJaQu7h3f4z4AwIq9XMtim36XN7Jhwo

To claim this, I am signing this object:

@jhamman
jhamman / dask.yaml
Created October 3, 2018 19:20
CISL system wide dask configuration
distributed:
scheduler:
bandwidth: 1000000000 # GB MB/s estimated worker-worker bandwidth
worker:
memory:
target: 0.90 # Avoid spilling to disk
spill: False # Avoid spilling to disk
pause: 0.80 # fraction at which we pause worker threads
terminate: 0.95 # fraction at which we terminate the worker
comm:
@jhamman
jhamman / gist:77894c2a99f5d0079dc19af57a9f4a9a
Created March 15, 2018 18:38 — forked from stephenpascoe/gist:3721874
Example of reading CMIP5 data over OPeNDAP in IPython
{
"metadata": {
"name": "esgf_opendap"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@jhamman
jhamman / explore_shapefile.ipynb
Last active March 14, 2018 23:10
ESMF Unstructured Mesh Regridding
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhamman
jhamman / start-notebook
Created March 8, 2018 00:51
NCAR start-notebook: adapted for use with conda/dask
#!/bin/bash
# Create trap to kill notebook when user is done
kill_server() {
if [[ $JNPID != -1 ]]; then
echo -en "\nKilling Jupyter Notebook Server with PID=$JNPID ... "
kill $JNPID
echo "done"
exit 0
else
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhamman
jhamman / xarray_resample.ipynb
Created October 12, 2017 19:17
xarray_resample
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
from scipy import stats
import dask.array as da
import xarray as xr
def test_quantile_mapping_dask():
# input datasets -- dims (time, y, x)
@jhamman
jhamman / test_quantile_mapping_dask
Created May 3, 2017 21:07
dask quantile mapping traceback
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-17-2776a0e3d860> in <module>()
----> 1 test_quantile_mapping_dask()
<ipython-input-16-09fe8c5dfb29> in test_quantile_mapping_dask()
21
22 new = quantile_mapping(input_data, data_to_match)
---> 23 new.compute()
24 new.data.visualize()
@jhamman
jhamman / random_effects.py
Last active February 1, 2017 19:54
GARD post processing
def add_random_effect(ds, ds_rand, pop_thresh=None, t_root=1., p_root=3.):
'''Add random effects to dataset `ds`
Parameters
----------
ds : xarray.Dataset
Input dataset with variables `tas` and/or `pr`
ds_rand : xarray.Dataset
Input dataset with random fields with variable names `t_rand` and `p_rand`
pop_thresh : float