Exemplo n.º 1
0
    def WriteFile(self, name=''):
        """
        Syntax: WriteFile([name= ])
        Purpose: Write information contained in an ADPAA object to a properly-
                 formatted NASA ASCII file. 
        Input: 'name' - optional argument to set the filename of the file being
                        written to (uses ADPAA class attribute 'name' otherwise)
        Output: nothing
        """
        if (name == '') & (self.name == ''):
            print("ERROR: Cannot write to file because class attribute 'name'"+\
                  " is not set.")
            return
        if (name == '') & (self.name != ''):
            name = self.name

        # Set number of variables (self.NV) according to the length of the
        # long name array (self.VNAME).
        self.NV = len(self.VNAME)

        # Check that all data has proper data types and is formatted properly.
        self.__check_data(name)

        # Call the WriteFile method.
        WriteFile(self, name)