\(\renewcommand\AA{\unicode{x212B}}\)
CatalogDownloadDataFiles v1¶
Summary¶
Downloads datafiles from the archives based on the ID of a datafile.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
FileIds |
Input |
int list |
List of fileids to download from the data server |
|
FileNames |
Input |
str list |
List of filenames to download from the data server |
|
DownloadPath |
Input |
string |
The path to save the downloaded files. |
|
Session |
Input |
string |
The session information of the catalog to use. |
|
FileLocations |
Output |
str list |
A list of file locations to the catalog datafiles. |
Description¶
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 CatalogGetDataFiles.
Usage¶
Example - downloading a single datafile from ICAT.
# 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:
# 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.
# 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
# The filenames are those that will be saved on your machine
# I have opted to use the datafile ids for this, but it is possible
# to provide a list of desired names.
# This must be the same size as the FileIds list.
FileNames = datafile_ids,
DownloadPath = '~/Desktop',
Session = session.getPropertyValue("Session")
)
Output:
['/home/USERNAME/Desktop/33127010.nxs', '/home/USERNAME/Desktop/33127011.nxs']
Categories: AlgorithmIndex | DataHandling\Catalog
Source¶
C++ header: CatalogDownloadDataFiles.h
C++ source: CatalogDownloadDataFiles.cpp