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 numpy as np | |
import iris | |
def lat_lon_cube(x, mval, latgrid, longrid): | |
""" | |
Returns a masked cube with a latitude and longitude suitable for testing. | |
Args: |
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 numpy as np | |
import cartopy.crs as ccrs | |
import matplotlib.pyplot as plt | |
def workaround_gridlines(src_proj, labels=True): | |
# Workaround for plotting lines of constant latitude/longitude as gridlines | |
# labels not supported for this projection. |
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 numpy as np | |
import matplotlib.pyplot as plt | |
import cartopy.crs as ccrs | |
import iris | |
from iris.coord_systems import GeogCS | |
from iris.cube import Cube | |
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
""" | |
Calculating the grate circle distance from a point | |
================================================== | |
This example demonstrates how we might use an external library (pyproj) to | |
calculate the distance from our points in a cube to a specific location, | |
using our cubes grid mapping. We then associate this information | |
onto our original cube as an auxiliary coordinate, since this relates to the | |
original phenomena. |
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 numpy as np | |
import matplotlib.pyplot as plt | |
a = np.linspace(0, 1, 256).reshape(1,-1) | |
a = np.vstack((a,a)) | |
plot_spec = None | |
if plot_spec is None: | |
# Get a list of the colormaps in matplotlib. Ignore the ones that end with |
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 copy | |
import matplotlib | |
from matplotlib import cm | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def plot_colormap(cmapname='jet'): | |
""" |
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
" ENABLE FILETYPE SPECIFIC VIM SETTINGS FILES | |
filetype plugin on | |
" language-dependent indenting. | |
filetype plugin indent on | |
" SET COLOUR | |
" mkdir -p ~/.vim/colors && cd ~/.vim/colors | |
" wget -O wombat256mod.vim http://www.vim.org/scripts/download_script.php?src_id=13400 | |
set t_Co=256 |
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
" setup wrapping | |
setlocal textwidth=79 " width of document | |
setlocal nowrap " don't automatically wrap on load | |
setlocal fo-=t " don't automatically wrap text when typing | |
" Colour column at 80char | |
if exists('+colorcolumn') | |
setlocal colorcolumn=80 | |
else | |
autocmd BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1) |
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
#!/usr/bin/env python | |
import sys | |
import pyflakes.reporter as reporter | |
from pyflakes.scripts.pyflakes import main | |
# Monkey patch syntax error method for suitability with vim | |
def vimhappy_syntaxError(self, filename, msg, lineno, offset, text): | |
line = text.splitlines()[-1] |
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
#!/usr/bin/env python | |
import sys | |
import re | |
def main(fnme): | |
with open(fnme, 'r') as fh: | |
lines = fh.readlines() | |
OlderNewer