radarx.io.aws_data.download_file#

radarx.io.aws_data.download_file(bucket, file_key, save_dir, anonymous=True)[source]#

Download a file from S3.

Parameters:
  • bucket (str) – Name of the AWS S3 bucket.

  • file_key (str) – Key of the file to download.

  • save_dir (str) – Directory to save the downloaded file.

  • anonymous (bool, optional) – If True, uses anonymous access. Default is True.

Returns:

str – Path to the downloaded file.

Examples

Download a NEXRAD Level II file:

>>> file_path = download_file(
...     "noaa-nexrad-level2",
...     "2016/10/06/KAMX/KAMX20161006_170414_V06",
...     "./downloads"
... )
>>> print(f"File downloaded to: {file_path}")

Download an MRMS file:

>>> file_path = download_file(
...     "noaa-mrms-pds",
...     "CONUS/ReflectivityAtLowestAltitude_00.50/2016/10/06/" +
        "ReflectivityAtLowestAltitude_00.50_20161006-1700.grib2.gz",
...     "./downloads"
... )
>>> print(f"File downloaded to: {file_path}")