Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curvilinear_compute_rectangular_grid_on_extension does not result in grid with constant dx/dy #153

Open
veenstrajelmer opened this issue Feb 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@veenstrajelmer
Copy link

veenstrajelmer commented Feb 2, 2024

Describe the bug
When generating a spherical mesh I would expect the edge length to be relatively constant. I request 4/60 degrees, which is approximately 40075/360/60*4=7.42 km. However, the edge lengths of the resulting grid vary from 3340 to 5515. This might be valid, but also the edge length varies over latitude which I think should not be the case.

To Reproduce

from meshkernel import MakeGridParameters, MeshKernel, ProjectionType
import dfm_tools as dfmt

#general settings
lon_min,lon_max,lat_min,lat_max = -8, 3, 46, 52
lon_res,lat_res = 4/60, 4/60 # 4 nautical miles, is approx 40075/360/60*4=7.42 km

figsize = (10,8)
crs = 'EPSG:4326'

# Create an instance of MakeGridParameters and set the values
make_grid_parameters = MakeGridParameters(angle=0.0,
                                          origin_x=lon_min,
                                          origin_y=lat_min,
                                          upper_right_x=lon_max,
                                          upper_right_y=lat_max,
                                          block_size_x=lon_res,
                                          block_size_y=lat_res)

mk = MeshKernel(projection=ProjectionType.SPHERICAL)
mk.curvilinear_compute_rectangular_grid_on_extension(make_grid_parameters)
mk.curvilinear_convert_to_mesh2d() #convert to ugrid/mesh2d

#write xugrid grid to netcdf
xu_grid_uds = dfmt.meshkernel_to_UgridDataset(mk, crs=crs)
netfile = 'test_grid_no_constant_edge_length.nc'
xu_grid_uds.ugrid.to_netcdf(netfile)
#TODO: grid has edge_length of 3340 to 5155 meters, should this not be more constant?

Expected behavior
A resolution of about 7400 meters and more constant over space.

Screenshots
image

Version info (please complete the following information):

  • OS: Windows 10
  • Version 3.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant