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 523f958b authored by Qusai Al Shidi's avatar Qusai Al Shidi 💬
Browse files

Fixed download_magnetogram_adapt. Also raise new error if hmi mag not found

parent 39ba725a
......@@ -164,6 +164,8 @@ def download_magnetogram_hmi(time, **kwargs):
ImportError: If module `drms` is not found.
FileNotFoundError: If the JSOC doesn't have the magnetograms for that
......@@ -211,6 +213,8 @@ def download_magnetogram_hmi(time, **kwargs):
if not download_dir.endswith('/') and download_dir != '':
download_dir += '/'
for data_time, mag_url in zip(times, data[1].field):
if mag_url == 'BadSegLink': # JSOC will return this if not found
raise FileNotFoundError('Could not find those HMI magnetograms.')
filename = str(data_time).replace(' ', '_') # Add timestamp
filename += '_' + mag_url.split('/')[-1] # Last is filename
url = '' + mag_url
......@@ -339,7 +343,7 @@ def download_magnetogram_adapt(time, map_type='fixed', **kwargs):
# return first file name if all goes well
return_name = filenames[0]
return_name = filenames
if '.gz' in return_name:
return_name = return_name[:-3]
return_name = return_name.replace('.gz', '')
return return_name
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