def get_bower_package(self, url, dest=None, version=None,
                          process_deps=True):
        dest = dest or Path(".") / "assets"
        parsed_url = urlparse(url)
        if parsed_url.scheme == "git" or parsed_url.path.endswith(".git"):
            if parsed_url.netloc == "github.com":
                user, repo = parsed_url.path[1:-4].split("/")
                response = get(github_api_uri +
                               "/repos/{}/{}/tags".format(user, repo))
                tags = response.json()
                target = None
                if not len(tags):
                    click.secho("fatal: no tags exist for {}/{}".format(
                        user, repo), fg="red")
                    raise InvalidPackageError
                if version is None:
                    target = tags[0]
                else:
                    for tag in tags:
                        if semver.match(tag["name"],
                                        Bower.clean_semver(version)):
                            target = tag
                            break
                if not target:
                    click.secho(
                        "fatal: failed to find matching tag for "
                        "{user}/{repo} {version}".format(user, repo, version),
                        fg="red")
                    raise VersionNotFoundError
                click.secho("installing {}/{}#{}".format(
                    user, repo, tags[0]["name"]), fg="green")
                return self.get_bower_package(
                    url=target["zipball_url"],
                    dest=dest,
                    version=version)
            raise NotImplementedError
            click.echo("git clone {url}".format(url=url))
            cmd = envoy.run('git clone {url} "{dest}"'.format(
                url=url, dest=dest))
        elif parsed_url.scheme in ("http", "https"):
            zip_dest = download_file(url, dest=self.temp_dir,
                                     label="{dest_basename}",
                                     expected_extension="zip")
            with zipfile.ZipFile(zip_dest, "r") as pkg:
                return self.extract_bower_zipfile(pkg, dest,
                                                  expected_version=version)
                # pkg.extractall(str(dest))
        else:
            click.secho("protocol currently unsupported :(")
            sys.exit(1)
def find_storm_images_2d(
        top_directory_name, radar_source, radar_field_names,
        first_spc_date_string, last_spc_date_string, radar_heights_m_agl=None,
        reflectivity_heights_m_agl=None):
    """Locates files with 2-D storm-centered radar images.

    D = number of SPC dates in time period (`first_spc_date_string`...
        `last_spc_date_string`)

    :param top_directory_name: Name of top-level directory.  Files therein will
        be found by `storm_images.find_storm_image_file`.
    :param radar_source: Data source (must be accepted by
        `radar_utils.check_data_source`).
    :param radar_field_names: 1-D list of radar fields.  Each item must be
        accepted by `radar_utils.check_field_name`.
    :param first_spc_date_string: First SPC date (format "yyyymmdd").  This
        method will locate files from `first_spc_date_string`...
        `last_spc_date_string`.
    :param last_spc_date_string: Same.
    :param radar_heights_m_agl: [used only if radar_source = "gridrad"]
        1-D numpy array of radar heights (metres above ground level).  These
        heights apply to all radar fields.
    :param reflectivity_heights_m_agl: [used only if radar_source != "gridrad"]
        1-D numpy array of reflectivity heights (metres above ground level).
        These heights do not apply to other radar fields.
    :return: radar_file_name_matrix: D-by-C numpy array of file paths.
    """

    radar_utils.check_data_source(radar_source)
    first_spc_date_unix_sec = time_conversion.spc_date_string_to_unix_sec(
        first_spc_date_string)
    last_spc_date_unix_sec = time_conversion.spc_date_string_to_unix_sec(
        last_spc_date_string)

    if radar_source == radar_utils.GRIDRAD_SOURCE_ID:
        storm_image_file_dict = storm_images.find_many_files_gridrad(
            top_directory_name=top_directory_name,
            radar_field_names=radar_field_names,
            radar_heights_m_agl=radar_heights_m_agl,
            start_time_unix_sec=first_spc_date_unix_sec,
            end_time_unix_sec=last_spc_date_unix_sec,
            one_file_per_time_step=False, raise_error_if_all_missing=True)
    else:
        storm_image_file_dict = storm_images.find_many_files_myrorss_or_mrms(
            top_directory_name=top_directory_name, radar_source=radar_source,
            radar_field_names=radar_field_names,
            reflectivity_heights_m_agl=reflectivity_heights_m_agl,
            start_time_unix_sec=first_spc_date_unix_sec,
            end_time_unix_sec=last_spc_date_unix_sec,
            one_file_per_time_step=False,
            raise_error_if_all_missing=True, raise_error_if_any_missing=False)

    radar_file_name_matrix = storm_image_file_dict[
        storm_images.IMAGE_FILE_NAMES_KEY]
    num_file_times = radar_file_name_matrix.shape[0]

    if radar_source == radar_utils.GRIDRAD_SOURCE_ID:
        num_field_height_pairs = (
            radar_file_name_matrix.shape[1] * radar_file_name_matrix.shape[2]
        )
        radar_file_name_matrix = numpy.reshape(
            radar_file_name_matrix, (num_file_times, num_field_height_pairs)
        )

    time_missing_indices = numpy.unique(
        numpy.where(radar_file_name_matrix == '')[0]
    )
    return numpy.delete(
        radar_file_name_matrix, time_missing_indices, axis=0)