Created
January 30, 2013 20:36
-
-
Save betodealmeida/4676699 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
from pydap.parsers.dds import DDSParser | |
from pydap.parsers.das import DASParser | |
from pydap.xdr import DapUnpacker | |
f = open("/path/to/file.dods") | |
content = f.read() | |
dds, xdrdata = content.split('\nData:\n', 1) | |
# build the dataset | |
dataset = DDSParser(dds).parse() | |
dataset.data = DapUnpacker(xdrdata, dataset).getvalue() | |
f.close() | |
# add attributes, if you also have the DAS | |
f = open("/path/to/file.das") | |
das = f.read() | |
dataset = DASParser(das, dataset).parse() | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment