pymsis.msis.calculate#

pymsis.msis.calculate(dates, lons, lats, alts, f107s=None, f107as=None, aps=None, *, options=None, version=2.1, **kwargs)#

Call MSIS to calculate the atmosphere at the provided input points.

Satellite Fly-Through Mode: If ndates is the same length as nlons, nlats, and nalts, then the input arrays are assumed to be aligned and no regridding is done. This is equivalent to a satellite fly-through, producing an output return shape of (ndates, 11).

Grid Mode: If the input arrays have different lengths the data will be expanded in a grid-like fashion broadcasting to a larger shape than the input arrays. This is equivalent to a full atmosphere simulation where you want to calculate the data at every grid point. The output shape will be 5D (ndates, nlons, nlats, nalts, 11), with potentially single element dimensions if you have a single date, lon, lat, or alt.

The output array can be indexed with the Variable enum for easier access. output_array[..., Variable.MASS_DENSITY] returns the total mass density.

If F10.7, F10.7a, or Ap values are not provided, the historical data for the given date(s) will be used. If the local file is not available, the data will be downloaded and cached for future use. See get_f107_ap() for more details on the historical data retrieval.

Parameters:
  • dates (ArrayLike) – Dates and times of interest

  • lons (ArrayLike) – Geodetic longitudes (deg), referenced to the WGS84 ellipsoid

  • lats (ArrayLike) – Geodetic latitudes (deg), referenced to the WGS84 ellipsoid

  • alts (ArrayLike) – Geodetic altitudes (km), referenced to the WGS84 ellipsoid

  • f107s (ArrayLike, optional) – Daily F10.7 of the previous day for the given date(s)

  • f107as (ArrayLike, optional) – F10.7 running 81-day average centered on the given date(s)

  • aps (ArrayLike, optional) –

    Ap for the given date(s), (1-6 only used if geomagnetic_activity=-1)
    (0) Daily Ap
    (1) 3 hr ap index for current time
    (2) 3 hr ap index for 3 hrs before current time
    (3) 3 hr ap index for 6 hrs before current time
    (4) 3 hr ap index for 9 hrs before current time
    (5) Average of eight 3 hr ap indices from 12 to 33 hrs
    prior to current time
    (6) Average of eight 3 hr ap indices from 36 to 57 hrs
    prior to current time

  • options (ArrayLike[25, float], optional) – A list of options (switches) to the model, if options is passed all keyword arguments specifying individual options will be ignored.

  • version (Number or string, default: 2.1) – MSIS version number, one of (0, 2.0, 2.1).

  • **kwargs (dict) – Single options for the switches can be defined through keyword arguments. For example, calculate(..., geomagnetic_activity=-1) will set the geomagnetic activity switch to -1 (storm-time ap mode).

  • f107 (float) – Account for F10.7 variations

  • time_independent (float) – Account for time variations

  • symmetrical_annual (float) – Account for symmetrical annual variations

  • symmetrical_semiannual (float) – Account for symmetrical semiannual variations

  • asymmetrical_annual (float) – Account for asymmetrical annual variations

  • asymmetrical_semiannual (float) – Account for asymmetrical semiannual variations

  • diurnal (float) – Account for diurnal variations

  • semidiurnal (float) – Account for semidiurnal variations

  • geomagnetic_activity (float) – Account for geomagnetic activity (1 = Daily Ap mode, -1 = Storm-time Ap mode)

  • all_ut_effects (float) – Account for all UT/longitudinal effects

  • longitudinal (float) – Account for longitudinal effects

  • mixed_ut_long (float) – Account for UT and mixed UT/longitudinal effects

  • mixed_ap_ut_long (float) – Account for mixed Ap, UT, and longitudinal effects

  • terdiurnal (float) – Account for terdiurnal variations

Returns:

The data calculated at each grid point:
[Total mass density (kg/m3),
N2 # density (m-3),
O2 # density (m-3),
O # density (m-3),
He # density (m-3),
H # density (m-3),
Ar # density (m-3),
N # density (m-3),
Anomalous oxygen # density (m-3),
NO # density (m-3),
Temperature (K)]

Return type:

ndarray (ndates, nlons, nlats, nalts, 11) or (ndates, 11)

Notes

  1. The 10.7 cm radio flux is at the Sun-Earth distance, not the radio flux at 1 AU.

  2. aps[1:] are only used when geomagnetic_activity=-1.