Return lat/lon as strings.
557618
def strings(self):
        
        return [
            toString(self.lat, LAT),
            toString(self.lon, LON)
        ]
674477
def get_longs():
  
  longs = {}
  fname = pkg_resources.resource_filename(__name__, 'resources/Latitudes-Longitudes.csv')
  with open(fname, 'rb') as csvfile:
    # Read latitude/longitude coordinates
    reader = csv.reader(csvfile, delimiter = ',')
    for row in reader:
      word = row[0].lower()
      word = re.sub(' ', '', word)
      longs[word] = float(row[2])
  return longs
108732
def encode(lonlat, length=12):
  """"""
  assert len(lonlat) == 2, "Invalid lon/lat: %s"%lonlat
  # Half the length for each component.
  length /= 2
  lon = _float_to_bits(lonlat[0], lower=-180.0, upper=180.0, length=length*5)
  lat = _float_to_bits(lonlat[1], lower=-90.0, upper=90.0, length=length*5)
  # Zip the GeoHash bits.
  ret = []
  for a,b in zip(lon,lat):
    ret.append(a)
    ret.append(b)
  return _bits_to_geohash(ret)
775148
def toString(self):
        
        slist = self.toList()
        string = angle.slistStr(slist)
        return string if slist[0] == '-' else string[1:]
929028
def _make_area_from_coords(self, coords):
        """"""
        if len(coords) == 2:
            lon_sn = coords[0].attrs.get('standard_name')
            lat_sn = coords[1].attrs.get('standard_name')
            if lon_sn == 'longitude' and lat_sn == 'latitude':
                key = None
                try:
                    key = (coords[0].data.name, coords[1].data.name)
                    sdef = self.coords_cache.get(key)
                except AttributeError:
                    sdef = None
                if sdef is None:
                    sdef = SwathDefinition(*coords)
                    if key is not None:
                        self.coords_cache[key] = sdef
                sensor_str = '_'.join(self.info['sensors'])
                shape_str = '_'.join(map(str, coords[0].shape))
                sdef.name = "{}_{}_{}_{}".format(sensor_str, shape_str,
                                                 coords[0].attrs['name'],
                                                 coords[1].attrs['name'])
                return sdef
            else:
                raise ValueError(
                    'Coordinates info object missing standard_name key: ' +
                    str(coords))
        elif len(coords) != 0:
            raise NameError("Don't know what to do with coordinates " + str(
                coords))
315236
def latlong(text):
    '''
    
    '''
    nlat, nlon = text.split(',')
    return (float(nlat), float(nlon))
1283456
def main(lat, lon, loc):
    """"""
    writer = get_writer()

    try:
        if (not lat or not lon) and (not loc):
            raise IncorrectParametersException('Please specify a latitude, longitude, or location'
                                               'Example: wilos --lat=19.8968 --lon=155.5828 --loc="hawaii"')
        if lat is not None and long is not None:
            get_live_weather(lat, lon, writer)
        elif loc is not None:
            loc_data = get_coordinates(loc)
            writer.title(loc_data['address'])
            get_live_weather(loc_data['coordinates']['lat'],
                             loc_data['coordinates']['lng'],
                             writer)

    except IncorrectParametersException as e:
        click.secho(e.message, fg="red", bold=True)
660767
def longitude(self):
        ''''''
        sd = dm_to_sd(self.lon)
        if self.lon_dir == 'E':
            return +sd
        elif self.lon_dir == 'W':
            return -sd
        else:
            return 0.
198491
def geosgeometry_str_to_struct(value):
    '''
    
    '''

    result = geos_ptrn.match(value)

    if not result:
        return None

    return {
        'srid': result.group(1),
        'x': result.group(2),
        'y': result.group(3),
    }
438512
def obtain_to(filename):
    
    root, _ = nc.open(filename)
    lat, lon = nc.getvar(root, 'lat')[0,:], nc.getvar(root, 'lon')[0,:]
    nc.close(root)
    return obtain(lat, lon)
835515
def mapping_to_str(mapping):
    """"""
    result = ["<"]
    for i, (key, value) in enumerate(mapping.items()):
        if i > 0:
            result.append(",")
        result += [key, "=", serialize_for_header(key, value)]
    result += [">"]
    return "".join(result)
976212
function() {
		if (!this.elLat) return {};
		return {
			lat : parseFloat(this.elLat.value),
			lon : parseFloat(this.elLon.value),
			uzoom : parseInt(this.elUZoom.value),
			nzoom : parseInt(this.elNZoom.value)
		};
	}
242529
def split_coords_2d(seq):
    
    lons, lats = [], []
    for i, el in enumerate(seq):
        if i % 2 == 0:
            lons.append(valid.longitude(el))
        elif i % 2 == 1:
            lats.append(valid.latitude(el))
    return list(zip(lons, lats))
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))))
745899
def as_strings(self):
        """"""
        if self.value == '' or self.value is None:
            return '{0};\n'.format(self.name)
        if '"' not in self.value and (';' in self.value or '#' in self.value):
            return '{0} "{1}";\n'.format(self.name, self.value)
        return '{0} {1};\n'.format(self.name, self.value)
913204
def extract_geo(self):
        '''
        
        '''
        altitude = self.extract_altitude()
        dop = self.extract_dop()
        lon, lat = self.extract_lon_lat()
        d = {}
        if lon is not None and lat is not None:
            d['latitude'] = lat
            d['longitude'] = lon
        if altitude is not None:
            d['altitude'] = altitude
        if dop is not None:
            d['dop'] = dop
        return d
562636
function parse_lat_lon(obj, lat_field, lon_field) {
  if ([lat_field, lon_field].every(_.has.bind(null, obj))) {
    return { latitude: obj[lat_field], longitude: obj[lon_field] };
  }
}