EISCATData

DOI version

Access and process EISCAT incoherent scatter radar data from the Madrigal database.

Installation

using Pkg
Pkg.add("EISCATData")

Load Data

Download GUISDAP data from Tromsø for December 9-10, 2020:

using EISCATData
using Dates
t0 = DateTime(2020, 12, 9, 18)
t1 = DateTime(2020, 12, 10, 6)
kinst = :tro              # Tromsø radar
kindat = :GUISDAP         # Analysis method
modulation = "60"         # Pulse code
vars = (:ne, :ti, :tr, :vo, :gdalt)
res = get_data(t0, t1, kinst, kindat, modulation, vars; clip = true)
te = res.ti .* res.tr     # Electron temperature
res
(ne = [3.172582656e9 1.006654464e9 … 1.053419712e9 1.8044732e7; 4.8534016e9 1.548555904e9 … 1.145481984e9 1.0e6; … ; 2.3676563456e10 4.5527867392e10 … 5.9122249728e10 8.6790529024e10; 4.428058112e9 6.0824031232e10 … 2.6928111616e10 8.3626303488e10], ti = [219.5005340576172 219.4930877685547 … 215.09750366210938 215.08042907714844; 217.6664276123047 217.65704345703125 … 215.00967407226562 214.9900665283203; … ; 1075.9945068359375 232.65867614746094 … 395.8287658691406 833.48974609375; 304.3983154296875 611.496826171875 … 40.104331970214844 381.1969909667969], tr = [1.0 1.0 … 1.0 1.0; 1.0 1.0 … 1.0 1.0; … ; 1.9827593564987183 15.609371185302734 … 22.394451141357422 7.54026985168457; 0.009999999776482582 4.046082496643066 … 4.69175386428833 14.54135513305664], vo = [-130.32513427734375 955.9467163085938 … 106.02196502685547 1010.9185180664062; -240.40142822265625 605.44873046875 … 260.0054626464844 -124.85322570800781; … ; 3589.30517578125 -620.9808349609375 … -842.635009765625 2753.1630859375; -3048.921630859375 28.3243350982666 … 188.21426391601562 -1215.3184814453125], gdalt = [76.357734375 76.4567421875 … 76.44396875 76.5269609375; 79.410921875 79.47346875 … 79.318328125 79.42715625; … ; 646.51 646.43675 … 646.5738125 646.743625; 671.0903125 671.19075 … 670.891375 670.9716875], ut1_unix = [1.6075368e9 1.60753686e9 … 1.60757988e9 1.60757994e9; 1.6075368e9 1.60753686e9 … 1.60757988e9 1.60757994e9; … ; 1.6075368e9 1.60753686e9 … 1.60757988e9 1.60757994e9; 1.6075368e9 1.60753686e9 … 1.60757988e9 1.60757994e9], ut2_unix = [1.60753686e9 1.60753692e9 … 1.60757994e9 1.60758e9; 1.60753686e9 1.60753692e9 … 1.60757994e9 1.60758e9; … ; 1.60753686e9 1.60753692e9 … 1.60757994e9 1.60758e9; 1.60753686e9 1.60753692e9 … 1.60757994e9 1.60758e9], times = [Dates.DateTime("2020-12-09T18:00:30"), Dates.DateTime("2020-12-09T18:01:30"), Dates.DateTime("2020-12-09T18:02:30"), Dates.DateTime("2020-12-09T18:03:30"), Dates.DateTime("2020-12-09T18:04:30"), Dates.DateTime("2020-12-09T18:05:30"), Dates.DateTime("2020-12-09T18:06:30"), Dates.DateTime("2020-12-09T18:07:30"), Dates.DateTime("2020-12-09T18:08:30"), Dates.DateTime("2020-12-09T18:09:30")  …  Dates.DateTime("2020-12-10T05:50:30"), Dates.DateTime("2020-12-10T05:51:30"), Dates.DateTime("2020-12-10T05:52:30"), Dates.DateTime("2020-12-10T05:53:30"), Dates.DateTime("2020-12-10T05:54:30"), Dates.DateTime("2020-12-10T05:55:30"), Dates.DateTime("2020-12-10T05:56:30"), Dates.DateTime("2020-12-10T05:57:32.500"), Dates.DateTime("2020-12-10T05:58:30"), Dates.DateTime("2020-12-10T05:59:30")])

The returned data contains:

  • res.times: Time axis (UTC)
  • res.gdalt: Geodetic altitude (height, km)
  • res.ne: Electron density (cm⁻³)
  • res.ti: Ion temperature (K)
  • res.tr: Temperature ratio (Te/Ti)
  • res.vo: Line of sight ion velocity (pos = away, km/s)

Quicklook

Here we create altitude-time plots for density, temperatures, and velocity:

Visualize with Makie

Using Makie.jl package:

using CairoMakie

const x = unix2datetime.(res.ut1_unix)
const y = res.gdalt
const colorranges = (
    (9.0e9, 1.1e12),
    (0, 3200),
    (0, 2600),
    (-420, 420),
)
const names = (L"n_e \, (cm^{-3})", L"T_e \, (K)", L"T_i \, (K)", L"v_i \, (m/s)")
let vars = (res.ne, te, res.ti, res.vo), colormap = :rainbow_bgyrm_35_85_c69_n256
    z = zeros(size(x))
    f = CairoMakie.Figure(; size = (600, 600))
    shading = NoShading
    for (i, var) in enumerate(vars)
        colorrange = colorranges[i]
        colorscale = colorrange[1] > 0 ? log10 : identity
        ax = Axis(f[i, 1], ylabel = "Altitude (km)")
        plot = Makie.surface!(ax, x, y, z; color = var, colorrange, colorscale, shading, colormap)
        Makie.Colorbar(f[i, 2], plot; label = names[i])
        ylims!(70, 500)
        i != length(vars) && Makie.hidexdecorations!(ax; grid = false)
    end
    rowgap!(f.layout, 8)
    f
end
Example block output

Alternative: PythonPlot

Alternatively, we can also use PythonPlot for visualization:

using PythonPlot
using PythonCall
@py import cmap: Colormap

let vars = (res.ne, te, res.ti, res.vo), colors = PythonPlot.colorsm, cmap = Colormap("colorcet:CET_R1").to_mpl()
    fig, axs = PythonPlot.subplots(length(vars), 1, figsize = (10, 10))
    # plot the electron density, temperature, and velocity in three subplots
    norms = (
        colors.LogNorm(1.0e10, 1.0e12),
        colors.Normalize(0, 3200),
        colors.Normalize(0, 2500),
        colors.Normalize(-400, 400),
    )
    for (i, var) in enumerate(vars)
        ax = axs[i - 1]
        p = ax.pcolormesh(x, y, var; cmap, norm = norms[i])
        cbar = fig.colorbar(p, ax = ax)
        ax.set_ylim(nothing, 500)
    end
    gcf()
end
Example block output

API Reference

EISCATData.get_dataFunction
get_data(tstart, tend, kinst, kindat, mod, vars = nothing; tvars = (:ut1_unix, :ut2_unix), clip = false, verbose = false, kw...)

Download and process EISCAT data from the Madrigal database, given the time range, instrument code kinst, kind of data file code kindat, and modulation mod.

Set clip = true to clip data to the exact time range. Set verbose = true to show download progress. Additional keyword arguments are passed to download_file.

source