Skip to content
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

warn AreaWeights filling #81

Merged
merged 4 commits into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading