Improve orthogonality of rotated spherical grid
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- matplotlib, numpy, python
- Domain
- computer-graphics
Research direction
Start with the reproduction script and the MeshKernel entry points curvilinear_compute_rectangular_grid, curvilinear_convert_to_mesh2d, mesh2d_set, and mesh2d_get_orthogonality. Compare direct spherical generation with Cartesian generation followed by spherical conversion using the reported parameters. Done would require an agreed approach or documented result that addresses whether the target orthogonality is achievable.
Written by the indexing model from the issue text.
Description
Feature Request
To be discussed. Is it possible to generate more orthogonal spherical rotated grids? When we generate a sperical rotated grid like the example below, it results in a max orthogonality of approximately 0.18. When we start with a cartesian grid (orthogonality of approximately 0) and set it on a spherical meshkernel instance, the orthogonality is 0.05
To Reproduce
import meshkernel
import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
import dfm_tools as dfmt
lon_min, lon_max, lat_min, lat_max = 105.7, 106.59, 18.2, 18.46
dxy = 0.02
angle = -43
make_grid_parameters = meshkernel.MakeGridParameters(angle=angle,
origin_x=lon_min,
origin_y=lat_min,
num_columns=45,
num_rows=45,
block_size_x=dxy,
block_size_y=dxy)
fig,(ax1,ax2) = plt.subplots(1,2, figsize=(9,4))
# generate spherical rotated grid: max ortho 0.1642
mk0 = meshkernel.MeshKernel(projection=meshkernel.ProjectionType.SPHERICAL)
mk0.curvilinear_compute_rectangular_grid(make_grid_parameters)
mk0.curvilinear_convert_to_mesh2d() #convert to ugrid/mesh2d
ortho_values = mk0.mesh2d_get_orthogonality().values
ortho_values[ortho_values == -999] = np.nan
print(np.nanmin(ortho_values), np.nanmax(ortho_values))
mk0.mesh2d_get().plot_edges(ax=ax1)
dfmt.plot_coastlines(ax=ax1, aspect=None, min_area=1000)
# generate cartesian rotated grid: max ortho 1.272853350497083e-12
mk1 = meshkernel.MeshKernel(projection=meshkernel.ProjectionType.CARTESIAN)
mk1.curvilinear_compute_rectangular_grid(make_grid_parameters)
mk1.curvilinear_convert_to_mesh2d() #convert to ugrid/mesh2d
ortho_values = mk1.mesh2d_get_orthogonality().values
ortho_values[ortho_values == -999] = np.nan
print(np.nanmin(ortho_values), np.nanmax(ortho_values))
# convert to spherical: max ortho 0.0548
mk2 = meshkernel.MeshKernel(projection=meshkernel.ProjectionType.SPHERICAL)
mk2.mesh2d_set(mk1.mesh2d_get())
ortho_values = mk2.mesh2d_get_orthogonality().values
ortho_values[ortho_values == -999] = np.nan
print(np.nanmin(ortho_values), np.nanmax(ortho_values))
mk2.mesh2d_get().plot_edges(ax=ax2)
dfmt.plot_coastlines(ax=ax2, aspect=None, min_area=1000)
Resulting figure:
Reference RGFGRID grid: n:\Projects\11209500\11209671\B. Measurements and calculations\01_Updated_course_materials\02_exercises\Ex01_rectilinear_grd
Main difference is that in these course materials we start with cartesian, then convert to spherical. This also results in an orthogonality of 0.05. Would this also be possible if we start with spherical directly?
Version info (please complete the following information):
- OS: Windows
- Version 3.0.0
- Dominant language
- Python
- Stars
- 27
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Deltares/MeshKernelPy
-
chore
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Deltares/MeshKernelPy#284 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Deltares/MeshKernelPy#279 · 1 comment ·
-
Add support for Python 3.14Possibly taken @veenstrajelmer claimed this 140 days ago. Openchore
Difficulty 3/5 1-2 days Newbie friendliness 25/100
Deltares/MeshKernelPy#251 · 2 comments ·
-
global grid from `mesh2d_make_global` does not always extend to the polesPossibly taken @BillSenior claimed this 53 days ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Deltares/MeshKernelPy#236 · 1 comment ·
-
chore
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Deltares/MeshKernelPy#190 ·
All issues in Deltares/MeshKernelPy
Similar issues
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
json_params_matcher fails on falsy top-level JSON primitives (0, False, "")Possibly taken @mayureshsonawane17 claimed this today. OpenWaiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Add .devin pluginOpen
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ayghri/i-have-adhd#249 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
modelscope/FunASR#3762 ·
Maintainers usually reply within 1 day