Skip to content

Instantly share code, notes, and snippets.

View bradyrx's full-sized avatar

Riley Brady bradyrx

View GitHub Profile
@damianavila
damianavila / remove_output.py
Created April 3, 2013 22:05
Remove output from IPython notebook from the command line (dev version 1.0)
"""
Usage: python remove_output.py notebook.ipynb [ > without_output.ipynb ]
Modified from remove_output by Minrk
"""
import sys
import io
import os
from IPython.nbformat.current import read, write
@Zearin
Zearin / python_decorator_guide.md
Last active July 24, 2024 03:06
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@anttilipp
anttilipp / temperatureCircle.py
Created August 2, 2017 21:50
Code to reproduce the "Temperature Circle" visualization.
#
# Hi all,
# this is the Python code I used to make the visualization "Temperature circle"
# (https://twitter.com/anttilip/status/892318734244884480).
# Please be aware that originally I wrote this for my tests only so the
# code was not ment to be published and is a mess and has no comments.
# Feel free to improve, modify, do whatever you want with it. If you decide
# to use the code, make an improved version of it, or it is useful for you
# in some another way I would be happy to know about it. You can contact me
# for example in Twitter (@anttilip). Unchecked demo data (no quarantees)
@matt-long
matt-long / demo_plotting.ipynb
Last active December 21, 2020 18:06
Plotting the POP model
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import pandas as pd
from matplotlib import pyplot as plt
import numpy as np
%matplotlib inline
url = 'https://storage.googleapis.com/pangeo-cmip6/pangeo-cmip6-zarr-consolidated-stores.csv'
df = pd.read_csv(url)
run_count = df[df.activity_id == 'CMIP'].groupby(['experiment_id', 'source_id']).zstore.count()
rcu = run_count.unstack(level=-1)