Deltares / Deltares/MeshKernelPy

xy coordinates of some properties contain invalid values

Open
#279 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
27
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
some x/y arrays contain arbitrary/nan values, for instance the coordinates for edge_orthogonality. This is inconvenient for plotting, so would be better to just have valid values there. The xy coordinates of the GeometryList returned by get_property contains arbitrary invalid values.

To Reproduce

import numpy as np
import matplotlib.pyplot as plt
plt.close('all')
from meshkernel import (
    MeshKernel,
    ProjectionType,
    GeometryList,
    MakeGridParameters,
    Mesh2dProperty,
    Mesh2dLocation,
    )

# create basegrid
lon_min, lon_max, lat_min, lat_max = 1, 2, 48.5, 49.2
dxy = 0.7
make_grid_parameters = MakeGridParameters(
    origin_x=lon_min,
    origin_y=lat_min,
    upper_right_x=lon_max,
    upper_right_y=lat_max,
    block_size_x=dxy,
    block_size_y=dxy,
    )
mk = MeshKernel(projection=ProjectionType.SPHERICAL)
mk.curvilinear_compute_rectangular_grid_on_extension(make_grid_parameters)
mk.curvilinear_convert_to_mesh2d() #convert to ugrid/mesh2d

edge_orthogonality = mk.mesh2d_get_property(mesh2d_location=Mesh2dLocation.EDGES, property=Mesh2dProperty.ORTHOGONALITY)

# xy coordinates of orthogonality property contains invalid values 
print(edge_orthogonality.x_coordinates)

This returns any array with arbitrary values or nans, always different, but something like this:

[4.94e-324 2.96e-323 3.95e-323 6.42e-323 7.41e-323 9.88e-323 1.09e-322
 1.33e-322 1.43e-322 1.68e-322 1.78e-322 2.03e-322]

Expected behavior
Correct xy coordinates.

Version info

  • OS: Windows
  • Version 8.3.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example and inspect mesh2d_get_property for Mesh2dLocation.EDGES and Mesh2dProperty.ORTHOGONALITY, including how its GeometryList is constructed. Done means the returned x_coordinates and y_coordinates contain valid, deterministic coordinates suitable for plotting.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.