timeseries_scripts/download.py
def download_archive(archive_version):
    """
    Download archived data from the OPSD server. See download()
    for info on parameter.

    """

    filepath = 'original_data.zip'

    if not os.path.exists(filepath):
        url = ('http://data.open-power-system-data.org/time_series/'
               '{}/original_data/{}'.format(archive_version, filepath))
        logger.info('Downloading and extracting archived data from %s', url)
        resp = requests.get(url)
        with open(filepath, 'wb') as output_file:
            for chunk in resp.iter_content(1024):
                output_file.write(chunk)

        myzipfile = zipfile.ZipFile(filepath)
        if myzipfile.namelist()[0] == 'original_data/':
            myzipfile.extractall()
            logger.info('Extracted data to /original_data.')
        else:
            logger.warning('%s has unexpected content. Please check manually',
                           filepath)

    else:
        logger.info('%s already exists. Delete it if you want to download again',
                    filepath)

    return

    Download archived data from the OPSD server. See download()
    for info on parameter.

    
Download archived data from the OPSD server. See download()
for info on parameter.
Download archived data from the OPSD server . See download () for info on parameter .
def download_archive(archive_version):
    filepath = 'original_data.zip'
    if not os.path.exists(filepath):
        url = ('http://data.open-power-system-data.org/time_series/'
               '{}/original_data/{}'.format(archive_version, filepath))
        logger.info('Downloading and extracting archived data from %s', url)
        resp = requests.get(url)
        with open(filepath, 'wb') as output_file:
            for chunk in resp.iter_content(1024):
                output_file.write(chunk)
        myzipfile = zipfile.ZipFile(filepath)
        if myzipfile.namelist()[0] == 'original_data/':
            myzipfile.extractall()
            logger.info('Extracted data to /original_data.')
        else:
            logger.warning('%s has unexpected content. Please check manually',
                           filepath)
    else:
        logger.info('%s already exists. Delete it if you want to download again',
                    filepath)
    return
def download_archive ( archive_version ) : filepath = 'original_data.zip' if not os . path . exists ( filepath ) : url = ( 'http://data.open-power-system-data.org/time_series/' '{}/original_data/{}' . format ( archive_version , filepath ) ) logger . info ( 'Downloading and extracting archived data from %s' , url ) resp = requests . get ( url ) with open ( filepath , 'wb' ) as output_file : for chunk in resp . iter_content ( 1024 ) : output_file . write ( chunk ) myzipfile = zipfile . ZipFile ( filepath ) if myzipfile . namelist ( ) [ 0 ] == 'original_data/' : myzipfile . extractall ( ) logger . info ( 'Extracted data to /original_data.' ) else : logger . warning ( '%s has unexpected content. Please check manually' , filepath ) else : logger . info ( '%s already exists. Delete it if you want to download again' , filepath ) return
Download archived data from the OPSD server.
Download archived data from the OPSD server .
"""
    Download archived data from the OPSD server. See download()
    for info on parameter.

    """
archive_version