AHELP for CIAO 4.11

# coords_format

Context: contrib

## Synopsis

Convert between string and numeric formats for Astronomical positions.

## Syntax

```from coords.format import *
decd = dec2deg(decs)
decs = deg2dec(decd, fmt)

rad and decd are in decimal degrees, ras and decs are strings.
fmt is a string and can be one of: " ", "space", ":", "colon", and then
either "hms", "HMS", "hour" or "dms", "degree" for deg2ra() and
deg2dec() respectively

The Python help command - e.g. help(deg2ra) - can be used.```

## Description

The coords.format module contains 5 routines for converting between string and numeric formats for Astronomical positions.

The routines can be loaded into a Python session or script by saying:

```from coords.format import *
```

## Examples

### Example 1

```chips> from coords.format import *
chips> (ra, dec) = (101.28854, -16.71314)
chips> def doit1(fmt): print("Format={} ra={}".format(fmt,
deg2ra(ra,fmt)))
chips> for fmt in [" ", ":", "hms", "HMS", "hour"]: doit1(fmt)
Format= ra=6 45 9.2496
Format=: ra=6:45:9.2496
Format=hms ra=6h 45m 9.2496s
Format=HMS ra=6H 45M 9.2496S
Format=hour ra=6.75256933333h
chips> def doit2(fmt): print("Format={} dec={}".format(fmt,
deg2dec(dec,fmt)))
chips> for fmt in [" ", ":", "dms", "degree"]: doit2(fmt)
Format= dec=-16 42 47.304
Format=: dec=-16:42:47.304
Format=dms dec=-16d 42' 47.304"
Format=degree dec=-16.71314d```

The deg2ra() and deg2dec() routines are used to convert decimal values into strings, showing the various different formatting options.

### Example 2

```chips> print(ra2deg('6:45:9.2496'))
101.28854
chips> print(dec2deg('-16d 42\' 47.304"'))
-16.71314```

Here we convert a string value into a decimal position.

### Changes in the scripts 4.8.1 (December 2015) release

The code has been updated to avoid warning messages from NumPy version 1.9. There is no difference to how the script behaves.

### Changes in the scripts 4.5.5 (October 2013) release

The deg2dec routine now correctly handles small negative declinations; that is it now correctly converts the following

```chips> print(deg2dec(-0.00138888888889, ':'))
-0:0:5.0```

### Changes in the scripts 4.5.4 (August 2013) release

Documentation for the coords.format module is new in this release.