Skip to content

Commit

Permalink
fetch the file with pooch
Browse files Browse the repository at this point in the history
  • Loading branch information
ocefpaf committed Apr 10, 2024
1 parent b9dd256 commit 7968d44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pocean/tests/test_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@
import os
import unittest

import pooch

from pocean import logger as L
from pocean.cf import CFDataset
from pocean.dsg import OrthogonalMultidimensionalTimeseries as omt

L.level = logging.INFO
L.handlers = [logging.StreamHandler()]

url = "https://github.com/pyoceans/pocean-core/releases/download"
version = "3.1.0"

fname = pooch.retrieve(
url=f"{url}/{version}/1211-AA.cdf",
known_hash="sha256:2b535b768d5edf6bf326dbe926eb164f4d4a18c685bc56211b5ef43e40e6a55e",
)

class TestCFDatasetLoad(unittest.TestCase):

def test_load_url(self):
# File downloaded from https://geoport.usgs.esipfed.org/thredds/catalog/silt/usgs/Projects/stellwagen/CF-1.6/ARGO_MERCHANT/catalog.html?dataset=silt/usgs/Projects/stellwagen/CF-1.6/ARGO_MERCHANT/1211-AA.cdf
ncd = CFDataset.load('https://github.com/pyoceans/pocean-core/releases/download/3.1.0/1211-AA.cdf')
# File downloaded from https://geoport.usgs.esipfed.org/thredds/dodsC/silt/usgs/Projects/stellwagen/CF-1.6/ARGO_MERCHANT/1211-AA.cdf.html
ncd = CFDataset.load(fname)
assert omt.is_mine(ncd) is True
ncd.close()

Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
flake8
pre-commit
pytest
pooch

0 comments on commit 7968d44

Please sign in to comment.