Ray-tracing model


This notebook illustrate how to use the ray-tracing included with DaViTpy


In [1]:
############################################
# This code adds davitpy to your python path
# Eventually, this won't be necessary
import sys
sys.path.append('/davitpy')
############################################

In [2]:
import datetime as dt
from models import raydarn

In [3]:
sTime = dt.datetime(2006, 2, 22, 22)
eTime = dt.datetime(2006, 2, 23, 5)
radar = 'wal'
beam = 3
freq = 10.5

In [5]:
# Run the ray tracing for the specified period, radar, beam and frequency
# Use 4 threads (MPI) and output everything to /tmp
rto = raydarn.RtRun(sTime, eTime, 
    rCode=radar, beam=beam, freq=freq, 
    outDir='/tmp', nprocs=4)

In [6]:
# Read rays into memory
rto.readRays()

In [7]:
# Plot rays with refractive index color scale
# Plot 1 ray in 10 (1deg increment)
# Plot at start time
figure(figsize=(15,5))
rcParams.update({'font.size': 14})

ax, aax, cbax = rto.rays.plot(sTime, 
    step=10, showrefract=True, nr_lim=[.85,1])

ax.grid()



In [8]:
# Read electron densities into memory
rto.readEdens()

In [9]:
# Plot rays and electron densities together
# Plot at start time
# Plot range markers (every 250 km)
figure(figsize=(15,5))
rcParams.update({'font.size': 14})

ax, aax, cbax = rto.ionos.plot(sTime)
ax, aax, cbax = rto.rays.plot(sTime, 
    step=10, ax=ax, aax=aax)
rto.rays.showRange()

ax.grid()


/davitpy/models/raydarn/rt.py:446: RuntimeWarning: invalid value encountered in log10
  im = aax.pcolormesh(X, Y, np.log10( self.edens[time][beam]['nel'] ),

In [10]:
# Read ionospheric and ground scatter into memory
rto.readScatter()

In [11]:
# Plot ionospheric and ground scatter together
# Plot at start time
# Plot relative strength of ionospheric scatter
figure(figsize=(15,5))
rcParams.update({'font.size': 14})

ax, aax, cax = rto.scatter.plot(sTime, 
    title=True, weighted=True)

ax.grid()



In [ ]: