Index: sodar/branches/scintec-branch/sodar/scintec/maindata.py =================================================================== --- sodar/branches/scintec-branch/sodar/scintec/maindata.py (revision 270) +++ sodar/branches/scintec-branch/sodar/scintec/maindata.py (revision 271) @@ -123,5 +123,5 @@ Parse main daily Scintec sodar .mnd file. - MainData(mnd[,file_name[,file_path]]) -> + MainData(mnd[,file_path]) -> Where: @@ -130,19 +130,11 @@ Scintec .mnd daily sodar file including all line endings, - file_name is an optional str object representing a file name for - a file which contains the referenced .mnd daily sodar file, - file_path is an optional str object representing the path to - file_name. + a file which contains the referenced .mnd daily sodar file. Parse a known good .mnd file: >>> main_data = MainData(good_mnd) - >>> main_data = MainData(good_mnd,good_name) - >>> main_data.file_name == good_name - True - >>> main_data = MainData(good_mnd,good_name,good_path) - >>> main_data.file_name == good_name - True - >>> main_data.file_path == good_path + >>> main_data = MainData(good_mnd,good_path) + >>> main_data.path == good_path True """ @@ -150,11 +142,9 @@ super(self.__class__, self).__init__() - self.file_name = '' - self.file_path = '' + self.path = '' # Optional args: smoke 'em if ya got 'em. try: - self.file_name = str(args[0]) - self.file_path = str(args[1]) + self.path = str(args[0]) except IndexError: pass @@ -519,8 +509,7 @@ import doctest from sodar.tests import suite - mnd_path,mnd_file,mnd,profile,variables,observation = \ + mnd,mnd_path,profile,variables,observation = \ suite.setUpGoodMndData() doctest.testmod(extraglobs=dict(good_mnd=mnd, - good_name=mnd_file, good_path=mnd_path, good_profile=profile, Index: sodar/branches/scintec-branch/sodar/tests/suite.py =================================================================== --- sodar/branches/scintec-branch/sodar/tests/suite.py (revision 262) +++ sodar/branches/scintec-branch/sodar/tests/suite.py (revision 271) @@ -16,5 +16,5 @@ Get data from test file. - setUpData(data_dir,data_file) -> (data_path, data) + setUpData(data_dir,data_file) -> (data,data_path,) Where: @@ -24,5 +24,5 @@ data_file is a str representation of a data file within data_dir, - data_path is a str representation of the absolute path to data_file, + data_path is a str representation of the absolute path of data_file, data is a str representation of the contents of data_file. @@ -32,29 +32,44 @@ data_path = os.path.join(module_dir,'data',data_dir,data_file) data = open(data_path).read() - return (data_path, data,) + return (data,data_path,) def setUpGoodMndData(): """ Get data from a known good Scintec .mnd file. + + setUpGoodMndData() -> (mnd,path,profile,variables,observation,) + + Where: + + mnd is a str representation of a known good .mnd daily sodar file, + + mnd_path is a str representation of the absolute path to the file, + + profile is a list of str objects representing a known good profile + from the file, + + variables is a list of str objects representing a list of known good + variables from the file, + + observation is a list of str objects representing a list of known good + observation values from the file in the same order as variables. """ mnd_dir = os.path.join('scintec','good',) mnd_file = '091117.mnd' - mnd_path,mnd = setUpData(mnd_dir,mnd_file) - mnd_path,mnd_file = os.path.split(mnd_path) + mnd,mnd_path = setUpData(mnd_dir,mnd_file) profile = mnd.split('\n\n')[2].split('\n') profile = [line.strip() for line in profile if line] variables = profile[1].split()[1:] observation = profile[2].split() - return (mnd_path,mnd_file,mnd,profile,variables,observation,) + return (mnd,mnd_path,profile,variables,observation,) def setUpGoodMnd(test): """ - Test set up for a good Scintec .mnd file. + Doctest setUp() for a good Scintec .mnd file. """ - mnd_path,mnd_file,mnd,profile,variables,observation = setUpGoodMndData() + mnd,mnd_path,profile,variables,observation = setUpGoodMndData() test.globs.update(good_mnd=mnd, - good_name=mnd_file, good_path=mnd_path, good_profile=profile,