Skip to content

Commit

Permalink
Merge pull request #175 from rstoneback/documentation
Browse files Browse the repository at this point in the history
Documentation update
  • Loading branch information
jklenzing committed Mar 2, 2019
2 parents ed3c512 + 267b79f commit 8c14861
Show file tree
Hide file tree
Showing 10 changed files with 350 additions and 240 deletions.
12 changes: 6 additions & 6 deletions demo/cnofs_vefi_dc_b_orbit_plots.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
'''
"""
Demonstrates iterating over an instrument data set by orbit and plotting the
results.
'''
"""

import os
import pysat
import matplotlib.pyplot as plt
import pandas as pds

# set the directory to save plots to
results_dir = ''
Expand All @@ -18,8 +17,8 @@
clean_level=None, orbit_info=orbit_info)

# set limits on dates analysis will cover, inclusive
start = pds.datetime(2010, 5, 9)
stop = pds.datetime(2010, 5, 12)
start = pysat.datetime(2010, 5, 9)
stop = pysat.datetime(2010, 5, 12)

# if there is no vefi dc magnetometer data on your system, then run command
# below where start and stop are pandas datetimes (from above)
Expand Down Expand Up @@ -79,5 +78,6 @@
ax[6].set_xlim((0, 360))

f.tight_layout()
plt.savefig(os.path.join(results_dir, 'orbit_%05i.png' % orbit_count))
plt.savefig(os.path.join(results_dir,
'orbit_{num:05}.png').format(num=orbit_count))
plt.close()
8 changes: 4 additions & 4 deletions demo/cosmic_and_ivm_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def geo2mag(incoord):
r = 1.0

# convert first to radians
lon, lat = [x*pi/180 for x in lon, lat]
lon, lat = [x*pi/180 for x in [lon, lat]]

glat = incoord[0] * pi / 180.0
glon = incoord[1] * pi / 180.0
Expand Down Expand Up @@ -273,15 +273,15 @@ def addTopsideScaleHeight(cosmic):
cbar.set_label('Scale Height (km)')
axarr[3].set_xlabel('Apex Longitude')
f.tight_layout()
f.savefig('1D_params.png')
f.savefig('ssnl_median_ivm_cosmic_1d.png')


# make COSMIC profile plots
# 6 pages of plots, 4 plots per page
for k in np.arange(6):
f, axarr = plt.subplots(4, sharex=True, figsize=(8.5, 11))
# iterate over a group of four sectors at a time (4 plots per page)
for (j, sector) in enumerate(zip(*cosmicResults['profiles']['median'])
for (j, sector) in enumerate(list(zip(*cosmicResults['profiles']['median']))
[k * 4:(k + 1) * 4]):
# iterate over all local times within longitude sector
# data is returned from the median routine in plot order, [y, x]
Expand Down Expand Up @@ -309,4 +309,4 @@ def addTopsideScaleHeight(cosmic):
axarr[-1].set_xticks([0., 6., 12., 18., 24.])
axarr[-1].set_xlabel('Solar Local Time of Profile Maximum Density')
f.tight_layout()
f.savefig('cosmic_part%i' % (k))
f.savefig('cosmic_part{}.png'.format(k))
17 changes: 8 additions & 9 deletions demo/ssnl_occurrence_by_orbit.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
'''
"""
Demonstrates iterating over an instrument data set by orbit and determining
the occurrent probability of an event occurring.
'''
"""

import os
import pysat
import matplotlib.pyplot as plt
import pandas as pds
import numpy as np

# set the directory to save plots to
Expand All @@ -19,7 +18,7 @@
clean_level=None, orbit_info=orbit_info)


# define functino to remove flagged values
# define function to remove flagged values
def filter_vefi(inst):
idx, = np.where(vefi['B_flag'] == 0)
vefi.data = vefi.data.iloc[idx]
Expand All @@ -28,8 +27,8 @@ def filter_vefi(inst):

vefi.custom.add(filter_vefi, 'modify')
# set limits on dates analysis will cover, inclusive
start = pds.datetime(2010, 5, 9)
stop = pds.datetime(2010, 5, 15)
start = pysat.datetime(2010, 5, 9)
stop = pysat.datetime(2010, 5, 15)

# if there is no vefi dc magnetometer data on your system, then run command
# below where start and stop are pandas datetimes (from above)
Expand Down Expand Up @@ -60,13 +59,13 @@ def filter_vefi(inst):
plt.colorbar(im, ax=axarr[0], label='Occurrence Probability')

im = axarr[1].pcolor(ans['bin_x'], ans['bin_y'], ans['count'])
axarr[1].set_title('Number of Orbits in Bin')
axarr[1].set_xlabel('Longitude')
axarr[1].set_xticks((0, 60, 120, 180, 240, 300, 360))
axarr[1].set_xlim((ans['bin_x'][0], ans['bin_x'][-1]))
axarr[1].set_ylabel('Latitude')
axarr[1].set_title('Number of Orbits in Bin')

plt.colorbar(im, ax=axarr[1], label='Counts')

f.tight_layout()
plt.show()
plt.savefig(os.path.join(results_dir, 'ssnl_occurrence_by_orbit_demo'))
plt.close()
Loading

0 comments on commit 8c14861

Please sign in to comment.