5. Download data#

The alminer.download_data function allows the user to download the data from the archive directly to a location on the local disk.

General notes about the download function:

  • The default download location is the ‘data’ subdirectory in the current working directory. The desired location can be changed by setting the location parameter to the desired path.

  • The archive mirror used for downloading can be specified through the archive_mirror parameter. ESO is the default, and other options are NRAO and NAOJ.

  • To check the amount of disk space needed, the dryrun parameter can be toggled to True which will only stage the data and write to the terminal how much space is required.

  • By default, tar files (including both raw and FITS data products) associated with uids in the provided DataFrame will be downloaded.

  • To download only the FITS data products, the fitsonly parameter can be toggled to True.

  • It is possible to provide a list of strings (to the filename_must_include parameter) that the user wants to be included in the filenames that are downloaded. This is useful to restrict the download further, for example, to data that have been primary beam corrected (‘.pbcor’) or that have the science target (’_sci’ or the ALMA target name). The choice is largely dependent on the cycle and type of reduction that was performed, and data products that exist on the archive as a result.

  • A list of URLs (files) to be downloaded from the archive can be printed to the terminal by setting print_urls=True.

Load libraries & create a query

To explore these options, we will first query the archive using one of the methods presented in the previous section and use the results in the remainder of this tutorial.

[1]:
import alminer

observations = alminer.keysearch({'target_name':['G31.41'], 'proposal_id': ['2018']})
================================
alminer.keysearch results
================================
--------------------------------
Number of projects = 2
Number of observations = 3
Number of unique subbands = 9
Total number of subbands = 12
1 target(s) with ALMA data = ['G31.41+0.31']
--------------------------------

Example 5.1: download all data products (raw + products)#

[2]:
alminer.download_data(observations, fitsonly=False, dryrun=True,
                      location='./data', print_urls=False)
================================
This is a dryrun. To begin download, set dryrun=False.
================================
Download location = ./data
Total number of Member OUSs to download = 3
Selected Member OUSs: ['uid://A001/X133d/X325', 'uid://A001/X133d/X327', 'uid://A001/X133d/X21b4']
Number of files to download = 13
Needed disk space = 450.5 GB
--------------------------------

Example 5.2: download only continuum FITS images for the science target#

[3]:
alminer.download_data(observations, fitsonly=True, dryrun=True, location='./data',
                      filename_must_include=['_sci', '.pbcor', 'cont', 'G31.41'],
                      print_urls=True)
================================
This is a dryrun. To begin download, set dryrun=False.
================================
Download location = ./data
Total number of Member OUSs to download = 3
Selected Member OUSs: ['uid://A001/X133d/X325', 'uid://A001/X133d/X327', 'uid://A001/X133d/X21b4']
Number of files to download = 4
Needed disk space = 48.9 MB
File URLs to download = https://almascience.eso.org/dataPortal/member.uid___A001_X133d_X325._G31.41p0.31__sci.spw25_27_29_31.cont.I.tt0.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X133d_X325._G31.41p0.31__sci.spw25_27_29_31.cont.I.tt1.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X133d_X327._G31.41p0.31__sci.spw25_27_29_31.cont.I.tt0.pbcor.fits
https://almascience.eso.org/dataPortal/member.uid___A001_X133d_X327._G31.41p0.31__sci.spw25_27_29_31.cont.I.tt1.pbcor.fits
--------------------------------