Skip to content

Instantly share code, notes, and snippets.

View darothen's full-sized avatar

Daniel Rothenberg darothen

View GitHub Profile
@darothen
darothen / ray-numbapro-gpu.py
Last active November 28, 2019 17:59
Port of ray tracer from Chapter 6 of "CUDA by Example" to NumbaPro-CUDA
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SPHERE SCENE RAY TRACER
This is a basic port of the simple ray tracer from Chapter 6 of
"CUDA by Example", by Sanders and Kandrot. With a few exceptions
(notably, the `hit()` method is not bound to a struct containing
sphere data and we use a numpy record array).
@darothen
darothen / README.md
Last active August 29, 2015 14:23
mode_sunburst

Sunburst visualization of modal importance aerosol activation experiment results.

@darothen
darothen / SST_data.ipynb
Created July 2, 2015 00:59
Plotting HYCOM SST data in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darothen
darothen / pandas_groupby.ipynb
Created July 7, 2015 13:55
Simple reproduction of `aggr` examples using Pandas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darothen
darothen / xray_dask_test.ipynb
Created July 10, 2015 03:22
xray + dask random data test
Loading
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 October 12, 2015 23:58
Convert xray.Dataarray to iris.Cube
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 / WRF_example.ipynb
Created October 14, 2015 15:11
Simple WRF analysis/plotting examples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darothen
darothen / cartopy_wrap_example.ipynb
Last active April 25, 2023 11:55
Example of adding cyclic points to DataArrays for plotting with Cartopy
Loading
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 July 13, 2016 20:37
This is a simple example and writeup of using Snakemake in an actual data workflow.

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 / Example.ipynb
Created August 3, 2016 19:45 — forked from JESlaten/Example.ipynb
WRF Sample Python script.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.