# Path: gridded/utilities.py
# def get_dataset(ncfile, dataset=None):
#     """
#     Utility to create a netCDF4 Dataset from a filename, list of filenames,
#     or just pass it through if it's already a netCDF4.Dataset
# 
#     if dataset is not None, it should be a valid netCDF4 Dataset object,
#     and it will simply be returned
#     """
#     if dataset is not None:
#         return dataset
#     if isinstance(ncfile, nc4.Dataset):
#         return ncfile
#     elif isinstance(ncfile, Iterable) and len(ncfile) == 1:
#         return nc4.Dataset(ncfile[0])
#     elif isstring(ncfile):
#         return nc4.Dataset(ncfile)
#     else:
#         return nc4.MFDataset(ncfile)


from textwrap import dedent
from datetime import datetime, timedelta
from gridded.utilities import get_dataset
import netCDF4 as nc4
import numpy as np
        if self._has_duplicates(self.data):
            raise ValueError("Time sequence has duplicate entries")

        super(Time, self).__init__(*args, **kwargs)
    @classmethod
    def from_netCDF(cls,
                    filename=None,
                    dataset=None,
                    varname=None,
                    datavar=None,
                    tz_offset=None,
                    **kwargs):
        """
        construct a Time object from a netcdf file

        :param filename=None: name of netcddf file

        :param dataset=None: netcdf dataset object (one or the other)

        :param varname=None: name of the netcdf variable

        :param datavar=None: Either the time variable name, or
                             A netcdf variable that needs a Time object.
                             It will try to find the time variable that
                             corresponds to the passed in variable.

        :param tz_offset=None: offset to adjust for timezone, in hours.

        """
        if dataset is None:

# Path: gridded/utilities.py
# def get_dataset(ncfile, dataset=None):
#     """
#     Utility to create a netCDF4 Dataset from a filename, list of filenames,
#     or just pass it through if it's already a netCDF4.Dataset
# 
#     if dataset is not None, it should be a valid netCDF4 Dataset object,
#     and it will simply be returned
#     """
#     if dataset is not None:
#         return dataset
#     if isinstance(ncfile, nc4.Dataset):
#         return ncfile
#     elif isinstance(ncfile, Iterable) and len(ncfile) == 1:
#         return nc4.Dataset(ncfile[0])
#     elif isstring(ncfile):
#         return nc4.Dataset(ncfile)
#     else:
#         return nc4.MFDataset(ncfile)


# Path: gridded/time.py
from textwrap import dedent
from datetime import datetime, timedelta
from gridded.utilities import get_dataset
import netCDF4 as nc4
import numpy as np

        if self._has_duplicates(self.data):
            raise ValueError("Time sequence has duplicate entries")

        super(Time, self).__init__(*args, **kwargs)
    @classmethod
    def from_netCDF(cls,
                    filename=None,
                    dataset=None,
                    varname=None,
                    datavar=None,
                    tz_offset=None,
                    **kwargs):
        """
        construct a Time object from a netcdf file

        :param filename=None: name of netcddf file

        :param dataset=None: netcdf dataset object (one or the other)

        :param varname=None: name of the netcdf variable

        :param datavar=None: Either the time variable name, or
                             A netcdf variable that needs a Time object.
                             It will try to find the time variable that
                             corresponds to the passed in variable.

        :param tz_offset=None: offset to adjust for timezone, in hours.

        """
        if dataset is None:

            dataset = get_dataset(filename)