Skip to content

conflicting sizes for dimension 'n_face' when regridding #1445

@Chrismarsh

Description

@Chrismarsh

Version

2025.11.0

How did you install UXarray?

Source

What happened?

I'm trying to regrid from a triangulation to the structured mesh. However, I get an error when going to faces (to nodes works).

ValueError: conflicting sizes for dimension 'n_face': length 142546 on 'Mesh2_face_x' and length 24 on {'n_face': 'Elevation'}

MWE with attached mesh from netcdf in the zip file

mesh.zip

d = ux.open_dataset('subset_mesh.nc', 'subset_vars.nc')

dxdy=0.1
uxg = d.uxgrid
xmin, xmax = float(uxg.node_lon.min()), float(uxg.node_lon.max())
ymin, ymax = float(uxg.node_lat.min()), float(uxg.node_lat.max())

xspan = max(abs(xmax - xmin), dxdy)
yspan = max(abs(ymax - ymin), dxdy)
numX = max(int(round(xspan / dxdy)), 2)
numY = max(int(round(yspan / dxdy)), 2)

x_center = np.linspace(xmin, xmax, numX)
y_center = np.linspace(ymin, ymax, numY)
target_grid = ux.Grid.from_structured(lat=y_center, lon=x_center)

remap = d['Elevation'].remap.bilinear(destination_grid=target_grid, remap_to="faces")

What did you expect to happen?

It to work

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    📚 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions