Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use opendap #7

Merged
merged 12 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ci/environment-upstream-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ dependencies:
- pytest-xdist
- tqdm
- xarray
- pydap
- aiohttp
- pip:
- git+https://github.com/intake/intake.git
- git+https://github.com/Unidata/siphon.git
2 changes: 2 additions & 0 deletions ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ dependencies:
- siphon
- tqdm
- xarray
- pydap
- aiohttp
4 changes: 3 additions & 1 deletion intake_thredds/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ def _load(self):
ds.name: LocalCatalogEntry(
ds.name,
'THREDDS data',
'netcdf',
# 'netcdf',
'opendap',
True,
# {'urlpath': ds.access_urls['HTTPServer'], 'chunks': None},
{'urlpath': ds.access_urls['OPENDAP'], 'chunks': None},
[],
[],
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
aiohttp>=3.7
intake-xarray>=0.3
intake>=0.6.0
pydap
siphon
5 changes: 3 additions & 2 deletions tests/test_cat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import intake
import intake_xarray
import pytest
import xarray as xr

Expand All @@ -23,11 +24,11 @@ def test_init_catalog(thredds_cat_url):
def test_entry(thredds_cat_url):
cat = intake.open_thredds_cat(thredds_cat_url)
entry = cat['err.mnmean.v3.nc']
assert isinstance(entry, intake.source.base.DataSource)
assert isinstance(entry, intake_xarray.opendap.OpenDapSource)
d = entry.describe()
assert d['name'] == 'err.mnmean.v3.nc'
assert d['container'] == 'xarray'
assert d['plugin'] == ['netcdf']
assert d['plugin'] == ['opendap']
assert (
d['args']['urlpath']
== 'https://psl.noaa.gov/thredds/dodsC/Datasets/noaa.ersst/err.mnmean.v3.nc'
Expand Down
4 changes: 2 additions & 2 deletions tests/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ def test_thredds_merge(thredds_cat_url):
'ASCAT',
'ASCAT_v1-0_soil-moisture_daily_0-05deg_2007-2011',
'00000000',
'*.nc',
'*12.nc', # to speed up only takes all december files
]
cat = intake.open_thredds_merged(thredds_cat_url, paths)
assert cat.urlpath == thredds_cat_url
assert cat.path == paths

ds = cat.to_dask()
assert dict(ds.dims) == {'lat': 681, 'lon': 841, 'time': 1826}
assert dict(ds.dims) == {'lat': 681, 'lon': 841, 'time': 155}
d = cat.discover()
assert set(d['metadata']['coords']) == set(('lat', 'lon', 'time'))
assert set(d['metadata']['data_vars'].keys()) == set(
Expand Down