From 71b52e7cb7ce6407c476c65f176902e9ded859e5 Mon Sep 17 00:00:00 2001 From: Mario Santa Cruz <48736305+JPXKQX@users.noreply.github.com> Date: Fri, 22 Nov 2024 18:49:41 +0100 Subject: [PATCH] warn AreaWeights filling (#81) * fix: add warning --- src/anemoi/graphs/nodes/attributes.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/anemoi/graphs/nodes/attributes.py b/src/anemoi/graphs/nodes/attributes.py index db4ffa1..c88ea7f 100644 --- a/src/anemoi/graphs/nodes/attributes.py +++ b/src/anemoi/graphs/nodes/attributes.py @@ -155,7 +155,14 @@ def get_raw_values(self, nodes: NodeStorage, **kwargs) -> np.ndarray: sv.regions = [region for region in sv.regions if region] # compute the area weight without empty regions area_weights = sv.calculate_areas() - # add them back with zero weight + if (null_nodes := mask.sum()) > 0: + LOGGER.warning( + "%s is filling %d (%.2f%%) nodes with value %f", + self.__class__.__name__, + null_nodes, + 100 * null_nodes / len(mask), + self.fill_value, + ) result = np.ones(points.shape[0]) * self.fill_value result[mask] = area_weights LOGGER.debug(