### 6.31. `CBCData.degMinAdd()`

: Lat/long
arithmetic

pycbc.py

# - - - C B C D a t a . d e g M i n A d d
def degMinAdd(self, ddmm, plusMinutes):
'''Arithmetic on 'ddmm' and 'dddmm' quantities.
[ (ddmm is a string of four or five digits such that
the last two are minutes and the rest are degrees) and
(plusMinutes is an int) ->
return a string of the form "dddmm" representing
ddmm + plusMinutes as degrees and minutes
'''

This function is used by Section 6.30, “`CBCData.overlappers()`

: Find
overlapping circles” to compute the range of latitudes and longitudes that are
within a given distance of a circle's center.

pycbc.py

#-- 1 --
# [ dd := degrees part of ddmm as an int
# mm := minutes part of ddmm as an int ]
dd = int(ddmm[:-2])
mm = int(ddmm[-2:])
#-- 2 --
# [ minutes := sum of dd degrees, mm minutes, and plusMinutes ]
minutes = dd*60 + mm + plusMinutes
#-- 3 --
# [ return minutes as degrees and minutes in "dddmm" form ]
ddNew, mmNew = divmod(minutes, 60)
return "%03d%02d" % (ddNew, mmNew)