nrlmsise00.dataset

4-D Xarray interface

msise_4d(time, alt, lat, lon[, f107a, f107, ...])

4-D Xarray Interface to msise_flat().

Python 4-D xarray.dataset interface to the NRLMSISE-00 model

nrlmsise00.dataset.msise_4d(time, alt, lat, lon, f107a=None, f107=None, ap=None, lst=None, ap_a=None, flags=None, method='gtd7')[source]

4-D Xarray Interface to msise_flat().

4-D MSIS model atmosphere as a xarray.Dataset with dimensions (time, alt, lat, lon). Only scalars and 1-D arrays for time, alt, lat, and lon are supported.

The geomagnetic and Solar flux indices can be acquired using the spaceweather package (when set to None, the default). They can also be supplied explicitly as scalars or 1-D arrays with the same shape as time.

The local solar time (LST) will usually be calculated from time and lon, but can be set explicitly using a fixed scalar LST, a 1-D array matching the shape of either time or lon, or a 2-D array matching the shape of (time, lon).

Parameters:
  • time (datetime.datetime, pandas datetime, str, or 1-d array_like (I,)) – Time as datetime.datetime`s, a `pandas datetime object, a date-time string supported by pandas.to_datetime(), or an array of those. Will be converted with pandas.to_datetime().

  • alt (float or 1-d array_like (J,)) – Altitudes in [km].

  • lat (float or 1-d array_like (K,)) – Latitudes in [°N].

  • lon (float or 1-d array_like (L,)) – Longitudes in [°E]

  • f107a (float or 1-d array_like (I,), optional) – The 81-day running average Solar 10.7cm radio flux, centred at the day(s) of time. Set to None (default) to use the spaceweather package.

  • f107 (float or 1-d array_like (I,), optional) – The Solar 10.7cm radio flux at the previous day(s) of time. Set to None (default) to use the spaceweather package.

  • ap (float or 1-d array_like (I,), optional) – The daily geomagnetic Ap index at the day(s) of time. Set to None (default) to use the spaceweather package.

  • lst (float, 1-d (I,) or (L,) or 2-d array_like (I,L), optional) – The local solar time at time and lon, to override the calculated values. Default: None (calculate from time and lon)

  • ap_a (list of int (7,), optional) – List of Ap indices, passed to msise_flat(), broadcasting is currently not supported.

  • flags (list of int (23,), optional) – List of flags, passed to msise_flat(), broadcasting is currently not supported.

  • method (str, optional, default "gtd7") – Select MSISE-00 method, changes the output of “rho”, the atmospheric mass density.

Returns:

msise_4d – The MSIS atmosphere with dimensions (“time”, “alt”, “lat”, “lon”) and shape (I, J, K, L) containing the data arrays: “He”, “O”, “N2”, “O2”, “Ar”, “rho”, “H”, “N”, “AnomO”, “Texo”, “Talt”, as well as the local solar times “lst” (I,L), and the values used for “Ap” (I,), “f107” (I,), “f107a” (I,).

Return type:

xarray.Dataset

Example

Using “internal” setting of the geomagnetic and Solar indices and automatic conversion to 4-D looks like this (“time” can be an array of datetime.datetime as well):

>>> from datetime import datetime
>>> from nrlmsise00.dataset import msise_4d
>>> alts = np.arange(200, 401, 100.)  # = [200, 300, 400] [km]
>>> lats = np.arange(60, 71, 10.)  # = [60, 70] [°N]
>>> lons = np.arange(-70., 71., 35.)  # = [-70, -35,  0, 35, 70] [°E]
>>> # broadcasting is done internally
>>> ds = msise_4d(datetime(2009, 6, 21, 8, 3, 20), alts, lats, lons)
>>> ds  
<xarray.Dataset>
Dimensions:  (alt: 3, lat: 2, lon: 5, time: 1)
Coordinates:
  * time     (time) datetime64[ns] 2009-06-21T08:03:20
  * alt      (alt) float64 200.0 300.0 400.0
  * lat      (lat) float64 60.0 70.0
  * lon      (lon) float64 -70.0 -35.0 0.0 35.0 70.0
Data variables:
    He       (time, alt, lat, lon) float64 8.597e+05 1.063e+06 ... 4.936e+05
    O        (time, alt, lat, lon) float64 1.248e+09 1.46e+09 ... 2.635e+07
    N2       (time, alt, lat, lon) float64 2.555e+09 2.654e+09 ... 1.667e+06
    O2       (time, alt, lat, lon) float64 2.1e+08 2.062e+08 ... 3.471e+04
    Ar       (time, alt, lat, lon) float64 3.16e+06 3.287e+06 ... 76.55 67.16
    rho      (time, alt, lat, lon) float64 1.635e-13 1.736e-13 ... 7.984e-16
    H        (time, alt, lat, lon) float64 3.144e+05 3.02e+05 ... 1.237e+05
    N        (time, alt, lat, lon) float64 9.095e+06 1.069e+07 ... 6.765e+05
    AnomO    (time, alt, lat, lon) float64 1.173e-08 1.173e-08 ... 1.101e+04
    Texo     (time, alt, lat, lon) float64 805.2 823.7 807.1 ... 818.7 821.2
    Talt     (time, alt, lat, lon) float64 757.9 758.7 766.4 ... 818.7 821.1
    lst      (time, lon) float64 3.389 5.722 8.056 10.39 12.72
    Ap       (time) int32 6
    f107     (time) float64 66.7
    f107a    (time) float64 69.0

See also

msise_flat