unifhy-org / unifhy

A Unified Framework for Hydrology
https://unifhy-org.github.io/unifhy
BSD 3-Clause "New" or "Revised" License
11 stars 5 forks source link

Apply mask to underlying `SpaceDomain` field to be used in remapping #59

Closed ThibHlln closed 2 years ago

ThibHlln commented 2 years ago

At the moment, if the user sets the land_sea_mask attribute of their SpaceDomain, it is only used on the outputs and/or internally to a Component if the contributor made use of it.

However, even if the contributor made use of it, the underlying field of SpaceDomain used in the remapping (either as source or destination) is initialised as a regular numpy array. Assigning a masked array to a regular array does not turn the regular array into a masked array, rather it unmaskes the masked array.

This needs to be changed so that the mask is taken into account in the remapping. To do so, when the land_sea_mask attribute is assigned, it needs to be used to mask the underlying field. This way, whether the component contributor decided to return masked or regular numpy arrays, the masked nature of the transfer and potential remapping will be determined by the user's decision to assign a mask to their space domain or not.