@@ -137,12 +137,12 @@ def _default_result_attrs(attrs, func, signature):
137
137
return [{}] * signature .n_outputs
138
138
139
139
140
- def _build_output_coords (args , signature , new_coords = None ):
140
+ def build_output_coords (args , signature , new_coords = None ):
141
141
142
- coord_variables = [getattr (getattr (arg , 'coords' , arg ), 'variables' , {})
142
+ coord_variables = [getattr (getattr (arg , 'coords' , {} ), 'variables' , {})
143
143
for arg in args ]
144
144
if new_coords is not None :
145
- coord_variables .append (new_coords )
145
+ coord_variables .append (getattr ( new_coords , 'variables' , new_coords ) )
146
146
147
147
merged = merge_coords_without_align (coord_variables )
148
148
@@ -175,7 +175,7 @@ def apply_dataarray_ufunc(func, *args, **kwargs):
175
175
args = deep_align (args , join = join , copy = False , raise_on_invalid = False )
176
176
177
177
name = result_name (args )
178
- result_coords = _build_output_coords (args , signature , new_coords )
178
+ result_coords = build_output_coords (args , signature , new_coords )
179
179
180
180
data_vars = [getattr (a , 'variable' ) for a in args ]
181
181
result_var = func (* data_vars )
@@ -228,7 +228,7 @@ def apply_dataset_ufunc(func, args, signature=None, join='inner',
228
228
229
229
args = deep_align (args , join = join , copy = False , raise_on_invalid = False )
230
230
231
- list_of_coords = _build_output_coords (args , signature , new_coords )
231
+ list_of_coords = build_output_coords (args , signature , new_coords )
232
232
233
233
list_of_data_vars = [getattr (a , 'data_vars' , {}) for a in args ]
234
234
names = join_dict_keys (list_of_data_vars , how = join )
0 commit comments