Skip to content

Instantly share code, notes, and snippets.

View Cadair's full-sized avatar

Stuart Mumford Cadair

View GitHub Profile
@Cadair
Cadair / io_hack
Last active December 19, 2015 17:29
Optional readers
try:
from sunpy.io import fits
_known_formats.update({('fts', 'fits'): fits})
_fits_failed = False
except ImportError:
_fits_failed = True
try:
from sunpy.io import jp2
_known_formats.update({('jp2', 'j2k', 'jpc', 'jpt'): jp2})
sunpy/tests/util/test_xml.py ....................
sunpy/tests/wcs/test_wcs.py .......
================================================ 201 passed in 20.55 seconds =================================================
pastebin session-log: http://bpaste.net/show/118674
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 1080, in run
@Cadair
Cadair / after-thought-gitignore.sh
Created July 31, 2013 13:53
How to retroactively apply a gitignore file. To use: 1) Write the .gitignore file to include all the files that are already included you don't want any more 2) exectute this script 3) execute git-ignore-these.sh once you have checked it is not removing anything you want
declare -a myarray
while read p; do
find . -name $p -print >> git-ignore-these.sh
done < .gitignore
sed -i 's/.*/git rm --cached &/' git-ignore-these.sh
sed -i '1s/.*/#!\/bin\/bash \
&/' git-ignore-these.sh
chmod +x git-ignore-these.sh
@Cadair
Cadair / gist:6379469
Created August 29, 2013 15:22
new GOES download
#Subclass download to enable a different filename
@staticmethod
def _download(uri, kwargs, err='Unable to download data at specified URL',
filename = None):
#Create a better filename
query_str = uri.split('?')[1]
pars = {}
for s in query_str.split('&'):
kv = s.split('=')
pars.update({kv[0]:kv[1]})
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cadair
Cadair / error.py
Created October 30, 2013 13:58
NDData MapMeta error
sunpy/tests/net/test_helioviewer.py:59: in test_download_jp2
> map_ = sunpy.map.Map(filepath)
sunpy/map/map_factory.py:201: in __new__
> new_maps.append(WidgetType(data, meta, **kwargs))
sunpy/map/sources/soho.py:119: in __init__
> GenericMap.__init__(self, data, header, **kwargs)
sunpy/map/mapbase.py:172: in __init__
> astropy.nddata.NDData.__init__(self, data, meta=header, **kwargs)
../astropy/astropy/nddata/nddata.py:166: in __init__
> self.meta = meta
@Cadair
Cadair / gist:7251283
Created October 31, 2013 15:05
astropy 3.3
pip install astropy
Downloading/unpacking astropy
Downloading astropy-0.2.5.tar.gz (4.7MB): 4.7MB downloaded
Running setup.py egg_info for package astropy
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/home/stuart/.virtualenvs/sunpy33/build/astropy/setup.py", line 19, in <module>
from astropy.setup_helpers import (register_commands, adjust_compiler,
File "./astropy/setup_helpers.py", line 31, in <module>
from .tests.helper import astropy_test
@Cadair
Cadair / journal_macros.tex
Created December 6, 2013 11:40
A collection of journal abbreviations, include in your LaTeX source with \input{journal_macros.tex} Please feel free to fork and suggest additions: http://stackoverflow.com/questions/8758612/can-i-make-a-pull-request-on-a-gist-on-github
\newcommand*\aap{A\&A}
\let\astap=\aap
\newcommand*\aapr{A\&A~Rev.}
\newcommand*\aaps{A\&AS}
\newcommand*\actaa{Acta Astron.}
\newcommand*\aj{AJ}
\newcommand*\ao{Appl.~Opt.}
\let\applopt\ao
\newcommand*\apj{ApJ}
\newcommand*\apjl{ApJ}
@Cadair
Cadair / gist:8941272
Created February 11, 2014 18:41
xml madness
In [1]: import xml.etree.ElementTree
In [2]: from sunpy.net.helio import registry_links as RL
/home/stuart/.virtualenvs/sunpy26/lib/python2.6/site-packages/numpy/oldnumeric/__init__.py:11: ModuleDeprecationWarning: The oldnumeric module will be dropped in Numpy 1.9
warnings.warn(_msg, ModuleDeprecationWarning)
In [3]: import sunpy.net.helio.parser as p
In [4]: xmlstr = p.link_test(RL.LINK + 'hec')

For Major releases only:

  • Update RELEASE.md
  • Update the version for build numbers on Appveyor (Not sure this really matters)

Pre-release:

  • Check that the Continious Integration is passing for the correct version
  • Update version number in setup.py (the version number branch and don't commit yet)
  • Modify the changelog title (remove (unreleased))
  • Build the source distribution: