Skip to content

Commit dddc803

Browse files
🐛 fix the andro datasets (#489)
* fix url * put back decode_times default value to True * update docstring * Enhance andro tests * format * bump version --------- Co-authored-by: Kevin Santana <[email protected]>
1 parent 1751f4b commit dddc803

File tree

4 files changed

+38
-29
lines changed

4 files changed

+38
-29
lines changed

clouddrift/adapters/andro.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
from clouddrift.adapters.utils import download_with_progress
3030

3131
# order of the URLs is important
32-
ANDRO_URL = "https://www.seanoe.org/data/00360/47077/data/91950.dat"
32+
ANDRO_URL = "https://www.seanoe.org/data/00360/47077/data/109566.dat"
3333
ANDRO_TMP_PATH = os.path.join(tempfile.gettempdir(), "clouddrift", "andro")
34-
ANDRO_VERSION = "2022-03-04"
34+
ANDRO_VERSION = "2024-03-25"
3535

3636

3737
def to_xarray(tmp_path: str | None = None):
@@ -325,7 +325,7 @@ def to_xarray(tmp_path: str | None = None):
325325

326326
# global attributes
327327
attrs = {
328-
"title": "ANDRO: An Argo-based deep displacement dataset",
328+
"title": "ANDRO: An Argo-based deep displacement dataset (Quality controlled data)",
329329
"history": f"Dataset updated on {ANDRO_VERSION}",
330330
"date_created": datetime.now().isoformat(),
331331
"publisher_name": "SEANOE (SEA scieNtific Open data Edition)",

clouddrift/datasets.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ def yomaha(decode_times: bool = True) -> xr.Dataset:
549549
return _dataset_filecache("yomaha.nc", decode_times, adapters.yomaha.to_xarray)
550550

551551

552-
def andro(decode_times: bool = False) -> xr.Dataset:
552+
def andro(decode_times: bool = True) -> xr.Dataset:
553553
"""Returns the ANDRO as a ragged array Xarray dataset.
554554
555555
The function will first look for the ragged-array dataset on the local
@@ -573,36 +573,36 @@ def andro(decode_times: bool = False) -> xr.Dataset:
573573
>>> from clouddrift.datasets import andro
574574
>>> ds = andro()
575575
>>> ds
576-
<xarray.Dataset>
577-
Dimensions: (obs: 1360753, traj: 9996)
576+
<xarray.Dataset> Size: 110MB
577+
Dimensions: (obs: 510630, traj: 3344)
578578
Coordinates:
579-
time_d (obs) datetime64[ns] ...
580-
time_s (obs) datetime64[ns] ...
581-
time_lp (obs) datetime64[ns] ...
582-
time_lc (obs) datetime64[ns] ...
583-
id (traj) int64 ...
579+
time_d (obs) datetime64[ns] 4MB ...
580+
time_s (obs) datetime64[ns] 4MB ...
581+
time_lp (obs) datetime64[ns] 4MB ...
582+
time_lc (obs) datetime64[ns] 4MB ...
583+
id (traj) float32 13kB ...
584584
Dimensions without coordinates: obs, traj
585585
Data variables: (12/33)
586-
lon_d (obs) float64 ...
587-
lat_d (obs) float64 ...
588-
pres_d (obs) float32 ...
589-
temp_d (obs) float32 ...
590-
sal_d (obs) float32 ...
591-
ve_d (obs) float32 ...
586+
lon_d (obs) float64 4MB ...
587+
lat_d (obs) float64 4MB ...
588+
pres_d (obs) float32 2MB ...
589+
temp_d (obs) float32 2MB ...
590+
sal_d (obs) float32 2MB ...
591+
ve_d (obs) float32 2MB ...
592592
... ...
593-
lon_lc (obs) float64 ...
594-
lat_lc (obs) float64 ...
595-
surf_fix (obs) int64 ...
596-
cycle (obs) int64 ...
597-
profile_id (obs) float32 ...
598-
rowsize (traj) int64 ...
593+
lon_lc (obs) float64 4MB ...
594+
lat_lc (obs) float64 4MB ...
595+
surf_fix (obs) float32 2MB ...
596+
cycle (obs) float32 2MB ...
597+
profile_id (obs) float32 2MB ...
598+
rowsize (traj) int64 27kB ...
599599
Attributes:
600-
title: ANDRO: An Argo-based deep displacement dataset
601-
history: 2022-03-04
602-
date_created: 2023-12-08T00:52:00.937120
600+
title: ANDRO: An Argo-based deep displacement dataset (Quality ...
601+
history: Dataset updated on 2024-03-25
602+
date_created: 2024-07-02T12:11:50.643492
603603
publisher_name: SEANOE (SEA scieNtific Open data Edition)
604604
publisher_url: https://www.seanoe.org/data/00360/47077/
605-
license: freely available
605+
license: Creative Commons Attribution 4.0 International License (...
606606
607607
Reference
608608
---------

pyproject.toml

Lines changed: 1 addition & 1 deletion
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.38.1"
7+
version = "0.39.0"
88

99
authors = [
1010
{ name="Shane Elipot", email="[email protected]" },

tests/datasets_tests.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,16 @@ def test_subsurface_floats_opens(self):
4949

5050
def test_andro_opens(self):
5151
with datasets.andro() as ds:
52-
self.assertTrue(ds)
52+
self.assertTrue(ds is not None)
53+
self.assertTrue(len(ds.variables) > 0)
54+
self.assertTrue(len(ds["lon_d"]) > 0)
55+
56+
self.assertTrue(
57+
len(ds.lat_d[np.logical_or(ds.lat_d > 90, ds.lat_d < -90)]) == 0
58+
)
59+
self.assertTrue(
60+
len(ds.lat_d[np.logical_or(ds.lon_d > 180, ds.lon_d < -180)]) == 0
61+
)
5362

5463
def test_yomaha_opens(self):
5564
with datasets.yomaha() as ds:

0 commit comments

Comments
 (0)