You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: grid. transform is checking for that even dimensions not being transformed along are not periodic. Peridocity should only checked in the direction that is being transformed (e.g why would a transformation to density grid from depth care if my longitude is periodic).
import xarray as xr
import xgcm
import numpy as np
import matplotlib.pyplot as plt
# Make the coords
dx = 0.5
L = 20
x_left = np.arange(0,L-dx, dx)
x = np.arange(dx, L, dx)
dz = 10
L = 2000
z_left = np.arange(0,L-dz, dz)
z = np.arange(dz, L, dz)
da_z = xr.DataArray(z, dims=['z'])
da_x = xr.DataArray(x, dims=['x'])
# Make a fake density like profile
da_ones = xr.DataArray(np.ones( (len(x), len(z)) ), dims=['x','z'])
da_rho = da_ones*np.exp(da_z/-1000)
ds = xr.Dataset(coords={'x':da_x, 'xg':x_left,
'z':da_z, 'zg':z_left})
ds['rho'] = da_rho
# Define grid
grid = xgcm.Grid(ds,
coords={"X": {"center": "x", "left": "xg"},
"Z": {"center": "z", "left": "zg"}},
periodic='X')
# periodic=False) To make it work
# Rho axis to be used for transformation
rho_ax = np.linspace(0,1, 50)
# do the transform
Z_transformed = grid.transform(ds.z.broadcast_like(ds.rho), 'Z', rho_ax,
target_data=ds.rho)
The above code fails if we say that 'X' is periodic, even though we are transforming along 'Z'.
xgcm.__version__ = '0.8.1'
The text was updated successfully, but these errors were encountered:
The periodic argument seems to not longer be working properly, now that it is in process of being deprecated in favor of boundary (and I think eventually both in favor of padding?). I had the same issue as you and the following fixed it for me:
Issue: grid. transform is checking for that even dimensions not being transformed along are not periodic. Peridocity should only checked in the direction that is being transformed (e.g why would a transformation to density grid from depth care if my longitude is periodic).
The above code fails if we say that 'X' is periodic, even though we are transforming along 'Z'.
xgcm.__version__ = '0.8.1'
The text was updated successfully, but these errors were encountered: