Skip to content

[Bug]: No 'periodic' in code, no 'periodic' in data, but regridder.vertical refuses the 'periodic' argument #845

Closed

Description

@oliviermarti

What happened?

When runnning the MVCE pasted below, I've got the following error message.

My data does not contain any 'periodic' attributes.

My code does not containt the 'periodic' word.

It worked smoothly with before and update of xcdat and other dependant.

ValueError: The periodicargument has been removed. Usepadding='periodic'(per axis if needed, e.g.padding={'X': 'periodic', 'Y': 'fill'}) instead. Previously periodic=Falsecorresponded topadding='fill'.

What did you expect to happen? Are there are possible answers you came across?

No response

Minimal Complete Verifiable Example (MVCE)

# import necessary libraries
import sys
import numpy as np
import xarray as xr
import xcdat as xc

# Print version information
print ( f'Version python     : {sys.version}'    )
print ( f'Version xarray     : {xr.__version__}' )
print ( f'Version xcdat      : {xc.__version__}' )

# Open dataset
f_h = 'https://thredds-su.ipsl.fr/thredds/dodsC/tgcc_thredds/work/p86mart/IPSLCM6/PROD/pdControl/CM61T2REFPD/ATM/Analyse/SE/CM61T2REFPD_SE_2040_2049_1M_histmth.nc'
d_h =  xc.open_dataset (f_h, use_cftime=True, decode_cf=True, decode_times=xr.coders.CFDatetimeCoder (use_cftime=True))

# Define standard pressure levels in Pa
std_lev = np.array ( [1013, 1000, 975, 950, 925, 900, 875, 850, 825, 800,
                       750,  700, 650, 600, 550, 500, 450, 400, 350, 300,
                       250, 200,  150, 100,  70,  50,  30,  20,  10]) * 100.

# Creates the standard pressure levels as an xarray DataArray and prepares the pressure grid for regridding
std_lev = xr.DataArray ( std_lev, dims=('pressure',), coords={'pressure': std_lev} )
std_lev.attrs.update ( {'units':'Pa', 'standard_name':'Pressure levels'} )
std_pres_grid = xc.create_grid (z=xc.create_axis("pressure", std_lev))

# Create a dataset for regridding
ds = xr.Dataset ( {"w1": d_h.vitw.isel (time_counter=0), "pres": d_h.pres.isel (time_counter=0)} )
ds.presnivs.attrs.update ( {'axis':'Z', 'c_grid_axis_shift':0.5, 'long_name':'Pressure levels' } )

# Perform vertical regridding of the variable 'w1' to the standard pressure levels
w2 = ds.regridder.vertical ("w1", std_pres_grid, method="log", target_data=ds.pres, padding='fill')['w1']
help (ds.regridder.vertical)

Relevant log output

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[1], line 31
     28 ds.presnivs.attrs.update ( {'axis':'Z', 'c_grid_axis_shift':0.5, 'long_name':'Pressure levels' } )
     30 # Perform vertical regridding of the variable 'w1' to the standard pressure levels
---> 31 w2 = ds.regridder.vertical ("w1", std_pres_grid, method="log", target_data=ds.pres, padding='fill')['w1']
     32 help (ds.regridder.vertical)

File ~/miniforge3/envs/PROD/lib/python3.14/site-packages/xcdat/regridder/accessor.py:247, in RegridderAccessor.vertical(self, data_var, output_grid, tool, **options)
    239 input_grid = _get_input_grid(
    240     self._ds,
    241     data_var,
   (...)    244     ],
    245 )
    246 regridder = regrid_tool(input_grid, output_grid, **options)
--> 247 output_ds = regridder.vertical(data_var, self._ds)
    249 return output_ds

File ~/miniforge3/envs/PROD/lib/python3.14/site-packages/xcdat/regridder/xgcm.py:176, in XGCMRegridder.vertical(self, data_var, ds)
    171     grid_coords = {"Z": self._grid_positions}
    173 # NOTE: xgcm v0.9.0 introduces the arg autoparse_metadata to the Grid
    174 # constructor, which defaults to True. This is not compatible with
    175 # manually passing metadata such as coords, so we set it to False.
--> 176 grid = Grid(
    177     ds, coords=grid_coords, autoparse_metadata=False, **self._extra_init_options
...
    208         f"Grid.__init__() got unexpected keyword argument(s): "
    209         f"{', '.join(repr(k) for k in kwargs)}"
    210     )

ValueError: The `periodic` argument has been removed. Use `padding='periodic'` (per axis if needed, e.g. `padding={'X': 'periodic', 'Y': 'fill'}`) instead. Previously `periodic=False` corresponded to `padding='fill'`.
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

Anything else we need to know?

I may need to overload a default value in a function call. But where and how ?

Environment

INSTALLED VERSIONS

commit: None
python: 3.14.5 | packaged by conda-forge | (main, May 20 2026, 00:45:47) [Clang 20.1.8 ]
python-bits: 64
OS: Darwin
OS-release: 25.5.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: None
LANG: None
LOCALE: ('C', 'UTF-8')
libhdf5: 1.14.6
libnetcdf: 4.10.0

xarray: 2026.7.0
pandas: 3.0.5
numpy: 2.4.6
scipy: 1.18.0
netCDF4: 1.7.4
pydap: None
h5netcdf: None
h5py: 3.15.1
zarr: None
cftime: 1.6.5
nc_time_axis: 1.4.1
iris: None
bottleneck: 1.6.0
dask: 2026.1.2
distributed: 2026.1.2
matplotlib: 3.11.1
cartopy: 0.25.0
seaborn: 0.13.2
numbagg: None
fsspec: 2026.2.0
cupy: None
pint: 0.25.2
sparse: 0.18.0
flox: None
numpy_groupies: None
setuptools: 82.0.0
pip: 26.1.2
conda: None
pytest: 9.0.2
mypy: None
IPython: 9.10.0
sphinx: 9.1.0

Activity

  1. added
    type: bug
    on Aug 26, 2026
  2. tomvothecoder commented on Aug 26, 2026

    @tomvothecoder
    Collaborator

    Hey @oliviermarti, are you using xcdat v0.11.3 which includes this fix? I don't see what version of xcdat you're on.

  3. oliviermarti commented on Aug 26, 2026

    @oliviermarti
    Author

    I was in 0.11.2. It's OK with O.11.3

    Sorry

  4. tomvothecoder commented on Aug 26, 2026

    @tomvothecoder
    Collaborator

    I was in 0.11.2. It's OK with O.11.3

    Sorry

    No problem! This was a breaking xgcm API change that propagated up to xCDAT. Glad that 0.11.3 fixed it for you.

    Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions