Function Repository Resource:

ResourceDataDownloadSubmit

Source Notebook

Create a task to download data from a data repository

Contributed by: Bob Sandheinrich

ResourceFunction["ResourceDataDownloadSubmit"][resource]

launches as asynchronous download of the primary content in the ResourceObject resource.

ResourceFunction["ResourceDataDownloadSubmit"][resource,elem]

asynchronously downloads the content element elem.

Details

ResourceFunction["ResourceDataDownloadSubmit"] returns a TaskObject.
ResourceFunction["ResourceDataDownloadSubmit"] accepts the same arguments and options as ResourceData as well as the options for URLDownloadSubmit. However, specifying a custom HandlerFunctions value can disrupt the internal behavior of ResourceFunction["ResourceDataDownloadSubmit"] and cause errors.
Elements that do not require downloading return a dummy TaskObject which does not correspond to an actual download.

Examples

Basic Examples (2) 

Create a task to download data from the Wolfram Data Repository:

In[1]:=
task = ResourceFunction["ResourceDataDownloadSubmit"][
  "Babe Ruth Home Runs"]
Out[1]=

When the task is complete, the data is immediately available via ResourceData:

In[2]:=
TaskWait[task];
ResourceData["Babe Ruth Home Runs"]
Out[3]=

Create a task to download data from the Wolfram Neural Net Repository:

In[4]:=
task = ResourceFunction["ResourceDataDownloadSubmit"][
  "AdaIN-Style Trained on MS-COCO and Painter by Numbers Data"]
Out[4]=

When the task is complete, the neural network is immediately available via NetModel:

In[5]:=
TaskWait[task];
NetModel["AdaIN-Style Trained on MS-COCO and Painter by Numbers Data"]
Out[6]=

Scope (3) 

Specify the data resource element to download:

In[7]:=
task = ResourceFunction["ResourceDataDownloadSubmit"][
  "Epidemic Data for Novel Coronavirus COVID-19", "WorldCountries"]
Out[7]=

Check the status while it is downloading:

In[8]:=
task["TaskStatus"]
Out[8]=

When the download is complete the status will change to "Removed":

In[9]:=
task["TaskStatus"]
Out[9]=

The data is now stored locally:

In[10]:=
ResourceObject["Epidemic Data for Novel Coronavirus COVID-19"][
  "ContentElementLocations"]["WorldCountries"]
Out[10]=

Importing the data is now fast:

In[11]:=
AbsoluteTiming[
 ByteCount[
  ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "WorldCountries"]]]
Out[11]=

Download all content elements of a data resource:

In[12]:=
tasks = ResourceFunction["ResourceDataDownloadSubmit"][
  "Tweets by @WolframResearch", All]
Out[12]=

Download specified content elements:

In[13]:=
tasks = ResourceFunction["ResourceDataDownloadSubmit"][
  "Sample 3D Model: Triceratops", {"BoundaryMeshRegion", "MeshRegion"}]
Out[13]=

Publisher

Bob

Version History

  • 1.0.0 – 29 March 2022

Related Resources

License Information