strDate2MJD

Return to directory of Todd's CASA extensions

Converts a date in string format ("20110809" or "2011x08x09") to MJD, where 'x' can be any non-numeric character, like '-' or '/'. An additional UT time (in HH[:MM:SS] format) is optional. See also dateStringToMJD and dateStringToMJDSec.

Usage:

au.strDate2MJD(d, use_metool=True)
  • use_metool: if set to True (default), it will use the measures tool in casapy, otherwise it will use a canned formula to convert to MJD.

Example:

CASA <4>: au.strDate2MJD('2013/06/27')
  Out[4]: 56470.0
CASA <11>: au.strDate2MJD('20120801 12:13:14')
  Out[11]: 56140.509189814817

-- ToddHunter - 2013-06-27
Topic revision: r2 - 2013-07-29, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback