(vars, concat_dim_lengths)
| 717 | # we've already verified everything is consistent; now, calculate |
| 718 | # shared dimension sizes so we can expand the necessary variables |
| 719 | def ensure_common_dims(vars, concat_dim_lengths): |
| 720 | # ensure each variable with the given name shares the same |
| 721 | # dimensions and the same shape for all of them except along the |
| 722 | # concat dimension |
| 723 | common_dims = tuple(utils.OrderedSet(d for v in vars for d in v.dims)) |
| 724 | if dim_name not in common_dims: |
| 725 | common_dims = (dim_name,) + common_dims |
| 726 | for var, dim_len in zip(vars, concat_dim_lengths, strict=True): |
| 727 | if var.dims != common_dims: |
| 728 | common_shape = tuple(dims_sizes.get(d, dim_len) for d in common_dims) |
| 729 | var = var.set_dims(common_dims, common_shape) |
| 730 | yield var |
| 731 | |
| 732 | # get the indexes to concatenate together, create a PandasIndex |
| 733 | # for any scalar coordinate variable found with ``name`` matching ``dim``. |
no test coverage detected
searching dependent graphs…