File indexing completed on 2024-09-08 03:28:58
0001 #!/bin/bash 0002 0003 # What this is: 0004 # 0005 # Helpful script to download Digitized Sky Survey images using KStars 0006 # DBus interfaces to resolve object names. The script is designed to 0007 # produce fixed FOVs instead of relying on KStars' object-specific FOV 0008 # choices. 0009 0010 # Data use and copyrights: 0011 # 0012 # Please note that the images downloaded are governed by the terms of 0013 # the data use policies of the Digital Sky Survey. Relevant links are: 0014 # http://archive.stsci.edu/dss/acknowledging.html 0015 # http://archive.stsci.edu/data_use.html 0016 # 0017 # SPDX-FileCopyrightText: 2015 Akarsh Simha <akarsh@kde.org> 0018 # SPDX-License-Identifier: GPL-3.0-or-later 0019 0020 # Dependencies: 0021 # 0022 # Requires: qdbus, wget 0023 # Optional: ImageMagick suite (for mogrify) 0024 0025 0026 # Usage: 0027 # 0028 # ./dss_downloader.sh <list_file> 0029 # 0030 # list_file is a text file containing a list of objects known to 0031 # KStars. One object on one line 0032 # 0033 # You may need to comment / uncomment some lines and/or modify some 0034 # numbers to suit your needs 0035 0036 # Specify the sizes of the images below in arcminutes. No 0037 # minimum. Maximum 75 arcminutes. 0038 size_1="15" 0039 size_2="30" 0040 #size_3="45" 0041 0042 # Read the file 0043 while read object; do 0044 echo "========== Processing ${object} ==========" 0045 0046 # Get the DSS URL from KStars 0047 raw_dss_url=$(qdbus org.kde.kstars /KStars org.kde.kstars.getDSSURL "${object}") 0048 0049 # Strip height and width from URL 0050 trimmed_dss_url=$(echo ${raw_dss_url} | sed 's/&h=[0-9\.]*&w=[0-9\.]*//') 0051 0052 # Prepare URL for each size 0053 dss_url_size1="${trimmed_dss_url}&h=${size_1}&w=${size_1}" 0054 dss_url_size2="${trimmed_dss_url}&h=${size_2}&w=${size_2}" 0055 # dss_url_size3="${trimmed_dss_url}&h=${size_3}&w=${size_3}" 0056 0057 # Prepare file names for each size 0058 object_underscored=$(echo ${object} | sed 's/ */_/g') 0059 filename_size1="${object_underscored}_${size_1}x${size_1}.gif" 0060 filename_size2="${object_underscored}_${size_2}x${size_2}.gif" 0061 # filename_size3="${object_underscored}_${size_3}x${size_3}.gif" 0062 0063 # Download the images 0064 wget ${dss_url_size1} -O ${filename_size1} 0065 wget ${dss_url_size2} -O ${filename_size2} 0066 # wget ${dss_url_size3} -O ${filename_size3} 0067 0068 # Optional -- comment to disable 0069 # Make the DSS images white on black instead of black on white 0070 # mogrify -negate ${filename_size1} 0071 # mogrify -negate ${filename_size2} 0072 # mogrify -negate ${filename_size3} 0073 0074 # Optional -- uncomment to enable 0075 # Scale down images that are larger than 1024x1024 pixels in size to 1024x1024 0076 # mogrify ${filename_size1} -resize "1024>" 0077 # mogrify ${filename_size2} -resize "1024>" 0078 # mogrify ${filename_size3} -resize "1024>" 0079 0080 done < $1; 0081 0082 echo "========== ALL DONE! ==========" 0083