From e895dde9e9f6118ea9ca230cc33e7e04cfb0f368 Mon Sep 17 00:00:00 2001 From: Jochem Smit Date: Thu, 15 Feb 2024 11:33:10 +0100 Subject: [PATCH] chore: update examples with newer paths / data id --- examples/load_datasets.py | 4 ++-- examples/load_from_yaml.py | 4 ++-- examples/load_local_datasets.py | 4 ++-- examples/load_to_pyhdx.py | 7 +++---- tests/datasets/index.txt | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/load_datasets.py b/examples/load_datasets.py index b9c4aa1..0b322ff 100644 --- a/examples/load_datasets.py +++ b/examples/load_datasets.py @@ -12,12 +12,12 @@ # %% # Download a specific HDX dataset -vault.fetch_dataset("20221007_1530_SecA_Krishnamurthy") +vault.fetch_dataset("1665149400_SecA_Krishnamurthy") vault.datasets # %% # Load the dataset -ds = vault.load_dataset("20221007_1530_SecA_Krishnamurthy") +ds = vault.load_dataset("1665149400_SecA_Krishnamurthy") # Describe the dataset print(ds.describe()) diff --git a/examples/load_from_yaml.py b/examples/load_from_yaml.py index 72a8047..5851b85 100644 --- a/examples/load_from_yaml.py +++ b/examples/load_from_yaml.py @@ -3,9 +3,9 @@ import yaml -test_pth = Path("../tests").resolve() +test_pth = Path(__file__).parent.parent / "tests" data_pth = test_pth / "datasets" -data_id = "20221007_1530_SecA_Krishnamurthy" +data_id = "1665149400_SecA_Krishnamurthy" hdx_spec = yaml.safe_load((data_pth / data_id / "hdx_spec.yaml").read_text()) metadata = yaml.safe_load((data_pth / data_id / "metadata.yaml").read_text()) diff --git a/examples/load_local_datasets.py b/examples/load_local_datasets.py index 097482d..f115fc7 100644 --- a/examples/load_local_datasets.py +++ b/examples/load_local_datasets.py @@ -1,14 +1,14 @@ from hdxms_datasets import DataVault from pathlib import Path -test_pth = Path("../tests").resolve() +test_pth = Path(__file__).parent.parent / "tests" data_pth = test_pth / "datasets" # Creating a DataVault without giving a cache path name uses $home/.hdxms_datasets by default vault = DataVault(data_pth) # Load the dataset -ds = vault.load_dataset("20221007_1530_SecA_Krishnamurthy") +ds = vault.load_dataset("1665149400_SecA_Krishnamurthy") # %% diff --git a/examples/load_to_pyhdx.py b/examples/load_to_pyhdx.py index 0b4b859..980a084 100644 --- a/examples/load_to_pyhdx.py +++ b/examples/load_to_pyhdx.py @@ -3,13 +3,12 @@ from pathlib import Path -test_pth = Path("../tests").resolve() +test_pth = Path(__file__).parent.parent / "tests" data_pth = test_pth / "datasets" vault = DataVault(cache_dir=data_pth) -ds = vault.load_dataset("20221007_1530_SecB_Krishnamurthy") +ds = vault.load_dataset("1665149400_SecA_Krishnamurthy") -# not yet in latests release -hdxm = HDXMeasurement.from_dataset(ds) +hdxm = HDXMeasurement.from_dataset(ds, 0) print(hdxm) diff --git a/tests/datasets/index.txt b/tests/datasets/index.txt index fc69d84..403c289 100644 --- a/tests/datasets/index.txt +++ b/tests/datasets/index.txt @@ -1,2 +1,2 @@ # List of all available dataset id's -20221007_1530_SecA_Krishnamurthy \ No newline at end of file +1665149400_SecA_Krishnamurthy \ No newline at end of file