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 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 as_scalar(value): | |
"""Like np.asscalar, but also works on scalar values (not just ndarrays) | |
""" | |
return np.array(value).item() | |
def to_str(value): | |
"""Convert a (possibly bytes) string to unicode, which is comparable to | |
strings on all Python versions |
This file contains 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
class partial_by_order(object): | |
""" | |
>>> f = partial_by_order(add, [(1, 10)]) | |
>>> f(5) | |
15 | |
""" | |
def __init__(self, op, other): | |
if (not isinstance(other, list) or | |
not all(isinstance(o, tuple) and len(o) == 2 for o in other)): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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
resampled_xray = xray.open_dataset( | |
'COLA_data/resampled_tas_Amon_CCSM4_piControl_r3i1p1_000101-012012.nc') | |
climatology = resampled_xray.groupby('time.month').mean('time') | |
anomalies = resampled_xray.groupby('time.month') - climatology |
This file contains 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
4099953 function calls (4093947 primitive calls) in 14.571 seconds | |
Ordered by: internal time | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
89302 4.795 0.000 5.585 0.000 linref.py:14(__call__) | |
722 2.353 0.003 2.355 0.003 {cartopy.trace.project_linear} | |
89302 1.491 0.000 1.781 0.000 point.py:188(geos_point_from_py) | |
480 0.439 0.001 9.527 0.020 crs.py:329(_attach_lines_to_boundary) | |
288301 0.439 0.000 0.439 0.000 base.py:209(empty) |
This file contains 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
#!/usr/bin/env python | |
""" | |
simple example script for running and testing notebooks. | |
Usage: `ipnbdoctest.py foo.ipynb [bar.ipynb [...]]` | |
Each cell is submitted to the kernel, and the outputs are compared with those stored in the notebook. | |
""" | |
import os,sys,time |