17
17
__license__ = 'MIT License'
18
18
__description__ = 'Script used to search, order and download imagery from ' \
19
19
'the EODMS using the REST API (RAPI) service.'
20
- __version__ = '3.6.0 '
20
+ __version__ = '3.6.1 '
21
21
__maintainer__ = 'Kevin Ballantyne'
22
22
__email__ = 'eodms-sgdot@nrcan-rncan.gc.ca'
23
23
@@ -911,8 +911,9 @@ def ask_record_ids(self, ids, single_coll=False):
911
911
f"RCMImageProducts:7625368|25654750" \
912
912
f",NAPL:3736869{ self .eod .reset_colour } )\n "
913
913
if single_coll :
914
- msg = "\n Enter a single or set of Record IDs with the " \
915
- f"(Ex: { self .eod .var_colour } " \
914
+ msg = f"\n Enter a single or set of Record IDs with the " \
915
+ f"Collection ID at the start of IDs separated by a " \
916
+ f"pipe (Ex: { self .eod .var_colour } " \
916
917
f"RCMImageProducts:7625368|25654750" \
917
918
f"{ self .eod .reset_colour } )\n "
918
919
ids = self .get_input (msg , required = False )
@@ -928,7 +929,43 @@ def ask_record_ids(self, ids, single_coll=False):
928
929
929
930
return ids
930
931
931
- def ask_st (self , record_ids ):
932
+ def ask_st_images (self , ids ):
933
+
934
+ """
935
+ Asks the user for Record IDs or Order Keys for SAR Toolbox orders.
936
+
937
+ :param ids: A single or set of Record IDs with their collections.
938
+ :type ids: str
939
+ """
940
+
941
+ if ids is None or ids == '' :
942
+
943
+ if not self .eod .silent :
944
+ self .print_header ("Enter Record Id(s) or Order Key(s)" )
945
+
946
+ msg = f"\n Enter a single or set of Record IDs or enter a " \
947
+ f"single or set of Order Keys separated by a pipe. " \
948
+ f"Include the Collection Id at the beginning of the set." \
949
+ f" (Ex: { self .eod .var_colour } " \
950
+ f"RCMImageProducts:7625368|25654750" \
951
+ f"{ self .eod .reset_colour } or { self .eod .var_colour } " \
952
+ f"RCMImageProducts:RCM2_OK1373330_PK1530425_1_16M12_" \
953
+ f"20210326_111202_HH_HV_GRD|RCM2_OK1373330_PK1524695_1_" \
954
+ f"16M17_20210321_225956_HH_HV_GRD{ self .eod .reset_colour } )\n "
955
+ ids = self .get_input (msg , required = False )
956
+
957
+ process = self .eod .validate_st_images (ids )
958
+
959
+ if not process :
960
+ err_msg = "Invalid entry for the Record Ids or Order Keys."
961
+ # self.eod.print_support(True, err_msg)
962
+ self .eod .print_msg (err_msg , heading = 'error' )
963
+ self .logger .error (err_msg )
964
+ self .eod .exit_cli (1 )
965
+
966
+ return ids
967
+
968
+ def ask_st (self ):
932
969
"""
933
970
Ask user for all SAR Toolbox information
934
971
"""
@@ -960,7 +997,7 @@ def ask_param(param):
960
997
if param .get_value ():
961
998
sub_params = param .get_sub_param ()
962
999
# print(f"param.get_value(): {param.get_value()}")
963
- if param .data_type == bool and not param .get_value ():
1000
+ if param .data_type == ' bool' and param .get_value () == 'False' :
964
1001
return None
965
1002
if sub_params :
966
1003
for s_param in sub_params :
@@ -1025,7 +1062,7 @@ def ask_item(item_name, item_list, item_type='runner', multiple=False,
1025
1062
1026
1063
self .print_header ("Enter SAR Toolbox Information" )
1027
1064
1028
- st = sar .SARToolbox (self .eod , record_ids )
1065
+ st = sar .SARToolbox (self .eod )
1029
1066
1030
1067
###############################
1031
1068
# Set the category
@@ -1698,10 +1735,11 @@ def prompt(self):
1698
1735
sar_tb = sar .SARToolbox (self .eod , out_fn = st_request )
1699
1736
sar_tb .ingest_request ()
1700
1737
else :
1701
- inputs = self .ask_record_ids (input_val , True )
1738
+ inputs = self .ask_st_images (input_val )
1702
1739
self .params ['input_val' ] = inputs
1703
1740
1704
- sar_tb = self .ask_st (self .params ['input_val' ])
1741
+ # sar_tb = self.ask_st(self.params['input_val'])
1742
+ sar_tb = self .ask_st ()
1705
1743
1706
1744
self .params ['st_request' ] = sar_tb .out_fn
1707
1745
@@ -1713,7 +1751,7 @@ def prompt(self):
1713
1751
self .print_syntax ()
1714
1752
1715
1753
# Run the order_csv process
1716
- self .eod .order_st (sar_tb , priority )
1754
+ self .eod .order_st (sar_tb , self . params )
1717
1755
1718
1756
else :
1719
1757
# self.eod.print_support("That is not a valid process type.")
0 commit comments