@@ -944,7 +944,8 @@ def get_observation_products(self, *, id=None, schema="sedm", product_type=None,
944944
945945 return files
946946
947- def __get_tile_catalogue_list (self , * , tile_index , product_type , verbose = False ):
947+ def __get_tile_catalogue_list (self , * , tile_index , product_type , schema = "sedm" , dsr_part1 = None ,
948+ dsr_part2 = None , dsr_part3 = None , verbose = False ):
948949 """
949950 Get the list of products of a given EUCLID tile_index (mosaics)
950951
@@ -989,6 +990,15 @@ def __get_tile_catalogue_list(self, *, tile_index, product_type, verbose=False):
989990 dpdSleModelOutput: SLE Model Output
990991 #. SIR
991992 DpdSirCombinedSpectra: Combined Spectra Product
993+ schema : str, optional
994+ release name. Default value is 'sedm'.
995+ dsr_part1: str, optional, default None
996+ the data set release part 1: for OTF environment, the activity code; for REG and IDR, the target environment
997+ dsr_part2: str, optional, default None
998+ the data set release part 2: for OTF environment, the patch id (a positive integer); for REG and IDR,
999+ the activity code
1000+ dsr_part3: int, optional, default None
1001+ the data set release part 3: for OTF, REG and IDR environment, the version (an integer greater than 1)
9921002 verbose : bool, optional, default 'False'
9931003 flag to display information about the process
9941004
@@ -1005,53 +1015,69 @@ def __get_tile_catalogue_list(self, *, tile_index, product_type, verbose=False):
10051015 query = None
10061016
10071017 if product_type in conf .MOSAIC_PRODUCTS :
1018+ dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 , 'mosaic_product' )
1019+ extra_condition = '' if dsr_condition is None else f' AND { dsr_condition } '
1020+
10081021 query = (
10091022 f"SELECT DISTINCT mosaic_product.file_name, mosaic_product.mosaic_product_oid, "
10101023 f"mosaic_product.tile_index, mosaic_product.instrument_name, mosaic_product.filter_name, "
10111024 f"mosaic_product.category, mosaic_product.second_type, mosaic_product.ra, mosaic_product.dec, "
1012- f"mosaic_product.release_name, "
1013- f"mosaic_product.technique FROM sedm.mosaic_product WHERE mosaic_product.tile_index = '{ tile_index } ' "
1014- f"AND "
1015- f"mosaic_product.product_type = '{ product_type } ';" )
1025+ f"mosaic_product.release_name, mosaic_product.technique, mosaic_product.{ self .dsr_1 } , "
1026+ f"mosaic_product.{ self .dsr_2 } , mosaic_product.{ self .dsr_3 } FROM { schema } .mosaic_product "
1027+ f"WHERE mosaic_product.tile_index = '{ tile_index } ' "
1028+ f"AND mosaic_product.product_type = '{ product_type } ' { extra_condition } ;" )
1029+
1030+ elif product_type in conf .BASIC_DOWNLOAD_DATA_PRODUCTS :
1031+ dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 , 'basic_download_data' )
1032+ extra_condition = '' if dsr_condition is None else f' AND { dsr_condition } '
10161033
1017- if product_type in conf .BASIC_DOWNLOAD_DATA_PRODUCTS :
10181034 query = (
10191035 f"SELECT basic_download_data.basic_download_data_oid, basic_download_data.product_type, "
10201036 f"basic_download_data.product_id, CAST(basic_download_data.observation_id_list as text) AS "
10211037 f"observation_id_list, CAST(basic_download_data.tile_index_list as text) AS tile_index_list, "
10221038 f"CAST(basic_download_data.patch_id_list as text) AS patch_id_list, "
1023- f"CAST(basic_download_data.filter_name as text) AS filter_name, basic_download_data.release_name FROM "
1024- f"sedm.basic_download_data WHERE '{ tile_index } '=ANY(tile_index_list) AND product_type = '"
1025- f"{ product_type } ' "
1039+ f"CAST(basic_download_data.filter_name as text) AS filter_name, basic_download_data.release_name, "
1040+ f"basic_download_data.{ self .dsr_1 } , basic_download_data.{ self .dsr_2 } , "
1041+ f"basic_download_data.{ self .dsr_3 } FROM { schema } .basic_download_data "
1042+ f"WHERE '{ tile_index } '=ANY(tile_index_list) AND product_type = '{ product_type } ' { extra_condition } "
10261043 f"ORDER BY observation_id_list ASC;" )
10271044
1028- if product_type in conf .COMBINED_SPECTRA_PRODUCTS :
1045+ elif product_type in conf .COMBINED_SPECTRA_PRODUCTS :
1046+ dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 , 'combined_spectra' )
1047+ extra_condition = '' if dsr_condition is None else f' AND { dsr_condition } '
1048+
10291049 query = (
10301050 f"SELECT combined_spectra.combined_spectra_oid, combined_spectra.lambda_range, "
10311051 f"combined_spectra.tile_index, combined_spectra.stc_s, combined_spectra.product_type, "
1032- f"combined_spectra.product_id, combined_spectra.observation_id_list FROM sedm.combined_spectra "
1052+ f"combined_spectra.product_id, combined_spectra.observation_id_list, combined_spectra.{ self .dsr_1 } , "
1053+ f"combined_spectra.{ self .dsr_2 } , combined_spectra.{ self .dsr_3 } FROM { schema } .combined_spectra "
10331054 f"WHERE combined_spectra.tile_index = '{ tile_index } ' AND combined_spectra.product_type = '"
1034- f"{ product_type } ';" )
1055+ f"{ product_type } ' { extra_condition } ;" )
1056+
1057+ elif product_type in conf .MER_SEGMENTATION_MAP_PRODUCTS :
1058+ dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 , 'mer_segmentation_map' )
1059+ extra_condition = '' if dsr_condition is None else f' AND { dsr_condition } '
10351060
1036- if product_type in conf .MER_SEGMENTATION_MAP_PRODUCTS :
10371061 query = (
10381062 f"SELECT mer_segmentation_map.file_name, mer_segmentation_map.segmentation_map_oid, "
10391063 f"mer_segmentation_map.ra, mer_segmentation_map.dec, mer_segmentation_map.stc_s, "
10401064 f"mer_segmentation_map.tile_index, "
10411065 f"CAST(mer_segmentation_map.observation_id_list as TEXT) AS observation_id_list, "
1042- f"mer_segmentation_map.product_type, mer_segmentation_map.product_id FROM sedm.mer_segmentation_map "
1066+ f"mer_segmentation_map.product_type, mer_segmentation_map.product_id, "
1067+ f"mer_segmentation_map.{ self .dsr_1 } , mer_segmentation_map.{ self .dsr_2 } , "
1068+ f"mer_segmentation_map.{ self .dsr_3 } FROM { schema } .mer_segmentation_map "
10431069 f"WHERE mer_segmentation_map.tile_index = '{ tile_index } ' AND "
1044- f"mer_segmentation_map.product_type = '{ product_type } ';" )
1070+ f"mer_segmentation_map.product_type = '{ product_type } ' { extra_condition } ;" )
10451071
1046- if query is None :
1072+ else :
10471073 raise ValueError (f"Invalid product type { product_type } ." )
10481074
10491075 job = super ().launch_job (query = query , output_format = 'votable_plain' , verbose = verbose ,
10501076 format_with_results_compressed = ('votable_gzip' ,))
10511077 return job .get_results ()
10521078
1053- def get_product_list (self , * , observation_id = None , tile_index = None , product_type , dsr_part1 = None , dsr_part2 = None ,
1054- dsr_part3 = None , verbose = False ):
1079+ def get_product_list (self , * , observation_id = None , tile_index = None , product_type , schema = "sedm" , dsr_part1 = None ,
1080+ dsr_part2 = None , dsr_part3 = None , verbose = False ):
10551081 """
10561082 Get the list of products of a given EUCLID id searching by observation_id or tile_index.
10571083
@@ -1140,6 +1166,8 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
11401166 DpdSirCombinedSpectra: Combined Spectra Product \
11411167 - We suggest to use ADQL to retrieve data (spectra) from this dataset.
11421168 dpdSirScienceFrame: Science Frame Product
1169+ schema : str, optional
1170+ release name. Default value is 'sedm'.
11431171 dsr_part1: str, optional, default None
11441172 the data set release part 1: for OTF environment, the activity code; for REG and IDR, the target environment
11451173 dsr_part2: str, optional, default None
@@ -1164,11 +1192,12 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
11641192 raise ValueError (self .__ERROR_MSG_REQUESTED_OBSERVATION_ID + "; " + self .__ERROR_MSG_REQUESTED_TILE_ID )
11651193
11661194 if tile_index is not None :
1167- return self .__get_tile_catalogue_list (tile_index = tile_index , product_type = product_type , verbose = verbose )
1195+ return self .__get_tile_catalogue_list (tile_index = tile_index , product_type = product_type , schema = schema ,
1196+ verbose = verbose )
11681197
11691198 query = None
11701199 if product_type in conf .OBSERVATION_STACK_PRODUCTS :
1171- table = 'sedm .observation_stack'
1200+ table = f' { schema } .observation_stack'
11721201
11731202 dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 , 'observation_stack' )
11741203 extra_condition = '' if dsr_condition is None else f' AND { dsr_condition } '
@@ -1183,8 +1212,8 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
11831212 f" observation_stack.observation_id = '{ observation_id } ' AND observation_stack.product_type = '"
11841213 f"{ product_type } ' { extra_condition } ;" )
11851214
1186- if product_type in conf .BASIC_DOWNLOAD_DATA_PRODUCTS :
1187- table = 'sedm .basic_download_data'
1215+ elif product_type in conf .BASIC_DOWNLOAD_DATA_PRODUCTS :
1216+ table = f' { schema } .basic_download_data'
11881217
11891218 dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 ,
11901219 'basic_download_data' )
@@ -1202,8 +1231,8 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
12021231 f"{ product_type } ' { extra_condition } "
12031232 f"ORDER BY observation_id_list ASC;" )
12041233
1205- if product_type in conf .MER_SEGMENTATION_MAP_PRODUCTS :
1206- table = 'sedm .mer_segmentation_map'
1234+ elif product_type in conf .MER_SEGMENTATION_MAP_PRODUCTS :
1235+ table = f' { schema } .mer_segmentation_map'
12071236
12081237 dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 ,
12091238 'mer_segmentation_map' )
@@ -1221,8 +1250,8 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
12211250 f"like '%,{ observation_id } ' OR CAST(observation_id_list as TEXT) like '%,{ observation_id } ,%' ) AND "
12221251 f"mer_segmentation_map.product_type = '{ product_type } ' { extra_condition } ;" )
12231252
1224- if product_type in conf .RAW_FRAME_PRODUCTS :
1225- table = 'sedm .raw_frame'
1253+ elif product_type in conf .RAW_FRAME_PRODUCTS :
1254+ table = f' { schema } .raw_frame'
12261255
12271256 dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 , 'raw_frame' )
12281257 extra_condition = '' if dsr_condition is None else f'AND { dsr_condition } '
@@ -1242,8 +1271,8 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
12421271 f"raw_frame.observation_id = '{ observation_id } ' "
12431272 f"AND raw_frame.instrument_name = '{ instrument_name } ' { extra_condition } ;" )
12441273
1245- if product_type in conf .CALIBRATED_FRAME_PRODUCTS :
1246- table = 'sedm .calibrated_frame'
1274+ elif product_type in conf .CALIBRATED_FRAME_PRODUCTS :
1275+ table = f' { schema } .calibrated_frame'
12471276
12481277 dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 , 'calibrated_frame' )
12491278 extra_condition = '' if dsr_condition is None else f'AND { dsr_condition } '
@@ -1257,8 +1286,8 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
12571286 f"FROM { table } WHERE calibrated_frame.observation_id = '{ observation_id } ' AND "
12581287 f"calibrated_frame.product_type = '{ product_type } ' { extra_condition } ;" )
12591288
1260- if product_type in conf .FRAME_CATALOG_PRODUCTS :
1261- table = 'sedm .frame_catalog'
1289+ elif product_type in conf .FRAME_CATALOG_PRODUCTS :
1290+ table = f' { schema } .frame_catalog'
12621291
12631292 dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 , 'frame_catalog' )
12641293 extra_condition = '' if dsr_condition is None else f'AND { dsr_condition } '
@@ -1272,8 +1301,8 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
12721301 f"WHERE frame_catalog.observation_id = '{ observation_id } ' AND frame_catalog.product_type = '"
12731302 f"{ product_type } ' { extra_condition } ;" )
12741303
1275- if product_type in conf .COMBINED_SPECTRA_PRODUCTS :
1276- table = 'sedm .combined_spectra'
1304+ elif product_type in conf .COMBINED_SPECTRA_PRODUCTS :
1305+ table = f' { schema } .combined_spectra'
12771306
12781307 dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 , 'combined_spectra' )
12791308 extra_condition = '' if dsr_condition is None else f'AND { dsr_condition } '
@@ -1287,8 +1316,8 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
12871316 f"OR observation_id_list like '% { observation_id } %' ) AND "
12881317 f"combined_spectra.product_type = '{ product_type } ' { extra_condition } ;" )
12891318
1290- if product_type in conf .SIR_SCIENCE_FRAME_PRODUCTS :
1291- table = 'sedm .sir_science_frame'
1319+ elif product_type in conf .SIR_SCIENCE_FRAME_PRODUCTS :
1320+ table = f' { schema } .sir_science_frame'
12921321
12931322 dsr_condition = self .__get_data_set_release_by_env (dsr_part1 , dsr_part2 , dsr_part3 , 'sir_science_frame' )
12941323 extra_condition = '' if dsr_condition is None else f'AND { dsr_condition } '
@@ -1302,7 +1331,7 @@ def get_product_list(self, *, observation_id=None, tile_index=None, product_type
13021331 f"sir_science_frame.{ self .dsr_3 } FROM { table } WHERE sir_science_frame.observation_id = '"
13031332 f"{ observation_id } ' AND sir_science_frame.instrument_name = '{ instrument_name } ' { extra_condition } ;" )
13041333
1305- if query is None :
1334+ else :
13061335 raise ValueError (f"Invalid product type { product_type } ." )
13071336
13081337 job = super ().launch_job (query = query , output_format = 'votable_plain' , verbose = verbose ,
@@ -1720,8 +1749,8 @@ def get_valid_le3_configuration_values(self):
17201749 return job .get_results ()
17211750
17221751 def get_scientific_product_list (self , * , observation_id = None , tile_index = None , category = None , group = None ,
1723- product_type = None , dataset_release = 'REGREPROC1_R2' , dsr_part1 = None , dsr_part2 = None ,
1724- dsr_part3 = None , verbose = False ):
1752+ product_type = None , dataset_release = 'REGREPROC1_R2' , schema = "sedm" , dsr_part1 = None ,
1753+ dsr_part2 = None , dsr_part3 = None , verbose = False ):
17251754 """ Gets the LE3 products (the high-level science data products).
17261755
17271756 Please note that not all combinations of ``category``, ``group``, and ``product_type`` are valid. Use the
@@ -1741,6 +1770,8 @@ def get_scientific_product_list(self, *, observation_id=None, tile_index=None, c
17411770 Product type.
17421771 dataset_release : str, mandatory. Default REGREPROC1_R2
17431772 Data release from which the data should be retrieved.
1773+ schema : str, optional, default 'sedm'
1774+ the data release
17441775 dsr_part1: str, optional, default None
17451776 the data set release part 1: for OTF environment, the activity code; for REG and IDR, the target environment
17461777 dsr_part2: str, optional, default None
@@ -1817,7 +1848,7 @@ def get_scientific_product_list(self, *, observation_id=None, tile_index=None, c
18171848 quoted_products = ", " .join (f"'{ p } '" for p in valid_products )
18181849 conditions .append (f"product_type IN ({ quoted_products } )" )
18191850
1820- table = "sedm .level_3"
1851+ table = f" { schema } .level_3"
18211852 query = f" SELECT * FROM { table } WHERE { ' AND ' .join (conditions )} ORDER BY observation_id_list ASC "
18221853
18231854 job = super ().launch_job (query = query , output_format = 'csv' , verbose = verbose ,
0 commit comments