Last active
December 14, 2015 22:09
-
-
Save betodealmeida/5156775 to your computer and use it in GitHub Desktop.
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
import requests | |
class RemoteFile(object): | |
def __init__(self, url): | |
self.url = url | |
self.position = 0 | |
def tell(self): | |
return self.position | |
def seek(self, position): | |
self.position = position | |
def read(self, bytes): | |
start = self.position | |
end = start+bytes | |
headers = {'Range': 'bytes=%d-%d' % (start, end)} | |
r = requests.get(url, headers=headers) | |
return r.content | |
buf = RemoteFile('http://test.pydap.org/coads.nc') | |
from pupynere import netcdf_file | |
f = netcdf_file(buf) | |
print f.variables |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment