Skip to content

Instantly share code, notes, and snippets.

View j08lue's full-sized avatar

Jonas j08lue

View GitHub Profile
@j08lue
j08lue / ttkcalendar.py
Last active September 6, 2022 22:12
Simple calendar using ttk Treeview together with calendar and datetime classes - from http://svn.python.org/projects/sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py
"""Simple calendar using ttk Treeview together with calendar and datetime
classes.
Credits
-------
http://svn.python.org/projects/sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py
"""
import calendar
try:
@j08lue
j08lue / contour_to_hatched_patches.py
Created April 15, 2013 15:05
Convert matplotlib contours to hatched patches
"""Convert matplotlib contours to hatched patches"""
from matplotlib.patches import PathPatch
from itertools import cycle
def contour_to_hatched_patches(cntrset, hatch_colors, hatch_patterns,
remove_contour=True):
"""Convert matplotlib contours to hatched patches"""
patches_list = []
@j08lue
j08lue / replace_sourcecode_dashes.py
Created April 15, 2013 15:17
In Python source code file docstrings, replace dashes- by equals= using sed
"""In Python source code file docstrings, replace dashes- by equals= using sed"""
import subprocess
import os
def sed_replace_patterns(wdir,maxdash=20,mindash=2):
for n in xrange(maxdash,mindash+1,-1):
pstr = '-'*n # pattern
sstr = '='*n # substitute
@j08lue
j08lue / oneway_anova_test.py
Created April 15, 2013 15:19
Test the SciPy built-in function for One-Way ANOVA
"""Test the SciPy built-in function for One-Way ANOVA"""
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as sstats
numargs = sstats.f.numargs
[ dfn, dfd ] = [0.9,] * numargs
rv = sstats.f(dfn, dfd)
# Display frozen pdf
"""Arrange existing matplotlib figures into subplots"""
import numpy as np
from matplotlib.figure import *
def multisubplot(figures=[], ratio=1.0, wspace=0.0, hspace=0.0):
"""Arrange existing matplotlib figures into subplots
Source
------
@j08lue
j08lue / download_eSurge.py
Last active December 16, 2015 06:08
Automatize the download of eSurge data from vannstand.no
"""Automatize the download of eSurge data from vannstand.no
Troubleshooting
===============
If the script does not work anymore, this is likely to be
due to changes in the website data request form.
Most sensitive: field names (e.g. 'tid', 'aar', etc.).
Check the website source code.
Note
@j08lue
j08lue / download_WOA09.py
Last active December 16, 2015 06:08
Fills out and submit a form on the NODC.NOAA website and extract download links on the resulting page. The links can then be downloaded using download_from_url.py
"""Fetch WOA09 files from NODC.NOAA website via WOAselect"""
import re
import mechanize
import os
import urllib2
import shutil
import time
def abs2relftp(url):
@j08lue
j08lue / ferret.el
Last active December 16, 2015 15:49
Ferret (climate data visualization software) mode for Emacs. Initially from http://www.gfdl.noaa.gov/~atw/ferret/ferret.el
;;; ferret.el --- Ferret mode for GNU Emacs
;; Copyright (c) 1999 by Mark A. Verschell <verschell@neptune.gsfc.nasa.gov>
;; Author: Mark A. Verschell <verschell@neptune.gsfc.nasa.gov>
;; Maintainer: Mark A. Verschell <verschell@neptune.gsfc.nasa.gov>
;; Version 0.03.0 (February 2, 2000)
;; Keywords: languages
;; Ferret.el is free software; you can redistribute it and/or modify it under
@j08lue
j08lue / ferret.el
Created April 25, 2013 07:37
Emacs mode for Ferret (Analysis Tool for Gridded and Non-Gridded Data) by Mark A. Verschell, retrieved from http://www.gfdl.noaa.gov/~atw/ferret/ferret.el
;;; ferret.el --- Ferret mode for GNU Emacs
;; Copyright (c) 1999 by Mark A. Verschell <verschell@neptune.gsfc.nasa.gov>
;; Author: Mark A. Verschell <verschell@neptune.gsfc.nasa.gov>
;; Maintainer: Mark A. Verschell <verschell@neptune.gsfc.nasa.gov>
;; Version 0.03.0 (February 2, 2000)
;; Keywords: languages
;; Ferret.el is free software; you can redistribute it and/or modify it under
@j08lue
j08lue / ferret.el
Created April 25, 2013 07:37
Emacs mode for Ferret (Analysis Tool for Gridded and Non-Gridded Data) by Mark A. Verschell, retrieved from http://www.gfdl.noaa.gov/~atw/ferret/ferret.el
;;; ferret.el --- Ferret mode for GNU Emacs
;; Copyright (c) 1999 by Mark A. Verschell <verschell@neptune.gsfc.nasa.gov>
;; Author: Mark A. Verschell <verschell@neptune.gsfc.nasa.gov>
;; Maintainer: Mark A. Verschell <verschell@neptune.gsfc.nasa.gov>
;; Version 0.03.0 (February 2, 2000)
;; Keywords: languages
;; Ferret.el is free software; you can redistribute it and/or modify it under