Download

This module contains methods to download files from ftp-servers or via http. The method download()

ninolearn.download.download(info_dict, **kwargs)[source]

Download data specified in the dictionary info_dict. The value of the keyword ‘downloadType’ is important to tell the method if the download is done from an ftp-server (value *’ftp’) or via http (value ‘http’).

The information dictionary ‘info_dict’ contains the essential informations over the source of the data. See ninolearn.download.sources for a detailed description how the information dictionary should be orgainized.

Parameters
  • info_dict (dict) – The information dictionary for the source of the data. See ninolearn.download.sources for more details on the organization of the dictionary.

  • kwargs – Keyword arguments that are passed to :method:’ninolearn.download.downloadFTP’ or :method:’ninolearn.download.downloadHTTP’.

ninolearn.download.downloadFTP(info_dict, outdir='', username='anonymous', password='anonymous_pass')[source]

Download a file from a FTP server. Note, just some ftp-servers require an login account. Make sure you do NOT commit code in which your login details are visible to a public repository. Hence, put the information in a module that that you do not commit (put its name into the .gitignore) file.

Parameters
  • info_dict – The information dictionary for the source of the data. See :class:’ninolearn.download.sources’ for more details on the organization of the dictionary.

  • outdir (str) – The output directory for your variable. If outdir=’’, then no separate directory is made and all data is put into the raw data directory (see ninolearn.pathes).

  • username (str) – Username for ftp-server login (not always required).

  • password (str) – Password for ftp-server login (not always required).

ninolearn.download.downloadHTTP(info_dict, outdir='')[source]

Download a file via a HTTP.

Parameters
  • info_dict (dict) – The information dictionary for the source of the data. See ninolearn.download.sources for more details on the organization of the dictionary.

  • outdir (str) – The output directory for your variable. If outdir=’’, then no separate directory is made and all data is put into the raw data directory (see ninolearn.pathes).

class ninolearn.download.sources[source]

Collection of relevant data sources. If you add a new data source yourself follow the dictionary template:

For FTP download, you need to specify the host (keyword ‘host’) the directory on the ftp-server (keyword ‘location’) as well as the filename (keyword ‘filename’) that is going to be the name of the file AS WELL AS for the downloaded file.

NAME_FTP = {

‘downloadType’:’ftp’,

‘filename’: ‘filename_on_the_server_AND_local’,

‘host’: ‘ftp.hostname.com’,

‘location’: ‘/directory/on/the/server’

}

For HTTP download, you need to specific the FULL path to the file (keyword ‘url’) as well as the name that is used for the downloaded file (keyword ‘filename’)

NAME_HTTP = {

‘downloadType’:’http’,

‘url’: ‘https://www.full_url_to_the_file.com/data.txt’,

‘filename’: ‘local_file_name.txt’

}

Source dictionaries:

Source ONI

The Oceanic Nino Index.

Source NINOindeces

The monthly Nino1+2, Nino3, Nino4 and Nino3.4 indeces.

Source WWV,WWV_West

The Warm water volume (WWV) and the WWV in the western basin.

Source IOD

The Dipole Mode Index (DMI) of the Indian Ocean Dipole (IOD).

Source SST_ERSSTv5

The SST field from the ERSSTv5 field.

Source ORAS4

The ORAS4 data set. Define the argument for the keyword ‘filename’ yourself. There are various variables available form the ORAS4 data set. Moreover, they are just available in multiple files (not in a single big file).

Source GODAS

The GODAS data set. Define the argument for the keyword ‘filename’ yourself. Data is just available in multiple files (not in a single big file).

Source UWIND_NCEP,VWIND_NCEP,SAT_monthly_NCEP

The monthly u-wind, vwind and surface air temperature (SAT) from the NCEP reanalysis.

Source SAT_daily_NCEP

The daily surface air temperature (SAT) from the NCEP reanalysis.

Source HCA

The heat content anomaly. (Data source: NOAA)

Source OLR_NOAA

The outgoing longwave radiation (OLR). (Data source: NOAA)