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) – Solar flux F10.7 effects on atmospheric density. Controls how much the current F10.7 value modifies the base atmospheric state. When set to 0, F10.7 variations are ignored and the atmosphere uses a standard reference solar flux level.

  • time_independent (float) – Time-independent baseline atmospheric structure. Controls the basic north-south atmospheric variations that provide the fundamental geographic structure of the atmosphere independent of time. Setting to 0 removes these baseline latitude-dependent terms, leaving only time-varying atmospheric patterns.

  • symmetrical_annual (float) – Annual variations that are the same in both hemispheres. Controls seasonal changes in atmospheric density due to Earth’s orbit around the Sun. When set to 0, removes symmetric year-to-year variations.

  • symmetrical_semiannual (float) – Semiannual (6-month) variations that are symmetric between hemispheres. Controls atmospheric changes that occur twice per year due to solar heating patterns. Setting to 0 removes these biannual variations.

  • asymmetrical_annual (float) – Annual variations that differ between northern and southern hemispheres. Accounts for seasonal differences caused by land/ocean distribution and other hemispheric asymmetries. When set to 0, removes asymmetric seasonal effects.

  • asymmetrical_semiannual (float) – Semiannual variations that differ between hemispheres. Controls atmospheric changes that occur twice yearly but with different magnitudes in each hemisphere. Setting to 0 removes these asymmetric biannual variations.

  • diurnal (float) – Daily (24-hour) variations in atmospheric density. Controls day/night differences caused by solar heating and atmospheric tides. When set to 0, removes all diurnal atmospheric variations.

  • semidiurnal (float) – Semi-daily (12-hour) variations in atmospheric density. Controls atmospheric tides that occur twice per day due to solar heating patterns. Setting to 0 removes these twice-daily atmospheric oscillations.

  • geomagnetic_activity (float) – Geomagnetic activity effects on atmospheric heating and expansion. Controls how magnetic storms and aurora affect atmospheric density. (1 = Daily Ap mode using average daily values, -1 = Storm-time Ap mode using 3-hourly Ap indices for more detailed storm modeling)

  • all_ut_effects (float) – Universal Time (UT) and longitudinal effects combined. Controls atmospheric variations that depend on the time of day in UT and geographic longitude. Setting to 0 removes all UT/longitude-dependent variations.

  • longitudinal (float) – Pure longitudinal variations independent of UT. Controls atmospheric differences that vary only with geographic longitude (e.g., land/sea contrasts, topography). When set to 0, removes longitude-only atmospheric variations.

  • mixed_ut_long (float) – Mixed Universal Time and longitudinal effects. Controls atmospheric variations that depend on both UT and longitude simultaneously (e.g., regional differences in tidal patterns). Setting to 0 removes these coupled effects.

  • mixed_ap_ut_long (float) – Combined geomagnetic activity, UT, and longitudinal effects. Controls how magnetic activity affects the atmosphere differently across longitude and UT. When set to 0, removes the geographic/temporal coupling of magnetic effects.

  • terdiurnal (float) – Terdiurnal (8-hour) atmospheric variations. Controls atmospheric tides that occur three times per day due to solar heating harmonics. Setting to 0 removes these 8-hourly atmospheric oscillations.

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.