From 8a47dfe476e53396dcb33178582b32c9b0c6a081 Mon Sep 17 00:00:00 2001 From: Alex Fox Date: Fri, 10 Oct 2025 21:47:42 -0600 Subject: [PATCH 1/2] updated version, added xarray export test --- CHANGELOG.md | 5 ++++- docs/conf.py | 2 +- pyproject.toml | 2 +- tests/test_basic.py | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91a191d..71f304f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,4 +13,7 @@ - fixed history tracking bug - fixed a bug in the rng algorithm that impacted reproducibility in some cases - odd-sized grids are now supported -- fixed a bug preventing early exit in some situations during optimization when the convergence criterion is met \ No newline at end of file +- fixed a bug preventing early exit in some situations during optimization when the convergence criterion is met + +# 1.3.20251010 +- fixed critical bug preventing export to xarray datasets \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index cce89a2..1730f3b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,7 +14,7 @@ project = 'PyOCN' copyright = '2025, Alexander S. Fox' author = 'Alexander S. Fox' -release = '1.2.20251010' +release = '1.3.20251010' # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/pyproject.toml b/pyproject.toml index 8775135..acceae7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "PyOCN" -version = "1.2.20251010" +version = "1.3.20251010" description = "Optimal Channel Networks (OCN) in Python with a C core" readme = "readme.md" requires-python = ">=3.10" diff --git a/tests/test_basic.py b/tests/test_basic.py index 8397564..7f498b0 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -11,6 +11,23 @@ class TestBasicOCN(unittest.TestCase): """Basic tests for OCN creation and energy computation.""" + def test_ocn_to_xarray(self): + """Test that OCN can be converted to xarray and back.""" + ocn = po.OCN.from_net_type( + net_type="V", + dims=(32, 32), + random_state=1234, + ) + ocn.to_xarray() + + ocn = po.OCN.from_net_type( + net_type="V", + dims=(32, 32), + random_state=1234, + wrap=True, + ) + ocn.to_xarray() + def test_ocn_energy(self): """Test that OCN creation produces expected energy value.""" ocn = po.OCN.from_net_type( From f71a00eb5baa8784e393b875ff063dd60396c39e Mon Sep 17 00:00:00 2001 From: Alex Fox Date: Fri, 10 Oct 2025 21:51:06 -0600 Subject: [PATCH 2/2] fixed test workflow to now use xarray and rasterio --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a6e1fdd..4323dbf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . + pip install -e .[raster] - name: Build C extensions run: |