I installed Pydap on my Ubuntu using:
sudo pip install Pydap
If I understand properly output of the pip search pydap
command, I have all Pydap modules installed properly.
But to be 100% sure I also typed:
sudo apt-get install python-dap
However as I can see there's no util path:
/usr/local/lib/python2.7/dist-packages/pydap/util
so I am unable to import util module (import pydap.util
) to execute following code:
from pydap.util.urs import install_basic_client
install_basic_client()
from pydap.client import open_url
dataset = open_url('https://goldsmr4.gesdisc.eosdis.nasa.gov/opendap/MERRA2/M2T1NXSLV.5.12.4/2016/06/MERRA2_400.tavg1_2d_slv_Nx.20160601.nc4')
(code copied from https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+PyDAP)
It seems that:
apt-file find urs.py
is not returning any package name to install
At https://wiki.earthdata.nasa.gov/display/EL/How+To+Access+Data+With+PyDAP there's sample 'AUTH MODULE CODE' for those who have no util module installed, but it does not work for me - there's a problem with following line:
opener.addheaders = [('User-agent', pydap.lib.USER_AGENT)]
because pydap.lib has no USER_AGENT defined:
AttributeError: 'module' object has no attribute 'USER_AGENT'
Just a heads up that I am going to answer the question that I think you are actually asking rather than the question that you asked :)
The real question is: "How do I access NASA Earth data that is behind an auth wall?"
Unfortunately the NASA documentation that you are referencing is a bit out of date. There were two different proposals for modification to the Pydap client for allowing authentication to NASA/URS services. A different proposal won out in the end, rather than the one that this NASA wiki is based from.
So the answer to your question: "How do I install Pydap.util?", is that you can't, because that was an internal module that has been removed in the most recent version (3.2).
However, it should be possible to access the earth data with a stock install of the most recent version of Pydap. It's now a supported feature and its usage is described in the documentation.
You should be able to do so with a few simple lines:
from pydap.client import open_url
from pydap.cas.urs import setup_session
session = setup_session("your_username", "your_pw")
dataset = open_url('http://server.example.com/path/to/dataset', session=session)