diff --git a/pyris/bin/pyris b/pyris/bin/pyris index 2746e92..e10e918 100644 --- a/pyris/bin/pyris +++ b/pyris/bin/pyris @@ -160,7 +160,7 @@ if args.config is not None: axisdir = os.path.join( cf.get( 'Data', 'output' ), 'axis' ) migdir = os.path.join( cf.get( 'Data', 'output' ), 'migration' ) bardir = os.path.join( cf.get( 'Data', 'output' ), 'bars' ) - if not args.raw_mask_import: + if args.segmentation or args.bars: landsat_dirs = sorted( [ os.path.join(cf.get('Data','input'), f) for f in os.listdir(cf.get('Data','input')) if os.path.isdir( os.path.join(cf.get('Data','input'), f) ) ] ) # log file @@ -294,22 +294,28 @@ if args.migration: print(); print(title); print('-'*len(title)) axisfiles = [ os.path.join( axisdir, f ) for f in sorted( os.listdir( axisdir ) ) ] migration_rates( axisfiles, migdir, columns=(0,1), show=args.show, pfreq=pf ) - elif args.axis_files is not None and args.config is None: + elif args.axis_dir is not None and args.axis_files is not None: + raise ParserException('--axis-files or --axis-dir cannot be provided together') + elif args.axis_files is not None: if not os.path.isdir( args.output_dir ): os.makedirs( args.output_dir ) title = 'Computing migration rates from files: %s' % args.axis_files - print(); print(title); print('-'*len(title)) - migration_rates( args.axis_files, args.output_dir, columns=args.axis_columns, show=args.show, pfreq=pf ) - elif args.axis_dir is not None and args.config is None: + print(); print(title); print('-'*len(title)) + axis_files = [] + for f in args.axis_files: + path, file = os.path.split( f ) + if path == '' and args.config is not None: + axis_files.append( os.path.join( axisdir, f ) ) + else: + axis_files.append( f ) + migration_rates( axis_files, args.output_dir, columns=args.axis_columns, show=args.show, pfreq=pf ) + elif args.axis_dir is not None: axis_files = [ os.path.join(args.axis_dir, f) for f in sorted(os.listdir(args.axis_dir)) ] if not os.path.isdir( args.output_dir ): os.makedirs( args.output_dir ) title = 'Computing migration rates from directory: %s' % args.axis_dir print(); print(title); print('-'*len(title)) migration_rates( axis_files, args.output_dir, columns=args.axis_columns, show=args.show, pfreq=pf ) else: - if args.axis_dir is not None and args.axis_files is not None: - raise ParserException('--axis-files or --axis-dir cannot be provided together') - else: - raise ParserException('Either --axis-files, --axis-dir or config must be provided') + raise ParserException('Either --axis-files, --axis-dir or config must be provided') # Bars Position # ------------- @@ -317,6 +323,7 @@ if args.bars: if not os.path.isdir( bardir ): os.makedirs( bardir ) from pyris import bars_detection title = 'Decesting bars from centerlines in internal directory: %s' % cf.get( 'Data', 'output' ) + print(); print(title); print('-'*len(title)) bars_detection( landsat_dirs, geodir, axisdir, migdir, bardir, show=args.show ) # print elapsed time