-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,702 additions
and
1,380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,7 +140,7 @@ | |
except ImportError: | ||
pass | ||
|
||
__version__ = '0.9.6' | ||
__version__ = '0.9.7' | ||
__author__ = 'Martin Paces ([email protected])' | ||
__copyright__ = 'Copyright (C) 2014 EOX IT Services GmbH' | ||
__licence__ = 'EOX licence (MIT style)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2,740 changes: 1,370 additions & 1,370 deletions
2,740
eoxmagmod/eoxmagmod/tests/data/QuasiDipoleTestData.tsv
Large diffs are not rendered by default.
Oops, something went wrong.
96 changes: 96 additions & 0 deletions
96
eoxmagmod/eoxmagmod/tests/data/update_quasi_dipole_test_data.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#------------------------------------------------------------------------------- | ||
# | ||
# Quasi-Dipole coordinates - test | ||
# | ||
# Author: Martin Paces <[email protected]> | ||
# | ||
#------------------------------------------------------------------------------- | ||
# Copyright (C) 2018 EOX IT Services GmbH | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies of this Software or works derived from this Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
#------------------------------------------------------------------------------- | ||
#pylint: disable=missing-docstring | ||
|
||
import sys | ||
try: | ||
# Python 2 | ||
from itertools import izip as zip | ||
except ImportError: | ||
pass | ||
from numpy import array | ||
from eoxmagmod import mjd2000_to_decimal_year | ||
from eoxmagmod.quasi_dipole_coordinates import ( | ||
eval_mlt, eval_subsol, eval_qdlatlon_with_base_vectors, | ||
) | ||
|
||
EARTH_RADIUS = 6371.2 # km | ||
START_TIME = 0.0 # MJD2000 / 2000-01-01T00:00:00Z | ||
END_TIME = 7305.0 # MJD2000 / 2020-01-01T00:00:00Z | ||
|
||
|
||
def load_coordinates(file_in): | ||
|
||
_ = next(file_in) | ||
|
||
times, lats, lons, rads = [], [], [], [] | ||
|
||
for line in file_in: | ||
time, _, lat, lon, rad = [float(v) for v in line.split()[:5]] | ||
times.append(time) | ||
lats.append(lat) | ||
lons.append(lon) | ||
rads.append(rad) | ||
|
||
return array(times), array(lats), array(lons), array(rads) | ||
|
||
|
||
def update_test_data(file_out, time_mjd2000, lat, lon, rad): | ||
""" Generate test dataset. """ | ||
time_decimal_year = mjd2000_to_decimal_year(time_mjd2000) | ||
|
||
qdlat, qdlon, f11, f12, f21, f22, f__ = eval_qdlatlon_with_base_vectors( | ||
lat, lon, rad, time_decimal_year | ||
) | ||
mlt = eval_mlt(qdlon, time_mjd2000) | ||
sol_lat, sol_lon = eval_subsol(time_mjd2000) | ||
|
||
header = [ | ||
"MJD2000", "DecimalYear", "Latitude", "Longitude", "Radius", | ||
"QDLatitude", "QDLongitude", "F11", "F12", "F21", "F22", "F", | ||
"MagneticLocalTime", "SubsolarLatitude", "SubsolarLongitude", | ||
] | ||
records = zip( | ||
time_mjd2000, time_decimal_year, lat, lon, rad, | ||
qdlat, qdlon, f11, f12, f21, f22, f__, | ||
mlt, sol_lat, sol_lon | ||
) | ||
|
||
file_out.write("\t".join(header) + "\n") | ||
for record in records: | ||
file_out.write("\t".join("%.14e" % value for value in record) + "\n") | ||
|
||
|
||
def main(filename): | ||
with open(filename) as file_in: | ||
time, lat, lon, rad = load_coordinates(file_in) | ||
update_test_data(sys.stdout, time, lat, lon, rad) | ||
|
||
|
||
if __name__ == "__main__": | ||
main(sys.argv[1]) |