Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit 27995889 authored by Zhenguang Huang's avatar Zhenguang Huang
Browse files

@qalshidi commiting for @zghuang

parent d0a83080
......@@ -18,6 +18,7 @@ import urllib
from dateutil import rrule
import drms
import numpy as np
import os
from sunpy.coordinates.sun import carrington_rotation_number
from .tools import _nearest
......@@ -480,11 +481,14 @@ def download_magnetogram_adapt(time, map_type='fixed', **kwargs):
raise FileNotFoundError('Could not find a file that matches'
+ 'the pattern.')
for filename in filenames:
# open the file locally
directory = kwargs.get('download_dir', './')
if directory[-1] != '/':
directory += '/'
for filename in filenames:
# Only try to download if the file does not exist
if os.path.isfile(directory+filename) == False:
# open the file locally
with open(directory + filename, 'wb') as fhandle:
# try to download the magnetogram
......@@ -492,6 +496,8 @@ def download_magnetogram_adapt(time, map_type='fixed', **kwargs):
except ftplib.all_errors:
raise FileNotFoundError('Cannot download ', filename)
print(filename + ' already exists, skipping downloading')
# unzip the file
if '.gz' in filename:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment