psyplot icon indicating copy to clipboard operation
psyplot copied to clipboard

Implementation missing for UGRID start_index attribute

Open platipodium opened this issue 5 years ago • 1 comments

The UGRID standard allows node connectivities to be specified as zero-based or one-based. The base is indicated by the attribute start_index of the connectivity variable.

Code Sample, a copy-pastable example if possible

	int mesh_element_node_connectivity(mesh_element, ungridded00004) ;
		mesh_element_node_connectivity:long_name = "mesh_element_node_connectivity" ;
		mesh_element_node_connectivity:standard_name = "face_node_connectivity" ;
		mesh_element_node_connectivity:start_index = 1;

Problem description

Currently, psyplot seems to handle only zero-based connectivities and disregards this attribute.

On the above example, an index-out-of-bounds error is thrown.

Workaround

As a workaround, you can decrease the index by one

    ds['mesh_element_node_connectivity'][:] = ds['mesh_element_node_connectivity'][:] - 1
    ds['mesh_element_node_connectivity'].__setitem__('start_index',0)

NOTE

This is a bug report.

For requesting new features, use this template.

For changing existing features, use this template.

platipodium avatar Nov 19 '20 21:11 platipodium

See attached file to reproduce the problem and test a fix

schism_mesh_output_stitched.nc.gz

platipodium avatar Nov 19 '20 21:11 platipodium

this has been implemented in psy-ugrid

Chilipp avatar Apr 02 '24 08:04 Chilipp