Convert WGS lat/long (� dec) to CH y
421797
public static function WGStoCHy($lat, $long)
    {

        // Converts decimal degrees sexagesimal seconds
        $lat = self::DECtoSEX($lat);
        $long = self::DECtoSEX($long);

        // Auxiliary values (% Bern)
        $lat_aux = ($lat - 169028.66) / 10000;
        $long_aux = ($long - 26782.5) / 10000;

        // Process Y
        $y = 600072.37
            + 211455.93 * $long_aux
            - 10938.51 * $long_aux * $lat_aux
            - 0.36 * $long_aux * pow($lat_aux, 2)
            - 44.54 * pow($long_aux, 3);

        return $y;
    }
316793
def convert(lat, lon):
    """"""

    x = numpy.cos(lon) * numpy.cos(lat)
    y = numpy.sin(lon) * numpy.cos(lat)
    z = numpy.sin(lat)

    # Invariable plane: values in arcseconds.
    epsilon = 5713.86
    omega = 387390.8

    coseps = numpy.cos(epsilon * secrad)
    sineps = numpy.sin(epsilon * secrad)
    cosom = numpy.cos(omega * secrad)
    sinom = numpy.sin(omega * secrad)

    xi = x * cosom + y * sinom
    yi = coseps * (-sinom * x + cosom * y) + sineps * z
    zi = - sineps * (-sinom * x + cosom * y) + coseps * z

    lat = numpy.arcsin(zi)
    lon = numpy.arctan2(yi, xi)
    return (lat, lon)
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
1264083
Double readLongitude(Columns columns) {
        Object value = columns.valueForField(longitude);
        return value == null ? null : readLongitude(value);
    }
353238
function (wgsLon, wgsLat) {
        if (this.outOfChina(wgsLat, wgsLon))
            return [wgsLon, wgsLat];

        var d = this.delta(wgsLat, wgsLon);
        return [wgsLon + d.lon, wgsLat + d.lat];
    }
935439
def rsdl_s(self, Yprev, Y):
        """"""

        return self.rho * self.cnst_AT(self.U)
653833
def to_ts(s):
        

        # Strip TZ portion if present
        m = Nginx.DATE_FMT.match(s)
        if m:
            s = m.group(1)
            delta = timedelta(seconds=int(m.group(3)) * (-1 if m.group(2) == '-' else 1)) # Offset from GMT
        else:
            delta = timedelta(seconds=0)
        dt = datetime.strptime(s, "%d/%b/%Y:%H:%M:%S")
        dt += delta
        return dt.strftime('%Y-%m-%dT%H:%M:%SZ')
460002
def date_to_long_form_string(dt, locale_ = 'en_US.utf8'):
    ''''''
    if locale_:
        old_locale = locale.getlocale()
        locale.setlocale(locale.LC_ALL, locale_)
    v = dt.strftime("%A %B %d %Y")
    if locale_:
        locale.setlocale(locale.LC_ALL, old_locale)
    return v
65721
def swap_lat_lon(coordinates)
      coordinates.map { |polygon| polygon.map { |x, y| [y, x] } }
    end
202031
def parse_location(location):
    
    def split_dms(text, hemisphere):
        """Split degrees, minutes and seconds string.

        Args:
            text (str): Text to split

        Returns::
            float: Decimal degrees
        """
        out = []
        sect = []
        for i in text:
            if i.isdigit():
                sect.append(i)
            else:
                out.append(sect)
                sect = []
        d, m, s = [float(''.join(i)) for i in out]
        if hemisphere in 'SW':
            d, m, s = [-1 * x for x in (d, m, s)]
        return to_dd(d, m, s)

    for sep in ';, ':
        chunks = location.split(sep)
        if len(chunks) == 2:
            if chunks[0].endswith('N'):
                latitude = float(chunks[0][:-1])
            elif chunks[0].endswith('S'):
                latitude = -1 * float(chunks[0][:-1])
            else:
                latitude = float(chunks[0])
            if chunks[1].endswith('E'):
                longitude = float(chunks[1][:-1])
            elif chunks[1].endswith('W'):
                longitude = -1 * float(chunks[1][:-1])
            else:
                longitude = float(chunks[1])
            return latitude, longitude
        elif len(chunks) == 4:
            if chunks[0].endswith(('s', '"')):
                latitude = split_dms(chunks[0], chunks[1])
            else:
                latitude = float(chunks[0])
                if chunks[1] == 'S':
                    latitude = -1 * latitude
            if chunks[2].endswith(('s', '"')):
                longitude = split_dms(chunks[2], chunks[3])
            else:
                longitude = float(chunks[2])
                if chunks[3] == 'W':
                    longitude = -1 * longitude
            return latitude, longitude
576680
public double toScreenY(double y)
    {
        Point2D src = srcPnt.get();
        Point2D dst = dstPnt.get();
        src.setLocation(0, y);
        combinedTransform.transform(src, dst);
        return dst.getY();
    }
355226
def get_dec(self):
        

        try:

            return self.dec.value

        except AttributeError:

            # Transform from L,B to R.A., Dec

            return self.sky_coord.transform_to('icrs').dec.value
4764
def to_jd(year, month, day):
    ''''''
    return (day + ceil(29.5 * (month - 1)) + (year - 1) * 354 + trunc((3 + (11 * year)) / 30) + EPOCH) - 1
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
173938
def standardize(Y,in_place=False):
    
    if in_place:
        YY = Y
    else:
        YY = Y.copy()
    for i in range(YY.shape[1]):
        Iok = ~SP.isnan(YY[:,i])
        Ym = YY[Iok,i].mean()
        YY[:,i]-=Ym
        Ys = YY[Iok,i].std()
        YY[:,i]/=Ys
    return YY
1083191
def _format_lat(self, lat):
        '''  '''
        if self.ppd in [4, 16, 64, 128]:
            return None
        else:
            if lat < 0:
                return map(lambda x: "{0:0>2}"
                           .format(int(np.abs(x))) + 'S', self._map_center('lat', lat))
            else:
                return map(lambda x: "{0:0>2}"
                           .format(int(x)) + 'N', self._map_center('lat', lat))
776680
def bd09togcj02(bd_lon, bd_lat):
    
    x = bd_lon - 0.0065
    y = bd_lat - 0.006
    z = math.sqrt(x * x + y * y) - 0.00002 * math.sin(y * x_pi)
    theta = math.atan2(y, x) - 0.000003 * math.cos(x * x_pi)
    gg_lng = z * math.cos(theta)
    gg_lat = z * math.sin(theta)
    return [gg_lng, gg_lat]