Skip to content

Commit

Permalink
Merge pull request #7 from aaronspring/AS_use_opendap
Browse files Browse the repository at this point in the history
use opendap
  • Loading branch information
martindurant authored Dec 8, 2020
2 parents e799112 + 674ba2b commit 292a75f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
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

0 comments on commit 292a75f

Please sign in to comment.