Montage (and a lot of other software) find it hard to work with WCS information that are not connected to the first two axes in a datacube. Rather than over-complicate all the cube-related software we have opted for having this utility for transposing the data. The default for the program is to examine the cube and rearrange the data so the first two axes represent sky longitude and latitude but the user can optionally specify the order of the rearrangement themselves (this also allows transforming reprojected cubes back into the original order for use by other programs).
mTranspose [-d level] [-s statusfile] incube.fits outcube.fits [outaxis1 outaxis2 [outaxi3 [outaxis4]]]


-d level
Turns on debugging to the specified level (1-3).
-s statusfile
mTranspose output and errors will be written to statusfile instead of stdout.


Input FITS cube (3 or 4 dimensions).
Output FITS cube.
outaxis1 ... outaxis4
The input axis numbers (1,2,3,4) in output order.
mTranspose rearranges the data value so the axes are in a different order. As much as possible, the FITS header keywords are renamed accordingly but as it is not alway possible to identify which parameters have axis "subscripts" it may be necessary to manually modify the headera(e.g., using mGetHdr / mPutHdr) after the fact.
$ mTranspose in.fits out.fits 3 2 1 4
[struct stat="OK", mindata=2234.5, maxdata=10234.4]

Return Codes:

  • [struct stat = "OK", mindata=value, maxdata=value]
  • [struct stat="ERROR", msg="Usage: mTranspose [-d level] [-s statusfile] in.fits out.fits [outaxis1 outaxis2 [outaxis3 [outaxis4]]]"]
  • [struct stat="ERROR", msg="No status file name given"]
  • [struct stat="ERROR", msg="Cannot open status file: filename"]
  • [struct stat="ERROR", msg="No debug level given"]
  • [struct stat="ERROR", msg="Debug level string is invalid: 'string'"]
  • [struct stat="ERROR", msg="Debug level value cannot be negative"]
  • [struct stat="ERROR", msg="Invalid input file 'string'"]
  • [struct stat="ERROR", msg="Invalid output file 'string'"]
  • [struct stat="ERROR", msg="Axis ID 1 cannot be interpreted as an integer."]
  • [struct stat="ERROR", msg="Axis ID 2 cannot be interpreted as an integer."]
  • [struct stat="ERROR", msg="Axis ID 3 cannot be interpreted as an integer."]
  • [struct stat="ERROR", msg="Axis ID 4 cannot be interpreted as an integer."]
  • [struct stat="ERROR", status=stat, msg="FITS library error"]
  • [struct stat="ERROR", msg="general error message"]