Skip to content

Commit

Permalink
warn AreaWeights filling (#81)
Browse files Browse the repository at this point in the history
* fix: add warning
  • Loading branch information
JPXKQX authored Nov 22, 2024
1 parent bd6f030 commit 71b52e7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/anemoi/graphs/nodes/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 71b52e7

Please sign in to comment.