Skip to content
Snippets Groups Projects
Commit cbacc755 authored by Jay Rainey's avatar Jay Rainey
Browse files

Add usage to CatalogDownloadFiles. Refs #9585.

parent ed9085c8
No related branches found
No related tags found
No related merge requests found
......@@ -52,9 +52,8 @@ namespace Mantid
~CatalogDownloadDataFiles(){}
/// Algorithm's name for identification overriding a virtual method
virtual const std::string name() const { return "CatalogDownloadDataFiles"; }
///Summary of algorithms purpose
virtual const std::string summary() const {return "Downloads the given data files from the data server";}
/// Summary of algorithms purpose.
virtual const std::string summary() const { return "Downloads datafiles from the archives based on the ID of a datafile."; }
/// Algorithm's version for identification overriding a virtual method
virtual int version() const { return 1; }
/// Algorithm's category for identification overriding a virtual method
......@@ -69,7 +68,6 @@ namespace Mantid
std::string testDownload(const std::string& URL,const std::string& fileName);
private:
/// Overwrites Algorithm method.
void init();
/// Overwrites Algorithm method
......
......@@ -9,8 +9,52 @@
Description
-----------
This algorithm gets the location strings for the selected files from the
data archive; if the data archive is not accessible, it downloads the
files from the data server.
This algorithm downloads a datafile or multiple datafiles based on the given ID of a datafile in an investigation. It first checks if the file can be downloaded from the data archives (based on information in the config file Facilities.xml) and downloads the file from there. Otherwise, the file is downloaded over HTTPS.
The datafile ID to use to download a datafile can be obtained from :ref:`CatalogGetDataFiles <algm-CatalogGetDataFiles>`.
Usage
-----
**Example - downloading a single datafile from ICAT.**
.. code:: python
# Assuming you have previously logged into the catalog
# and stored the session return value in the variable 'session'
CatalogDownloadDataFiles(FileIds = '33127010', # Which file to find?
FileNames = '33127010.nxs', # What to name it?
DownloadPath = '~/Desktop', # Where to save it?
Session = session.getPropertyValue("Session") # Which session to use?
)
Output:
.. code:: python
# Outputs a list locations of the datafiles downloaded.
# USERNAME will be your username on your system.
['/home/USERNAME/Desktop/33127010.nxs']
**Example - downloading multiple datafiles from ICAT.**
.. code:: python
# The ids of the datafiles to download.
# These could be obtained from CatalogGetDataFiles or entered manually.
datafile_ids = [33127010, 33127011]
# This option will not append any file extensions to the datafiles.
CatalogDownloadDataFiles(FileIds = datafile_ids, # We now pass our list of ids here
FileNames = datafile_ids, # and also here.
DownloadPath = '~/Desktop',
Session = session.getPropertyValue("Session")
)
Output:
.. code:: python
['/home/USERNAME/Desktop/33127010.nxs', '/home/USERNAME/Desktop/33127011.nxs']
.. categories::
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment