Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Riccardobonanomi/issue-BUG-axis-files #14

Merged
merged 4 commits into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions pyris/bin/pyris
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -294,29 +294,36 @@ 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
# -------------
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
Expand Down