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
Is your feature request related to a problem? Please describe.
curvilinear_make_uniform() contains a non-optional geometry_list argument. This geometry_list can be empty, but in this case it makes more sense to supply no geometry_list argument. This is more user friendly.
Describe the solution you'd like
Make the geometry_list argument optional
Describe alternatives you've considered
Supplying an empty list works, but is cumbersome
Additional context
MWE:
import meshkernel
import xarray as xr
import matplotlib.pyplot as plt
plt.close('all')
import numpy as np
import contextily as ctx
#general settings
lon_min,lon_max = -6,2
lat_min,lat_max = 48.5,51.2
lon_res,lat_res = 0.2,0.2
num_x = int(np.ceil((lon_max-lon_min)/lon_res))
num_y = int(np.ceil((lat_max-lat_min)/lat_res))
figsize = (10,4)
crs = 'EPSG:4326'
"""
Make a regular (potentially rotated) rectilinear grid. First generate a curvilinear grid than convert the curvilinear grid into unstructured grid. The steps are the following:
- curvilinear_make_uniform, see the following notebook: https://github.com/Deltares/MeshKernelPy/blob/AddCurvilinearGridSupport/docs/examples/04_curvilineargrid_basics.ipynb
- curvilinear_convert_to_mesh2d: https://github.com/Deltares/MeshKernelPy/blob/118cb4953c4e95d5b18ed283bb37f391134b2bb2/meshkernel/meshkernel.py#L1399
"""
# Create an instance of MakeGridParameters and set the values
make_grid_parameters = meshkernel.MakeGridParameters() #TODO: contains default values that are maybe not intuitive
make_grid_parameters.num_columns = num_x
make_grid_parameters.num_rows = num_y
make_grid_parameters.angle = 0.0 #TODO: does non-zero result in an orthogonal spherical grid?
#make_grid_parameters.block_size = 0.0
make_grid_parameters.origin_x = lon_min
make_grid_parameters.origin_y = lat_min
make_grid_parameters.block_size_x = lon_res
make_grid_parameters.block_size_y = lat_res
grid_in_pol = False
# A polygon must to be provided. If empty it will not be used. If a polygon is provided it will be used in the generation of the curvilinear grid. The polygon must be closed
if grid_in_pol: #can be used instead of origin_x/origin_y and num_x/num_y
pol_x = np.array([-6,-4,0,-6], dtype=np.double)
pol_y = np.array([48,51,49.5,48], dtype=np.double)
else:
pol_x = np.empty(0, dtype=np.double)
pol_y = np.empty(0, dtype=np.double)
geometry_list = meshkernel.GeometryList(pol_x, pol_y)
mk1 = meshkernel.MeshKernel()
mk1.curvilinear_make_uniform(make_grid_parameters, geometry_list)
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
curvilinear_make_uniform() contains a non-optional geometry_list argument. This geometry_list can be empty, but in this case it makes more sense to supply no geometry_list argument. This is more user friendly.
Describe the solution you'd like
Make the geometry_list argument optional
Describe alternatives you've considered
Supplying an empty list works, but is cumbersome
Additional context
MWE:
The text was updated successfully, but these errors were encountered: