def __setitem__(self, key, data):
    'Puts a slice into the data array. Details under :py:class:`pycdf.Var`.\n\n        @param key: index or slice to store\n        @type key: int or slice\n        @param data: data to store\n        @type data: numpy.array\n        @raise IndexError: if L{key} is out of range, mismatches dimensions,\n                           or simply unparseable. IndexError will\n        @raise CDFError: for errors from the CDF library\n        '
    hslice = _Hyperslice(self, key)
    n_recs = hslice.counts[0]
    hslice.expand(data)
    cdf_type = self.type()
    if (cdf_type == const.CDF_EPOCH16.value):
        if (not self._raw):
            try:
                data = lib.v_datetime_to_epoch16(data)
            except AttributeError:
                pass
        data = numpy.require(data, requirements=('C', 'A', 'W'), dtype=numpy.float64)
    elif (cdf_type == const.CDF_EPOCH.value):
        if (not self._raw):
            try:
                data = lib.v_datetime_to_epoch(data)
            except AttributeError:
                pass
        data = numpy.require(data, requirements=('C', 'A', 'W'), dtype=numpy.float64)
    elif (cdf_type == const.CDF_TIME_TT2000.value):
        if (not self._raw):
            try:
                data = lib.v_datetime_to_tt2000(data)
            except AttributeError:
                pass
        data = numpy.require(data, requirements=('C', 'A', 'W'), dtype=numpy.int64)
    else:
        data = numpy.require(data, requirements=('C', 'A', 'W'), dtype=self._np_type())
    if (cdf_type == const.CDF_EPOCH16.value):
        datashape = data.shape[:(- 1)]
    else:
        datashape = data.shape
    if (datashape != tuple(hslice.expected_dims())):
        raise ValueError(((('attempt to assign data of dimensions ' + str(datashape)) + ' to slice of dimensions ') + str(tuple(hslice.expected_dims()))))
    data = hslice.convert_output_array(data)
    if ((hslice.counts[0] > n_recs) and ((hslice.starts[0] + n_recs) < hslice.dimsizes[0])):
        saved_data = self[(hslice.starts[0] + n_recs):]
    if (hslice.counts[0] > 0):
        hslice.select()
        lib.call(const.PUT_, const.zVAR_HYPERDATA_, data.ctypes.data_as(ctypes.c_void_p))
    if (hslice.counts[0] < n_recs):
        first_rec = (hslice.starts[0] + hslice.counts[0])
        last_rec = (hslice.dimsizes[0] - 1)
        lib.call(const.DELETE_, const.zVAR_RECORDS_, ctypes.c_long(first_rec), ctypes.c_long(last_rec))
    elif ((hslice.counts[0] > n_recs) and ((hslice.starts[0] + n_recs) < hslice.dimsizes[0])):
        self[(hslice.starts[0] + hslice.counts[0]):] = saved_data
Puts a slice into the data array. Details under :py:class:`pycdf.Var`.

@param key: index or slice to store
@type key: int or slice
@param data: data to store
@type data: numpy.array
@raise IndexError: if L{key} is out of range, mismatches dimensions,
                   or simply unparseable. IndexError will
@raise CDFError: for errors from the CDF library
def __setitem__(self, key, data):
    'Puts a slice into the data array. Details under :py:class:`pycdf.Var`.\n\n        @param key: index or slice to store\n        @type key: int or slice\n        @param data: data to store\n        @type data: numpy.array\n        @raise IndexError: if L{key} is out of range, mismatches dimensions,\n                           or simply unparseable. IndexError will\n        @raise CDFError: for errors from the CDF library\n        '
    hslice = _Hyperslice(self, key)
    n_recs = hslice.counts[0]
    hslice.expand(data)
    cdf_type = self.type()
    if (cdf_type == const.CDF_EPOCH16.value):
        if (not self._raw):
            try:
                data = lib.v_datetime_to_epoch16(data)
            except AttributeError:
                pass
        data = numpy.require(data, requirements=('C', 'A', 'W'), dtype=numpy.float64)
    elif (cdf_type == const.CDF_EPOCH.value):
        if (not self._raw):
            try:
                data = lib.v_datetime_to_epoch(data)
            except AttributeError:
                pass
        data = numpy.require(data, requirements=('C', 'A', 'W'), dtype=numpy.float64)
    elif (cdf_type == const.CDF_TIME_TT2000.value):
        if (not self._raw):
            try:
                data = lib.v_datetime_to_tt2000(data)
            except AttributeError:
                pass
        data = numpy.require(data, requirements=('C', 'A', 'W'), dtype=numpy.int64)
    else:
        data = numpy.require(data, requirements=('C', 'A', 'W'), dtype=self._np_type())
    if (cdf_type == const.CDF_EPOCH16.value):
        datashape = data.shape[:(- 1)]
    else:
        datashape = data.shape
    if (datashape != tuple(hslice.expected_dims())):
        raise ValueError(((('attempt to assign data of dimensions ' + str(datashape)) + ' to slice of dimensions ') + str(tuple(hslice.expected_dims()))))
    data = hslice.convert_output_array(data)
    if ((hslice.counts[0] > n_recs) and ((hslice.starts[0] + n_recs) < hslice.dimsizes[0])):
        saved_data = self[(hslice.starts[0] + n_recs):]
    if (hslice.counts[0] > 0):
        hslice.select()
        lib.call(const.PUT_, const.zVAR_HYPERDATA_, data.ctypes.data_as(ctypes.c_void_p))
    if (hslice.counts[0] < n_recs):
        first_rec = (hslice.starts[0] + hslice.counts[0])
        last_rec = (hslice.dimsizes[0] - 1)
        lib.call(const.DELETE_, const.zVAR_RECORDS_, ctypes.c_long(first_rec), ctypes.c_long(last_rec))
    elif ((hslice.counts[0] > n_recs) and ((hslice.starts[0] + n_recs) < hslice.dimsizes[0])):
        self[(hslice.starts[0] + hslice.counts[0]):] = saved_data