Created
January 10, 2018 00:37
-
-
Save Timvrakas/4e80938cbe1c1f83c6c4ed6e13e7269e to your computer and use it in GitHub Desktop.
It gets the Juno PDS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import os | |
from tqdm import tqdm | |
import requests | |
import shutil | |
def download_file(url, path): | |
r = requests.get(url, stream=False) | |
open(path, 'wb').write(r.content) | |
text_file = open("download.sh", "w") | |
with open('INDEX.TAB', newline='') as csvfile: | |
spamreader = csv.reader(csvfile, delimiter=',', quotechar='"') | |
prefix = "https://pds-imaging.jpl.nasa.gov/data/juno/JNOJNC_0001/" | |
for row in spamreader: | |
directory = row[0] | |
if not os.path.exists(directory): | |
os.makedirs(directory) | |
labelname = row[3] + ".LBL" | |
imgname = row[3] + ".IMG" | |
labelpath = directory +"/"+ labelname | |
imgpath = directory +"/"+ imgname | |
if os.path.exists(imgpath): | |
continue | |
#print(labelpath) | |
#print(imgpath) | |
imgurl = prefix + row[13] | |
labelurl = imgurl.replace(".LBL",".IMG") | |
#print(imgurl) | |
#print(labelurl) | |
print("wget -nc -O "+imgpath+" "+imgurl) | |
print("wget -nc -O "+labelpath+" "+labelurl) | |
text_file.write("wget -nc -O "+imgpath+" "+imgurl+ "\n") | |
text_file.write("wget -nc -O "+labelpath+" "+labelurl+ "\n") | |
#download_file(imgurl,imgpath) | |
#download_file(labelurl,labelpath) | |
text_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment