Returns layer depth at lat / lon (degrees)
    where lat/lon may be arrays (of equal size).
    Depths are returned in metres.
493116
def layer_depth( lat, lon, layerID="LID-BOTTOM"):
    

    ## Must wrap longitude from 0 to 360 ...

    lon1 = np.array(lon)%360.0
    lat1 = np.array(lat)

    # ## Must wrap longitude from -180 to 180 ...
    #
    # lon1[np.where(lon1 > 180.0)] = 360.0 - lon1[np.where(lon1 > 180.0)]
    #
    data, err = _interpolator.interpolate( np.radians(lon1), np.radians(lat1),
                                      _litho_data[l1_layer_decode[layerID], l1_data_decode["DEPTH"]], order=1 )

    return data
1083829
def extract(filename, doy, latitude, longitude, depth):
    
    assert np.size(doy) == 1
    assert np.size(latitude) == 1
    assert np.size(longitude) == 1
    assert np.size(depth) == 1

    assert (longitude >= 0) & (longitude <= 360)
    assert depth >= 0

    nc = netCDF4.Dataset(filename)

    t = 2 * np.pi * doy/366

    Z = np.absolute(nc['depth'][:] - depth).argmin()
    I = np.absolute(nc['lat'][:] - latitude).argmin()
    J = np.absolute(nc['lon'][:] - longitude).argmin()

    # Naive solution
    value = nc['mean'][:, I, J]
    value[:64] += nc['an_cos'][Z, I, J] * np.cos(t) + \
            nc['an_sin'][:, I, J] * np.sin(t)
    value[:55] += nc['sa_cos'][Z, I, J] * np.cos(2*t) + \
            nc['sa_sin'][:, I, J] * np.sin(2*t)
    value = value[Z]

    std = nc['std_dev'][Z, I, J]

    return value, std
943730
private int getUTMZone(final double lat, final double lon) {

		int zone = Double.valueOf(Math.floor((lon + 180.0) / 6.0)).intValue() + 1;

		if (lat >= 56.0 && lat < 64.0 && lon >= 3.0 && lon < 12.0) {
			zone = 32;
		}

		if (lat >= 72.0 && lat < 84.0) {
			if (lon >= 0.0 && lon < 9.0) {
				zone = 31;
			}

		} else if (lon >= 9.0 && lon < 21.0) {
			zone = 33;

		} else if (lon >= 21.0 && lon < 33.0) {

			zone = 35;

		} else if (lon >= 33.0 && lon < 42.0) {
			zone = 37;
		}

		return zone;
	}
564172
def eqCoords(self, zerolat=False):
        
        lat = 0.0 if zerolat else self.lat
        return utils.eqCoords(self.lon, lat)
1359568
def get_lats():
  
  lats = {}
  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)
      lats[word] = float(row[1])

  return lats
1028527
def compute_depth(self):
        
        left_depth = self.left_node.compute_depth() if self.left_node else 0
        right_depth = self.right_node.compute_depth() if self.right_node else 0
        return 1 + max(left_depth, right_depth)
948212
def get_top_edge_depth(self):
        
        areas = self._get_areas()
        depths = numpy.array(
            [surf.get_top_edge_depth() for surf in self.surfaces])
        return numpy.sum(areas * depths) / numpy.sum(areas)
572333
def lon_lat(value):
    
    lon, lat = value.split()
    return longitude(lon), latitude(lat)
773836
public int depth() {
        if (isLeaf())
            return 1;
        return 1 + max(max(northWest.depth(), northEast.depth()), max(southWest.depth(), southEast.depth()));
    }
106372
def getCoords(self):
        '''
        
        '''

        if DEBUG_COORDS:
            print >>sys.stderr, "getCoords(%s %s ## %s)" % (self.getClass(), self.getId(), self.getUniqueId())

        (x, y) = self.getXY();
        w = self.getWidth()
        h = self.getHeight()
        return ((x, y), (x+w, y+h))
752090
def full_distance(latitude, longitude, lat_attr, lon_attr, options = {})
      units = options[:units] || Geocoder.config.units
      earth = Geocoder::Calculations.earth_radius(units)

      "#{earth} * 2 * ASIN(SQRT(" +
        "POWER(SIN((#{latitude.to_f} - #{lat_attr}) * PI() / 180 / 2), 2) + " +
        "COS(#{latitude.to_f} * PI() / 180) * COS(#{lat_attr} * PI() / 180) * " +
        "POWER(SIN((#{longitude.to_f} - #{lon_attr}) * PI() / 180 / 2), 2)" +
      "))"
    end
955657
def get_mesh(sitecol, complete=True):
    
    sc = sitecol.complete if complete else sitecol
    if sc.at_sea_level():
        mesh = numpy.zeros(len(sc), [('lon', F64), ('lat', F64)])
        mesh['lon'] = sc.lons
        mesh['lat'] = sc.lats
    else:
        mesh = numpy.zeros(len(sc), [('lon', F64), ('lat', F64),
                                     ('depth', F64)])
        mesh['lon'] = sc.lons
        mesh['lat'] = sc.lats
        mesh['depth'] = sc.depths
    return mesh
1146032
def __get_depth(root):
    
    if root is None:
        return 0
    left  = __get_depth(root.left)
    right = __get_depth(root.right)
    if abs(left-right) > 1 or -1 in [left, right]:
        return -1
    return 1 + max(left, right)
117859
def split_coords_3d(seq):
    
    lons, lats, depths = [], [], []
    for i, el in enumerate(seq):
        if i % 3 == 0:
            lons.append(valid.longitude(el))
        elif i % 3 == 1:
            lats.append(valid.latitude(el))
        elif i % 3 == 2:
            depths.append(valid.depth(el))
    return list(zip(lons, lats, depths))
881358
def depth(self):
        
        if self._depth_cache is not None:
            return self._depth_cache
        depth, node = 1, self
        while node.package is not None:
            depth += 1
            node = node.package
        self._depth_cache = depth
        return depth
734915
def wave_at_location(self, l):
        
        cterm = 1j * self._wave_nums[l.index] * l.depth_within

        if l.wave_field == WaveField.within:
            return (self._waves_a[l.index] * np.exp(cterm) +
                    self._waves_b[l.index] * np.exp(-cterm))
        elif l.wave_field == WaveField.outcrop:
            return 2 * self._waves_a[l.index] * np.exp(cterm)
        elif l.wave_field == WaveField.incoming_only:
            return self._waves_a[l.index] * np.exp(cterm)
        else:
            raise NotImplementedError
525624
def get_full_lonlats(self):
        
        if self.lons is not None and self.lats is not None:
            return self.lons, self.lats

        self.lons, self.lats = self._get_full_lonlats()
        self.lons = da.from_delayed(self.lons, dtype=self["EARTH_LOCATIONS"].dtype,
                                    shape=(self.scanlines, self.pixels))
        self.lats = da.from_delayed(self.lats, dtype=self["EARTH_LOCATIONS"].dtype,
                                    shape=(self.scanlines, self.pixels))
        return self.lons, self.lats