def ll2z(locations, radius_search=CITY_RADIUS_SEARCH):
    'Computes the z-value for the given lon, lat tuple or\n     list of lon, lat tuples\n    :param locations:\n    :param radius_search: Checks to see if a city is within X km from the given location,\n                          removes the search if value is set to 0\n    :return: Array of z-values, one for each location specified\n    '
    try:
        multi = bool(len(locations[0]))
    except TypeError:
        multi = False
        locations = [locations]
    out = np.zeros(len(locations))
    for p in POLYGONS:
        c = Path(geo.path_from_corners(corners=np.loadtxt(p[0]).tolist(), output=None, min_edge_points=4)).contains_points(locations)
        out = np.where(c, p[1], out)
    if (radius_search > 0):
        cities = pd.read_csv(os.path.join(DATA, 'cities_z.csv'), header=None, names=['lon', 'lat', 'city', 'z_value'])
        cities_ll = cities[['lon', 'lat']].values
        for (i, location) in enumerate(locations):
            dists = geo.get_distances(cities_ll, location[0], location[1])
            if np.any((dists < radius_search)):
                cities['dist'] = dists
                city_idx = cities.dist.idxmin()
                out[i] = cities.loc[city_idx].z_value
    nz = []
    points_all = []
    for z in Z_VALS:
        points = np.atleast_2d(np.loadtxt((Z_FORMAT % z)))
        nz.append(len(points))
        points_all.append(points)
    points = np.concatenate(points_all)
    del points_all
    z = griddata(points, np.repeat(Z_VALS, nz), locations, method='linear')
    return np.where((out == 0), np.where(np.isnan(z), 0.13, z), out)
Computes the z-value for the given lon, lat tuple or
 list of lon, lat tuples
:param locations:
:param radius_search: Checks to see if a city is within X km from the given location,
                      removes the search if value is set to 0
:return: Array of z-values, one for each location specified
def ll2z(locations, radius_search=CITY_RADIUS_SEARCH):
    'Computes the z-value for the given lon, lat tuple or\n     list of lon, lat tuples\n    :param locations:\n    :param radius_search: Checks to see if a city is within X km from the given location,\n                          removes the search if value is set to 0\n    :return: Array of z-values, one for each location specified\n    '
    try:
        multi = bool(len(locations[0]))
    except TypeError:
        multi = False
        locations = [locations]
    out = np.zeros(len(locations))
    for p in POLYGONS:
        c = Path(geo.path_from_corners(corners=np.loadtxt(p[0]).tolist(), output=None, min_edge_points=4)).contains_points(locations)
        out = np.where(c, p[1], out)
    if (radius_search > 0):
        cities = pd.read_csv(os.path.join(DATA, 'cities_z.csv'), header=None, names=['lon', 'lat', 'city', 'z_value'])
        cities_ll = cities[['lon', 'lat']].values
        for (i, location) in enumerate(locations):
            dists = geo.get_distances(cities_ll, location[0], location[1])
            if np.any((dists < radius_search)):
                cities['dist'] = dists
                city_idx = cities.dist.idxmin()
                out[i] = cities.loc[city_idx].z_value
    nz = []
    points_all = []
    for z in Z_VALS:
        points = np.atleast_2d(np.loadtxt((Z_FORMAT % z)))
        nz.append(len(points))
        points_all.append(points)
    points = np.concatenate(points_all)
    del points_all
    z = griddata(points, np.repeat(Z_VALS, nz), locations, method='linear')
    return np.where((out == 0), np.where(np.isnan(z), 0.13, z), out)