@@ -43,7 +43,10 @@ def concat(objs, dim=None, data_vars='all', coords='different',
43
43
coords : {'minimal', 'different', 'all' or list of str}, optional
44
44
These coordinate variables will be concatenated together:
45
45
* 'minimal': Only coordinates in which the dimension already appears
46
- are included.
46
+ are concatenated. Non-dimensional coordinates will be checked for
47
+ equality.
48
+ * 'skip_nondim': Same as minimal but avoids checking nondimensional
49
+ coordinates for equality.
47
50
* 'different': Coordinates which are not equal (ignoring attributes)
48
51
across all datasets are also concatenated (as well as all for which
49
52
dimension already appears). Beware: this option may load the data
@@ -190,6 +193,8 @@ def process_subset_opt(opt, subset):
190
193
set (datasets [0 ].dims ))
191
194
elif opt == 'minimal' :
192
195
pass
196
+ elif opt == 'skip_nondim' and subset == 'coords' :
197
+ pass
193
198
else :
194
199
raise ValueError ("unexpected value for %s: %s" % (subset , opt ))
195
200
else :
@@ -258,6 +263,13 @@ def insert_result_variable(k, v):
258
263
elif (k in result_coord_names ) != (k in ds .coords ):
259
264
raise ValueError ('%r is a coordinate in some datasets but not '
260
265
'others' % k )
266
+ elif ((k in result_coord_names )
267
+ and (k in result_vars )
268
+ and (k not in ds .dims )
269
+ and (coords == 'skip_nondim' )):
270
+ # skip comparison of non dimensional coords when ask to
271
+ # concatenate only over dim_coords if needed
272
+ pass
261
273
elif k in result_vars and k != dim :
262
274
# Don't use Variable.identical as it internally invokes
263
275
# Variable.equals, and we may already know the answer
0 commit comments