class_docstr: Data storage and retrieval functionality for Earthlab.
  
  An object of this class is available upon importing earthpy as
  ``earthpy.data`` that writes data files to the path:
  ``~/earth-analytics/data/``.
  
  Parameters
  ----------
  path : string | None
      The path where data is stored. NOTE: this defaults to the directory
      ``~/earth-analytics/data/``.
  
  Examples
  --------
  List datasets that are available for download, using default object:
  
      >>> import earthpy as et
      >>> et.data
      Available Datasets: ['california-rim-fire', ...]
  
  Specify a custom directory for data downloads:
  
      >>> et.data.path = "."
      >>> et.data
      Available Datasets: ['california-rim-fire', ...]
docstr: Download a file.
  
  This helper function downloads files and saves them to ``path``.
  Zip and tar files are extracted to the ``path`` directory.
  The implementation is adapted from the download library:
  https://github.com/choldgraf/download
  
  Parameters
  ----------
  url : str
      The URL pointing to a file to download.
  path : str
      Destination path of downloaded file.
  kind: str
      Kind of file. Must be one of ALLOWED_FILE_TYPES.
  replace : bool
      Whether to replace the file if it already exists.
  verbose : bool
      Whether to print verbose output while downloading files.
  
  
  Returns
  -------
  output_path : str
      Path to the downloaded file.
docstr_tok: ["Download","a","file",".","This","helper","function","downloads","files","and","saves","them","to","``","path","``",".","Zip","and","tar","files","are","extracted","to","the","``","path","``","directory",".","The","implementation","is","adapted","from","the","download","library",":","https",":","\/\/github.com\/choldgraf\/download","Parameters","--","--","--","--","--","url",":","str","The","URL","pointing","to","a","file","to","download",".","path",":","str","Destination","path","of","downloaded","file",".","kind",":","str","Kind","of","file",".","Must","be","one","of","ALLOWED_FILE_TYPES",".","replace",":","bool","Whether","to","replace","the","file","if","it","already","exists",".","verbose",":","bool","Whether","to","print","verbose","output","while","downloading","files",".","Returns","--","--","--","-","output_path",":","str","Path","to","the","downloaded","file","."]
code: def _download(self, url, path, kind, replace, verbose):
      """Download a file.
  
      This helper function downloads files and saves them to ``path``.
      Zip and tar files are extracted to the ``path`` directory.
      The implementation is adapted from the download library:
      https://github.com/choldgraf/download
  
      Parameters
      ----------
      url : str
          The URL pointing to a file to download.
      path : str
          Destination path of downloaded file.
      kind: str
          Kind of file. Must be one of ALLOWED_FILE_TYPES.
      replace : bool
          Whether to replace the file if it already exists.
      verbose : bool
          Whether to print verbose output while downloading files.
  
  
      Returns
      -------
      output_path : str
          Path to the downloaded file.
      """
      path = op.expanduser(path)
      if replace is False and op.exists(path):
          return path
  
      if verbose is True:
          print("Downloading from {}".format(url))
  
      r = requests.get(url)
  
      os.makedirs(op.dirname(path), exist_ok=True)
      if kind == "file":
          with open(path, "wb") as f:
              f.write(r.content)
      else:
          self._download_and_extract(path, r, kind, verbose)
      return path
  
file_path: earthpy/earthpy/io.py
imports: import io
  import os
  import os.path
  import re
  import requests
  import tarfile
  import zipfile
  import earthpy
label_desc: Use image node_id 4 for calling the Data obj's underlying member method code with example usage: obj._download(url, path, kind, replace, verbose) and returns: path, path