@@ -137,12 +137,12 @@ def _default_result_attrs(attrs, func, signature):
137137 return [{}] * signature .n_outputs
138138
139139
140- def _build_output_coords (args , signature , new_coords = None ):
140+ def build_output_coords (args , signature , new_coords = None ):
141141
142- coord_variables = [getattr (getattr (arg , 'coords' , arg ), 'variables' , {})
142+ coord_variables = [getattr (getattr (arg , 'coords' , {} ), 'variables' , {})
143143 for arg in args ]
144144 if new_coords is not None :
145- coord_variables .append (new_coords )
145+ coord_variables .append (getattr ( new_coords , 'variables' , new_coords ) )
146146
147147 merged = merge_coords_without_align (coord_variables )
148148
@@ -175,7 +175,7 @@ def apply_dataarray_ufunc(func, *args, **kwargs):
175175 args = deep_align (args , join = join , copy = False , raise_on_invalid = False )
176176
177177 name = result_name (args )
178- result_coords = _build_output_coords (args , signature , new_coords )
178+ result_coords = build_output_coords (args , signature , new_coords )
179179
180180 data_vars = [getattr (a , 'variable' ) for a in args ]
181181 result_var = func (* data_vars )
@@ -228,7 +228,7 @@ def apply_dataset_ufunc(func, args, signature=None, join='inner',
228228
229229 args = deep_align (args , join = join , copy = False , raise_on_invalid = False )
230230
231- list_of_coords = _build_output_coords (args , signature , new_coords )
231+ list_of_coords = build_output_coords (args , signature , new_coords )
232232
233233 list_of_data_vars = [getattr (a , 'data_vars' , {}) for a in args ]
234234 names = join_dict_keys (list_of_data_vars , how = join )
0 commit comments