pythonurllibopendap

Using python3.4 and opendap - import error


I am a python newbie and I am using pydap to download atmospheric data from a thredds server. I am running python 3.4 but I believe pydap has been installed using python2.7.

When I run this I get the following message -

Traceback (most recent call last): File "data.py", line 9, in from pydap.client import open_url File "/usr/local/lib/python2.7/dist-packages/pydap/client.py", line 13, in from urlparse import urlsplit, urlunsplit ImportError: No module named 'urlparse'

Any suggestions where I am going wrong ?

#!/usr/bin/python3.4



import numpy as np

import urllib

from pydap.client import open_url


dataset = open_url('http://dataserver.nccs.nasa.gov/thredds/dodsC/bypass/CREATE-

IP/CFSR/6hr/atmos/va_2010s.ncml.html')


Solution

  • Usage of urlparse has been deprecated in Python 3 as seen here, so it's not included as is anymore. However it is still accessible under urllib.parse.

    So either install the Python 3 version of Pydap, or run Python 2.7 instead, or go through the Pydap code and replace mentions of urlparse with urllib.parse (probably a bad idea).