Python API for Fortran MSISE-00 neutral atmosphere model.
Project description
MSISE-00 in Python and Matlab
NRL MSISE-00 atmospheric model for Python ≥ 3.6, also accessible via Matlab. Valid from altitude z = 0..1000 km.
The plot immediately below shows a slice at 200km on a world-wide grid. The yellow ball represents the sun footprint on Earth.
This plot is from Matlab calling MSISE00:
Install
This process is used for the Python and Matlab access to MSIS. Any Fortran compiler should work. Fortran compiler may be installed by
- Mac:
brew install gcc
- Linux:
apt install gfortran
- Windows
Get MSISE00 and install Python package
python3 -m pip install msise00
Or if you wish to install the latest development version:
git clone https://github.com/scivision/msise00
cd msise00
python3 -m pip install -e .
The Fortran code will automatically compile on first import. If you need to recompile manually, use:
python3 -c "import msise00; msise00.build()"
Examples
MSISE00 can be used from the command line, as an imported module, and even from Matlab.
import module
import msise00
from datetime import datetime
atmos = msise00.run(time=datetime(2013, 3, 31, 12), altkm=150., glat=65., glon=-148.)
atmos is an xarray.Dataset containing all the simulation output values.
atmos
is 4-D: (time, altitude, lat, lon), and indexed like atmos['N2']
Command Line
Write NetCDF4 output (HDF5 compatible) with command line argument -w filename.nc
.
Simple examples include:
-
AltitudeProfile.py
-
TimeProfile.py
-
Worldgrid.py
-
Altitude Profile at a single time:
MSISE00.py -t 2017-08-21T20:48 -c 40 -90
-
Alt. profile time-range with hourly time step:
MSISE00.py -t 2017-08-21 2017-08-22 -c 40 -90
-
Grid: time,lat,lon: generates the plots in the README:
MSISE00.py -t 2016-09-20 2016-09-21
-
single time lat/lon can be plotted:
MSISE00.py -t 2017-01-02T12
Matlab
Matlab and GNU Octave users can seamlessly access Python modules, as demonstrated in AltitudeProfile.m and msise00.m.
-
Install MSISe00 by running setup.m from within Matlab or Octave
-
From Matlab, verify everything is working by from the
msise00/
directory:runtests('tests')
Time Utiliies
Time utilities of general interest include:
msise00.todatetime
msise00.todt64
Fortran source
The MSISE00 Fortran source code may also be used directly. We have provided for easy code reuse in CMake and Meson projects.
Reference
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.