def write_globalattrs(self, globalAttrs):
        '''
        Writes the global attributes.

        Parameters
        ----------
        globalAttrs: dict
            Global attribute name(s) and their value(s) pair(s).

            The value(s) is a dictionary of entry number and value pair(s).
            For example::

                globalAttrs={}
                globalAttrs['Global1']={0: 'Global Value 1'}
                globalAttrs['Global2']={0: 'Global Value 2'}

            For a non-string value, use a list with the value and its
            CDF data type. For example::

                globalAttrs['Global3']={0: [12, 'cdf_int4']}
                globalAttrs['Global4']={0: [12.34, 'cdf_double']}

            If the data type is not provided, a corresponding
            CDF data type is assumed::

                globalAttrs['Global3']={0: 12}     as 'cdf_int4'
                globalAttrs['Global4']={0: 12.34}  as 'cdf_double'

            CDF allows multi-values for non-string data for an attribute::

                globalAttrs['Global5']={0: [[12.34,21.43], 'cdf_double']}

            For multi-entries from a global variable, they should be
            presented in this form::

                GA6={}
                GA6[0]='abcd'
                GA6[1]=[12, 'cdf_int2']
                GA6[2]=[12.5, 'cdf_float']
                GA6[3]=[[0,1,2], 'cdf_int8']
                globalAttrs['Global6']=GA6
                ....
                f.write_globalattrs(globalAttrs)
        '''
        if not (isinstance(globalAttrs, dict)):
            print('Global attribute(s) not in dictionary form.... Stop')
            return
        dataType = None
        numElems = None
        with self.path.open('rb+') as f:
            f.seek(0, 2)  # EOF (appending)
            for attr, entry in globalAttrs.items():
                if (attr in self.gattrs):
                    raise ValueError('Global attribute: {} already exists.'.format(attr))

                if (attr in self.vattrs):
                    logging.warning('Attribute: {} already defined as a variable attribute.'.format(attr))
                    continue

                attrNum, offsetADR = self._write_adr(f, True, attr)
                entries = 0
                if (entry == None):
                    continue
                entryNumMaX = -1
                poffset = -1
                for entryNum, value in entry.items():
                    if (entryNumMaX < entryNum):
                        entryNumMaX = entryNum
                    if (isinstance(value, list) or isinstance(value, tuple)):
                        if (len(value) == 2):
                            # Check if the second value is a valid data type
                            value2 = value[1]
                            dataType = CDF._datatype_token(value2)
                            if (dataType > 0):
                                # Data Type found
                                data = value[0]
                                if (dataType == CDF.CDF_CHAR or
                                        dataType == CDF.CDF_UCHAR):
                                    if (isinstance(data, list) or
                                            isinstance(data, tuple)):
                                        print('Invalid global attribute value.... Skip')
                                        return
                                    numElems = len(data)
                                elif (dataType == CDF.CDF_EPOCH or
                                      dataType == CDF.CDF_EPOCH16
                                      or dataType == CDF.CDF_TIME_TT2000):
                                    cvalue = []
                                    if (isinstance(data, list) or
                                            isinstance(data, tuple)):
                                        numElems = len(data)
                                        for x in range(0, numElems):
                                            if (isinstance(data[x], str)):
                                                cvalue.append(cdfepoch.CDFepoch.parse(data[x]))
                                            else:
                                                cvalue.append(data[x])
                                        data = cvalue
                                    else:
                                        if (isinstance(data, str)):
                                            data = cdfepoch.CDFepoch.parse(data)
                                        numElems = 1
                                else:
                                    if (isinstance(data, list) or
                                            isinstance(data, tuple)):
                                        numElems = len(data)
                                    else:
                                        numElems = 1
                            else:
                                # Data type not found, both values are data.
                                data = value
                                numElems, dataType = CDF._datatype_define(value[0])
                                numElems = len(value)
                        else:
                            # Length greater than 2, so it is all data.
                            data = value
                            numElems, dataType = CDF._datatype_define(value[0])
                            numElems = len(value)
                    else:
                        # Just one value
                        data = value
                        numElems, dataType = CDF._datatype_define(value)
                        if (numElems is None):
                            print('Unknown data.... Skip')
                            return

                    offset = self._write_aedr(f, True, attrNum, entryNum, data,
                                              dataType, numElems, None)
                    if (entries == 0):
                        # ADR's AgrEDRhead
                        self._update_offset_value(f, offsetADR+20, 8, offset)
                    else:
                        # ADR's ADRnext
                        self._update_offset_value(f, poffset+12, 8, offset)

                    poffset = offset
                    entries = entries + 1
                # ADR's NgrEntries
                self._update_offset_value(f, offsetADR+36, 4, entries)
                # ADR's MAXgrEntry
                self._update_offset_value(f, offsetADR+40, 4, entryNumMaX)
Writes the global attributes.

        Parameters
        ----------
        globalAttrs: dict
            Global attribute name(s) and their value(s) pair(s).

            The value(s) is a dictionary of entry number and value pair(s).
            For example::

                globalAttrs={}
                globalAttrs['Global1']={0: 'Global Value 1'}
                globalAttrs['Global2']={0: 'Global Value 2'}

            For a non-string value, use a list with the value and its
            CDF data type. For example::

                globalAttrs['Global3']={0: [12, 'cdf_int4']}
                globalAttrs['Global4']={0: [12.34, 'cdf_double']}

            If the data type is not provided, a corresponding
            CDF data type is assumed::

                globalAttrs['Global3']={0: 12}     as 'cdf_int4'
                globalAttrs['Global4']={0: 12.34}  as 'cdf_double'

            CDF allows multi-values for non-string data for an attribute::

                globalAttrs['Global5']={0: [[12.34,21.43], 'cdf_double']}

            For multi-entries from a global variable, they should be
            presented in this form::

                GA6={}
                GA6[0]='abcd'
                GA6[1]=[12, 'cdf_int2']
                GA6[2]=[12.5, 'cdf_float']
                GA6[3]=[[0,1,2], 'cdf_int8']
                globalAttrs['Global6']=GA6
                ....
                f.write_globalattrs(globalAttrs)