Data access
IceCube has a bunch of public datasets available at https://icecube.wisc.edu/science/data-releases/. icecube_tools
provides an easy interface to this repository so that you can download and organise your data through python.
[1]:
from icecube_tools.utils.data import IceCubeData
The IceCubeData
class provides this functionality.
[2]:
my_data = IceCubeData()
You can use the find
method to pick out datasets you are interested in.
[3]:
found_dataset = my_data.find("20181018")
found_dataset
[3]:
['20181018']
The my_data
object has been inititalised to store data in the package’s default location (“~/.icecube_data”). This is where other icecube_tools
modules will look for stored data.
[4]:
my_data.data_directory
[4]:
'/home/runner/.icecube_data'
The fetch
method will download this dataset to this default location for later use by icecube_tools
. This method takes a list of names, so can also be used to download multiple datasets. fetch
has a built in delay of a few seconds between HTTP requests to avoid spamming the website. fetch
will not overwrite files by default, but this can be forced with overwrite=True
.
[5]:
my_data.fetch(found_dataset)
20181018: 11730609it [00:00, 56099319.94it/s]
You may not want to use icecube_tools
for other stuff, so you can also fetch to a specificed location with the keyword write_to
.
[6]:
my_data.fetch(found_dataset, write_to="data", overwrite=True)
20181018: 11730609it [00:00, 52666286.58it/s]
For convenience, there is also the fetch_all_to
method to download all the available data to a specified location. We comment this here as it can take a while to execute.
[7]:
# my_data.fetch_all_to("data")