# Source code for pygmt.datasets.tutorial

"""
Functions to load sample data from the GMT tutorials.
"""
import pandas as pd

from .. import which

"""
Load a table of earthquakes around Japan as a pandas.Dataframe.

Data is from the NOAA NGDC database. This is the @tut_quakes.ngdc
dataset used in the GMT tutorials.

The data are downloaded to a cache directory (usually ~/.gmt/cache) the
first time you invoke this function. Afterwards, it will load the data from
the cache. So you'll need an internet connection the first time around.

Returns
-------
data :  pandas.Dataframe
The data table. Columns are year, month, day, latitude, longitude,
depth (in km), and magnitude of the earthquakes.

"""
data.columns = [
"year",
"month",
"day",
"latitude",
"longitude",
"depth_km",
"magnitude",
]
return data

"""
Load a table of ocean ridge points for the entire world as a
pandas.DataFrame.

This is the @ridge.txt dataset used in the GMT tutorials.

The data are downloaded to a cache directory (usually ~/.gmt/cache) the
first time you invoke this function. Afterwards, it will load the data from
the cache. So you'll need an internet connection the first time around.

Returns
-------
data :  pandas.Dataframe
The data table. Columns are longitude and latitude.
"""
fname, sep=r"\s+", names=["longitude", "latitude"], skiprows=1, comment=">"
)
return data

"""
Load a table of ship observations of bathymetry off Baja California as a
pandas.DataFrame.

This is the @tut_ship.xyz dataset used in the GMT tutorials.

The data are downloaded to a cache directory (usually ~/.gmt/cache) the
first time you invoke this function. Afterwards, it will load the data from
the cache. So you'll need an internet connection the first time around.

Returns
-------
data :  pandas.Dataframe
The data table. Columns are longitude, latitude, and bathymetry.
"""
fname, sep="\t", header=None, names=["longitude", "latitude", "bathymetry"]
)
return data

"""
Load a table of global earthquakes form the USGS as a pandas.Dataframe.

This is the @usgs_quakes_22.txt dataset used in the GMT tutorials.

The data are downloaded to a cache directory (usually ~/.gmt/cache) the
first time you invoke this function. Afterwards, it will load the data from
the cache. So you'll need an internet connection the first time around.

Returns
-------
data : pandas.Dataframe
The data table. Use print(data.describe()) to see the available
columns.

"""