Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 06d0499
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Fri Mar 30 03:28:53 2018 -0400

    lat profile working

commit 2720d13
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Fri Mar 30 02:54:27 2018 -0400

    fixed time profile too

commit 95082c2
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Fri Mar 30 02:43:56 2018 -0400

    needs thorough cleaning

commit 4b7eee9
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Fri Mar 30 02:40:27 2018 -0400

    altitude profile OK

commit 6c80575
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Tue Mar 6 23:27:05 2018 -0500

    template

commit 2ced97a
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Tue Mar 6 23:19:22 2018 -0500

    mpl2.2

commit 7fdac07
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 18:28:45 2018 -0500

    log

commit c994f87
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 18:12:32 2018 -0500

    alt plots OK

commit 5c76e42
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 18:07:46 2018 -0500

    uniform alt grid fixed

commit d2c48f3
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 17:42:23 2018 -0500

    ig

commit 8d1fb84
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 17:42:05 2018 -0500

    ig

commit 93e261a
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 17:41:35 2018 -0500

    INWORK: debug altitude all one height

commit e4dc4e3
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 17:29:58 2018 -0500

    first time density profile plot workign

commit adc1d9f
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 17:11:39 2018 -0500

    passing out data, fixing up plots

commit 60a814b
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 16:48:49 2018 -0500

    disable FIRI by default

commit 2a9218e
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 16:27:55 2018 -0500

    import syntax

commit 25e18df
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 16:20:28 2018 -0500

    OK repeated run

commit e195488
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 15:43:28 2018 -0500

    simplify

commit 803b41b
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 15:23:32 2018 -0500

    cleaning up

commit ac3483d
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 14:58:55 2018 -0500

    cleanup

commit 4cdbcd9
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 14:56:29 2018 -0500

    deblank

commit 95e7776
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 14:44:34 2018 -0500

    needed to read ig_rz.dat

commit dc14f41
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 14:27:21 2018 -0500

    pass data directory, error stop

commit 692d7b8
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 13:53:01 2018 -0500

    error stop

commit f7181af
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 13:42:52 2018 -0500

    init

commit f8ff215
Author: Michael Hirsch, Ph.D <scivision@users.noreply.github.com>
Date:   Mon Mar 5 13:42:44 2018 -0500

    large cleanup
  • Loading branch information
scivision committed Mar 30, 2018
1 parent b10cdc5 commit 99e94a2
Show file tree
Hide file tree
Showing 25 changed files with 1,446 additions and 1,397 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,3 +1,5 @@
baseIRI2016
testiri2016
bin/

# Byte-compiled / optimized / DLL files
Expand Down
9 changes: 6 additions & 3 deletions .travis.yml
Expand Up @@ -21,8 +21,11 @@ before_install:
# temp for pip < 9.1
- pip -q install numpy

install: pip install -e .[tests]
install: pip -q install -e .[tests]

script: coverage run tests/test_all.py -v
script:
- pytest -v

after_success: coveralls
after_success:
- coverage run tests/test_all.py
- coveralls
38 changes: 38 additions & 0 deletions AltitudeProfile.py
@@ -0,0 +1,38 @@
#!/usr/bin/env python
""" Height Profile Example """
import pyiri2016
#
import numpy as np
from matplotlib.pyplot import figure, show

glat, glon = -11.95, -76.77

alt_km = np.arange(80,1000,20.)

iri = pyiri2016.IRI('2012-08-21T12', alt_km, glat, glon)

fig = figure(figsize=(16,6))
axs = fig.subplots(1,2)

fig.suptitle(f'{str(iri.time[0].values)[:-13]}\n Glat, Glon: {iri.glat}, {iri.attrs["glon"]}')


pn = axs[0]
pn.plot(iri['ne'].squeeze(), iri.alt_km, label='N$_e$')
#pn.set_title(iri2016Obj.title1)
pn.set_xlabel('Density (m$^{-3}$)')
pn.set_ylabel('Altitude (km)')
pn.set_xscale('log')
pn.legend(loc='best')
pn.grid(True)

pn = axs[1]
pn.plot(iri['Ti'].squeeze(), iri.alt_km, label='T$_i$')
pn.plot(iri['Te'].squeeze(), iri.alt_km, label='T$_e$')
#pn.set_title(iri2016Obj.title2)
pn.set_xlabel('Temperature (K)')
pn.set_ylabel('Altitude (km)')
pn.legend(loc='best')
pn.grid(True)

show()
45 changes: 45 additions & 0 deletions LatitudeProfile.py
@@ -0,0 +1,45 @@
#!/usr/bin/env python
import pyiri2016
from numpy import arange
from matplotlib.pyplot import figure, show

""" Geog. Latitude Profile Example """

latlim = [-60, 60]
latstp = 2.
sim = pyiri2016.geoprofile(altkm=600, latlim=latlim, dlat=latstp, \
glon=-76.77, time='2004-01-01T17')

latbins = arange(latlim[0], latlim[1], latstp)


fig = figure(figsize=(8,12))
axs = fig.subplots(2,1, sharex=True)

pn = axs[0]

pn.plot(latbins, sim['NmF2'].squeeze(), label='N$_m$F$_2$')
pn.plot(latbins, sim['NmF1'].squeeze(), label='N$_m$F$_1$')
pn.plot(latbins, sim['NmE'].squeeze(), label='N$_m$E')
pn.set_title(str(sim.time[0].values)[:-13] + ' latitude'+str(latlim))
pn.set_xlim(latbins[[0, -1]])
pn.set_xlabel('Geog. Lat. ($^\circ$)')
pn.set_ylabel('(m$^{-3}$)')
pn.set_yscale('log')


pn = axs[1]
pn.plot(latbins, sim['hmF2'].squeeze(), label='h$_m$F$_2$')
pn.plot(latbins, sim['hmF1'].squeeze(), label='h$_m$F$_1$')
pn.plot(latbins, sim['hmE'].squeeze(), label='h$_m$E')
pn.set_xlim(latbins[[0, -1]])
pn.set_title(str(sim.time[0].values)[:-13] + ' latitude'+str(latlim))
pn.set_xlabel('Geog. Lat. ($^\circ$)')
pn.set_ylabel('(km)')

for a in axs:
a.legend(loc='best')
a.grid(True)


show()
8 changes: 4 additions & 4 deletions README.rst
Expand Up @@ -31,20 +31,20 @@ Usage
Height-profile
---------------

`plot density and temperatures vs height <examples/iri1DExample01.py>`_
`plot density and temperatures vs height <AltitudeProfile.py>`_

.. image:: figures/iri1DExample01.png

Latitudinal profile
-------------------

`plot densities and height at the peak of F2, F2, and E regions vs geographic latitude <examples/iri1DExample02.py>`_
`plot densities and height at the peak of F2, F2, and E regions vs geographic latitude <LatitudeProfile.py>`_

.. image:: figures/iri1DExample02.png

GMT profile
-----------
`plot densities and height at the peak of F2, F2, and E regions vs universal time <examples/iri_timeprofile.py>`_
`plot densities and height at the peak of F2, F2, and E regions vs universal time <TimeProfile.py>`_

.. image:: figures/iri1DExample08.png

Expand Down Expand Up @@ -74,7 +74,7 @@ Fortran compile

make

./testiri2016
make test


f2py compile
Expand Down
104 changes: 104 additions & 0 deletions TimeProfile.py
@@ -0,0 +1,104 @@
#!/usr/bin/env python
""" Time Profile: IRI2016 """
import numpy as np
from datetime import timedelta
from matplotlib.pyplot import figure, show
try:
import ephem
except ImportError:
ephem = None
#
import pyiri2016


# %% user parameters
#lat = -11.95; lon = -76.77
#glat, glon = 0,0
glat,glon = 65,-148
alt_km = np.arange(120, 180, 20)
# %% ru
sim = pyiri2016.timeprofile(('2012-08-21','2012-08-22'),timedelta(hours=0.25),
alt_km,glat,glon)

# %% Plots
Nplot=3

if Nplot>2:
fig = figure(figsize=(16,12))
axs = fig.subplots(3,1, sharex=True).ravel()
else:
fig = figure(figsize=(16,6))
axs = fig.subplots(1,2).ravel()

fig.suptitle(f'{str(sim.time[0].values)[:-13]} to {str(sim.time[-1].values)[:-13]}\n Glat, Glon: {sim.glat}, {sim.glon}')

ax = axs[0]
#NmF1 = pyiri2016.IRI2016()._RmNeg(sim.b[2, :])
#NmE = sim.loc[4, :]
ax.plot(sim.time, sim['NmF2'].squeeze(), label='N$_m$F$_2$')
#ax.plot(sim.time, NmF1, label='N$_m$F$_1$')
#ax.plot(sim.time, NmE, label='N$_m$E')
ax.set_title('Maximum number densities vs. ionospheric layer')
ax.set_xlabel('Hour (UT)')
ax.set_ylabel('(m$^{-3}$)')
ax.set_yscale('log')
ax.legend(loc='best')

ax = axs[1]
#hmF1 = pyiri2016.IRI2016()._RmNeg(sim.b[3, :])
#hmE = sim.b[5, :]
ax.plot(sim.time, sim['hmF2'].squeeze(), label='h$_m$F$_2$')
#ax.plot(sim.time, hmF1, label='h$_m$F$_1$')
#ax.plot(sim.time, hmE, label='h$_m$E')
ax.set_title('Height of maximum density vs. ionospheric layer')
ax.set_xlabel('Hour (UT)')
ax.set_ylabel('(km)')
ax.legend(loc='best')
# %%
if Nplot > 2:
ax = axs[2]

for a in sim.alt_km:
ax.plot(sim.time, sim['ne'].squeeze(), marker='.', label=f'{a.item()} km')
ax.set_xlabel('time UTC (hours)')
ax.set_ylabel('[m$^{-3}$]')
ax.set_title(f'$N_e$ vs. altitude and time')
ax.set_yscale('log')
ax.legend(loc='best')
# %%
if Nplot > 4:
ax = axs[4]
tec = sim.b[36, :]
ax.plot(sim.time, tec, label=r'TEC')
ax.set_xlabel('Hour (UT)')
ax.set_ylabel('(m$^{-2}$)')
#ax.set_yscale('log')
ax.legend(loc='best')

ax = axs[5]
vy = sim.b[43, :]
ax.plot(sim.time, vy, label=r'V$_y$')
ax.set_xlabel('Hour (UT)')
ax.set_ylabel('(m/s)')
ax.legend(loc='best')

for a in axs.ravel():
a.grid(True)


if __name__ == '__main__':
from argparse import ArgumentParser
p = ArgumentParser(description='IRI2016 time profile plot')
p.add_argument('-t','--trange',help='START STOP STEP (hours) time [UTC]',nargs=3,
default=('2012-08-21','2012-08-22',0.25))
p.add_argument('--alt',help='START STOP STEP altitude [km]',type=float, nargs=3,default=(120,180,20))
p.add_argument('-c','--latlon',help='geodetic coordinates of simulation',
type=float,default=(65,-147.5))
p.add_argument('--f107',type=float,default=200.)
p.add_argument('--f107a', type=float,default=200.)
p.add_argument('--ap', type=int, default=4)
p.add_argument('--species',help='species to plot',nargs='+',default=('ne'))
p = p.parse_args()


show()
21 changes: 11 additions & 10 deletions data/index/ig_rz.dat
@@ -1,4 +1,4 @@
10,17,2016,
11,2,2017,

1,1958,12,2018,

Expand Down Expand Up @@ -61,10 +61,10 @@
75.5, 75.8, 75.1, 74.5, 75.4, 78.0, 79.4, 81.6, 86.6, 90.8, 92.1, 91.8,
92.1, 92.5, 93.2, 94.8, 95.6, 96.0, 96.8, 96.8, 94.4, 92.0, 91.4, 91.2,
90.1, 88.1, 85.0, 81.0, 76.4, 71.3, 66.5, 62.0, 58.5, 55.5, 53.0, 50.1,
41.0, 38.5, 37.0, 35.7, 35.3, 35.3, 34.1, 33.5, 33.2, 33.9, 34.4, 33.0,
35.6, 30.3, 31.0, 29.6, 30.7, 28.9, 27.0, 23.6, 22.2, 15.7, 17.4, 11.8,
9.0, 8.3, 6.9, 3.0, 4.1, 8.8, 6.2, 8.5, 11.5, 13.5, 15.2, 14.3,
18.3,
41.0, 38.5, 37.0, 35.2, 32.3, 28.6, 24.7, 21.2, 18.2, 15.9, 14.2, 12.6,
11.0, 9.2, 8.0, 8.3, 8.7, 9.3, 9.8, 8.6, 9.8, 9.7, 9.7, 9.5,
8.1, 9.5, 8.0, 9.6, 8.8, 10.0, 7.7, 5.9, 6.6, 5.7, 7.2, 5.2,
2.5,

200.1,
199.0,200.9,201.3,196.8,191.4,186.8,185.2,184.9,183.8,182.2,180.7,180.5,
Expand Down Expand Up @@ -124,9 +124,10 @@
65.5, 66.9, 66.8, 64.6, 61.7, 58.9, 57.8, 58.2, 58.1, 58.6, 59.7, 59.6,
58.7, 58.4, 57.5, 57.8, 59.8, 62.6, 65.4, 68.9, 73.1, 75.0, 75.4, 76.0,
109.3,110.5,114.3,116.4,115.0,114.1,112.6,108.3,101.9, 97.3, 94.7, 92.2,
89.3, 86.1, 82.2, 78.9, 76.1, 72.1, 68.3, 66.4, 65.9, 64.3, 61.3 57.8,
54.5, 52.6, 50.6, 48.2, 46.3, 44.5, 42.7, 40.9, 39.2, 38.2, 37.1, 36.7,
37.0, 35.9, 34.3, 33.2, 32.0, 30.7, 29.4, 28.3, 27.4, 26.7, 26.1, 25.3,
24.5, 23.6, 22.6, 21.8, 21.2, 20.3, 19.5, 18.6, 17.4, 16.5, 15.9, 15.5,
15.3,
89.3, 86.1, 82.2, 78.9, 76.1, 72.1, 68.3, 66.4, 65.9, 64.3, 61.2, 57.8,
54.4, 52.5, 50.4, 47.8, 44.8, 41.5, 38.5, 36.0, 33.2, 31.5, 29.9, 28.5,
27.8, 26.5, 25.8, 24.9, 24.1, 24.1, 23.9, 23.4, 23.2, 22.6, 21.9, 21.7,
21.5, 20.6, 18.6, 17.4, 17.0, 16.1, 15.4, 14.8, 14.3, 14.0, 13.7, 13.2,
12.7


94 changes: 0 additions & 94 deletions examples/TimeProfile.py

This file was deleted.

5 changes: 2 additions & 3 deletions examples/example01.py
@@ -1,9 +1,8 @@
#!/usr/bin/env python
from pyiri2016 import IRI2016
from pyiri2016 import IRI


sim = IRI2016()
IRIData, IRIDATAAdd = sim.IRI()
IRIData, IRIDATAAdd = IRI()
print('Ne {:.3e}'.format(IRIData['ne']))
print('NmF2 {:.3e}'.format(IRIDATAAdd['NmF2']))
print('hmF2 {:.3e}'.format(IRIDATAAdd['hmF2']))

0 comments on commit 99e94a2

Please sign in to comment.