-
Notifications
You must be signed in to change notification settings - Fork 283
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
Can't collapse over a mesh dimension #4672
Comments
That particular call to Lines 2215 to 2222 in 62047f7
I have seen this warning many times, and have never found it useful. What happens if you just don't bother with the contiguity check? |
In ESMValTool, we recently started improving our support for unstructured grids. This issue here hampers the application of our I tested commenting the Would it make sense to change the lines above to something like @@ -2228,12 +2228,22 @@ class Coord(_DimensionalMetadata):
"Metadata may not be fully descriptive for {!r}."
)
warnings.warn(msg.format(self.name()))
- elif not self.is_contiguous():
- msg = (
- "Collapsing a non-contiguous coordinate. "
- "Metadata may not be fully descriptive for {!r}."
- )
- warnings.warn(msg.format(self.name()))
+ else:
+ try:
+ self._sanity_check_bounds()
+ except ValueError as exc:
+ msg = (
+ f"Cannot check if coordinate is contiguous: "
+ f"{str(exc)}."
+ )
+ warnings.warn(msg.format(self.name()))
+ else:
+ if not self.is_contiguous():
+ msg = (
+ "Collapsing a non-contiguous coordinate. "
+ "Metadata may not be fully descriptive for {!r}."
+ )
+ warnings.warn(msg.format(self.name()))
if self.has_bounds():
item = self.core_bounds() ? I could open a PR if that makes sense. |
There has been talk elsewhere (e.g. #4762 (comment)) of reducing the number of warnings Iris throws. Personally my vote would be to remove this if loop (and the two warnings it throws) altogether. |
Sounds much easier! Can I open a pull request with that? |
@schlunma I'd be delighted to merge such a PR, but I don't think I have the authority to decide that by myself. Hopefully someone else from @SciTools/peloton can weigh in. I guess it could be considered a breaking change, but I can't imagine anyone is relying on these warnings to tell them that their "metadata might not be fully descriptive". |
@SciTools/peloton like @schunma's suggestion, thanks! Please submit something and we'll get it reviewed |
See #4870. |
A cube cannot currently be collapsed over a MeshCoord (or mesh dim),
since the collapse operation expects a bounds shape of (N, 2) and it can't handle (N, 4).
Example:
So, the problem isn't really specific to the peculiarities of MeshCoords, it is about the shape of the bounds :
(N. 2) is expected and nothing else works.
However, it would make perfect sense to discard the bounds here and proceed (with a warning).
In the case of a MeshCoord, we can see that this does produce a perfectly sensible result.
The text was updated successfully, but these errors were encountered: