code: def _attach_dim_scales(self):
          
          for name, var in self.variables.items():
              if name not in self.dimensions:
                  for n, dim in enumerate(var.dimensions):
                      var._h5ds.dims[n].attach_scale(self._all_h5groups[dim])
  
          for subgroup in self.groups.values():
              subgroup._attach_dim_scales()
docs: Attach dimension scales to all variables.