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

Improve curvilinear_make_uniform user feedback #70

Closed
veenstrajelmer opened this issue Jul 4, 2023 · 1 comment
Closed

Improve curvilinear_make_uniform user feedback #70

veenstrajelmer opened this issue Jul 4, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Jul 4, 2023

Describe the bug
It is unclear when to use curvilinear_make_uniform_on_extension or curvilinear_make_uniform if you look to the feedback from error messages. I would expect that arguments that are not used are not possible to pass (raise an error). Currently, this is not the case.

To Reproduce

import meshkernel
import matplotlib.pyplot as plt
plt.close('all')

extent = True 
numrowcols0 = False
#TODO: extent=True ignores num_columns/num_rows arguments. This is fine since we are defining it with upper_right_x and upper_right_y in this case, but there should be an error if the user provides this argument.
#TODO: False/False gives grid of too small extent >> upper_right_x/upper_right_y should not be accepted as arguments for curvilinear_make_uniform

#general settings
lon_min,lon_max = -1,-0.2
lat_min,lat_max = 49.1,49.6
lon_res,lat_res = 0.1,0.1

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

# Create an instance of MakeGridParameters and set the values
make_grid_parameters = meshkernel.MakeGridParameters()
make_grid_parameters.angle = 0.0
make_grid_parameters.origin_x = lon_min
make_grid_parameters.origin_y = lat_min
if numrowcols0:
    make_grid_parameters.num_columns = 0 #TODO: this is necessary or the grid extent will be wrong
    make_grid_parameters.num_rows = 0
make_grid_parameters.upper_right_x = lon_max
make_grid_parameters.upper_right_y = lat_max
make_grid_parameters.block_size_x = lon_res
make_grid_parameters.block_size_y = lat_res

mk2 = meshkernel.MeshKernel(is_geographic=True)
if extent:
    mk2.curvilinear_make_uniform_on_extension(make_grid_parameters)
else:
    mk2.curvilinear_make_uniform(make_grid_parameters)
mk2.curvilinear_convert_to_mesh2d() #convert to ugrid/mesh2d

mesh2d = mk2.mesh2d_get()
fig, ax = plt.subplots()
mesh2d.plot_edges(ax)

Version info (please complete the following information):

  • OS: Windows
  • Version: MeshkernelPy 2.1.0
@veenstrajelmer
Copy link
Collaborator Author

Since MakeGridParameters is used for both curvilinear_make_uniform_on_extension and curvilinear_make_uniform, we always have unused parameters. This is intended and also expected behaviour, so this issue is closed as not planned.

@veenstrajelmer veenstrajelmer closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2023
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