-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
This only exists to bypass the gzipped issue with parfive. | ||
See https://github.com/Cadair/parfive/issues/121 | ||
If you want to complain, his name is Stuart Mumford, @cadair on GitHub | ||
""" | ||
|
||
from pathlib import Path | ||
|
||
from sunpy import config | ||
from sunpy.data.data_manager.cache import Cache | ||
from sunpy.data.data_manager.downloader import DownloaderBase, DownloaderError | ||
from sunpy.data.data_manager.manager import DataManager | ||
from sunpy.data.data_manager.storage import SqliteStorage | ||
from sunpy.util.parfive_helpers import Downloader | ||
|
||
__all__ = ["manager"] | ||
|
||
|
||
class AIAParfiveDownloader(DownloaderBase): | ||
def download(self, url, path): | ||
downloader = Downloader() | ||
path = Path(path) | ||
filename = path.name | ||
directory = path.parent | ||
downloader.enqueue_file(url, directory, filename, max_splits=1) | ||
try: | ||
output = downloader.download() | ||
except Exception as e: | ||
raise DownloaderError from e | ||
if output.errors: | ||
raise DownloaderError(output.errors[0].exception) | ||
|
||
|
||
_download_dir = config.get("downloads", "remote_data_manager_dir") | ||
manager = DataManager(Cache(AIAParfiveDownloader(), SqliteStorage(_download_dir + "/data_manager.db"), _download_dir)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters