# Path: data_cube_utilities/dc_chunker.py
# def create_geographic_chunks(longitude=None, latitude=None, geographic_chunk_size=0.5):
# def create_square_geographic_chunks(longitude=None, latitude=None,
#                                     geographic_chunk_size=0.05):
# def combine_geographic_chunks(chunks):
# def create_time_chunks(datetime_list, _reversed=False, time_chunk_size=10):
# def group_datetimes_by_year(datetime_list):
# def group_datetimes_by_month(datetime_list, months=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]):
# def _chunk_iterable(_iterable, chunk_size):
# def generate_baseline(_iterable, window_length):


import unittest
import xarray as xr
import numpy as np
from datetime import datetime
from data_cube_utilities import dc_chunker
        self.assertTrue(combined_data.test_data.values.shape == (101, 10))

    def test_create_time_chunks(self):
        date_groups = dc_chunker.create_time_chunks(self.dates, time_chunk_size=2)
        self.assertTrue(len(date_groups) == 3)
        self.assertTrue(date_groups[0][0] == min(self.dates))
        self.assertTrue(date_groups[-1][-1] == max(self.dates))

        date_groups = dc_chunker.create_time_chunks(self.dates, time_chunk_size=10)
        self.assertTrue(len(date_groups) == 1)

        date_groups = dc_chunker.create_time_chunks(self.dates, _reversed=True, time_chunk_size=2)
        self.assertTrue(date_groups[0][0] == max(self.dates))
        self.assertTrue(date_groups[-1][-1] == min(self.dates))

    def test_group_datetimes_by_year(self):
        date_groups = dc_chunker.group_datetimes_by_year(self.dates)
        self.assertTrue(len(date_groups.keys()) == 5)

        for key in date_groups:
            self.assertTrue(len(date_groups[key]) == 1)

    def test_group_datetimes_by_month(self):
        date_groups = dc_chunker.group_datetimes_by_month(self.dates)
        self.assertTrue(len(date_groups.keys()) == 3)
        self.assertTrue(len(date_groups[1]) == 3)

        date_groups = dc_chunker.group_datetimes_by_month(self.dates, months=[2, 5])
        self.assertTrue(len(date_groups.keys()) == 2)


# Path: data_cube_utilities/dc_chunker.py
# def create_geographic_chunks(longitude=None, latitude=None, geographic_chunk_size=0.5):
# def create_square_geographic_chunks(longitude=None, latitude=None,
#                                     geographic_chunk_size=0.05):
# def combine_geographic_chunks(chunks):
# def create_time_chunks(datetime_list, _reversed=False, time_chunk_size=10):
# def group_datetimes_by_year(datetime_list):
# def group_datetimes_by_month(datetime_list, months=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]):
# def _chunk_iterable(_iterable, chunk_size):
# def generate_baseline(_iterable, window_length):


# Path: test/test_dc_chunker.py
import unittest
import xarray as xr
import numpy as np
from datetime import datetime
from data_cube_utilities import dc_chunker

        self.assertTrue(combined_data.test_data.values.shape == (101, 10))

    def test_create_time_chunks(self):
        date_groups = dc_chunker.create_time_chunks(self.dates, time_chunk_size=2)
        self.assertTrue(len(date_groups) == 3)
        self.assertTrue(date_groups[0][0] == min(self.dates))
        self.assertTrue(date_groups[-1][-1] == max(self.dates))

        date_groups = dc_chunker.create_time_chunks(self.dates, time_chunk_size=10)
        self.assertTrue(len(date_groups) == 1)

        date_groups = dc_chunker.create_time_chunks(self.dates, _reversed=True, time_chunk_size=2)
        self.assertTrue(date_groups[0][0] == max(self.dates))
        self.assertTrue(date_groups[-1][-1] == min(self.dates))

    def test_group_datetimes_by_year(self):
        date_groups = dc_chunker.group_datetimes_by_year(self.dates)
        self.assertTrue(len(date_groups.keys()) == 5)

        for key in date_groups:
            self.assertTrue(len(date_groups[key]) == 1)

    def test_group_datetimes_by_month(self):
        date_groups = dc_chunker.group_datetimes_by_month(self.dates)
        self.assertTrue(len(date_groups.keys()) == 3)
        self.assertTrue(len(date_groups[1]) == 3)

        date_groups = dc_chunker.group_datetimes_by_month(self.dates, months=[2, 5])
        self.assertTrue(len(date_groups.keys()) == 2)


        date_groups = dc_chunker.group_datetimes_by_month(self.dates, months=[])