Add is_geographic
or is_projected
boolean property to meshkernel instance
#108
Labels
wontfix
This will not be worked on
Is your feature request related to a problem? Please describe.
Quick question. When we want to save a meshkernel instance as a netcdf file, it is good to add "projection_x_coordinate" or "longitude" and other attributes. For this we need to know whether the meshkernel instance is projected/cartesian or spherical. Whether it is spherical or spherical accurate is irrelevant in this case, since the attributes would be the same. Maybe it is also useful to add a crs (coordinate reference system) to the meshkernel instance, but that might be out of the scope of meshkernel.
Describe the solution you'd like
I would like to avoid checking on
mk.get_projection()==meshkernel.ProjectionType.CARTESIAN
in several packages (dfm_tools, xugrid, hydromt, hydrolib-core and maybe in the future external packages also). Is there a boolean property of the meshkernel instance that provides this information? If not, could it be created?For instance, when converting a meshkernel instance to xugrid.UgridDataset (xugrid.Ugrid2d) with xugrid.Ugrid2d.from_meshkernel() we need to know it:
https://github.com/Deltares/xugrid/blob/a021f190bc35dae4b325a11569f9d87d600bc9be/xugrid/ugrid/ugrid2d.py#L193
Alternatives
Alternatively, we can limit the packages where this check is carried out. One way would be to not pass
projected
toxugrid.Ugrid2d.from_meshkernel
, but not sure yet if that is desireable: Deltares/xugrid#188The text was updated successfully, but these errors were encountered: