Skip to content

RT2D Cartesian Oblique Rays from IRI

2D Cartesian Gradient Tracing Workflow

Build a route-based 2D IRI electron-density grid, run Cartesian oblique rays with RT2D.oblique_trace(..., coordinate_system="cartesian"), and overlay rays on the density field.

This page explains:

  • examples/run_rt2d_iri_cartesian.py

Call Flow

  1. main() parses CLI (--config, --event, --mode, --formulation).
  2. _run(...) builds a ground-referenced altitude grid and fetches IRI through:
  3. RT2DProfile.from_cfg(..., fetch_iri=True)
  4. Density below config floor is zeroed by:
  5. RT2DProfile.force_zero_density_below(cfg.start_height_km)
  6. RT2D(profile=...) initializes the 2D tracer.
  7. _trace_fan_cartesian(...) runs a fan of rays using:
  8. oblique_trace(..., coordinate_system="cartesian")
  9. _plot_density_and_rays(...) draws electron density + rays using PlotRays.

Key Code

1) Build Profile and Apply Lower-Altitude Mask

profile = RT2DProfile.from_cfg(
    cfg=cfg,
    time=event_time,
    alt_km=alt_km,
    fetch_iri=True,
    fetch_msise=False,
    fetch_geomag=False,
    workers=workers,
)
n_rows = profile.force_zero_density_below(float(cfg.start_height_km))
model = RT2D(profile=profile)

2) Cartesian Oblique Fan Tracing

out = model.oblique_trace(
    freq_hz=float(f_mhz) * 1e6,
    elevation_deg=float(elev_deg),
    coordinate_system="cartesian",
    x0_km=0.0,
    z0_km=float(heights_km[0]),
    mode=mode,
    formulation=formulation,
)

3) Density + Rays Plot

p = PlotRays(oth=True, xlim=[0.0, 1500.0], ylim=[-100.0, y_max * 1.02], figsize=(7, 4))
p.set_density(X, Z, profile.ne_cm3, pf=None)
p.lay_rays(outputs=rays, kind="edens", lcolor="k", lw=0.6, param_alpha=0.85)

Run

cd /home/chakras4/Research/CodeBase/trace
python examples/run_rt2d_iri_cartesian.py

Custom options:

python examples/run_rt2d_iri_cartesian.py \
  --config hfpytrace/cfg/config2D.json \
  --event 2017-05-27T16:00:00Z \
  --mode O \
  --formulation appleton-hartree

Output Figure

RT2D IRI Cartesian

  • examples/run_rt2d_iri_cartesian.py
  • hfpytrace/model/rt2d.py
  • hfpytrace/density/iri.py
  • hfpytrace/plottrace.py