This notebook will demonstrate how to do basic SuperDARN data plotting.


In [1]:
%pylab inline
import datetime
import os
import matplotlib.pyplot as plt
from davitpy import pydarn


Populating the interactive namespace from numpy and matplotlib

In [2]:
sTime = datetime.datetime(2008,2,22)
eTime = datetime.datetime(2008,2,23)
radar = 'bks'
beam  = 7

Remote File RTI Plots


In [3]:
#The following command will print the docstring for the plotRti routine:
#pydarn.plotting.rti.plotRti?

In [4]:
fig = plt.figure(figsize=(14,12)) #Define a figure with a custom size.
pydarn.plotting.rti.plotRti(sTime, radar, eTime=eTime, bmnum=beam, figure=fig)
plt.show()


Found cached file: /tmp/sd/20080222.000000.20080223.000000.bks.fitex

reached end of data
plotting took: 0:00:05.204070
/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py:387: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure
  "matplotlib is currently using a non-GUI backend, "

In [5]:
#Now save as a PNG to your home folder...
home = os.getenv('HOME')
filename = os.path.join(home,'rti.png')
fig.savefig(filename)

In [6]:
fig.clear() #Clear the figure from memory.

Local File RTI Plot

You can also plot data stored in a local file. Just change the variables in the cell below.


In [7]:
fileName = '/tmp/sd/20080222.000000.20080223.000000.bks.fitex'
fileType = 'fitex'
radar = 'bks'
beam  = 7
sTime = datetime.datetime(2008,2,22)
eTime = datetime.datetime(2008,2,23)

fig = plt.figure(figsize=(14,12)) #Define a figure with a custom size.
pydarn.plotting.rti.plotRti(sTime, radar, eTime=eTime, bmnum=beam, figure=fig, fileName=fileName,fileType=fileType)
plt.show()


cp /tmp/sd/20080222.000000.20080223.000000.bks.fitex /tmp/sd/1426173571
Concatenating all the files in to one
cat /tmp/sd/1426173571 > /tmp/sd/20080222.000000.20080223.000000.bks.fitex
rm /tmp/sd/1426173571

reached end of data
plotting took: 0:00:05.474366

In [8]:
fig.clear() #Clear the figure from memory.

Fan Plots

Right now we don't have plotFan setup to accept local files. But, we will add that in shortly.

Geopgraphic Coordinates


In [9]:
import datetime
import os
import matplotlib.pyplot as plt
from davitpy import pydarn

pydarn.plotting.fan.plotFan(datetime.datetime(2013,3,16,16,30),['fhe','fhw'],param='power',gsct=False)


Found cached file: /tmp/sd/20130316.163000.20130316.163100.fhe.fitex
Found cached file: /tmp/sd/20130316.163000.20130316.163100.fhw.fitex
Warning, setting dateTime to datetime
Warning, setting dateTime to datetime
0:00:02.030614

reached end of data

reached end of data
<matplotlib.figure.Figure at 0x5add3d0>
/usr/local/lib/python2.7/dist-packages/matplotlib/text.py:52: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if rotation in ('horizontal', None):
/usr/local/lib/python2.7/dist-packages/matplotlib/text.py:54: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  elif rotation == 'vertical':

Magnetic Coordinates

Magnetic coordinates still need a little work. For instance, high latitude continent lines don't always plot. Also, we are working on getting Simon's new AACGM system in place (http://dx.doi.org/doi/10.1002/2014JA020264). Not there yet...


In [10]:
import datetime
import os
import matplotlib.pyplot as plt
from davitpy import pydarn

pydarn.plotting.fan.plotFan(datetime.datetime(2013,3,16,16,30),['fhe','fhw'],param='power',gsct=False,coords='mag')


Found cached file: /tmp/sd/20130316.163000.20130316.163100.fhe.fitex
Found cached file: /tmp/sd/20130316.163000.20130316.163100.fhw.fitex
Warning, setting dateTime to datetime
Warning, setting dateTime to datetime
0:00:01.811914

reached end of data

reached end of data
<matplotlib.figure.Figure at 0x6cd0f90>

Convection Plotting


In [11]:
import datetime
import matplotlib.pyplot as plt
import davitpy.pydarn.plotting.plotMapGrd
from davitpy.utils import *

fig = plt.figure(figsize=(15,15))
ax = fig.add_subplot(111)

sdate = datetime.datetime(2011,4,3,4,0)
mObj = plotUtils.mapObj(boundinglat=50.,gridLabels=True, coords='mag')
mapDatObj = davitpy.pydarn.plotting.plotMapGrd.MapConv(sdate, mObj, ax)
mapDatObj.overlayMapFitVel()
mapDatObj.overlayCnvCntrs()
mapDatObj.overlayHMB()


Warning, datetime/dateTime not specified, using current time.
Found cached file: /tmp/sd/20110403.040000.20110403.040200.north.grdex
Found cached file: /tmp/sd/20110403.040000.20110403.040200.north.mapex

In [ ]: