Skip to content

Commit

Permalink
Merge pull request #737 from nickssl/master
Browse files Browse the repository at this point in the history
Improved data handling
  • Loading branch information
nickssl authored Feb 1, 2024
2 parents 33f7e4b + ea1e83e commit db6b97a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion pyspedas/kyoto/load_dst.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ def dst(
logging.error("trange keyword required to download data.")
return

file_names = dailynames(file_format="%Y%m/index.html", trange=trange)
try:
file_names = dailynames(file_format="%Y%m/index.html", trange=trange)
except Exception as e:
logging.error("Error occurred while getting file names: " + str(e))
return

times = []
data = []
Expand Down
16 changes: 8 additions & 8 deletions pyspedas/kyoto/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
class LoadTestCases(unittest.TestCase):
def test_load_dst_data(self):
# final
dst_vars = pyspedas.kyoto.dst(trange=['2015-10-15', '2015-10-16'])
self.assertTrue(data_exists('kyoto_dst'))
dst_vars = pyspedas.kyoto.dst(trange=["2015-10-15", "2015-10-16"])
self.assertTrue(data_exists("kyoto_dst"))
# provisional
dst_vars = pyspedas.kyoto.dst(trange=['2019-10-15', '2019-10-16'])
self.assertTrue(data_exists('kyoto_dst'))
dst_vars = pyspedas.kyoto.dst(trange=["2019-10-15", "2019-10-16"])
self.assertTrue(data_exists("kyoto_dst"))
# real time
dst_vars = pyspedas.kyoto.dst(trange=['2022-7-15', '2022-7-16'])
self.assertTrue(data_exists('kyoto_dst'))
dst_vars = pyspedas.kyoto.dst(trange=["2022-07-15", "2022-07-16"])
self.assertTrue(data_exists("kyoto_dst"))

def test_errors(self):
pyspedas.kyoto.dst(trange=None)
pyspedas.kyoto.dst(trange=['1015-10-15', '1015-10-16'])
pyspedas.kyoto.dst(trange=["1015-10-15", "1015-10-16"])


if __name__ == '__main__':
if __name__ == "__main__":
unittest.main()

0 comments on commit db6b97a

Please sign in to comment.