Changeset 25b14be in flex_extract.git for source/python/classes
- Timestamp:
- Sep 23, 2018, 11:40:28 AM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 4971f63
- Parents:
- 5d42acd
- Location:
- source/python/classes
- Files:
-
- 1 added
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
source/python/classes/ControlFile.py
r5d42acd r25b14be 143 143 self.ecstorage = 0 144 144 self.ectrans = 0 145 self.inputdir = '../work'145 self.inputdir = _config.PATH_INPUT_DIR 146 146 self.outputdir = self.inputdir 147 147 self.ecmwfdatadir = _config.PATH_FLEXEXTRACT_DIR … … 177 177 <nothing> 178 178 ''' 179 from tools import my_error179 from mods.tools import my_error 180 180 181 181 # read whole CONTROL file … … 331 331 <nothing> 332 332 ''' 333 from tools import my_error333 from mods.tools import my_error 334 334 import numpy as np 335 335 -
source/python/classes/EcFlexpart.py
r5d42acd r25b14be 61 61 # 62 62 # @Class Attributes: 63 # - dtime 64 # - basetime 65 # - server 66 # - marsclass 67 # - stream 68 # - resol 69 # - accuracy 70 # - number 71 # - expver 72 # - glevelist 73 # - area 74 # - grid 75 # - level 76 # - levelist 77 # - types 78 # - dates 79 # - area 80 # - gaussian 81 # - params 82 # - inputdir 83 # - outputfilelist 63 # 64 # TODO 84 65 # 85 66 #******************************************************************************* 86 67 #pylint: disable=unsupported-assignment-operation 87 # this is disabled because its an error in pylint for this specific case68 # this is disabled because for this specific case its an error in pylint 88 69 #pylint: disable=consider-using-enumerate 89 70 # this is not useful in this case … … 104 85 import _config 105 86 from GribTools import GribTools 106 from tools import init128, to_param_id, silent_remove, product, my_error87 from mods.tools import init128, to_param_id, silent_remove, product, my_error 107 88 from MarsRetrieval import MarsRetrieval 108 import disaggregation89 import mods.disaggregation 109 90 110 91 # ------------------------------------------------------------------------------ … … 471 452 MR.data_retrieve() 472 453 elif request == 1: 473 MR.print_info( )454 MR.print_info(self.inputdir) 474 455 elif request == 2: 475 MR.print_info( )456 MR.print_info(self.inputdir) 476 457 MR.display_info() 477 458 MR.data_retrieve() -
source/python/classes/MarsRetrieval.py
r2fb99de r25b14be 335 335 336 336 337 def print_info(self ):337 def print_info(self, inputdir): 338 338 ''' 339 339 @Description: … … 345 345 For description see class documentation. 346 346 347 inputdir: string 348 The path where all data from the retrievals are stored. 349 347 350 @Return: 348 351 <nothing> … … 352 355 353 356 # open a file to store all requests to 354 with open(os.path.join( _config.PATH_RUN_DIR,357 with open(os.path.join(inputdir, 355 358 _config.FILE_MARS_REQUESTS), 'a') as f: 356 359 f.write('mars\n') -
source/python/classes/UioFiles.py
r2fb99de r25b14be 52 52 # software specific module from flex_extract 53 53 #import profiling 54 from tools import silent_remove, get_list_as_string54 from mods.tools import silent_remove, get_list_as_string 55 55 56 56 # ------------------------------------------------------------------------------ … … 60 60 class UioFiles(object): 61 61 ''' 62 Class to manipulate files. At initialisation it has the attribute63 pattern which stores a regular expression pattern for the files associated64 with the instance of the class.62 Class to manipulate files. At initialisation it has the pattern 63 which stores a regular expression pattern for the files, the path 64 to the files and the files already. 65 65 ''' 66 66 # -------------------------------------------------------------------------- … … 88 88 self.path = path 89 89 self.pattern = pattern 90 self.files = None90 self.files = [] 91 91 92 92 self.__list_files__(self.path) … … 95 95 96 96 #@profiling.timefn 97 def __list_files__(self, path , callid=0):97 def __list_files__(self, path): 98 98 ''' 99 99 @Description: … … 108 108 Path to the files. 109 109 110 callid: integer111 Id which tells the function if its the first call112 or a recursive call. Default and first call is 0.113 Everything different from 0 is ment to be a recursive case.114 115 110 @Return: 116 111 <nothing> 117 112 ''' 118 119 # initialize variable in first function call120 if callid == 0:121 self.files = []122 123 113 # Get the absolute path 124 114 path = os.path.abspath(path) 125 115 126 # get the file list of the path if its not a directory and 127 # if it contains the pattern 128 self.files.extend([os.path.join(path, k) for k in os.listdir(path) 129 if fnmatch.fnmatch(k, self.pattern)]) 130 131 # find possible sub-directories in the path 132 subdirs = [s for s in os.listdir(path) 133 if os.path.isdir(os.path.join(path, s))] 134 135 # do recursive calls for sub-direcorties 136 if subdirs: 137 for subdir in subdirs: 138 self.__list_files__(os.path.join(path, subdir), callid=1) 116 # get all files in the dir and subdir as absolut path 117 for root, dirnames, filenames in os.walk(path): 118 for filename in fnmatch.filter(filenames, self.pattern): 119 self.files.append(os.path.join(root, filename)) 139 120 140 121 return
Note: See TracChangeset
for help on using the changeset viewer.