Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/getephemtable.py: 100%

27 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-01 07:19 +0000

1##################### generated by xml-casa (v2) from getephemtable.xml ############# 

2##################### ee42dc427cda73f59a313d88491d20a7 ############################## 

3from __future__ import absolute_import 

4import numpy 

5from casatools.typecheck import CasaValidator as _val_ctor 

6_pc = _val_ctor( ) 

7from casatools.coercetype import coerce as _coerce 

8from casatools.errors import create_error_string 

9from .private.task_getephemtable import getephemtable as _getephemtable_t 

10from casatasks.private.task_logging import start_log as _start_log 

11from casatasks.private.task_logging import end_log as _end_log 

12from casatasks.private.task_logging import except_log as _except_log 

13 

14class _getephemtable: 

15 """ 

16 getephemtable ---- Query the JPL-Horizons database for ephemeris data and create a CASA table 

17 

18  

19 This task retrieves the ephemeris data of a specific ephemeris object by sending 

20 a query to JPL's Horizons system and creates the ephemeris data stored in a CASA table 

21 format. 

22 

23 --------- parameter descriptions --------------------------------------------- 

24 

25 objectname Name of ephemeris object. The common name of major bodies such as 

26 planets known in CASA will be converted into the (NAIF/SPK) ID. If the parameter, asis 

27 is set to True, objectname is passed to the query as is to the JPL-Horizons system. 

28 If the object ID is used asis must be set to True. 

29  

30 Default: ''  

31  

32 Example:  

33 objectname='Titan' 

34 objectname='606' (should set asis=True in this case) 

35 asis A toggle for objectname check to be done or not before sending a query to the JPL-Horizons system.  

36 Default: False  

37  

38 As described in objectname parameter description, when asis=False, objectname is checked  

39 against the known objects (a list of the supported ephemeris sources in setjy task plus  

40 a few others) in CASA (See the getephemtable Description section in CASA Docs). 

41 Setting asis=True will skip this check/conversion thus objectname has to be uniquly  

42 recognized by the JPL-Horzions system. 

43 For example, objectname='Jupiter' with asis=True results in the JPL-Horizons system  

44 to return no ephemeris data as multiple objects matches with the name. 

45 timerange Time range of ephemeris data to be queried. 

46 Default: '' 

47  

48 Standard CASA timerange specification('T0~T1'),YY/MM/DD/hh:mm, 

49 or by Modified Julian date or Julian date if the string is prefixed by 'MJD' or 'JD'. 

50  

51 Example: 

52 timerange = '2023/09/01/20:45~2023/09/02/04:00' 

53 (Note: Both start and end times need to be fully specified starting with YYYY  

54 but hours or minutes can be omitted as long as the 

55 start and stop times are distinguishable. The omitted hours or minutes are translated as '00') 

56 timerange = 'MJD 60175.1~60176.1' 

57 interval Interval or step size of ephemeris data 

58 Default: '5m'  

59  

60 A string with integer value and unit (minutes, hours, days) or 

61 a string with integer value without unit (to produce equal time interval defined by 

62 timerange/interval). 

63 The unit can be given as the first few characters, e.g. 'm', 'min', 'h', or 'd'. 

64  

65 Note: The JPL-Horizons query allows the step size by calendar months or years however 

66 the task will not convert such data to the CASA table as Measures requires the ephemeris 

67 table data in equal time interval. When the calendar months or years is specified  

68 for interval, the task execution will result in a SEVERE error. The raw query results 

69 will be saved even such a case if rawdatafile parameter is specified. 

70  

71 Example: 

72  

73 interval='5min' 

74 interval='5minutes' 

75 interval='1h' 

76 interval='1d' 

77 outfile Output CASA table name 

78 Default: ''  

79  

80 Example:  

81 outfile = 'Titan_MJD60175.1-60176.1.tab' 

82 rawdatafile Name of raw ephemeris data file before converting into a CASA table (optional) 

83 Default: '' = No raw ephemeris data is saved  

84  

85 Useful for debugging when errors occured and/or no output table is produced. 

86  

87 Example: rawdatafile='Titan-jplhorizons.dat' 

88 overwrite If True, overwrite output files (outfile, rawdatafile), if already exist 

89 Default: False 

90 RETURNS void 

91 

92 --------- examples ----------------------------------------------------------- 

93 

94  

95 

96 

97 """ 

98 

99 _info_group_ = """import/export""" 

100 _info_desc_ = """Query the JPL-Horizons database for ephemeris data and create a CASA table""" 

101 

102 def __call__( self, objectname='', asis=False, timerange='', interval='5m', outfile='', rawdatafile='', overwrite=False ): 

103 schema = {'objectname': {'type': 'cStr', 'coerce': _coerce.to_str}, 'asis': {'type': 'cBool'}, 'timerange': {'type': 'cStr', 'coerce': _coerce.to_str}, 'interval': {'type': 'cStr', 'coerce': _coerce.to_str}, 'outfile': {'type': 'cPath', 'coerce': _coerce.expand_path}, 'rawdatafile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'overwrite': {'type': 'cBool'}} 

104 doc = {'objectname': objectname, 'asis': asis, 'timerange': timerange, 'interval': interval, 'outfile': outfile, 'rawdatafile': rawdatafile, 'overwrite': overwrite} 

105 assert _pc.validate(doc,schema), create_error_string(_pc.errors) 

106 _logging_state_ = _start_log( 'getephemtable', [ 'objectname=' + repr(_pc.document['objectname']), 'asis=' + repr(_pc.document['asis']), 'timerange=' + repr(_pc.document['timerange']), 'interval=' + repr(_pc.document['interval']), 'outfile=' + repr(_pc.document['outfile']), 'rawdatafile=' + repr(_pc.document['rawdatafile']), 'overwrite=' + repr(_pc.document['overwrite']) ] ) 

107 task_result = None 

108 try: 

109 task_result = _getephemtable_t( _pc.document['objectname'], _pc.document['asis'], _pc.document['timerange'], _pc.document['interval'], _pc.document['outfile'], _pc.document['rawdatafile'], _pc.document['overwrite'] ) 

110 except Exception as exc: 

111 _except_log('getephemtable', exc) 

112 raise 

113 finally: 

114 task_result = _end_log( _logging_state_, 'getephemtable', task_result ) 

115 return task_result 

116 

117getephemtable = _getephemtable( ) 

118