Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xarray v2024.09.0 breaks tests #191

Closed
navidcy opened this issue Oct 3, 2024 · 0 comments · Fixed by #190
Closed

xarray v2024.09.0 breaks tests #191

navidcy opened this issue Oct 3, 2024 · 0 comments · Fixed by #190

Comments

@navidcy
Copy link
Contributor

navidcy commented Oct 3, 2024

In particular test that involve the bathymetry:

(base) navid:regional-mom6/ (main) $ conda env create --prefix ./env --file environment-ci.yml                [17:32:04]

Retrieving notices: ...working... done
Channels:
 - conda-forge
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
    current version: 24.7.1
    latest version: 24.9.1

Please update conda by running

    $ conda update -n base -c conda-forge conda



Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate /Users/navid/Research/rmom6-v2/env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) navid:regional-mom6/ (main) $ conda activate ./env                                                     [17:35:26]

(/Users/navid/Research/regional-mom6/env) navid:regional-mom6/ (main) $ python -m pip install .                    [17:35:39]
python -m pip install pytest

Processing /Users/navid/Research/regional-mom6
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting bottleneck (from regional_mom6==0.6.2.dev3+g471554a)
  Using cached Bottleneck-1.4.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (7.9 kB)
Collecting dask[array] (from regional_mom6==0.6.2.dev3+g471554a)
  Downloading dask-2024.9.1-py3-none-any.whl.metadata (3.7 kB)
Collecting netCDF4 (from regional_mom6==0.6.2.dev3+g471554a)
  Using cached netCDF4-1.7.1.post2-cp312-cp312-macosx_14_0_arm64.whl.metadata (1.8 kB)
Requirement already satisfied: numpy<2.0.0,>=1.17.0 in ./env/lib/python3.12/site-packages (from regional_mom6==0.6.2.dev3+g471554a) (1.26.4)
Collecting scipy>=1.2.0 (from regional_mom6==0.6.2.dev3+g471554a)
  Using cached scipy-1.14.1-cp312-cp312-macosx_14_0_arm64.whl.metadata (60 kB)
Collecting xarray (from regional_mom6==0.6.2.dev3+g471554a)
  Downloading xarray-2024.9.0-py3-none-any.whl.metadata (11 kB)
Collecting xesmf>=0.8.4 (from regional_mom6==0.6.2.dev3+g471554a)
  Using cached xesmf-0.8.7-py3-none-any.whl.metadata (3.9 kB)
Collecting f90nml>=1.4.1 (from regional_mom6==0.6.2.dev3+g471554a)
  Using cached f90nml-1.4.4-py2.py3-none-any.whl.metadata (6.0 kB)
Collecting cf-xarray>=0.5.1 (from xesmf>=0.8.4->regional_mom6==0.6.2.dev3+g471554a)
  Downloading cf_xarray-0.9.5-py3-none-any.whl.metadata (16 kB)
Collecting numba>=0.55.2 (from xesmf>=0.8.4->regional_mom6==0.6.2.dev3+g471554a)
  Using cached numba-0.60.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (2.7 kB)
Collecting shapely (from xesmf>=0.8.4->regional_mom6==0.6.2.dev3+g471554a)
  Using cached shapely-2.0.6-cp312-cp312-macosx_11_0_arm64.whl.metadata (7.0 kB)
Collecting sparse>=0.8.0 (from xesmf>=0.8.4->regional_mom6==0.6.2.dev3+g471554a)
  Using cached sparse-0.15.4-py2.py3-none-any.whl.metadata (4.5 kB)
Collecting packaging>=23.1 (from xarray->regional_mom6==0.6.2.dev3+g471554a)
  Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting pandas>=2.1 (from xarray->regional_mom6==0.6.2.dev3+g471554a)
  Downloading pandas-2.2.3-cp312-cp312-macosx_11_0_arm64.whl.metadata (89 kB)
Collecting click>=8.1 (from dask[array]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting cloudpickle>=3.0.0 (from dask[array]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached cloudpickle-3.0.0-py3-none-any.whl.metadata (7.0 kB)
Collecting fsspec>=2021.09.0 (from dask[array]->regional_mom6==0.6.2.dev3+g471554a)
  Downloading fsspec-2024.9.0-py3-none-any.whl.metadata (11 kB)
Collecting partd>=1.4.0 (from dask[array]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached partd-1.4.2-py3-none-any.whl.metadata (4.6 kB)
Collecting pyyaml>=5.3.1 (from dask[array]->regional_mom6==0.6.2.dev3+g471554a)
  Downloading PyYAML-6.0.2-cp312-cp312-macosx_11_0_arm64.whl.metadata (2.1 kB)
Collecting toolz>=0.10.0 (from dask[array]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached toolz-0.12.1-py3-none-any.whl.metadata (5.1 kB)
Collecting distributed==2024.9.1 (from dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Downloading distributed-2024.9.1-py3-none-any.whl.metadata (3.3 kB)
Collecting jinja2>=2.10.3 (from distributed==2024.9.1->dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting locket>=1.0.0 (from distributed==2024.9.1->dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached locket-1.0.0-py2.py3-none-any.whl.metadata (2.8 kB)
Collecting msgpack>=1.0.2 (from distributed==2024.9.1->dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Downloading msgpack-1.1.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (8.4 kB)
Collecting psutil>=5.8.0 (from distributed==2024.9.1->dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached psutil-6.0.0-cp38-abi3-macosx_11_0_arm64.whl.metadata (21 kB)
Collecting sortedcontainers>=2.0.5 (from distributed==2024.9.1->dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached sortedcontainers-2.4.0-py2.py3-none-any.whl.metadata (10 kB)
Collecting tblib>=1.6.0 (from distributed==2024.9.1->dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached tblib-3.0.0-py3-none-any.whl.metadata (25 kB)
Collecting tornado>=6.2.0 (from distributed==2024.9.1->dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Downloading tornado-6.4.1-cp38-abi3-macosx_10_9_universal2.whl.metadata (2.5 kB)
Collecting urllib3>=1.26.5 (from distributed==2024.9.1->dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Downloading urllib3-2.2.3-py3-none-any.whl.metadata (6.5 kB)
Collecting zict>=3.0.0 (from distributed==2024.9.1->dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached zict-3.0.0-py2.py3-none-any.whl.metadata (899 bytes)
Collecting cftime (from netCDF4->regional_mom6==0.6.2.dev3+g471554a)
  Using cached cftime-1.6.4-cp312-cp312-macosx_11_0_arm64.whl.metadata (8.7 kB)
Collecting certifi (from netCDF4->regional_mom6==0.6.2.dev3+g471554a)
  Downloading certifi-2024.8.30-py3-none-any.whl.metadata (2.2 kB)
Collecting llvmlite<0.44,>=0.43.0dev0 (from numba>=0.55.2->xesmf>=0.8.4->regional_mom6==0.6.2.dev3+g471554a)
  Using cached llvmlite-0.43.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (4.8 kB)
Collecting python-dateutil>=2.8.2 (from pandas>=2.1->xarray->regional_mom6==0.6.2.dev3+g471554a)
  Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting pytz>=2020.1 (from pandas>=2.1->xarray->regional_mom6==0.6.2.dev3+g471554a)
  Downloading pytz-2024.2-py2.py3-none-any.whl.metadata (22 kB)
Collecting tzdata>=2022.7 (from pandas>=2.1->xarray->regional_mom6==0.6.2.dev3+g471554a)
  Downloading tzdata-2024.2-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting MarkupSafe>=2.0 (from jinja2>=2.10.3->distributed==2024.9.1->dask[distributed]->regional_mom6==0.6.2.dev3+g471554a)
  Using cached MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl.metadata (3.0 kB)
Collecting six>=1.5 (from python-dateutil>=2.8.2->pandas>=2.1->xarray->regional_mom6==0.6.2.dev3+g471554a)
  Using cached six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Using cached f90nml-1.4.4-py2.py3-none-any.whl (32 kB)
Using cached scipy-1.14.1-cp312-cp312-macosx_14_0_arm64.whl (23.1 MB)
Using cached xesmf-0.8.7-py3-none-any.whl (46 kB)
Downloading xarray-2024.9.0-py3-none-any.whl (1.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 5.7 MB/s eta 0:00:00
Using cached Bottleneck-1.4.0-cp312-cp312-macosx_11_0_arm64.whl (98 kB)
Downloading distributed-2024.9.1-py3-none-any.whl (1.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 6.2 MB/s eta 0:00:00
Downloading dask-2024.9.1-py3-none-any.whl (1.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 6.2 MB/s eta 0:00:00
Using cached netCDF4-1.7.1.post2-cp312-cp312-macosx_14_0_arm64.whl (2.4 MB)
Downloading cf_xarray-0.9.5-py3-none-any.whl (66 kB)
Using cached click-8.1.7-py3-none-any.whl (97 kB)
Using cached cloudpickle-3.0.0-py3-none-any.whl (20 kB)
Downloading fsspec-2024.9.0-py3-none-any.whl (179 kB)
Using cached numba-0.60.0-cp312-cp312-macosx_11_0_arm64.whl (2.7 MB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Downloading pandas-2.2.3-cp312-cp312-macosx_11_0_arm64.whl (11.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.4/11.4 MB 6.5 MB/s eta 0:00:00
Using cached partd-1.4.2-py3-none-any.whl (18 kB)
Downloading PyYAML-6.0.2-cp312-cp312-macosx_11_0_arm64.whl (173 kB)
Using cached sparse-0.15.4-py2.py3-none-any.whl (237 kB)
Using cached toolz-0.12.1-py3-none-any.whl (56 kB)
Downloading certifi-2024.8.30-py3-none-any.whl (167 kB)
Using cached cftime-1.6.4-cp312-cp312-macosx_11_0_arm64.whl (209 kB)
Using cached shapely-2.0.6-cp312-cp312-macosx_11_0_arm64.whl (1.3 MB)
Using cached jinja2-3.1.4-py3-none-any.whl (133 kB)
Using cached llvmlite-0.43.0-cp312-cp312-macosx_11_0_arm64.whl (28.8 MB)
Using cached locket-1.0.0-py2.py3-none-any.whl (4.4 kB)
Downloading msgpack-1.1.0-cp312-cp312-macosx_11_0_arm64.whl (82 kB)
Using cached psutil-6.0.0-cp38-abi3-macosx_11_0_arm64.whl (251 kB)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Downloading pytz-2024.2-py2.py3-none-any.whl (508 kB)
Using cached sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB)
Using cached tblib-3.0.0-py3-none-any.whl (12 kB)
Downloading tornado-6.4.1-cp38-abi3-macosx_10_9_universal2.whl (435 kB)
Downloading tzdata-2024.2-py2.py3-none-any.whl (346 kB)
Downloading urllib3-2.2.3-py3-none-any.whl (126 kB)
Using cached zict-3.0.0-py2.py3-none-any.whl (43 kB)
Using cached MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl (18 kB)
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: regional_mom6
  Building wheel for regional_mom6 (pyproject.toml) ... done
  Created wheel for regional_mom6: filename=regional_mom6-0.6.2.dev3+g471554a-py3-none-any.whl size=51667 sha256=acb827464bc7699b023f7e487be51b5268e2e1b181c8f807a72a608e40030298
  Stored in directory: /Users/navid/Library/Caches/pip/wheels/ed/24/fd/b99bea13b2d85bb33f5318ee3ae32657cecb0d131032a34eee
Successfully built regional_mom6
Installing collected packages: sortedcontainers, pytz, f90nml, zict, urllib3, tzdata, tornado, toolz, tblib, six, shapely, scipy, pyyaml, psutil, packaging, msgpack, MarkupSafe, locket, llvmlite, fsspec, cloudpickle, click, cftime, certifi, bottleneck, python-dateutil, partd, numba, netCDF4, jinja2, sparse, pandas, dask, xarray, distributed, cf-xarray, xesmf, regional_mom6
Successfully installed MarkupSafe-2.1.5 bottleneck-1.4.0 certifi-2024.8.30 cf-xarray-0.9.5 cftime-1.6.4 click-8.1.7 cloudpickle-3.0.0 dask-2024.9.1 distributed-2024.9.1 f90nml-1.4.4 fsspec-2024.9.0 jinja2-3.1.4 llvmlite-0.43.0 locket-1.0.0 msgpack-1.1.0 netCDF4-1.7.1.post2 numba-0.60.0 packaging-24.1 pandas-2.2.3 partd-1.4.2 psutil-6.0.0 python-dateutil-2.9.0.post0 pytz-2024.2 pyyaml-6.0.2 regional_mom6-0.6.2.dev3+g471554a scipy-1.14.1 shapely-2.0.6 six-1.16.0 sortedcontainers-2.4.0 sparse-0.15.4 tblib-3.0.0 toolz-0.12.1 tornado-6.4.1 tzdata-2024.2 urllib3-2.2.3 xarray-2024.9.0 xesmf-0.8.7 zict-3.0.0
Collecting pytest
  Downloading pytest-8.3.3-py3-none-any.whl.metadata (7.5 kB)
Collecting iniconfig (from pytest)
  Using cached iniconfig-2.0.0-py3-none-any.whl.metadata (2.6 kB)
Requirement already satisfied: packaging in ./env/lib/python3.12/site-packages (from pytest) (24.1)
Collecting pluggy<2,>=1.5 (from pytest)
  Using cached pluggy-1.5.0-py3-none-any.whl.metadata (4.8 kB)
Downloading pytest-8.3.3-py3-none-any.whl (342 kB)
Using cached pluggy-1.5.0-py3-none-any.whl (20 kB)
Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Installing collected packages: pluggy, iniconfig, pytest
Successfully installed iniconfig-2.0.0 pluggy-1.5.0 pytest-8.3.3
(/Users/navid/Research/regional-mom6/env) navid: regional-mom6/ (main) $ python -m pytest tests/                    [17:36:16]

==================================================== test session starts ====================================================
platform darwin -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
rootdir: /Users/navid/Research/rmom6-v2
configfile: pyproject.toml
collected 34 items

tests/test_expt_class.py F.....                                                                                       [ 17%]
tests/test_grid_generation.py ......................                                                                  [ 82%]
tests/test_utils.py ......                                                                                            [100%]

========================================================= FAILURES ==========================================================
_ test_setup_bathymetry[longitude_extent0-latitude_extent0-date_range0-0.1-5-1-1000-rundir/-inputdir/-toolpath-even_spacing] _

longitude_extent = (-5, 5), latitude_extent = [0, 10], date_range = ['2003-01-01 00:00:00', '2003-01-01 00:00:00']
resolution = 0.1, number_vertical_layers = 5, layer_thickness_ratio = 1, depth = 1000, mom_run_dir = 'rundir/'
mom_input_dir = 'inputdir/', toolpath_dir = 'toolpath', grid_type = 'even_spacing'
tmp_path = PosixPath('/private/tmp/pytest-of-navid/pytest-0/test_setup_bathymetry_longitud0')

    @pytest.mark.parametrize(
        (
            "longitude_extent",
            "latitude_extent",
            "date_range",
            "resolution",
            "number_vertical_layers",
            "layer_thickness_ratio",
            "depth",
            "mom_run_dir",
            "mom_input_dir",
            "toolpath_dir",
            "grid_type",
        ),
        [
            (
                (-5, 5),
                [0, 10],
                ["2003-01-01 00:00:00", "2003-01-01 00:00:00"],
                0.1,
                5,
                1,
                1000,
                "rundir/",
                "inputdir/",
                "toolpath",
                "even_spacing",
            ),
        ],
    )
    def test_setup_bathymetry(
        longitude_extent,
        latitude_extent,
        date_range,
        resolution,
        number_vertical_layers,
        layer_thickness_ratio,
        depth,
        mom_run_dir,
        mom_input_dir,
        toolpath_dir,
        grid_type,
        tmp_path,
    ):
        expt = experiment(
            longitude_extent=longitude_extent,
            latitude_extent=latitude_extent,
            date_range=date_range,
            resolution=resolution,
            number_vertical_layers=number_vertical_layers,
            layer_thickness_ratio=layer_thickness_ratio,
            depth=depth,
            mom_run_dir=mom_run_dir,
            mom_input_dir=mom_input_dir,
            toolpath_dir=toolpath_dir,
            grid_type=grid_type,
        )

        ## Generate a bathymetry to use in tests

        bathymetry_file = tmp_path / "bathymetry.nc"

        bathymetry = np.random.random((100, 100)) * (-100)
        bathymetry = xr.DataArray(
            bathymetry,
            dims=["silly_lat", "silly_lon"],
            coords={
                "silly_lat": np.linspace(
                    latitude_extent[0] - 5, latitude_extent[1] + 5, 100
                ),
                "silly_lon": np.linspace(
                    longitude_extent[0] - 5, longitude_extent[1] + 5, 100
                ),
            },
        )
        bathymetry.name = "silly_depth"
        bathymetry.to_netcdf(bathymetry_file)
        bathymetry.close()

        # Now provide the above bathymetry file as input in `expt.setup_bathymetry()`
>       expt.setup_bathymetry(
            bathymetry_path=str(bathymetry_file),
            longitude_coordinate_name="silly_lon",
            latitude_coordinate_name="silly_lat",
            vertical_coordinate_name="silly_depth",
            minimum_layers=1,
            chunks={"longitude": 10, "latitude": 10},
        )

tests/test_expt_class.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
regional_mom6/regional_mom6.py:1297: in setup_bathymetry
    regridder = xe.Regridder(
env/lib/python3.12/site-packages/xesmf/frontend.py:980: in __init__
    self._init_para_regrid(ds_in, ds_out, kwargs)
env/lib/python3.12/site-packages/xesmf/frontend.py:1062: in _init_para_regrid
    w_templ = xr.DataArray(templ, dims=weights_dims).chunk(
env/lib/python3.12/site-packages/xarray/util/deprecation_helpers.py:118: in inner
    return func(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <xarray.DataArray (y_out: 100, x_out: 100, y_in: 54, x_in: 54)> Size: 0B
<COO: shape=(100, 100, 54, 54), dtype=float64, nnz=0, fill_value=0.0>
Dimensions without coordinates: y_out, x_out, y_in, x_in
chunks = [(10, 10, 10, 10, 10, 10, ...), (10, 10, 10, 10, 10, 10, ...)], name_prefix = 'xarray-', token = None, lock = False
inline_array = False, chunked_array_type = None, from_array_kwargs = None, chunks_kwargs = {}

    @_deprecate_positional_args("v2023.10.0")
    def chunk(
        self,
        chunks: T_ChunksFreq = {},  # {} even though it's technically unsafe, is being used intentionally here (#4667)
        *,
        name_prefix: str = "xarray-",
        token: str | None = None,
        lock: bool = False,
        inline_array: bool = False,
        chunked_array_type: str | ChunkManagerEntrypoint | None = None,
        from_array_kwargs=None,
        **chunks_kwargs: T_ChunkDimFreq,
    ) -> Self:
        """Coerce this array's data into a dask arrays with the given chunks.

        If this variable is a non-dask array, it will be converted to dask
        array. If it's a dask array, it will be rechunked to the given chunk
        sizes.

        If neither chunks is not provided for one or more dimensions, chunk
        sizes along that dimension will not be updated; non-dask arrays will be
        converted into dask arrays with a single block.

        Along datetime-like dimensions, a pandas frequency string is also accepted.

        Parameters
        ----------
        chunks : int, "auto", tuple of int or mapping of hashable to int or a pandas frequency string, optional
            Chunk sizes along each dimension, e.g., ``5``, ``"auto"``, ``(5, 5)`` or
            ``{"x": 5, "y": 5}`` or ``{"x": 5, "time": "YE"}``.
        name_prefix : str, optional
            Prefix for the name of the new dask array.
        token : str, optional
            Token uniquely identifying this array.
        lock : bool, default: False
            Passed on to :py:func:`dask.array.from_array`, if the array is not
            already as dask array.
        inline_array: bool, default: False
            Passed on to :py:func:`dask.array.from_array`, if the array is not
            already as dask array.
        chunked_array_type: str, optional
            Which chunked array type to coerce the underlying data array to.
            Defaults to 'dask' if installed, else whatever is registered via the `ChunkManagerEntryPoint` system.
            Experimental API that should not be relied upon.
        from_array_kwargs: dict, optional
            Additional keyword arguments passed on to the `ChunkManagerEntrypoint.from_array` method used to create
            chunked arrays, via whichever chunk manager is specified through the `chunked_array_type` kwarg.
            For example, with dask as the default chunked array type, this method would pass additional kwargs
            to :py:func:`dask.array.from_array`. Experimental API that should not be relied upon.
        **chunks_kwargs : {dim: chunks, ...}, optional
            The keyword arguments form of ``chunks``.
            One of chunks or chunks_kwargs must be provided.

        Returns
        -------
        chunked : xarray.DataArray

        See Also
        --------
        DataArray.chunks
        DataArray.chunksizes
        xarray.unify_chunks
        dask.array.from_array
        """
        chunk_mapping: T_ChunksFreq
        if chunks is None:
            warnings.warn(
                "None value for 'chunks' is deprecated. "
                "It will raise an error in the future. Use instead '{}'",
                category=FutureWarning,
            )
            chunk_mapping = {}

        if isinstance(chunks, float | str | int):
            # ignoring type; unclear why it won't accept a Literal into the value.
            chunk_mapping = dict.fromkeys(self.dims, chunks)
        elif isinstance(chunks, tuple | list):
            utils.emit_user_level_warning(
                "Supplying chunks as dimension-order tuples is deprecated. "
                "It will raise an error in the future. Instead use a dict with dimension names as keys.",
                category=DeprecationWarning,
            )
>           chunk_mapping = dict(zip(self.dims, chunks, strict=True))
E           ValueError: zip() argument 2 is shorter than argument 1

env/lib/python3.12/site-packages/xarray/core/dataarray.py:1442: ValueError
--------------------------------------------------- Captured stdout call ----------------------------------------------------
Begin regridding bathymetry...

If this process hangs it means that the chosen domain might be too big to handle this way. After ensuring access to appropriate computational resources, try calling ESMF directly from a terminal in the input directory via

mpirun ESMF_Regrid -s bathymetry_original.nc -d bathymetry_unfinished.nc -m bilinear --src_var elevation --dst_var elevation --netcdf4 --src_regional --dst_regional

For details see https://xesmf.readthedocs.io/en/latest/large_problems_on_HPC.html

Afterwards, we run 'tidy_bathymetry' method to skip the expensive interpolation step, and finishing metadata, encoding and cleanup.
Regridding in parallel: True
===================================================== warnings summary ======================================================
tests/test_expt_class.py::test_setup_bathymetry[longitude_extent0-latitude_extent0-date_range0-0.1-5-1-1000-rundir/-inputdir/-toolpath-even_spacing]
  /Users/navid/Research/rmom6-v2/env/lib/python3.12/site-packages/xesmf/frontend.py:1062: DeprecationWarning: Supplying chunks as dimension-order tuples is deprecated. It will raise an error in the future. Instead use a dict with dimension names as keys.
    w_templ = xr.DataArray(templ, dims=weights_dims).chunk(

tests/test_expt_class.py::test_ocean_forcing[longitude_extent0-latitude_extent0-date_range0-0.1-5-1-1000-rundir/-inputdir/-toolpath-even_spacing-temp_dataarray_initial_condition0]
tests/test_expt_class.py::test_ocean_forcing[longitude_extent0-latitude_extent0-date_range0-0.1-5-1-1000-rundir/-inputdir/-toolpath-even_spacing-temp_dataarray_initial_condition1]
tests/test_expt_class.py::test_ocean_forcing[longitude_extent0-latitude_extent0-date_range0-0.1-5-1-1000-rundir/-inputdir/-toolpath-even_spacing-temp_dataarray_initial_condition2]
tests/test_expt_class.py::test_ocean_forcing[longitude_extent0-latitude_extent0-date_range0-0.1-5-1-1000-rundir/-inputdir/-toolpath-even_spacing-temp_dataarray_initial_condition3]
  /Users/navid/Research/rmom6-v2/env/lib/python3.12/site-packages/xesmf/backend.py:41: UserWarning: Input array is not F_CONTIGUOUS. Will affect performance.
    warnings.warn('Input array is not F_CONTIGUOUS. ' 'Will affect performance.')

tests/test_expt_class.py: 25 warnings
  /Users/navid/Research/rmom6-v2/env/lib/python3.12/site-packages/xesmf/smm.py:131: UserWarning: Input array is not C_CONTIGUOUS. Will affect performance.
    warnings.warn('Input array is not C_CONTIGUOUS. ' 'Will affect performance.')

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================== short test summary info ==================================================
FAILED tests/test_expt_class.py::test_setup_bathymetry[longitude_extent0-latitude_extent0-date_range0-0.1-5-1-1000-rundir/-inputdir/-toolpath-even_spacing] - ValueError: zip() argument 2 is shorter than argument 1
======================================== 1 failed, 33 passed, 30 warnings in 47.63s =========================================
[WARNING] yaksa: 10 leaked handle pool objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant