@@ -201,6 +201,15 @@ def get_crs_of_data(file, vector=False):
201201print ('clip files is:' , clip_file )
202202logger .info ('Clip file: %s' % clip_file )
203203
204+ # check if file passed from previous step
205+ outcome = [find_extents_file ('extents.txt' , data_path )]
206+ logger .info (outcome )
207+ print ('Outcome is:' , outcome )
208+ if outcome [0 ] is not None :
209+ clip_file = outcome
210+
211+ logger .info ('Clip file set to:' , clip_file )
212+
204213# defined extents
205214extent = None
206215if len (clip_file ) == 0 : #if not files passed expect an env to be passed defiing the extents
@@ -211,37 +220,9 @@ def get_crs_of_data(file, vector=False):
211220 print ('Extent: %s' % extent )
212221 logger .info ('Extent: %s' % extent )
213222
214- # check if file passed from previous step
215- outcome = find_extents_file ('extents.txt' , data_path )
216- logger .info (outcome )
217- print ('Outcome is:' , outcome )
218- clip_file = [outcome ]
219- print (clip_file )
220- logger .info (clip_file )
221-
222- # if by now no file passed and extent not passed as an env, check again for an extents text file
223- if len (clip_file ) == 0 and extent is None :
224- # check if a file has been passed from the previous step in DAFNI
225- print ('checking to see if file from previous step' )
226- print (join (data_path , input_dir ))
227- potential_files = []
228- for f in listdir (join (data_path , input_dir )):
229- if isfile (join (data_path , input_dir , f )) is False :
230- for k in listdir (join (data_path , input_dir , f )):
231- if isfile (join (data_path , input_dir , f , k )):
232- potential_files .append (join (data_path , input_dir , f , k ))
233-
234-
235- #extent_file = [f for f in listdir(join(data_path, input_dir)) if isfile(join(data_path, input_dir, f))]
236- print (potential_files )
237- extent_file = filter_input_files (potential_files , ['txt' ])
238- print (extent_file )
239- if len (extent_file ) > 0 :
240- print ('found extent file' )
241- clip_file = extent_file
242223
243224# if no extent string set no, presume file is passed and read in. if no file, return an error and exit
244- if extent is None and len (clip_file ) == 1 :
225+ if extent is None and len (clip_file ) == 1 and clip_file != None :
245226 # if a text bounds file passed, convert to extent text so can use that existing method
246227 # xmin,ymin,xmax,ymax
247228 print ('reading extents file' )
0 commit comments