From 3bee8f70ae7f4eddf86ee372e706c1a1723cba90 Mon Sep 17 00:00:00 2001 From: Jeremy Fee <jmfee@usgs.gov> Date: Mon, 6 Apr 2020 08:54:19 -0600 Subject: [PATCH] Add test scripts until better integrated --- create_db.py | 3 +++ test_residual.py | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 create_db.py create mode 100644 test_residual.py diff --git a/create_db.py b/create_db.py new file mode 100644 index 00000000..1c34c2c2 --- /dev/null +++ b/create_db.py @@ -0,0 +1,3 @@ +from geomagio.api.db.create_db import create_db + +create_db() diff --git a/test_residual.py b/test_residual.py new file mode 100644 index 00000000..686dc530 --- /dev/null +++ b/test_residual.py @@ -0,0 +1,27 @@ +import json +from obspy import UTCDateTime + +from geomagio.residual import ( + CalFileFactory, + SpreadsheetAbsolutesFactory, + WebAbsolutesFactory, +) + + +input_factory = SpreadsheetAbsolutesFactory() +readings = input_factory.get_readings( + observatory="CMO", + starttime=UTCDateTime(2020, 1, 1), + endtime=UTCDateTime(2020, 1, 8), +) +print( + json.dumps( + readings, + default=lambda x: isinstance(x, UTCDateTime) and str(x) or x.__dict__, + indent=2, + ) +) + +output_factory = CalFileFactory() +out = output_factory.format_readings(readings) +print(out) -- GitLab