Verified Commit 6c1b90db authored by Qusai Al Shidi's avatar Qusai Al Shidi 💬

FEAT: Add helpful `download_adapt_magnetogram()` error.

download_adapt_magnetogram() now gives a more helpful error message by
showing you what hours have files instead of just telling you file not
found.
parent fbd63523
......@@ -496,8 +496,13 @@ def download_magnetogram_adapt(time, map_type='fixed', **kwargs):
filenames = ftp.nlst(file_pattern)
if len(filenames) < 1:
raise FileNotFoundError('Could not find a file that matches'
+ 'the pattern.')
daily_filenames = ftp.nlst(file_pattern[:-3] + '*')
raise FileNotFoundError('FILE NOT FOUND',
'Could not find a file that matches the hour',
'Time entered: ' + str(time)
+ '. Files found from same day:',
*[fname[18:30] for fname in daily_filenames],
)
directory = kwargs.get('download_dir', './')
if directory[-1] != '/':
......
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