def reset_bins(da, bin_dim):
    """resets binned coordinates to midpoint and resets dim name. bin_dim is original dimension name"""
    bin_dim_name = bin_dim + '_bins'
    da = da.rename({bin_dim_name: bin_dim})
    da.coords[bin_dim] = [interval.mid for interval in da.coords[bin_dim].values]
    return da