-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use python -m iri2016. instead of console_scripts
- Loading branch information
Showing
10 changed files
with
157 additions
and
105 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
dist: bionic | ||
# Matlab R2020a libstdc++ needs Ubuntu 18.04 | ||
|
||
language: matlab | ||
|
||
matlab: | ||
- latest | ||
|
||
os: | ||
- linux | ||
|
||
git: | ||
- depth: 3 | ||
- quiet: true | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- gfortran | ||
snaps: | ||
- name: cmake | ||
confinement: classic | ||
|
||
before_script: | ||
- export PATH=/snap/bin:$PATH | ||
|
||
script: | ||
- matlab -batch "r = runtests('iri2016'); assert(~isempty(r)); assertSuccess(r)" |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from .base import IRI | ||
|
||
from argparse import ArgumentParser | ||
import typing as T | ||
|
||
|
||
def main(time: str, alt_km: T.Sequence[float], glat: float, glon: float): | ||
""" Height Profile Example """ | ||
|
||
return IRI(time, alt_km, glat, glon) | ||
|
||
|
||
def cli(): | ||
p = ArgumentParser(description="IRI2016 altitude profile") | ||
p.add_argument("time", help="time of simulation") | ||
p.add_argument("latlon", help="geodetic latitude, longitude (degrees)", type=float, nargs=2) | ||
p.add_argument("-alt_km", help="altitude START STOP STEP (km)", type=float, nargs=3, default=(80, 1000, 10)) | ||
P = p.parse_args() | ||
|
||
iono = main(P.time, P.alt_km, *P.latlon) | ||
|
||
try: | ||
from matplotlib.pyplot import show | ||
import iri2016.plots as piri | ||
|
||
piri.altprofile(iono) | ||
show() | ||
except ImportError: | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from .profile import geoprofile | ||
|
||
from pathlib import Path | ||
from argparse import ArgumentParser | ||
import typing as T | ||
|
||
|
||
def main(time: str, alt_km: float, glat: T.Sequence[float], glon: float, outfn: Path = None): | ||
""" latitude Profile Example """ | ||
|
||
iono = geoprofile(latrange=glat, glon=glon, altkm=alt_km, time=time) | ||
|
||
if outfn: | ||
outfn = Path(outfn).expanduser() | ||
print("writing", outfn) | ||
iono.to_netcdf(outfn) | ||
|
||
return iono | ||
|
||
|
||
def cli(): | ||
p = ArgumentParser(description="IRI2016 latitude profile") | ||
p.add_argument("time", help="time of simulation") | ||
p.add_argument("glon", help="geodetic longitude (degrees)", type=float) | ||
p.add_argument("-glat", help="geodetic latitude START STOP STEP (degrees)", type=float, nargs=3, default=(-60, 60, 2.0)) | ||
p.add_argument("-alt_km", help="altitude (km)", type=float, default=300.0) | ||
p.add_argument("-o", "--outfn", help="write data to file") | ||
P = p.parse_args() | ||
|
||
iono = main(P.time, P.alt_km, P.glat, P.glon, P.outfn) | ||
|
||
try: | ||
from matplotlib.pyplot import show | ||
import iri2016.plots as piri | ||
|
||
piri.latprofile(iono) | ||
show() | ||
except ImportError: | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
import pytest | ||
import iri2016.time as time_profile | ||
import iri2016.latitude as lat_profile | ||
import iri2016.altitude as alt_profile | ||
|
||
import subprocess | ||
import os | ||
|
||
|
||
@pytest.mark.skipif(os.environ.get("CI") is not None, reason="CI no display") | ||
def test_latitude(): | ||
pytest.importorskip("matplotlib") | ||
subprocess.check_call(["iri2016_latitude", "-148"]) | ||
lat_profile.main("2012-01-01", 300, (-60, 60, 2.0), -148) | ||
|
||
|
||
@pytest.mark.skipif(os.environ.get("CI") is not None, reason="CI no display") | ||
def test_time(): | ||
pytest.importorskip("matplotlib") | ||
subprocess.check_call(["iri2016_time", "2012-01-01", "2012-01-02", "1.0", "65", "-148"]) | ||
time_profile.main(("2012-01-01", "2012-01-02", 1.0), (100, 200, 20), 65, -148) | ||
|
||
|
||
@pytest.mark.skipif(os.environ.get("CI") is not None, reason="CI no display") | ||
def test_alt(): | ||
pytest.importorskip("matplotlib") | ||
subprocess.check_call(["iri2016_altitude", "2012-01-01", "65", "-148"]) | ||
alt_profile.main("2012-01-01", (80, 1000, 10), 65, -148) |
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,33 @@ | ||
from .profile import timeprofile | ||
|
||
from argparse import ArgumentParser | ||
from datetime import timedelta | ||
import typing as T | ||
|
||
|
||
def main(time: T.Sequence[str], alt_km: T.Sequence[float], glat: float, glon: float): | ||
""" IRI2016 time profile """ | ||
return timeprofile((time[0], time[1]), timedelta(hours=float(time[2])), alt_km, glat, glon) | ||
|
||
|
||
def cli(): | ||
p = ArgumentParser() | ||
p.add_argument("time", help="start yy-mm-dd, stop yy-mm-dd, step_hour", nargs=3) | ||
p.add_argument("latlon", help="geodetic latitude, longitude (degrees)", nargs=2, type=float) | ||
p.add_argument("-alt_km", help="altitude START STOP STEP (km)", type=float, nargs=3, default=(100, 200, 20)) | ||
P = p.parse_args() | ||
|
||
iono = main(P.time, P.alt_km, *P.latlon) | ||
|
||
try: | ||
from matplotlib.pyplot import show | ||
import iri2016.plots as piri | ||
|
||
piri.timeprofile(iono) | ||
show() | ||
except ImportError: | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() |