Create a wrapper to also allow scantable creation directly from a file on the web.
import urllib2 import tempfile from asap import scantable def urlscantable(*args, **kwargs): if isinstance(args[0], basestring) and args[0].startswith("http"): url = urllib2.urlopen(args[0]) tfile = tempfile.NamedTemporaryFile() tfile.write(url.read()) return scantable(tfile.name, *args[1:], **kwargs) else: return scantable(*args, **kwargs) if __name__ == "__main__": s = urlscantable("http://www.narrabri.atnf.csiro.au/mopra/DataDepot/2008-03-12_0932-M999.rpf") print s
Last modified
13 years ago
Last modified on 12/14/11 11:55:37
Note:
See TracWiki
for help on using the wiki.