download

../../_images/DOWNLOAD.png

Downloads a file from a given URL. By default the result is cached, but a target path can also be specified in order to save the file directly to a given location. This is particularly useful for data types that Metview does not have specific support for.

Note

This function performs the same task as the Download from URL icon in Metview’s user interface. It accepts its parameters as keyword arguments, described below.

download(**kwargs)

Downloads a file from a given URL.

Parameters
  • url (str) – Provide a URL that will return a file. This can be, for instance, a URL that points directly to a particular file, or a request to a web service that generates and returns some data.

  • target (str) – This parameter is optional. If set, the downloaded file will be copied to the given location. The target path can be absolute or relative, but must include the file name, and the parent directory must already exist. If running from an interactive session, a relative path will be relative to the folder containing the script; when running in batch mode, the path will be relative to where the metview command was run from.

Return type

Metview object representing the type of the downloaded data.