diff --git a/example/aitf-data-for-run b/example/aitf-data-for-run index cfa29c3858247554d54017304278a5b0fae615bf..1697c6f574b32cd4bd7f25e5e9a5a0bf61d2df8c 100755 --- a/example/aitf-data-for-run +++ b/example/aitf-data-for-run @@ -81,9 +81,9 @@ def hack_oisst_preliminary_filename(filename): def yes_download_report(name, stats): - sys.stderr.write(name+"\n") + sys.stdout.write(name+"\n") for x in stats.report(): - sys.stderr.write(" "+x+"\n") + sys.stdout.write(" "+x+"\n") def no_download_report(name, stats): pass @@ -116,21 +116,21 @@ def main(): try: - if args.want_progress: sys.stderr.write("Acquiring SST\n") + if args.want_progress: sys.stdout.write("Acquiring SST\n") sststats = aitf.ancil.SST.download_for_time(args.scan_time, args.cache, do_download = do_download, progress=progress) sst_files = sststats.all_files() log_download_report("SST Download Summary", sststats) # using SST instead of GFS to show that # DownloadStatistics are interchangable. - if args.want_progress: sys.stderr.write("Acquiring GFS\n") + if args.want_progress: sys.stdout.write("Acquiring GFS\n") gfsstats = aitf.ancil.GFS.download_for_time(args.scan_time, args.cache, do_download = do_download, progress=progress) gfs_files = gfsstats.all_files() log_download_report("GFS Download Summary", gfsstats) log_download_report("Total Download Summary", sststats + gfsstats) - if args.want_progress: sys.stderr.write("Symbolically linking into place\n") + if args.want_progress: sys.stdout.write("Symbolically linking into place\n") all_files = list(sst_files) + list(gfs_files) for destination in args.destination: for file in all_files: diff --git a/example/aitf-update-cache b/example/aitf-update-cache index b394c070eac6e339b8445cf8b732ba1472664f04..c9ff249c9a48fba177fb973c92c0621ca9e65906 100755 --- a/example/aitf-update-cache +++ b/example/aitf-update-cache @@ -93,9 +93,9 @@ def parse_args(): def yes_download_report(name, stats): - sys.stderr.write(name+"\n") + sys.stdout.write(name+"\n") for x in stats.report(): - sys.stderr.write(" "+x+"\n") + sys.stdout.write(" "+x+"\n") def no_download_report(name, stats): pass @@ -219,9 +219,10 @@ def main(): from datetime import datetime expiration = (datetime.now() - args.expiration).timestamp() stats = delete_old_files(args.dir, expiration) - logging.summary('Expiring Old Data Summary') - logging.summary(f' Removed {stats.num_deleted} files totaling {stats.size_deleted} bytes') - logging.summary(f' Kept {stats.num_kept} files totaling {stats.size_kept} bytes') + if args.want_summary: + sys.stdout.write('Expiring Old Data Summary\n') + sys.stdout.write(f' Removed {stats.num_deleted} files totaling {stats.size_deleted} bytes\n') + sys.stdout.write(f' Kept {stats.num_kept} files totaling {stats.size_kept} bytes\n') return 0 diff --git a/example/aitf/progress.py b/example/aitf/progress.py index bdbeba57615f72f0c549f42d28421b944b50df8c..2996625aefff03af5d3f5d400dda078479abe47f 100755 --- a/example/aitf/progress.py +++ b/example/aitf/progress.py @@ -28,15 +28,15 @@ human_bytes = csppfetch.human_bytes class Progress(csppfetch.Progress): def start_attempt(self, stats): - sys.stderr.write(f"Attempt {stats.current_attempt} out of maximum {stats.max_attempts}\n") + sys.stdout.write(f"Attempt {stats.current_attempt} out of maximum {stats.max_attempts}\n") def start_fileset(self, stats): - sys.stderr.write( f" Working on {stats.current_fileset_description}\n") + sys.stdout.write( f" Working on {stats.current_fileset_description}\n") def finished_file(self, stats, local_path, is_cache_hit): reason = "downloaded" if is_cache_hit: reason = "found in local cache" - sys.stderr.write(f" {local_path} {reason}. (Downloaded {len(stats.downloaded_files)} files, {human_bytes(stats.downloaded_size)}. Found in cache {len(stats.cached_files)} files, {human_bytes(stats.cached_size)})\n") + sys.stdout.write(f" {local_path} {reason}. (Downloaded {len(stats.downloaded_files)} files, {human_bytes(stats.downloaded_size)}. Found in cache {len(stats.cached_files)} files, {human_bytes(stats.cached_size)})\n")