models.raydarn.rt

Module: models.raydarn.rt

This module runs the raytracing code

Classes:

Note

The ray tracing requires mpi to run. You can adjust the number of processors, but be wise about it and do not assign more than you have

class models.raydarn.rt.Edens(readFrom, site=None, radar=None, debug=False)[source]

Store and process electron density profiles after ray tracing

Args:
  • readFrom (str): edens.dat file to read the rays from
  • [site] (:class:`pydarn.radar.site): radar site object
  • [radar] (:class:`pydarn.radar.radar): radar object
  • [debug] (bool): verbose mode
Methods:
plot(time, beam=None, maxground=2000, maxalt=500, nel_cmap='jet', nel_lim=[10, 12], title=False, fig=None, rect=111, ax=None, aax=None)[source]

Plot electron density profile

Args:
  • time (datetime.datetime): time of profile
  • [beam]: beam number
  • [maxground]: maximum ground range [km]
  • [maxalt]: highest altitude limit [km]
  • [nel_cmap]: color map name for electron density index coloring
  • [nel_lim]: electron density index plotting limits
  • [rect]: subplot spcification
  • [fig]: A pylab.figure object (default to gcf)
  • [ax]: Existing main axes
  • [aax]: Existing auxialary axes
  • [title]: Show default title
Returns:
  • ax: matplotlib.axes object containing formatting
  • aax: matplotlib.axes object containing data
  • cbax: matplotlib.axes object containing colorbar
Example:
# Show electron density profile
import datetime as dt
from models import raydarn
sTime = dt.datetime(2012, 11, 18, 5)
rto = raydarn.RtRun(sTime, rCode='bks', beam=12)
rto.readEdens() # read electron density into memory
ax, aax, cbax = rto.ionos.plot(sTime, title=True)
ax.grid()

written by Sebastien, 2013-04

readEdens(site=None, debug=False)[source]

Read edens.dat fortran output

Args:
  • [site] (pydarn.radar.radStrict.site): site object of current radar
  • [debug] (bool): print some i/o diagnostics
Returns:
  • Populate member edens rt.Edens
class models.raydarn.rt.Rays(readFrom, site=None, radar=None, saveToAscii=None, debug=False)[source]

Store and process individual rays after ray tracing

Args:
  • readFrom (str): rays.dat file to read the rays from
  • [site] (:class:`pydarn.radar.site): radar site object
  • [radar] (:class:`pydarn.radar.radar): radar object
  • [saveToAscii] (str): file name where to output ray positions
  • [debug] (bool): verbose mode
Methods:
plot(time, beam=None, maxground=2000, maxalt=500, step=1, showrefract=False, nr_cmap='jet_r', nr_lim=[0.8, 1.0], raycolor='0.3', title=False, fig=None, rect=111, ax=None, aax=None)[source]

Plot ray paths

Args:
  • time (datetime.datetime): time of rays
  • [beam]: beam number
  • [maxground]: maximum ground range [km]
  • [maxalt]: highest altitude limit [km]
  • [step]: step between each plotted ray (in number of ray steps)
  • [showrefract]: show refractive index along ray paths (supersedes raycolor)
  • [nr_cmap]: color map name for refractive index coloring
  • [nr_lim]: refractive index plotting limits
  • [raycolor]: color of ray paths
  • [rect]: subplot spcification
  • [fig]: A pylab.figure object (default to gcf)
  • [title]: Show default title
  • [ax]: Existing main axes
  • [aax]: Existing auxialary axes
Returns:
  • ax: matplotlib.axes object containing formatting
  • aax: matplotlib.axes object containing data
  • cbax: matplotlib.axes object containing colorbar
Example:
# Show ray paths with colored refractive index along path
import datetime as dt
from models import raydarn
sTime = dt.datetime(2012, 11, 18, 5)
rto = raydarn.RtRun(sTime, rCode='bks', beam=12, title=True)
rto.readRays() # read rays into memory
ax, aax, cbax = rto.rays.plot(sTime, step=10, showrefract=True, nr_lim=[.85,1])
ax.grid()

written by Sebastien, 2013-04

readRays(site=None, debug=False)[source]

Read rays.dat fortran output

Args:
  • [site] (pydarn.radar.radStrict.site): site object of current radar
  • [debug] (bool): print some i/o diagnostics
Returns:
  • Populate member paths rt.Rays
writeToAscii(fname)[source]

Save rays to ASCII file (limited use)

class models.raydarn.rt.RtRun(sTime=None, eTime=None, rCode=None, radarObj=None, dTime=0.5, freq=11, beam=None, nhops=1, elev=(5, 60, 0.1), azim=None, hmf2=None, nmf2=None, outDir=None, debug=False, fext=None, loadFrom=None, nprocs=4)[source]

This class runs the raytracing code and processes the output

Args:
  • [sTime] (datetime.datetime): start time UT
  • [eTime] (datetime.datetime): end time UT (if not provided run for a single time sTime)
  • [rCode] (str): radar 3-letter code
  • [radarObj] (pydarn.radar.radar): radar object (overrides rCode)
  • [dTime] (float): time step in Hours
  • [freq] (float): operating frequency [MHz]
  • [beam] (int): beam number (if None run all beams)
  • [nhops] (int): number of hops
  • [elev] (tuple): (start elevation, end elevation, step elevation) [degrees]
  • [azim] (tuple): (start azimuth, end azimuth, step azimuth) [degrees East] (overrides beam specification)
  • [hmf2] (float): F2 peak alitude [km] (default: use IRI)
  • [nmf2] (float): F2 peak electron density [log10(m^-3)] (default: use IRI)
  • [debug] (bool): print some diagnostics of the fortran run and output processing
  • [fext] (str): output file id, max 10 character long (mostly used for multiple users environments, like a website)
  • [loadFrom] (str): file name where a pickled instance of RtRun was saved (supersedes all other args)
  • [nprocs] (int): number of processes to use with MPI
Methods:
Example:
# Run a 2-hour ray trace from Blackstone on a random day
sTime = dt.datetime(2012, 11, 18, 5)
eTime = sTime + dt.timedelta(hours=2)
radar = 'bks'
# Save the results to your /tmp directory
rto = raydarn.RtRun(sTime, eTime, rCode=radar, outDir='/tmp')
clean()[source]

Clean-up files

load(filename)[source]

Load rt.RtRun from a file

readEdens(debug=False)[source]

Read edens.dat fortran output

Args:
  • [site] (pydarn.radar.radStrict.site): site object of current radar
  • [debug] (bool): print some i/o diagnostics
Returns:
  • Add a new member to rt.RtRun: rays, of type rt.rays
readRays(saveToAscii=None, debug=False)[source]

Read rays.dat fortran output into dictionnary

Args:
  • [saveToAscii] (str): output content to text file
  • [debug] (bool): print some i/o diagnostics
Returns:
  • Add a new member to rt.RtRun: rays, of type rt.rays
readScatter(debug=False)[source]

Read iscat.dat and gscat.dat fortran output

Args:
  • [site] (pydarn.radar.radStrict.site): site object of current radar
  • [debug] (bool): print some i/o diagnostics
Returns:
  • Add a new member to rt.RtRun: rays, of type rt.rays
save(filename)[source]

Save rt.RtRun to a file

class models.raydarn.rt.Scatter(readGSFrom=None, readISFrom=None, site=None, radar=None, debug=False)[source]

Stores and process ground and ionospheric scatter

Args:
  • readISFrom (str): iscat.dat file to read the ionospheric scatter from
  • readGSFrom (str): gscat.dat file to read the ground scatter from
  • [site] (:class:`pydarn.radar.site): radar site object
  • [debug] (bool): verbose mode
Methods:
plot(time, beam=None, maxground=2000, maxalt=500, iscat=True, gscat=True, title=False, weighted=False, cmap='hot_r', fig=None, rect=111, ax=None, aax=None, zorder=4)[source]

Plot scatter on ground/altitude profile

Args:
  • time (datetime.datetime): time of profile
  • [beam]: beam number
  • [iscat] (bool): show ionospheric scatter
  • [gscat] (bool): show ground scatter
  • [maxground]: maximum ground range [km]
  • [maxalt]: highest altitude limit [km]
  • [rect]: subplot spcification
  • [fig]: A pylab.figure object (default to gcf)
  • [ax]: Existing main axes
  • [aax]: Existing auxialary axes
  • [title]: Show default title
  • [weighted] (bool): plot ionospheric scatter relative strength (based on background density and range)
  • [cmap]: colormap used for weighted ionospheric scatter
Returns:
  • ax: matplotlib.axes object containing formatting
  • aax: matplotlib.axes object containing data
  • cbax: matplotlib.axes object containing colorbar
Example:
# Show ionospheric scatter
import datetime as dt
from models import raydarn
sTime = dt.datetime(2012, 11, 18, 5)
rto = raydarn.RtRun(sTime, rCode='bks', beam=12)
rto.readRays() # read rays into memory
ax, aax, cbax = rto.rays.plot(sTime, title=True)
rto.readScatter() # read scatter into memory
rto.scatter.plot(sTime, ax=ax, aax=aax)
ax.grid()

written by Sebastien, 2013-04

readGS(site=None, debug=False)[source]

Read gscat.dat fortran output

Args:
  • [site] (pydarn.radar.radStrict.site): site object of current radar
  • [debug] (bool): print some i/o diagnostics
Returns:
  • Populate member isc rt.Scatter
readIS(site=None, debug=False)[source]

Read iscat.dat fortran output

Args:
  • [site] (pydarn.radar.radStrict.site): site object of current radar
  • [debug] (bool): print some i/o diagnostics
Returns:
  • Populate member isc rt.Scatter
models.raydarn.rt

alias of models.raydarn.rt

Previous topic

models.raydarn

Next topic

models.tsyganenko

This Page