PyDap и Xarray удаленный доступ к LP DAAC - PullRequest
0 голосов
/ 20 июня 2019

Я хотел бы использовать xarray / pydap для удаленного доступа к данным на сервере LP DAAC OpeNDAP.

У меня есть учетная запись данных о земле (имя пользователя и пароль - логинстр. ), и я добавил приложение LP DAAC OpeNDAP в свой список утвержденных приложений.

Ниже приведены мои попытки получить доступ к данным.Кто-нибудь еще был в состоянии получить доступ к данным через opendap из LP DAAC?Мой URL правильный?Это похоже на проблему со стороны сервера (opendap)?

Пример кода:

from pydap.client import open_url
from pydap.cas.urs import setup_session
import xarray as xr

dataset_url = 'https://opendap.cr.usgs.gov/opendap/hyrax/MOD13Q1.006/h00v08.ncml.nc4'

### Replace with your username and password
session = setup_session('XXXX', 'XXXXXX', check_url=dataset_url)
store = xr.backends.PydapDataStore.open(dataset_url, session=session)
ds = xr.open_dataset(store)

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-5-0ddf552f3174> in <module>
----> 1 store = xr.backends.PydapDataStore.open(dataset_url, session=session)
      2 ds = xr.open_dataset(store)

/opt/conda/lib/python3.7/site-packages/xarray/backends/pydap_.py in open(cls, url, session)
     71     def open(cls, url, session=None):
     72         import pydap.client
---> 73         ds = pydap.client.open_url(url, session=session)
     74         return cls(ds)
     75 

/opt/conda/lib/python3.7/site-packages/pydap/client.py in open_url(url, application, session, output_grid, timeout)
     65     """
     66     dataset = DAPHandler(url, application, session, output_grid,
---> 67                          timeout).dataset
     68 
     69     # attach server-side functions

/opt/conda/lib/python3.7/site-packages/pydap/handlers/dap.py in __init__(self, url, application, session, output_grid, timeout)
     52         ddsurl = urlunsplit((scheme, netloc, path + '.dds', query, fragment))
     53         r = GET(ddsurl, application, session, timeout=timeout)
---> 54         raise_for_status(r)
     55         if not r.charset:
     56             r.charset = 'ascii'

/opt/conda/lib/python3.7/site-packages/pydap/net.py in raise_for_status(response)
     37             detail=response.status+'\n'+response.text,
     38             headers=response.headers,
---> 39             comment=response.body
     40         )
     41 

HTTPError: 404 Not Found





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel='stylesheet' href='/opendap/docs/css/contents.css' type='text/css'/>
    <title>Hyrax: Resource Not Found</title>
</head>

<body>
<p align="left">&nbsp;</p>

<h1 align="center">Hyrax - Resource Not Found (404) </h1>
<hr align="left" size="1" noshade="noshade"/>
<table width="100%" border="0">
    <tr>
        <td>
            <a href="/opendap/docs/images/largeEarth.jpg">
            <img src="/opendap/docs/images/smallEarth.jpg"
                 alt="I looked everywhere!"
                 title="I looked everywhere!"
                 border="0"/>
            </a>
        </td>

        <td>
            <p align="left">The URL requested does not describe a resource that can be found on this server.</p>

            <p align="left">If you would like to start at the top level of this server, go <a
                    href="/opendap/"><strong>HERE</strong></a>.</p>


            <p align="left">The specific error message associated with your request was:</p>
            <blockquote> <p><strong>Failed to locate resource: /MOD13Q1.006/h00v08.ncml.nc4.dds </strong></p> </blockquote>

            <p align="left">If you think that the server is broken (that the URL you submitted should have worked),
                then please contact the OPeNDAP user support coordinator at: <a href="mailto:lpdaac@usgs.gov">lpdaac@usgs.gov</a>
            </p>

        </td>
    </tr>
</table>
<hr align="left" size="1" noshade="noshade"/>
<h1 align="center">Hyrax - Resource Not Found (404) </h1>
</body>
</html>

Информация о версии:

xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.7.3 | packaged by conda-forge | (default, Mar 27 2019, 23:01:00) 
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 4.4.0-150-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.4
libnetcdf: 4.6.2

xarray: 0.12.1
pandas: 0.24.2
numpy: 1.15.4
scipy: 1.2.1
netCDF4: 1.5.1.2
pydap: installed
h5netcdf: None
h5py: 2.9.0
Nio: None
zarr: 2.3.2
cftime: 1.0.3.4
nc_time_axis: None
PseudonetCDF: None
rasterio: 1.0.24
cfgrib: None
iris: None
bottleneck: 1.2.1
dask: 1.2.2
distributed: 1.28.0
matplotlib: 3.0.3
cartopy: 0.17.0
seaborn: 0.9.0
setuptools: 41.0.1
pip: 19.1.1
conda: 4.6.14
pytest: None
IPython: 7.5.0
sphinx: None
...