Requirements

To download data from inside the SAAO network, follow these steps:

Step 1: Search for Data

Perform your search on SAAO Data Search.

Step 2: Locate Data

Once you have located the data you want to download, repeat the search and select "FileName" under "Format Output" and redo the search.

Step 3: Save Filenames

Copy and paste the list of filenames into a file on your local machine. Name it filelist.txt.

Step 4: Prepare for Download

On your local machine, create a directory into which you want to download your data. Place both filelist.txt and download_files.py in this directory.

Step 5: Execute Download

Run the download script with the following command:

python download_files.py <your_username>

Replace <your_username> with your SAAO username. Enter your password when prompted, and the download will begin.

Notes

download_files.py Script


import os
import sys

def main(username):
    # Read filenames from filelist.txt
    with open('filelist.txt', 'r') as file:
        filenames = file.read().splitlines()

    # Create the scp command string
    scp_command = f"scp -OT {username}@astro2015.cape.saao.ac.za:'{' '.join(filenames)}' ."

    # Execute the command on the command line
    os.system(scp_command)

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: python download_files.py ")
        sys.exit(1)
    
    username = sys.argv[1]
    main(username)