@@ -574,7 +574,10 @@ def add_variables(
574574 self ._check_valid_dim_names (data )
575575
576576 if mask is not None :
577- mask = as_dataarray (mask , coords = data .coords , dims = data .dims ).astype (bool )
577+ # TODO: Simplify when removing Future Warning from broadcast_mask
578+ if not isinstance (mask , DataArray ):
579+ mask = as_dataarray (mask , coords = data .coords , dims = data .dims )
580+ mask = mask .astype (bool )
578581 mask = broadcast_mask (mask , data .labels )
579582
580583 # Auto-mask based on NaN in bounds (use numpy for speed)
@@ -799,7 +802,10 @@ def add_constraints(
799802 (data ,) = xr .broadcast (data , exclude = [TERM_DIM ])
800803
801804 if mask is not None :
802- mask = as_dataarray (mask , coords = data .coords , dims = data .dims ).astype (bool )
805+ # TODO: Simplify when removing Future Warning from broadcast_mask
806+ if not isinstance (mask , DataArray ):
807+ mask = as_dataarray (mask , coords = data .coords , dims = data .dims )
808+ mask = mask .astype (bool )
803809 mask = broadcast_mask (mask , data .labels )
804810
805811 # Auto-mask based on null expressions or NaN RHS (use numpy for speed)
0 commit comments