This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:1ccaf1d6efde449dc4d273823364434c19bdd068d41587570ffde0a5be796216" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plot_data(*args, **kwargs): | |
save = kwargs.pop('save', False) | |
import matplotlib.pyplot as plt | |
import iris.plot as iplt | |
markers = ('+', 'x', 's') | |
if save is True: | |
plt.switch_backend('Agg') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from netCDF4 import Dataset | |
import numpy as np | |
import os | |
def process_usage(): | |
fnme = os.path.join('/', 'proc', str(os.getpid()), 'status') | |
usage = {} | |
with open(fnme, 'r') as fh: | |
for line in fh: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import biggus | |
import iris | |
import numpy as np | |
print iris.__file__, iris.__version__ | |
print biggus.__file__, biggus.__version__ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
import os | |
def proc_stat(): | |
pid = os.getpid() | |
fnme = os.path.join('/', 'proc', str(pid), 'status') | |
fields = ['VmSize', 'VmRSS', 'VmPeak', 'VmHWM'] | |
with open(fnme, 'r') as fh: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:563b350202cce7ea8c83bbb25c227c1bdcef905445af72e7b040121fc52884b8" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mosaic(iterable_shape, subdivided_shape): | |
""" | |
Return a generator of slices that represent a subdivided indexing of an iterable of specified shape. | |
""" | |
shape = subdivided_shape | |
if len(iterable_shape) != len(shape): | |
raise ValueError('Array shape and resulting shape mismatch, broadcasting not supported.') | |
# iterate through this array with shape (shape) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil | |
import tempfile | |
class TemporaryDirectory(object): | |
""" | |
Context manager for tempfile.mkdtemp(). | |
This class is available in python +v3.2. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.