Format coordinates.
347213
def deg2fmt(ra_deg, dec_deg, format):
    """"""

    rhr, rmn, rsec = degToHms(ra_deg)
    dsgn, ddeg, dmn, dsec = degToDms(dec_deg)

    if format == 'hms':
        return rhr, rmn, rsec, dsgn, ddeg, dmn, dsec

    elif format == 'str':
        #ra_txt = '%02d:%02d:%06.3f' % (rhr, rmn, rsec)
        ra_txt = '%d:%02d:%06.3f' % (rhr, rmn, rsec)
        if dsgn < 0:
            dsgn = '-'
        else:
            dsgn = '+'
        #dec_txt = '%s%02d:%02d:%05.2f' % (dsgn, ddeg, dmn, dsec)
        dec_txt = '%s%d:%02d:%05.2f' % (dsgn, ddeg, dmn, dsec)
        return ra_txt, dec_txt
1342620
def _convert_point(cls, feature):
        """"""
        lon, lat = feature['geometry']['coordinates']
        popup = feature['properties'].get('name', '')
        return cls(lat, lon)
1143289
def _format_name_map(self, lon, lat):
        '''  '''

        if self.ppd in [4, 16, 64, 128]:
            lolaname = '_'.join(['LDEM', str(self.ppd)])
        elif self.ppd in [512]:
            lolaname = '_'.join(
                ['LDEM', str(self.ppd), lat[0], lat[1], lon[0], lon[1]])
        return lolaname
97983
def format_data(data):
    
    if data is None:
        return None
    return u":".join([u"{:02x}".format(ord(c)) for c in data])
316177
def coordinates_inside_data(
        self,
        x,
        y
        ):

        

        return (self.min_x <= x < self.max_x) and (self.min_y <= y < self.max_y)
34934
def coordinates(self, x, y, **kwargs):
        ''''''
        kwargs['returntype'] = 'geographies'
        fields = {
            'x': x,
            'y': y
        }

        return self._fetch('coordinates', fields, **kwargs)
453738
def format_location(ctx, text):
    
    text = conversions.to_string(text, ctx)
    return text.split(">")[-1].strip()
728556
def make_coord_dict(coord):
    """"""
    return dict(
        z=int_if_exact(coord.zoom),
        x=int_if_exact(coord.column),
        y=int_if_exact(coord.row),
    )
67602
def _expand_coord(self, lat, lon, lmax_calc, degrees):
        """"""
        if self.normalization == '4pi':
            norm = 1
        elif self.normalization == 'schmidt':
            norm = 2
        elif self.normalization == 'unnorm':
            norm = 3
        elif self.normalization == 'ortho':
            norm = 4
        else:
            raise ValueError(
                "Normalization must be '4pi', 'ortho', 'schmidt', or " +
                "'unnorm'. Input value was {:s}"
                .format(repr(self.normalization)))

        if degrees is True:
            latin = lat
            lonin = lon
        else:
            latin = _np.rad2deg(lat)
            lonin = _np.rad2deg(lon)

        if type(lat) is not type(lon):
            raise ValueError('lat and lon must be of the same type. ' +
                             'Input types are {:s} and {:s}'
                             .format(repr(type(lat)), repr(type(lon))))

        if type(lat) is int or type(lat) is float or type(lat) is _np.float_:
            return _shtools.MakeGridPoint(self.coeffs, lat=latin, lon=lonin,
                                          lmax=lmax_calc, norm=norm,
                                          csphase=self.csphase)
        elif type(lat) is _np.ndarray:
            values = _np.empty_like(lat, dtype=float)
            for v, latitude, longitude in _np.nditer([values, latin, lonin],
                                                     op_flags=['readwrite']):
                v[...] = _shtools.MakeGridPoint(self.coeffs, lat=latitude,
                                                lon=longitude,
                                                lmax=lmax_calc, norm=norm,
                                                csphase=self.csphase)
            return values
        elif type(lat) is list:
            values = []
            for latitude, longitude in zip(latin, lonin):
                values.append(
                    _shtools.MakeGridPoint(self.coeffs, lat=latitude,
                                           lon=longitude,
                                           lmax=lmax_calc, norm=norm,
                                           csphase=self.csphase))
            return values
        else:
            raise ValueError('lat and lon must be either an int, float, ' +
                             'ndarray, or list. ' +
                             'Input types are {:s} and {:s}'
                             .format(repr(type(lat)), repr(type(lon))))
1183047
def format_value(self, value, padding):
        """"""

        # padding = padding - 1 if value < 0 and padding > 0 else padding
        # prefix = '-' if value < 0 else ''

        if padding:
            return "{:0{pad}d}".format(value, pad=padding)

        else:
            return str(value)
941549
def lat_to_deg(lat):
    """"""
    if isinstance(lat, str) and (':' in lat):
        # TODO: handle other coordinate systems
        lat_deg = dmsStrToDeg(lat)
    else:
        lat_deg = float(lat)
    return lat_deg
165206
def encode(self):
        """"""
        return '{:.6f} {:.6f} {:.6f} {:.6f} {:.6f} {:.6f}'.format(
            self.a, self.b, self.c, self.d, self.e, self.f
        ).encode()
1172156
private static String formatWaypointTargets(Point[] waypointTargets) {
    String[] coordinatesFormatted = new String[waypointTargets.length];
    int index = 0;
    for (Point target : waypointTargets) {
      if (target == null) {
        coordinatesFormatted[index++] = "";
      } else {
        coordinatesFormatted[index++] = String.format(Locale.US, "%s,%s",
          TextUtils.formatCoordinate(target.longitude()),
          TextUtils.formatCoordinate(target.latitude()));
      }
    }
    return TextUtils.join(";", coordinatesFormatted);
  }
146775
def convert_coordinates(self):
        
        coord_list_str = regex_coordinate.findall(self.reg_str) + regex_length.findall(self.reg_str)
        coord_list = []

        if self.region_type == 'poly':
            if len(coord_list_str) < 4:
                self._raise_error('Not in proper format: {} polygon should have > 4 coordinates'.format(self.reg_str))
            if coord_list_str[0] != coord_list_str[-1]:
                self._raise_error("Not in proper format: '{0}', "
                                  "In polygon, the last and first coordinates should be same".format(self.reg_str))
        else:
            if len(coord_list_str) != len(self.language_spec[self.region_type]):
                self._raise_error("Not in proper format: '{0}', "
                                  "Does not contain expected number of parameters for the region '{1}'"
                                  .format(self.reg_str, self.region_type))

        for attr_spec, val_str in zip(self.language_spec[self.region_type], coord_list_str):

            if attr_spec == 'c':
                if len(val_str) == 2 and val_str[1] != '':
                    coord_list.append(CoordinateParser.parse_coordinate(val_str[0]))
                    coord_list.append(CoordinateParser.parse_coordinate(val_str[1]))
                else:
                    self._raise_error("Not in proper format: {0} should be a coordinate".format(val_str))
            if attr_spec == 'pl':
                if len(val_str) == 2 and val_str[1] != '':
                    coord_list.append(CoordinateParser.parse_angular_length_quantity(val_str[0]))
                    coord_list.append(CoordinateParser.parse_angular_length_quantity(val_str[1]))
                else:
                    self._raise_error("Not in proper format: {0} should be a pair of length".format(val_str))
            if attr_spec == 'l':
                if isinstance(val_str, six.string_types):
                    coord_list.append(CoordinateParser.parse_angular_length_quantity(val_str))
                else:
                    self._raise_error("Not in proper format: {0} should be a single length".format(val_str))
            if attr_spec == 's':
                if self.region_type == 'symbol':
                    if val_str in valid_symbols:
                        self.meta['symbol'] = val_str
                    else:
                        self._raise_error("Not in proper format: '{0}' should be a symbol".format(val_str))
                elif self.region_type == 'text':
                    self.meta['text'] = val_str[1:-1]

        self.coord = coord_list
269713
def get_coordinates(self, i, end=False):
        """"""
        if end:
            endpoint = self.endpoints[i][1]
        else:
            endpoint = self.endpoints[i][0]
        return (endpoint.real, endpoint.imag)
376421
def __format(self, x, type='x'):
        
        fmt, v = '%1.5g','%1.5g'
        if type == 'y':
            ax = self.axes.yaxis
        elif type == 'y2' and len(self.fig.get_axes()) > 1:
            ax =  self.fig.get_axes()[1].yaxis
        else:
            ax = self.axes.xaxis

        try:
            dtick = 0.1 * ax.get_view_interval().span()
        except:
            dtick = 0.2
        try:
            ticks = ax.get_major_locator()()
            dtick = abs(ticks[1] - ticks[0])
        except:
            pass
        if dtick > 89999:
            fmt, v = ('%.1e',  '%1.6g')
        elif dtick > 1.99:
            fmt, v = ('%1.0f', '%1.2f')
        elif dtick > 0.099:
            fmt, v = ('%1.1f', '%1.3f')
        elif dtick > 0.0099:
            fmt, v = ('%1.2f', '%1.4f')
        elif dtick > 0.00099:
            fmt, v = ('%1.3f', '%1.5f')
        elif dtick > 0.000099:
            fmt, v = ('%1.4f', '%1.6e')
        elif dtick > 0.0000099:
            fmt, v = ('%1.5f', '%1.6e')

        s =  fmt % x
        s.strip()
        s = s.replace('+', '')
        while s.find('e0')>0:
            s = s.replace('e0','e')
        while s.find('-0')>0:
            s = s.replace('-0','-')
        if type == 'y':
            self._yfmt = v
        if type == 'y2':
            self._y2fmt = v
        if type == 'x':
            self._xfmt = v
        return s
634396
def coords_string_parser(self, coords):
        """"""

        lat, lon = coords.split(',')
        return {"lat": lat.strip(), "lon": lon.strip(), "bounds": {}}