Mercurial > repos > astroteam > astronomical_archives
annotate astronomical_archives.py @ 1:667fc28d803c draft
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
author | astroteam |
---|---|
date | Tue, 24 Oct 2023 06:38:22 +0000 |
parents | 0ddfc343f9f9 |
children | 7398ea3d9ac4 |
rev | line source |
---|---|
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1 import errno |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
2 import functools |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
3 import json |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
4 import os |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
5 import signal |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
6 import sys |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
7 import urllib |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
8 from urllib import request |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
9 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
10 from astropy.coordinates import SkyCoord |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
11 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
12 import pyvo |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
13 from pyvo import DALAccessError, DALQueryError, DALServiceError |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
14 from pyvo import registry |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
15 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
16 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
17 MAX_ALLOWED_ENTRIES = 100 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
18 MAX_REGISTRIES_TO_SEARCH = 100 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
19 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
20 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
21 class TimeoutException(Exception): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
22 pass |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
23 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
24 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
25 def timeout(seconds=10, error_message=os.strerror(errno.ETIME)): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
26 def decorator(func): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
27 def _handle_timeout(signum, frame): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
28 raise TimeoutException(error_message) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
29 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
30 @functools.wraps(func) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
31 def wrapper(*args, **kwargs): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
32 signal.signal(signal.SIGALRM, _handle_timeout) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
33 signal.alarm(seconds) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
34 try: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
35 result = func(*args, **kwargs) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
36 finally: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
37 signal.alarm(0) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
38 return result |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
39 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
40 return wrapper |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
41 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
42 return decorator |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
43 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
44 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
45 class Service: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
46 # https://pyvo.readthedocs.io/en/latest/api/pyvo.registry.Servicetype.html |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
47 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
48 services = { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
49 'TAP': 'tap', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
50 'SIA': 'sia', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
51 'SIA2': 'sia2', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
52 'SPECTRUM': 'spectrum', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
53 'SCS': 'scs', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
54 'LINE': 'line' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
55 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
56 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
57 supported_services = { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
58 'TAP': 'tap' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
59 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
60 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
61 def __init__(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
62 pass |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
63 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
64 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
65 def is_service_supported(service_type) -> bool: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
66 is_supported = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
67 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
68 if service_type not in Service.services.keys(): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
69 is_supported = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
70 elif service_type not in Service.supported_services.keys(): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
71 is_supported = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
72 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
73 return is_supported |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
74 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
75 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
76 class Waveband: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
77 # https://pyvo.readthedocs.io/en/latest/api/pyvo.registry.Waveband.html |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
78 # https://www.ivoa.net/rdf/messenger/2020-08-26/messenger.html |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
79 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
80 wavebands = { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
81 'Extreme UV': 'EUV', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
82 'Gamma ray': 'Gamma-ray', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
83 'Infrared': 'Infrared', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
84 'Millimeter': 'Millimeter', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
85 'Neutrino': 'Neutrino', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
86 'Optical': 'Optical', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
87 'Photon': 'Photon', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
88 'Radio': 'Radio', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
89 'Ultra violet': 'UV', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
90 'X-ray': 'X-ray' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
91 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
92 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
93 def __init__(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
94 pass |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
95 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
96 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
97 def is_waveband_supported(waveband) -> bool: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
98 is_supported = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
99 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
100 if waveband not in Waveband.wavebands.keys(): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
101 is_supported = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
102 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
103 return is_supported |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
104 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
105 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
106 class TapArchive: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
107 # https://www.ivoa.net/documents/ObsCore/20170509/REC-ObsCore-v1.1-20170509 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
108 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
109 service_type = Service.services['TAP'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
110 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
111 def __init__(self, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
112 id=1, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
113 title="Unknown title", |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
114 name="Unknown name", |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
115 access_url=""): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
116 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
117 self.id = id, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
118 self.title = title, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
119 self.name = name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
120 self.access_url = access_url |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
121 self.initialized = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
122 self.archive_service = None |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
123 self.tables = None |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
124 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
125 @timeout(10) |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
126 def get_resources(self, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
127 query, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
128 number_of_results, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
129 url_field='access_url'): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
130 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
131 resource_list_hydrated = [] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
132 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
133 error_message = None |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
134 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
135 if self.initialized: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
136 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
137 try: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
138 raw_resource_list = self.archive_service.search(query) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
139 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
140 for i, resource in enumerate(raw_resource_list): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
141 if i < number_of_results: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
142 resource_list_hydrated.append( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
143 self._get_resource_object(resource)) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
144 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
145 break |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
146 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
147 except DALQueryError: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
148 if self.has_obscore_table(): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
149 error_message = "Error in query -> " + query |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
150 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
151 Logger.ACTION_ERROR, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
152 Logger.ACTION_TYPE_DOWNLOAD, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
153 error_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
154 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
155 error_message = "No obscore table in the archive" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
156 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
157 Logger.ACTION_ERROR, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
158 Logger.ACTION_TYPE_DOWNLOAD, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
159 error_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
160 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
161 except DALServiceError: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
162 error_message = "Error communicating with the service" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
163 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
164 Logger.ACTION_ERROR, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
165 Logger.ACTION_TYPE_DOWNLOAD, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
166 error_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
167 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
168 except Exception: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
169 error_message = "Unknow error while querying the service" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
170 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
171 Logger.ACTION_ERROR, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
172 Logger.ACTION_TYPE_DOWNLOAD, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
173 error_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
174 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
175 return resource_list_hydrated, error_message |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
176 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
177 def _get_resource_object(self, resource): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
178 resource_hydrated = {} |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
179 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
180 for key, value in resource.items(): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
181 resource_hydrated[key] = value |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
182 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
183 return resource_hydrated |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
184 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
185 def initialize(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
186 error_message = None |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
187 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
188 try: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
189 self._get_service() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
190 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
191 if self.archive_service: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
192 self._set_archive_tables() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
193 self.initialized = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
194 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
195 except DALAccessError: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
196 error_message = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
197 "A connection to the service could not be established" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
198 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
199 Logger.ACTION_ERROR, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
200 Logger.ACTION_TYPE_ARCHIVE_CONNECTION, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
201 error_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
202 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
203 except Exception: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
204 error_message = "Unknow error while initializing TAP service" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
205 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
206 Logger.ACTION_ERROR, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
207 Logger.ACTION_TYPE_ARCHIVE_CONNECTION, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
208 error_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
209 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
210 return self.initialized, error_message |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
211 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
212 def _get_service(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
213 if self.access_url: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
214 self.archive_service = pyvo.dal.TAPService(self.access_url) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
215 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
216 def _set_archive_tables(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
217 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
218 self.tables = [] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
219 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
220 for table in self.archive_service.tables: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
221 archive_table = { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
222 'name': table.name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
223 'type': table.type, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
224 'fields': None |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
225 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
226 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
227 fields = [] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
228 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
229 for table_field in table.columns: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
230 field = { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
231 'name': table_field.name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
232 'description': table_field.description, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
233 'unit': table_field.unit, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
234 'datatype': table_field.datatype.content |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
235 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
236 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
237 fields.append(field) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
238 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
239 archive_table['fields'] = fields |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
240 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
241 self.tables.append(archive_table) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
242 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
243 def _is_query_valid(self, query) -> bool: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
244 is_valid = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
245 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
246 attribute_from = 'from' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
247 attribute_where = 'where' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
248 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
249 idx_from = query.index(attribute_from) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
250 idx_where = query.index(attribute_where) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
251 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
252 table_name = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
253 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
254 for idx in range(idx_from + len('from') + 1, idx_where): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
255 table_name = table_name + query[idx] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
256 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
257 if not next( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
258 (item for item in self.tables if |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
259 item["name"] == table_name), |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
260 False): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
261 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
262 is_valid = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
263 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
264 return is_valid |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
265 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
266 def has_obscore_table(self) -> bool: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
267 has_obscore_table = self._has_table("ivoa.obscore") |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
268 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
269 return has_obscore_table |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
270 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
271 def _has_table(self, table_name) -> bool: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
272 _has_table = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
273 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
274 _has_table = next( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
275 (item for item in self.tables if item["name"] == table_name), |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
276 False) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
277 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
278 return _has_table |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
279 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
280 def get_archive_name(self, archive_type): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
281 try: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
282 if archive_type == 'registry': |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
283 name = str(self.title).strip("',()") |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
284 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
285 name = self.access_url |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
286 except Exception: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
287 name = 'Unknown archive title' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
288 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
289 return name |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
290 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
291 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
292 class ConeService(TapArchive): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
293 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
294 def _get_service(self): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
295 if self.access_url: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
296 self.archive_service = pyvo.dal.SCSService(self.access_url) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
297 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
298 def get_resources_from_service_list(self, service_list, target, radius): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
299 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
300 resource_list_hydrated = [] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
301 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
302 for service in service_list: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
303 resources = service.search(target, radius) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
304 for i in range(resources.__len__()): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
305 resource_url = resources.getrecord(i).getdataurl() |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
306 if resource_url: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
307 resource_list_hydrated.append(resource_url) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
308 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
309 return resource_list_hydrated |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
310 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
311 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
312 class RegistrySearchParameters: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
313 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
314 def __init__(self, keyword=None, waveband=None, service_type=None): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
315 self.keyword = keyword |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
316 self.waveband = waveband |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
317 self.service_type = service_type |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
318 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
319 def get_parameters(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
320 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
321 parameters = { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
322 'keywords': '', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
323 'waveband': '', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
324 'service_type': '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
325 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
326 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
327 if self.keyword: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
328 parameters['keywords'] = self.keyword |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
329 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
330 if Waveband.is_waveband_supported(self.waveband): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
331 parameters['waveband'] = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
332 Waveband.wavebands[self.waveband] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
333 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
334 if Service.is_service_supported(self.service_type): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
335 parameters['service_type'] = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
336 Service.services[self.service_type] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
337 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
338 parameters['service_type'] = Service.services['TAP'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
339 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
340 return parameters |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
341 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
342 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
343 class Registry: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
344 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
345 def __init__(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
346 pass |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
347 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
348 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
349 def search_registries(rsp: RegistrySearchParameters, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
350 number_of_registries): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
351 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
352 parameters = rsp.get_parameters() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
353 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
354 keywords = parameters['keywords'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
355 waveband = parameters['waveband'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
356 service_type = parameters['service_type'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
357 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
358 if not waveband: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
359 registry_list = registry.search( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
360 keywords=keywords, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
361 servicetype=service_type) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
362 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
363 registry_list = registry.search( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
364 keywords=keywords, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
365 waveband=waveband, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
366 servicetype=service_type) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
367 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
368 if registry_list: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
369 registry_list = Registry._get_registries_from_list( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
370 registry_list, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
371 number_of_registries) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
372 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
373 return registry_list |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
374 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
375 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
376 def _get_registries_from_list(registry_list, number_of_registries): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
377 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
378 archive_list = [] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
379 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
380 for i, ivoa_registry in enumerate(registry_list): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
381 if i < number_of_registries: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
382 archive = TapArchive(ivoa_registry.standard_id, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
383 ivoa_registry.res_title, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
384 ivoa_registry.short_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
385 ivoa_registry.access_url) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
386 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
387 archive_list.append(archive) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
388 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
389 return archive_list |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
390 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
391 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
392 class ConeServiceRegistry: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
393 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
394 def __init__(self): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
395 pass |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
396 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
397 @staticmethod |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
398 def search_services(keyword, number_of_registries): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
399 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
400 service_list = [] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
401 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
402 service_list = registry.search(servicetype="scs", keywords=keyword) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
403 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
404 if service_list: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
405 service_list = service_list[:number_of_registries] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
406 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
407 return service_list |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
408 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
409 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
410 class TapQuery: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
411 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
412 def __init__(self, query): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
413 self.raw_query = query |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
414 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
415 def get_query(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
416 return urllib.parse.unquote(self.raw_query).replace("+", " ") |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
417 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
418 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
419 class BaseADQLQuery: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
420 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
421 def __init__(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
422 pass |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
423 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
424 def _get_order_by_clause(self, order_type): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
425 order_by_clause = 'ORDER BY ' + order_type |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
426 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
427 return order_by_clause |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
428 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
429 def _get_where_clause(self, parameters): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
430 where_clause = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
431 is_first_statement = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
432 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
433 for key, value in parameters.items(): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
434 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
435 if value != '': |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
436 statement = str(key) + ' = ' + '\'' + str(value) + '\' ' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
437 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
438 if is_first_statement: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
439 is_first_statement = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
440 where_clause += 'WHERE ' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
441 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
442 statement = 'AND ' + statement |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
443 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
444 where_clause += statement |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
445 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
446 return where_clause |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
447 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
448 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
449 class ToolRunner: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
450 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
451 def __init__(self, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
452 run_parameters, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
453 output, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
454 output_csv, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
455 output_html, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
456 output_basic_html, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
457 output_error): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
458 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
459 self._raw_parameters_path = run_parameters |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
460 self._json_parameters = json.load(open(run_parameters, "r")) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
461 self._archive_type = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
462 self._query_type = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
463 self._archives = [] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
464 self._adql_query = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
465 self._services_access_url = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
466 self._url_field = 'access_url' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
467 self._number_of_files = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
468 self._is_initialised = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
469 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
470 self._csv_file = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
471 self._image_file = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
472 self._html_file = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
473 self._basic_html_file = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
474 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
475 self._output = output |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
476 self._output_csv = output_csv |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
477 self._output_html = output_html |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
478 self._output_basic_html = output_basic_html |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
479 self._output_error = output_error |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
480 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
481 self._set_run_main_parameters() |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
482 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
483 self._is_initialised, error_message = self._set_archive() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
484 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
485 if self._is_initialised and error_message is None: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
486 self._set_query() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
487 self._set_output() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
488 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
489 def _set_run_main_parameters(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
490 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
491 qs = "query_section" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
492 qsl = "query_selection" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
493 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
494 self._archive_type = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
495 self._json_parameters['archive_selection']['archive_type'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
496 self._query_type = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
497 self._json_parameters[qs][qsl]['query_type'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
498 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
499 def _set_archive(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
500 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
501 error_message = None |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
502 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
503 if self._archive_type == 'archive': |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
504 self._service_access_url =\ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
505 self._json_parameters['archive_selection']['archive'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
506 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
507 self._archives.append( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
508 TapArchive(access_url=self._service_access_url)) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
509 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
510 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
511 keyword = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
512 self._json_parameters['archive_selection']['keyword'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
513 waveband = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
514 self._json_parameters['archive_selection']['wavebands'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
515 service_type = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
516 self._json_parameters['archive_selection']['service_type'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
517 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
518 rsp = RegistrySearchParameters( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
519 keyword=keyword, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
520 waveband=waveband, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
521 service_type=service_type) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
522 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
523 archive_list = Registry.search_registries( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
524 rsp, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
525 MAX_REGISTRIES_TO_SEARCH) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
526 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
527 if len(archive_list) >= 1: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
528 self._archives = archive_list |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
529 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
530 error_message = "no archive matching search parameters" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
531 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
532 Logger.ACTION_ERROR, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
533 Logger.ACTION_TYPE_ARCHIVE_CONNECTION, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
534 error_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
535 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
536 if error_message is None: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
537 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
538 self._archives[:] = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
539 [archive for archive in self._archives if |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
540 archive.initialize()[0]] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
541 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
542 if len(self._archives) >= 1: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
543 return True, None |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
544 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
545 return False, \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
546 "no archive matching search" \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
547 " parameters could be initialized" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
548 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
549 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
550 return False, error_message |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
551 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
552 def _set_cone_service(self): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
553 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
554 qs = 'query_section' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
555 qsl = 'query_selection' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
556 csts = 'cone_search_target_selection' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
557 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
558 error_message = None |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
559 is_service_initialised = True |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
560 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
561 keyword = self._json_parameters[qs][qsl][csts]['keyword'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
562 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
563 service_list = ConeServiceRegistry.search_services( |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
564 keyword, |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
565 MAX_REGISTRIES_TO_SEARCH) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
566 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
567 if len(service_list) >= 1: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
568 self._services = service_list |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
569 else: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
570 is_service_initialised = False |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
571 error_message = "no services matching search parameters" |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
572 Logger.create_action_log( |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
573 Logger.ACTION_ERROR, |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
574 Logger.ACTION_TYPE_ARCHIVE_CONNECTION, |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
575 error_message) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
576 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
577 return is_service_initialised, error_message |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
578 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
579 def _set_query(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
580 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
581 qs = 'query_section' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
582 qsl = 'query_selection' |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
583 csts = 'cone_search_target_selection' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
584 cs = 'cone_section' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
585 ts = 'target_selection' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
586 con = 'cone_object_name' |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
587 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
588 if self._query_type == 'obscore_query': |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
589 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
590 dataproduct_type = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
591 self._json_parameters[qs][qsl]['dataproduct_type'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
592 obs_collection = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
593 self._json_parameters[qs][qsl]['obs_collection'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
594 obs_title = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
595 self._json_parameters[qs][qsl]['obs_title'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
596 obs_id = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
597 self._json_parameters[qs][qsl]['obs_id'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
598 facility_name = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
599 self._json_parameters[qs][qsl]['facility_name'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
600 instrument_name = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
601 self._json_parameters[qs][qsl]['instrument_name'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
602 em_min = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
603 self._json_parameters[qs][qsl]['em_min'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
604 em_max = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
605 self._json_parameters[qs][qsl]['em_max'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
606 target_name = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
607 self._json_parameters[qs][qsl]['target_name'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
608 obs_publisher_id = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
609 self._json_parameters[qs][qsl]['obs_publisher_id'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
610 s_fov = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
611 self._json_parameters[qs][qsl]['s_fov'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
612 calibration_level = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
613 self._json_parameters[qs][qsl]['calibration_level'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
614 t_min = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
615 self._json_parameters[qs][qsl]['t_min'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
616 t_max = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
617 self._json_parameters[qs][qsl]['t_max'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
618 order_by = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
619 self._json_parameters[qs][qsl]['order_by'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
620 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
621 if self._json_parameters[qs][qsl][cs][csts][ts] == 'coordinates': |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
622 ra = self._json_parameters[qs][qsl][cs][csts]['ra'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
623 dec = self._json_parameters[qs][qsl][cs][csts]['dec'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
624 else: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
625 obs_target = self._json_parameters[qs][qsl][cs][csts][con] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
626 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
627 if obs_target != 'none' and obs_target is not None: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
628 target = CelestialObject(obs_target) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
629 target_coordinates = target.get_coordinates_in_degrees() |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
630 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
631 ra = target_coordinates['ra'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
632 dec = target_coordinates['dec'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
633 else: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
634 ra = None |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
635 dec = None |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
636 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
637 radius = self._json_parameters[qs][qsl][cs]['radius'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
638 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
639 if (ra != '' and ra is not None)\ |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
640 and (dec != '' and dec is not None)\ |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
641 and (radius != '' and radius is not None): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
642 cone_condition = \ |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
643 ADQLConeSearchQuery.get_search_circle_condition(ra, |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
644 dec, |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
645 radius) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
646 else: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
647 cone_condition = None |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
648 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
649 obscore_query_object = ADQLObscoreQuery(dataproduct_type, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
650 obs_collection, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
651 obs_title, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
652 obs_id, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
653 facility_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
654 instrument_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
655 em_min, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
656 em_max, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
657 target_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
658 obs_publisher_id, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
659 s_fov, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
660 calibration_level, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
661 t_min, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
662 t_max, |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
663 cone_condition, |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
664 order_by) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
665 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
666 self._adql_query = obscore_query_object.get_query() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
667 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
668 elif self._query_type == 'raw_query': |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
669 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
670 wc = 'where_clause' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
671 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
672 tap_table = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
673 self._json_parameters[qs][qsl]['table'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
674 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
675 where_field = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
676 self._json_parameters[qs][qsl][wc]['where_field'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
677 where_condition = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
678 self._json_parameters[qs][qsl][wc]['where_condition'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
679 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
680 self._url_field = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
681 self._json_parameters[qs][qsl]['url_field'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
682 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
683 self._adql_query = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
684 ADQLTapQuery().get_query( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
685 tap_table, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
686 where_field, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
687 where_condition) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
688 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
689 self._adql_query = ADQLObscoreQuery.base_query |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
690 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
691 def _set_cone_query(self): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
692 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
693 qs = 'query_section' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
694 qsl = 'query_selection' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
695 csts = 'cone_search_target_selection' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
696 ts = 'target_selection' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
697 con = 'cone_object_name' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
698 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
699 search_radius = self._json_parameters[qs][qsl]['radius'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
700 time = None |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
701 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
702 if self._json_parameters[qs][qsl][csts][ts] == 'coordinates': |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
703 ra = self._json_parameters[qs][qsl][csts]['ra'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
704 dec = self._json_parameters[qs][qsl][csts]['dec'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
705 time = self._json_parameters[qs][qsl][csts]['time'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
706 else: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
707 target = CelestialObject(self._json_parameters[qs][qsl][csts][con]) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
708 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
709 target_coordinates = target.get_coordinates_in_degrees() |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
710 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
711 ra = target_coordinates['ra'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
712 dec = target_coordinates['dec'] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
713 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
714 cone_query_object = ADQLConeSearchQuery(ra, dec, search_radius, time) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
715 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
716 self._adql_query = cone_query_object.get_query() |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
717 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
718 def _set_output(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
719 self._number_of_files = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
720 int( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
721 self._json_parameters['output_section']['number_of_files'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
722 ) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
723 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
724 if self._number_of_files < 1: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
725 self._number_of_files = 1 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
726 elif self._number_of_files > 100: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
727 self._number_of_files = MAX_ALLOWED_ENTRIES |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
728 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
729 output_selection = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
730 self._json_parameters['output_section']['output_selection'] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
731 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
732 if output_selection is not None: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
733 if 'c' in output_selection: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
734 self._csv_file = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
735 if 'i' in output_selection: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
736 self._image_file = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
737 if 'h' in output_selection: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
738 self._html_file = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
739 if 'b' in output_selection: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
740 self._basic_html_file = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
741 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
742 def _validate_json_parameters(self, json_parameters): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
743 self._json_parameters = json.load(open(json_parameters, "r")) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
744 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
745 def run(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
746 if self._is_initialised: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
747 error_message = None |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
748 file_url = [] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
749 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
750 archive_name = self._archives[0].get_archive_name( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
751 self._archive_type) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
752 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
753 for archive in self._archives: |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
754 try: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
755 _file_url, error_message = archive.get_resources( |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
756 self._adql_query, |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
757 self._number_of_files, |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
758 self._url_field) |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
759 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
760 file_url.extend(_file_url) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
761 except TimeoutException: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
762 error_message = \ |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
763 "Archive is taking too long to respond (timeout)" |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
764 Logger.create_action_log( |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
765 Logger.ACTION_ERROR, |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
766 Logger.ACTION_TYPE_ARCHIVE_CONNECTION, |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
767 error_message) |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
768 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
769 if len(file_url) >= int(self._number_of_files): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
770 file_url = file_url[:int(self._number_of_files)] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
771 break |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
772 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
773 if file_url: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
774 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
775 if self._csv_file: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
776 FileHandler.write_urls_to_output( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
777 file_url, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
778 self._output_csv, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
779 self._url_field) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
780 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
781 if self._image_file: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
782 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
783 try: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
784 fits_file = FileHandler.download_file_from_url( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
785 file_url[0][self._url_field]) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
786 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
787 FileHandler.write_file_to_output( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
788 fits_file, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
789 self._output, "wb") |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
790 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
791 log_message = "from url " +\ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
792 file_url[0][self._url_field] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
793 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
794 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
795 Logger.ACTION_SUCCESS, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
796 Logger.ACTION_TYPE_DOWNLOAD, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
797 log_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
798 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
799 except Exception: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
800 error_message = "from url " + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
801 file_url[0][self._url_field] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
802 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
803 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
804 Logger.ACTION_ERROR, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
805 Logger.ACTION_TYPE_DOWNLOAD, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
806 error_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
807 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
808 for i, url in enumerate(file_url[1:], start=1): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
809 try: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
810 fits_file = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
811 FileHandler.download_file_from_url( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
812 url[self._url_field]) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
813 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
814 FileHandler.write_file_to_subdir( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
815 fits_file, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
816 FileHandler.get_file_name_from_url( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
817 url[self._url_field])) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
818 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
819 log_message = "from url " + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
820 url[self._url_field] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
821 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
822 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
823 Logger.ACTION_SUCCESS, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
824 Logger.ACTION_TYPE_DOWNLOAD, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
825 log_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
826 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
827 except Exception: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
828 error_message = "from url " + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
829 url[self._url_field] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
830 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
831 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
832 Logger.ACTION_ERROR, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
833 Logger.ACTION_TYPE_DOWNLOAD, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
834 error_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
835 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
836 if self._html_file: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
837 html_file = OutputHandler.generate_html_output( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
838 file_url, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
839 archive_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
840 self._adql_query) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
841 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
842 FileHandler.write_file_to_output(html_file, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
843 self._output_html) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
844 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
845 if self._basic_html_file: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
846 html_file = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
847 OutputHandler.generate_basic_html_output( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
848 file_url, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
849 archive_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
850 self._adql_query) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
851 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
852 FileHandler.write_file_to_output( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
853 html_file, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
854 self._output_basic_html) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
855 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
856 summary_file = Logger.create_log_file(archive_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
857 self._adql_query) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
858 summary_file += "\n Tool run executed with success" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
859 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
860 FileHandler.write_file_to_output(summary_file, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
861 self._output_error) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
862 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
863 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
864 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
865 summary_file = Logger.create_log_file(archive_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
866 self._adql_query) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
867 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
868 if error_message is None: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
869 summary_file += \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
870 "\n No resources matching parameters found" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
871 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
872 summary_file += error_message |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
873 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
874 FileHandler.write_file_to_output(summary_file, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
875 self._output_error) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
876 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
877 summary_file = Logger.create_log_file("Archive", |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
878 self._adql_query) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
879 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
880 summary_file += "Unable to initialize archives" |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
881 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
882 FileHandler.write_file_to_output(summary_file, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
883 self._output_error) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
884 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
885 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
886 class ADQLObscoreQuery(BaseADQLQuery): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
887 order_by_field = { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
888 'size': 'access_estsize', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
889 'collection': 'obs_collection', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
890 'object': 'target_name' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
891 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
892 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
893 base_query = 'SELECT TOP ' + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
894 str(MAX_ALLOWED_ENTRIES) + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
895 ' * FROM ivoa.obscore ' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
896 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
897 def __init__(self, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
898 dataproduct_type, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
899 obs_collection, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
900 obs_title, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
901 obs_id, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
902 facility_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
903 instrument_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
904 em_min, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
905 em_max, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
906 target_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
907 obs_publisher_id, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
908 s_fov, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
909 calibration_level, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
910 t_min, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
911 t_max, |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
912 cone_condition, |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
913 order_by): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
914 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
915 super().__init__() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
916 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
917 if calibration_level == 'none': |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
918 calibration_level = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
919 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
920 if order_by == 'none': |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
921 order_by = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
922 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
923 if t_min == 'None' or t_min is None: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
924 t_min = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
925 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
926 if t_max == 'None' or t_max is None: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
927 t_max = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
928 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
929 if em_min == 'None' or em_min is None: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
930 em_min = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
931 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
932 if em_max == 'None' or em_max is None: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
933 em_max = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
934 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
935 if dataproduct_type == 'none' or dataproduct_type is None: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
936 dataproduct_type = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
937 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
938 if cone_condition is not None: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
939 self.cone_condition = cone_condition |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
940 else: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
941 self.cone_condition = None |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
942 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
943 self.parameters = { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
944 'dataproduct_type': dataproduct_type, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
945 'obs_collection': obs_collection, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
946 'obs_title': obs_title, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
947 'obs_id': obs_id, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
948 'facility_name': facility_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
949 'instrument_name': instrument_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
950 'em_min': em_min, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
951 'em_max': em_max, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
952 'target_name': target_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
953 'obs_publisher_id': obs_publisher_id, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
954 's_fov': s_fov, |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
955 'calib_level': calibration_level, |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
956 't_min': t_min, |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
957 't_max': t_max, |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
958 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
959 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
960 self.order_by = order_by |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
961 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
962 def get_query(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
963 return ADQLObscoreQuery.base_query + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
964 self.get_where_statement() + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
965 self.get_order_by_statement() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
966 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
967 def get_order_by_statement(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
968 if self.order_by != '': |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
969 return self._get_order_by_clause(self.order_by) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
970 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
971 return '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
972 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
973 def _get_order_by_clause(self, order_type): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
974 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
975 obscore_order_type = ADQLObscoreQuery.order_by_field[order_type] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
976 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
977 return super()._get_order_by_clause(obscore_order_type) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
978 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
979 def get_where_statement(self): |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
980 where_clause = self._get_where_clause(self.parameters) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
981 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
982 if where_clause == '' and self.cone_condition is not None: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
983 where_clause = 'WHERE ' + self.get_cone_condition() |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
984 elif where_clause != '' and self.cone_condition is not None: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
985 where_clause += 'AND ' + self.get_cone_condition() |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
986 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
987 return where_clause |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
988 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
989 def _get_where_clause(self, parameters): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
990 return super()._get_where_clause(parameters) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
991 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
992 def get_cone_condition(self): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
993 return self.cone_condition |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
994 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
995 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
996 class ADQLTapQuery(BaseADQLQuery): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
997 base_query = 'SELECT TOP '+str(MAX_ALLOWED_ENTRIES)+' * FROM ' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
998 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
999 def __init__(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1000 super().__init__() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1001 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1002 def get_order_by_clause(self, order_type): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1003 return super()._get_order_by_clause(order_type) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1004 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1005 def get_query(self, table, where_field, where_condition): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1006 if where_field != '' and where_condition != '': |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1007 return ADQLTapQuery.base_query + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1008 str(table) + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1009 ' WHERE ' + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1010 str(where_field) + ' = ' + '\'' + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1011 str(where_condition) + '\'' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1012 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1013 return ADQLTapQuery.base_query + str(table) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1014 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1015 |
1
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1016 class ADQLConeSearchQuery: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1017 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1018 base_query = "SELECT TOP 100 * FROM ivoa.obscore" |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1019 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1020 def __init__(self, ra, dec, radius, time=None): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1021 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1022 self.ra = ra |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1023 self.dec = dec |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1024 self.radius = radius |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1025 self.time = time |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1026 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1027 self._query = ADQLObscoreQuery.base_query |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1028 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1029 if self.ra and self.dec and self.radius: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1030 self._query += " WHERE " |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1031 self._query += self._get_search_circle(ra, dec, radius) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1032 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1033 if self.time: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1034 self._query += self._get_search_time() |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1035 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1036 def _get_search_circle(self, ra, dec, radius): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1037 return "(CONTAINS" \ |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1038 "(POINT('ICRS', s_ra, s_dec), " \ |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1039 "CIRCLE('ICRS', "+str(ra)+", "+str(dec)+", "+str(radius)+")" \ |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1040 ") = 1)" |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1041 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1042 def _get_search_time(self): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1043 return " AND t_min <= "+self.time+" AND t_max >= "+self.time |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1044 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1045 def get_query(self): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1046 return self._query |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1047 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1048 @staticmethod |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1049 def get_search_circle_condition(ra, dec, radius): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1050 return "(CONTAINS" \ |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1051 "(POINT('ICRS', s_ra, s_dec)," \ |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1052 "CIRCLE('ICRS', "+str(ra)+", "+str(dec)+", "+str(radius)+")" \ |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1053 ") = 1) " |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1054 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1055 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1056 class CelestialObject: |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1057 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1058 def __init__(self, name): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1059 self.name = name |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1060 self.coordinates = None |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1061 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1062 self.coordinates = SkyCoord.from_name(self.name) |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1063 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1064 def get_coordinates_in_degrees(self): |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1065 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1066 coordinates = { |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1067 'ra': '', |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1068 'dec': '' |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1069 } |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1070 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1071 ra_dec = self.coordinates.ravel() |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1072 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1073 coordinates['ra'] = ra_dec.ra.degree[0] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1074 coordinates['dec'] = ra_dec.dec.degree[0] |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1075 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1076 return coordinates |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1077 |
667fc28d803c
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit f9ba105adfaad1b2a16dd570652aa27c508d3c4d
astroteam
parents:
0
diff
changeset
|
1078 |
0
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1079 class HTMLReport: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1080 _html_report_base_header = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1081 _html_report_base_body = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1082 _html_report_base_footer = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1083 _html_report_base_script = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1084 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1085 def __init__(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1086 pass |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1087 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1088 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1089 class OutputHandler: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1090 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1091 def __init__(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1092 pass |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1093 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1094 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1095 def generate_html_output(urls_data, archive_name, adql_query): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1096 return OutputHandler.html_header + \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1097 OutputHandler.generate_html_content( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1098 urls_data, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1099 archive_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1100 adql_query, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1101 div_attr='class="title"', |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1102 table_attr='class="fl-table"') |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1103 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1104 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1105 def generate_basic_html_output(urls_data, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1106 archive_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1107 adql_query, ): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1108 return OutputHandler.generate_html_content(urls_data, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1109 archive_name, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1110 adql_query) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1111 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1112 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1113 def generate_html_content(urls_data, archive_name, adql_query, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1114 div_attr="", table_attr="border='1'"): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1115 html_file = \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1116 f""" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1117 <div {div_attr}> |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1118 <h2>Resources Preview archive: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1119 <span> |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1120 {archive_name} |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1121 </span> |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1122 </h2> |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1123 <span>ADQL query : {adql_query}</span> |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1124 </div>""" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1125 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1126 html_file += f'<table {table_attr}><thead><tr>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1127 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1128 for key in Utils.collect_resource_keys(urls_data): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1129 html_file += '<th>' + str(key) + '</th>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1130 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1131 html_file += '</thead></tr><tbody>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1132 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1133 for resource in urls_data: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1134 html_file += '<tr>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1135 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1136 for key, value in resource.items(): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1137 html_file += f'<td>{value}</td>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1138 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1139 html_file += '<td>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1140 for preview_key in \ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1141 ['preview', 'preview_url', 'postcard_url']: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1142 if preview_key in resource: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1143 html_file += ( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1144 '<details><summary>Preview</summary>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1145 f'<img src="{resource[preview_key]}"/>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1146 '</details>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1147 ) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1148 html_file += '</td>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1149 html_file += '</tr>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1150 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1151 html_file += '</tbody></table>' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1152 return html_file |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1153 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1154 html_header = """ <head><style> |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1155 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1156 details { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1157 padding: 10px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1158 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1159 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1160 .table-wrapper { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1161 margin: 10px 70px 70px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1162 box-shadow: 0px 35px 50px rgba( 0, 0, 0, 0.2 ); |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1163 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1164 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1165 .fl-table { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1166 border-radius: 5px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1167 font-size: 12px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1168 font-weight: normal; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1169 border: none; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1170 border-collapse: collapse; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1171 width: 100%; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1172 max-width: 100%; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1173 white-space: nowrap; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1174 background-color: white; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1175 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1176 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1177 .fl-table td, .fl-table th { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1178 text-align: center; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1179 padding: 8px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1180 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1181 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1182 .fl-table td { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1183 border: 1px solid #999999; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1184 font-size: 15px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1185 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1186 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1187 .fl-table thead th { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1188 color: #ffffff; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1189 background: #4FC3A1; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1190 border: 1px solid #999999; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1191 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1192 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1193 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1194 .fl-table thead th:nth-child(odd) { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1195 color: #ffffff; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1196 background: #324960; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1197 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1198 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1199 .fl-table tr:nth-child(even) { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1200 background: #F8F8F8; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1201 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1202 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1203 .title h2 { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1204 text-align: center; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1205 font-size: 22px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1206 font-weight: 700; color:#202020; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1207 text-transform: uppercase; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1208 word-spacing: 1px; letter-spacing:2px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1209 margin-bottom: 50px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1210 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1211 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1212 .title h2 span { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1213 padding-top: 40px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1214 text-transform: none; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1215 font-size:.80em; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1216 font-weight: bold; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1217 font-family: "Playfair Display","Bookman",serif; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1218 color:#999; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1219 letter-spacing:-0.005em; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1220 word-spacing:1px; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1221 letter-spacing:none; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1222 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1223 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1224 .title h1:before { |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1225 background-color: #dfdfdf; |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1226 } |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1227 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1228 </style></head>""" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1229 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1230 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1231 class FileHandler: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1232 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1233 def __init__(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1234 pass |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1235 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1236 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1237 def download_file_from_url(file_url): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1238 with request.urlopen(file_url) as response: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1239 fits_file = response.read() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1240 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1241 return fits_file |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1242 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1243 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1244 def write_file_to_output(file, output, write_type="w"): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1245 with open(output, write_type) as file_output: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1246 file_output.write(file) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1247 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1248 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1249 def write_urls_to_output(urls: [], output, access_url="access_url"): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1250 with open(output, "w") as file_output: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1251 for url in urls: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1252 try: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1253 file_output.write(url[access_url] + ',') |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1254 except Exception: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1255 error_message = "url field not found for url" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1256 Logger.create_action_log( |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1257 Logger.ACTION_ERROR, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1258 Logger.ACTION_TYPE_WRITE_URL, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1259 error_message) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1260 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1261 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1262 def write_file_to_subdir(file, index): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1263 dir = os.getcwd() |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1264 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1265 dir += '/fits' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1266 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1267 upload_dir = os.path.join(dir, str(index) + '.fits') |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1268 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1269 with open(upload_dir, "wb") as file_output: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1270 file_output.write(file) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1271 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1272 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1273 def get_file_name_from_url(url, index=None): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1274 url_parts = url.split('/') |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1275 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1276 file_name = '' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1277 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1278 try: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1279 if (url_parts[-1]) != '': |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1280 file_name = url_parts[-1] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1281 elif len(url_parts) > 1: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1282 file_name = url_parts[-2] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1283 except Exception: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1284 file_name = 'archive file ' |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1285 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1286 return file_name |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1287 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1288 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1289 class Utils: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1290 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1291 def __init__(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1292 pass |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1293 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1294 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1295 def collect_resource_keys(urls_data: list) -> list: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1296 """ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1297 Collect all the keys from the resources, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1298 keeping the order in the order of key appearance in the resources |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1299 """ |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1300 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1301 resource_keys = [] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1302 for resource in urls_data: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1303 for key in resource.keys(): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1304 if key not in resource_keys: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1305 resource_keys.append(key) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1306 return resource_keys |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1307 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1308 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1309 class Logger: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1310 _logs = [] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1311 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1312 ACTION_SUCCESS = 1 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1313 ACTION_ERROR = 2 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1314 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1315 ACTION_TYPE = 1 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1316 INFO_TYPE = 2 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1317 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1318 ACTION_TYPE_DOWNLOAD = 1 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1319 ACTION_TYPE_ARCHIVE_CONNECTION = 2 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1320 ACTION_TYPE_WRITE_URL = 3 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1321 ACTION_TYPE_WRITE_FILE = 4 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1322 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1323 def __init__(self): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1324 pass |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1325 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1326 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1327 def create_action_log(outcome, action, message) -> bool: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1328 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1329 is_log_created = False |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1330 log = "" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1331 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1332 if action == Logger.ACTION_TYPE_DOWNLOAD: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1333 if outcome == Logger.ACTION_SUCCESS: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1334 log += "Success downloading file : " + message |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1335 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1336 log += "Error downloading file : " + message |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1337 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1338 is_log_created = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1339 elif action == Logger.ACTION_TYPE_ARCHIVE_CONNECTION: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1340 if outcome == Logger.ACTION_SUCCESS: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1341 log += "Success connecting to archive : " + message |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1342 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1343 log += "Error connecting to archive : " + message |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1344 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1345 is_log_created = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1346 elif action == Logger.ACTION_TYPE_WRITE_URL: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1347 if outcome == Logger.ACTION_SUCCESS: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1348 log += "Success writing url to file : " + message |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1349 else: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1350 log += "Error writing to file : " + message |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1351 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1352 is_log_created = True |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1353 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1354 if is_log_created: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1355 Logger._insert_log(Logger.ACTION_TYPE, log) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1356 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1357 return is_log_created |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1358 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1359 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1360 def create_info_log(message): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1361 pass |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1362 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1363 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1364 def _insert_log(type, log): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1365 Logger._logs.append(log) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1366 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1367 @staticmethod |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1368 def create_log_file(archive_name, query): |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1369 log_file = "" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1370 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1371 log_file += "Run summary for archive : " + archive_name + "\n" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1372 log_file += "With query : " + query + "\n" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1373 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1374 for log in Logger._logs: |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1375 log_file += log + "\n" |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1376 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1377 return log_file |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1378 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1379 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1380 if __name__ == "__main__": |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1381 output = sys.argv[1] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1382 output_csv = sys.argv[2] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1383 output_html = sys.argv[3] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1384 output_basic_html = sys.argv[4] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1385 output_error = sys.argv[5] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1386 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1387 inputs = sys.argv[6] |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1388 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1389 tool_runner = ToolRunner(inputs, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1390 output, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1391 output_csv, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1392 output_html, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1393 output_basic_html, |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1394 output_error) |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1395 |
0ddfc343f9f9
planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/ commit d68858614f92df46c58724928d918e989d916db0
astroteam
parents:
diff
changeset
|
1396 tool_runner.run() |