Commit 90501ff6 authored by Qusai Al Shidi's avatar Qusai Al Shidi 💬
Browse files

Merge branch 'zhenguang-web-patch' into 'master'

@qalshidi commiting for @zghuang

See merge request swmf_software/swmfpy!6
parents 3b8c6b89 ffe49527
Pipeline #24246 passed with stage
in 1 minute and 10 seconds
......@@ -13,6 +13,7 @@ import ftplib
from functools import lru_cache
import gzip
from operator import itemgetter
import os.path
import shutil
import urllib
import urllib.request
......@@ -476,11 +477,16 @@ 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) == True:
raise RuntimeWarning(f'{filename} exists, not downloading')
else:
# open the file locally
with open(directory + filename, 'wb') as fhandle:
# try to download the magnetogram
try:
......
Supports Markdown
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