From 4ac622148d29ec419be501683c3799b33b1006c5 Mon Sep 17 00:00:00 2001 From: Jenya Bogacheva Date: Tue, 16 Sep 2025 03:37:25 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E2=9C=85=20=20Fixed=20the=20fixmes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/utils/tests/data/test_converter.py | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/utils/tests/data/test_converter.py b/packages/utils/tests/data/test_converter.py index 6fc5df5a..eb906593 100644 --- a/packages/utils/tests/data/test_converter.py +++ b/packages/utils/tests/data/test_converter.py @@ -17,37 +17,37 @@ from pyearthtools.utils.data import converter -SIMPLE_DATA_ARRAY = xr.DataArray([1, 2, 3, 4, 5]) +SIMPLE_DATA_ARRAY = xr.DataArray([1, 2, 3, 4, 5], dims=("x",), coords={"x": [0, 1, 2, 3, 4]}, name="Entry") SIMPLE_DATA_SET = xr.Dataset({"Entry": SIMPLE_DATA_ARRAY}) def test_NumpyConverter(): """ - This test provides coverage, but does not test for - correctness + Checks conversion from xarray to numpy and back """ # This round-trips convert and unconvert nc = converter.NumpyConverter() - _np_array1 = nc.convert_from_xarray(SIMPLE_DATA_ARRAY) + np_array = nc.convert_from_xarray(SIMPLE_DATA_ARRAY) - # FIXME - # xr_da1 = nc.convert_to_xarray(np_array1) - - # Test conversion from xarray works - nc = converter.NumpyConverter() - _np_array2 = nc.convert_from_xarray(SIMPLE_DATA_SET) + # Test conversion from xarray + np_array = nc.convert_from_xarray(SIMPLE_DATA_SET) + xr_ds = nc.convert_to_xarray(np_array) + assert isinstance(xr_ds, xr.Dataset) + assert "Entry" in xr_ds + xr.testing.assert_identical(xr_ds["Entry"], SIMPLE_DATA_ARRAY) def test_DaskConverter(): """ - This test provides coverage, but does not test for - correctness + Checks conversion from xarray to dask and back """ dc = converter.DaskConverter() - _da_array1 = dc.convert_from_xarray(SIMPLE_DATA_ARRAY) - - # FIXME - # xr_da1 = dc.convert_to_xarray(da_array1) + da_array = dc.convert_from_xarray(SIMPLE_DATA_SET) + da_array = da_array.compute() + xr_ds = dc.convert_to_xarray(da_array) + assert isinstance(xr_ds, xr.Dataset) + assert "Entry" in xr_ds + xr.testing.assert_identical(xr_ds["Entry"], SIMPLE_DATA_ARRAY) From d8919364dd6241fa32ec93c7e43a7d87c524878e Mon Sep 17 00:00:00 2001 From: Jenya Bogacheva Date: Tue, 16 Sep 2025 03:59:51 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=20=20Fix=20the=20conversion=20?= =?UTF-8?q?test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/utils/tests/data/test_converter.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/utils/tests/data/test_converter.py b/packages/utils/tests/data/test_converter.py index eb906593..a7ed9f12 100644 --- a/packages/utils/tests/data/test_converter.py +++ b/packages/utils/tests/data/test_converter.py @@ -26,11 +26,10 @@ def test_NumpyConverter(): Checks conversion from xarray to numpy and back """ - # This round-trips convert and unconvert - nc = converter.NumpyConverter() - np_array = nc.convert_from_xarray(SIMPLE_DATA_ARRAY) + nc_da = converter.NumpyConverter() + _ = nc_da.convert_from_xarray(SIMPLE_DATA_ARRAY) - # Test conversion from xarray + nc = converter.NumpyConverter() np_array = nc.convert_from_xarray(SIMPLE_DATA_SET) xr_ds = nc.convert_to_xarray(np_array) assert isinstance(xr_ds, xr.Dataset) From b5b6ddea915123ac105b843076cb65ea69e21351 Mon Sep 17 00:00:00 2001 From: Jenya Bogacheva Date: Tue, 16 Sep 2025 04:44:47 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=91=A5=20Added=20a=20contributor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .zenodo.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.zenodo.json b/.zenodo.json index 4f1c80aa..af2b2ea3 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -60,6 +60,10 @@ "orcid": "https://orcid.org/0000-0002-6799-9109", "affiliation": "Bureau of Meteorology, Australia", "name": "Holmes, Ryan" + }, + { + "orcid": "https://orcid.org/0009-0001-4486-0120", + "name": "Bogacheva, Jenya" } From 63fdcad9c6c4bbd0b118b39bcf4159cd583cfbb2 Mon Sep 17 00:00:00 2001 From: Jenya Bogacheva Date: Tue, 16 Sep 2025 05:25:37 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=91=A5=20=20Updated=20affiliation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .zenodo.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.zenodo.json b/.zenodo.json index af2b2ea3..1b58c911 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -63,6 +63,7 @@ }, { "orcid": "https://orcid.org/0009-0001-4486-0120", + "affiliation": "Independent researcher, Vietnam", "name": "Bogacheva, Jenya" }