/
get_images.py
executable file
·63 lines (50 loc) · 1.73 KB
/
get_images.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# -*- coding: utf-8 -*-
import json
import asciitable
def skip_bad_lines(self, str_vals, ncols):
"""Simply ignore every line with the wrong number of columns."""
print 'Skipping line:', ' '.join(str_vals)
return None
def get_iss_photos():
"""
Gets public photos from ISS missions and provide data input for tasks
:arg string size: Size of the image from ISS mission
:returns: A list of photos.
:rtype: list
http://eol.jsc.nasa.gov/sseop/images/ESC/small/ISS030/ISS030-E-67805.JPG
"""
photos = []
#asciitable.BaseReader.inconsistent_handler = skip_bad_lines
lista=asciitable.read('atlasOfNight.csv',guess=False,delimiter=",")
for i in lista:
tmpMission=i['ISS-ID'].split('-E-')
mission = tmpMission[0]
idIss = tmpMission[1]
pattern_s = "http://eol.jsc.nasa.gov/sseop/images/ESC/%s/%s/%s-E-%s.JPG" % (
"small",
mission,
mission,
idIss)
pattern_b = "http://eol.jsc.nasa.gov/sseop/images/ESC/%s/%s/%s-E-%s.JPG" % (
'large',
mission,
mission,
idIss)
linkData = "http://eol.jsc.nasa.gov/scripts/sseop/photo.pl?mission=%s&roll=E&frame=%s" % (
mission,
idIss)
idISS = idIss
citylon2 = str(i['nlon'])
citylat2 = str(i['nlat'])
f = '50'
tmp = dict(link_small=pattern_s,
link_big=pattern_b,
linkData=linkData,
idISS=idISS,
citylon=citylon2,
citylat=citylat2,
focal=f
)
photos.append(tmp)
return photos
#print get_iss_photos()