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.

We will be renewing and replacing the SSL certificate for the ITS GitLab service on 11/3/2021. While the certificate is being replaced, the GitLab service will be unavailable. Maintenance will start at 5:30p, and be completed by 7:30p.

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

Writing IMF files fixed, will not write nans anymore

parent 1a0466a7
......@@ -4,6 +4,7 @@ Here are tools to read and write files relating to SWMF.
import datetime as dt
import numpy as np
from .tools import _make_line
......@@ -68,21 +69,27 @@ def write_imf_input(imf_data, filename='IMF.dat', **kwargs):
# write dat file
def justified(str_list, width=7):
'Returns justified'
return [s.rjust(width) for s in str_list]
file_imf.write('\n'+' '.join(justified(columns_dat)))
file_imf.write('\n'+' '.join(_justified(columns_dat)))
lines = []
for index, _time in enumerate(imf_data[column_keys[0]]):
dirty = False # Don't write line if it has NaN
line = _time_repr(_time)
for key in column_keys[1:]:
line += [str(round(imf_data[key][index], 2))]
line = ' '.join(justified(line))
lines += line + '\n'
if np.isnan(imf_data[key][index]):
dirty = True
if not dirty:
line = ' '.join(_justified(line))
lines += line + '\n'
def _justified(str_list, width=7):
'Returns justified list from string list'
return [s.rjust(width) for s in str_list]
def read_wdc_ae(wdc_filename):
"""Read an auroral electrojet (AE) indeces from Kyoto's World Data Center
text file into a dictionary of lists.
......@@ -9,7 +9,7 @@ __author__ = 'Qusai Al Shidi'
__email__ = ''
import datetime as dt
from ftplib import FTP, all_errors
import ftplib
import gzip
from operator import itemgetter
import shutil
......@@ -208,7 +208,7 @@ def get_omni_data(time_from, time_to, **kwargs):
# Assign the data from after the time columns
for col_name, value in zip(omni['cols'],
if _check_bad_omni_num(value):
if _bad_omni_num(value):
return_data[col_name] += [None]
return_data[col_name] += [float(value)]
......@@ -228,7 +228,7 @@ def _urls_omni_hires(time_from, time_to):
suffix = 'omni_min'
suffix += str(date.year) + str(date.month).zfill(2)
suffix += '.asc'
......@@ -247,7 +247,7 @@ def _urls_omni_lores(time_from, time_to):
yield prefix+suffix
def _check_bad_omni_num(value_string):
def _bad_omni_num(value_string):
"""Returns true if bad or false if not. Bad numbers usually just have 9s
in omni.
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