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
Describe the bug
The ordering of the edge-orthogonality array seems different than the ordering of the edges in the xugrid.UgridDataset. Would be convenient if they are aligned so we can easily plot these type of values.
To Reproduce
frommeshkernelimportMeshKernel, ProjectionType, MakeGridParametersimportxarrayasxrimportdfm_toolsasdfmt#general settingslon_min,lon_max=-1,-0.2lat_min,lat_max=49.1,49.6lon_res,lat_res=0.1,0.1figsize= (10,4)
crs='EPSG:4326'# Create an instance of MakeGridParameters and set the valuesmake_grid_parameters=MakeGridParameters()
make_grid_parameters.angle=0.0make_grid_parameters.origin_x=lon_minmake_grid_parameters.origin_y=lat_minmake_grid_parameters.upper_right_x=lon_maxmake_grid_parameters.upper_right_y=lat_maxmake_grid_parameters.block_size_x=lon_resmake_grid_parameters.block_size_y=lat_resmk2=MeshKernel(projection=ProjectionType.SPHERICAL)
mk2.curvilinear_compute_rectangular_grid_on_extension(make_grid_parameters)
mk2.curvilinear_convert_to_mesh2d()
mesh2d_grid2=mk2.mesh2d_get()
uds=dfmt.meshkernel_to_UgridDataset(mk2, crs=crs)
aa=mk2.mesh2d_get_orthogonality()
uds['ortho'] =xr.DataArray(aa.values,dims=(uds.grid.edge_dimension))
uds['ortho'] =uds['ortho'].where(uds['ortho']!=-999) #TODO: hardcoded -999, better to have nans in this array alreadyuds['ortho'].ugrid.plot() #TODO: ordering of the orthogonality array does not seem to align with the edge-order in the uds
Gives:
Expected behavior
The missing values are now scattered around trough the grid, but they probably belong to the outer edges of the grid. Not sure if this is a meshkernel issue or a xugrid issue.
Version info (please complete the following information):
This is an issue in xugrid indeed. In the from_meshkernel method, the edge_nodes from the meshkernel aren't used. Consequently, xugrid generates its own edge_node_connectivity, which doesn't match the order of the orthogonality array.
I'll make a change to use the edge_nodes from the meshkernel object.
Describe the bug
The ordering of the edge-orthogonality array seems different than the ordering of the edges in the
xugrid.UgridDataset
. Would be convenient if they are aligned so we can easily plot these type of values.To Reproduce
Gives:
Expected behavior
The missing values are now scattered around trough the grid, but they probably belong to the outer edges of the grid. Not sure if this is a meshkernel issue or a xugrid issue.
Version info (please complete the following information):
The text was updated successfully, but these errors were encountered: