Skip to content

Instantly share code, notes, and snippets.

Daniel Rothenberg darothen

View GitHub Profile
@darothen
darothen / xarray_laplace2d_numba_example.ipynb
Last active Jun 14, 2018
Numba-powered 2D Laplacian on data wrapped in xarray
View xarray_laplace2d_numba_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darothen
darothen / cubed_sphere.py
Last active Jan 31, 2019
Cubed Sphere Mesh Generation and Plotting
View cubed_sphere.py
from itertools import product
import numpy as np
INV_SQRT_3 = 1.0 / np.sqrt(3.0)
ASIN_INV_SQRT_3 = np.arcsin(INV_SQRT_3)
def gaussian_bell(xs, ys, xc=0., yc=0., xsigma=1., ysigma=1.):
""" Compute a 2D Gaussian with asymmetric standard deviations and
@darothen
darothen / .gitattributes
Last active Jan 16, 2018
Interactive regression analysis viewer w/ Bokeh
View .gitattributes
sample_data.nc filter=lfs diff=lfs merge=lfs -text
@darothen
darothen / Example.ipynb
Created Aug 3, 2016 — forked from JESlaten/Example.ipynb
WRF Sample Python script.
View Example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darothen
darothen / README.md
Created Jul 13, 2016
This is a simple example and writeup of using Snakemake in an actual data workflow.
View README.md

This is a simple example for using snakemake to automate a basic work pipeline.

Motivation

Makefiles and GNU Make are awesome for many reasons, and it's unforgivable for any scientist working with data processing pipelines to use them throughout their projects. But Makefiles, while feature-rich, are not really an ideal tool for automating complex data processing pipelines. If, by some chance, your analyses simply require you to collect different data, process them with identical procedures, collate them, and produce a plot, then sure - Makefiles will do. But in analyzing climate model output, I've found that I have to do a lot of quirky hacks to fit this sort of workflow model.

A perfect example is the analysis of hierarchical climate model output. It's quite common to run a climate model multiple times in a factorial factor, changing 2-3 parameters (say, an emissions dataset and a parameterization in the model). While you can pigeon-hole linear da

@darothen
darothen / cartopy_wrap_example.ipynb
Last active Oct 5, 2018
Example of adding cyclic points to DataArrays for plotting with Cartopy
View cartopy_wrap_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darothen
darothen / WRF_example.ipynb
Created Oct 14, 2015
Simple WRF analysis/plotting examples
View WRF_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darothen
darothen / dataarray_to_cube.py
Created Oct 12, 2015
Convert xray.Dataarray to iris.Cube
View dataarray_to_cube.py
def dataset_to_cube(ds, field):
""" Construct an iris Cube from a field of a given
xray DataSet. """
raise NotImplementedError("`iris` deprecated for Python 3")
dsf = ds[field]
## Attach coordinates to the cube, using full dataset for lookup
# dim_coords_and_dims = []
@darothen
darothen / xray_dask_test.ipynb
Created Jul 10, 2015
xray + dask random data test
View xray_dask_test.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.