def _write_aedr(self, f, gORz, attrNum, entryNum, value, pdataType,
                    pnumElems, zVar):
        '''
        Writes an aedr into the end of the file.

        Parameters:
            f : file
                The current open CDF file
            gORz : bool
                True if this entry is for a global or z variable, False if r variable
            attrNum : int
                Number of the attribute this aedr belongs to.
            entryNum : int
                Number of the entry
            value :
                The value of this entry
            pdataType : int
                The CDF data type of the value
            pnumElems : int
                Number of elements in the value.
            zVar : bool
                True if this entry belongs to a z variable

        Returns:
            byte_loc : int
                This current location in the file after writing the aedr.
        '''
        f.seek(0, 2)
        byte_loc = f.tell()
        if (gORz == True or zVar != True):
            section_type = CDF.AgrEDR_
        else:
            section_type = CDF.AzEDR_
        nextAEDR = 0

        if pdataType is None:
            # Figure out Data Type if not supplied
            if isinstance(value, (list, tuple)):
                avalue = value[0]
            else:
                avalue = value
            if (isinstance(avalue, int)):
                pdataType = CDF.CDF_INT8
            elif (isinstance(avalue, float)):
                pdataType = CDF.CDF_FLOAT
            elif (isinstance(avalue, complex)):
                pdataType = CDF.CDF_EPOCH16
            else:
                # assume a boolean
                pdataType = CDF.CDF_INT1

        if pnumElems is None:
            # Figure out number of elements if not supplied
            if isinstance(value, str):
                pdataType = CDF.CDF_CHAR
                pnumElems = len(value)
            else:
                if isinstance(value, (list, tuple)):
                    pnumElems = len(value)
                else:
                    pnumElems = 1

        dataType = pdataType
        numElems = pnumElems

        rfuB = 0
        rfuC = 0
        rfuD = -1
        rfuE = -1
        if gORz:
            numStrings = 0
        else:
            if (isinstance(value, str)):
                numStrings = value.count('\\N ') + 1
            else:
                numStrings = 0
        recs, cdata = self._convert_data(dataType, numElems, 1, value)
        if (dataType == 51):
            numElems = len(cdata)
        block_size = len(cdata) + 56
        aedr = bytearray(block_size)
        aedr[0:8] = struct.pack('>q', block_size)
        aedr[8:12] = struct.pack('>i', section_type)
        aedr[12:20] = struct.pack('>q', nextAEDR)
        aedr[20:24] = struct.pack('>i', attrNum)
        aedr[24:28] = struct.pack('>i', dataType)
        aedr[28:32] = struct.pack('>i', entryNum)
        aedr[32:36] = struct.pack('>i', numElems)
        aedr[36:40] = struct.pack('>i', numStrings)
        aedr[40:44] = struct.pack('>i', rfuB)
        aedr[44:48] = struct.pack('>i', rfuC)
        aedr[48:52] = struct.pack('>i', rfuD)
        aedr[52:56] = struct.pack('>i', rfuE)
        aedr[56:block_size] = cdata
        f.write(aedr)

        return byte_loc
Writes an aedr into the end of the file.

        Parameters:
            f : file
                The current open CDF file
            gORz : bool
                True if this entry is for a global or z variable, False if r variable
            attrNum : int
                Number of the attribute this aedr belongs to.
            entryNum : int
                Number of the entry
            value :
                The value of this entry
            pdataType : int
                The CDF data type of the value
            pnumElems : int
                Number of elements in the value.
            zVar : bool
                True if this entry belongs to a z variable

        Returns:
            byte_loc : int
                This current location in the file after writing the aedr.