def _calculate_grid_shape(reference_dataset, max_cols=6):
    total_temporal_bins = reference_dataset.values.shape[0]
    temporal_bins = total_temporal_bins

    num_rows = 1
    while temporal_bins > max_cols:
        temporal_bins -= max_cols
        num_rows += 1

    return _balance_grid_shape(total_temporal_bins, num_rows, max_cols)
    #return (num_rows, max_cols)
Calculate the plot grid shape given a reference dataset. 
dataset/ETHPy150Open apache/climate/ocw-ui/backend/processing.py/_calculate_grid_shape