<reponame>hajime9652/observations
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import csv
import numpy as np
import os
import sys

from observations.util import maybe_download_and_extract


def volcano(path):
  """Topographic Information on Auckland's Maunga Whau Volcano

  Maunga Whau (Mt Eden) is one of about 50 volcanos in the Auckland
  volcanic field. This data set gives topographic information for Maunga
  Whau on a 10m by 10m grid.

  A matrix with 87 rows and 61 columns, rows corresponding to grid lines
  running east to west and columns to grid lines running south to north.

  Digitized from a topographic map by <NAME>. These data should not be
  regarded as accurate.

  See Also
  ~~~~~~~~

  `filled.contour` for a nice plot.

  Args:

    path: str.
      Path to directory which either stores file or otherwise file will
      be downloaded and extracted there.
      Filename is `volcano.csv`.

  Returns:

    Tuple of np.ndarray `x_train` with 87 rows and 61 columns and
    dictionary `metadata` of column headers (feature names).
  """
  import pandas as pd
  path = os.path.expanduser(path)
  filename = 'volcano.csv'
  if not os.path.exists(os.path.join(path, filename)):
    url = 'http://dustintran.com/data/r/datasets/volcano.csv'
    maybe_download_and_extract(path, url,
                               save_file_name='volcano.csv',
                               resume=False)

  data = pd.read_csv(os.path.join(path, filename), index_col=0,
                     parse_dates=True)
  x_train = data.values
  metadata = {'columns': data.columns}
  return x_train, metadata

# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import csv
import numpy as np
import os
import sys

from observations.util import maybe_download_and_extract


def volcano(path):
  """Topographic Information on Auckland's Maunga Whau Volcano

  Maunga Whau (Mt Eden) is one of about 50 volcanos in the Auckland
  volcanic field. This data set gives topographic information for Maunga
  Whau on a 10m by 10m grid.

  A matrix with 87 rows and 61 columns, rows corresponding to grid lines
  running east to west and columns to grid lines running south to north.

  Digitized from a topographic map by <NAME>. These data should not be
  regarded as accurate.

  See Also
  ~~~~~~~~

  `filled.contour` for a nice plot.

  Args:

    path: str.
      Path to directory which either stores file or otherwise file will
      be downloaded and extracted there.
      Filename is `volcano.csv`.

  Returns:

    Tuple of np.ndarray `x_train` with 87 rows and 61 columns and
    dictionary `metadata` of column headers (feature names).
  """
  import pandas as pd
  path = os.path.expanduser(path)
  filename = 'volcano.csv'
  if not os.path.exists(os.path.join(path, filename)):
    url = 'http://dustintran.com/data/r/datasets/volcano.csv'
    maybe_download_and_extract(path, url,
                               save_file_name='volcano.csv',
                               resume=False)

  data = pd.read_csv(os.path.join(path, filename), index_col=0,
                     parse_dates=True)
  x_train = data.values
  metadata = {'columns': data.columns}
  return x_train, metadata
# -*- coding: utf-8 -*- Topographic Information on Auckland's Maunga Whau Volcano    Maunga Whau (Mt Eden) is one of about 50 volcanos in the Auckland   volcanic field. This data set gives topographic information for Maunga   Whau on a 10m by 10m grid.    A matrix with 87 rows and 61 columns, rows corresponding to grid lines   running east to west and columns to grid lines running south to north.    Digitized from a topographic map by <NAME>. These data should not be   regarded as accurate.    See Also   ~~~~~~~~    `filled.contour` for a nice plot.    Args:      path: str.       Path to directory which either stores file or otherwise file will       be downloaded and extracted there.       Filename is `volcano.csv`.    Returns:      Tuple of np.ndarray `x_train` with 87 rows and 61 columns and     dictionary `metadata` of column headers (feature names).