code: def _create_dim_scales(self):
          
          dim_order = self._dim_order.maps[0]
          for dim in sorted(dim_order, key=lambda d: dim_order[d]):
              if dim not in self._h5group:
                  size = self._current_dim_sizes[dim]
                  kwargs = {}
                  if self._dim_sizes[dim] is None:
                      kwargs["maxshape"] = (None,)
                  self._h5group.create_dataset(
                      name=dim, shape=(size,), dtype='S1', **kwargs)
  
              h5ds = self._h5group[dim]
              h5ds.attrs['_Netcdf4Dimid'] = dim_order[dim]
  
              if len(h5ds.shape) > 1:
                  dims = self._variables[dim].dimensions
                  coord_ids = np.array([dim_order[d] for d in dims], 'int32')
                  h5ds.attrs['_Netcdf4Coordinates'] = coord_ids
  
              scale_name = dim if dim in self.variables else NOT_A_VARIABLE
              h5ds.dims.create_scale(h5ds, scale_name)
  
          for subgroup in self.groups.values():
              subgroup._create_dim_scales()
docs: Create all necessary HDF5 dimension scale.