Skip to content

Commit dbfba90

Browse files
authored
Datasets module with the GDP hourly accessor (#188)
* Add datasets module * Test that the dataset opens * Add datasets module to the docs index * Update PyPI dependencies * Update conda-forge dependencies * Bump version to 0.15.0
1 parent 6acab3b commit dbfba90

File tree

6 files changed

+51
-7
lines changed

6 files changed

+51
-7
lines changed

clouddrift/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
from clouddrift.raggedarray import RaggedArray
66
import clouddrift.adapters
77
import clouddrift.analysis
8+
import clouddrift.datasets
89
import clouddrift.haversine
910
import clouddrift.sphere

clouddrift/datasets.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
This module provides functions to easily access ragged-array datasets.
3+
"""
4+
5+
import xarray as xr
6+
7+
8+
def gdp1h() -> xr.Dataset:
9+
"""
10+
Returns the hourly GDP dataset as an Xarray dataset.
11+
12+
Returns
13+
-------
14+
xarray.Dataset
15+
GDP1h dataset
16+
"""
17+
url = "https://noaa-oar-hourly-gdp-pds.s3.amazonaws.com/latest/gdp_v2.00.zarr"
18+
return xr.open_dataset(url, engine="zarr")

docs/api.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ Analysis
3333
:members:
3434
:undoc-members:
3535

36+
Datasets
37+
--------
38+
39+
.. automodule:: clouddrift.datasets
40+
:members:
41+
:undoc-members:
42+
3643
Haversine
3744
---------
3845

environment.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ channels:
44
dependencies:
55
- python>=3.9
66
- numpy>=1.21.6
7-
- xarray>=2022.6.0
8-
- netcdf4>=1.6.1
7+
- xarray>=2023.5.0
8+
- netcdf4>=1.6.4
99
- pyarrow>=9.0.0
1010
- tqdm>=4.64.1
1111
- fsspec>=2022.8.2
1212
- llvmlite>=0.38.1
1313
- awkward>=2.0.0
1414
- pip>=22.2.2
15+
- aiohttp>=3.8.4
16+
- requests>=2.31.0
17+
- zarr>=2.14.2
1518
- pip:
1619
- git+https://github.com/Cloud-Drift/clouddrift.git

pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "clouddrift"
7-
version = "0.14.0"
7+
version = "0.15.0"
88
authors = [
99
{ name="Shane Elipot", email="[email protected]" },
1010
{ name="Philippe Miron", email="[email protected]" },
@@ -20,13 +20,16 @@ classifiers = [
2020
]
2121

2222
dependencies = [
23+
"aiohttp>=3.8.4",
24+
"awkward>=2.0.0",
25+
"fsspec>=2022.3.0",
26+
"netcdf4>=1.6.4",
2327
"numpy>=1.22.4",
24-
"xarray>=2022.3.0",
25-
"netcdf4>=1.5.8",
2628
"pyarrow>=8.0.0",
2729
"tqdm>=4.64.0",
28-
"fsspec>=2022.3.0",
29-
"awkward>=2.0.0",
30+
"requests>=2.31.0",
31+
"xarray>=2023.5.0",
32+
"zarr>=2.14.2",
3033
]
3134

3235
[project.urls]

tests/datasets_tests.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from clouddrift import datasets
2+
import unittest
3+
4+
5+
if __name__ == "__main__":
6+
unittest.main()
7+
8+
9+
class datasets_tests(unittest.TestCase):
10+
def test_gdp1h_opens(self):
11+
ds = datasets.gdp1h()
12+
self.assertTrue(ds)

0 commit comments

Comments
 (0)