- Notifications
You must be signed in to change notification settings - Fork5
Python interface to the NRLMSIS codes
License
SWxTREC/pymsis
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Pymsis is a minimal and fast Python wrapper of the NRLMSIS models (MSISE-00, MSIS2.0, MSIS2.1).TheMSIS model isdeveloped by the Naval Research Laboratory. For quick access to the model data without any code,there is a web viewer that uses pymsis:https://swx-trec.com/msis
- Documentation
- API Reference: Details about the various options and configurations available in the functions.
- Examples: Demo for how to access and plot the data.
- Web viewer: An interactive website using pymsis through cloud-based serverless functions.
A few short lines of code to get started quickly with pymsis.
- Create a range of dates during the 2003 Halloween storm.
- Run the model at the desired location (lon, lat) (0, 0) and 400 km altitude.
- Plot the results to see how the mass density increased at 400 km altitude during this storm.
importnumpyasnpimportpymsisdates=np.arange(np.datetime64("2003-10-28T00:00"),np.datetime64("2003-11-04T00:00"),np.timedelta64(30,"m"))# geomagnetic_activity=-1 is a storm-time rundata=pymsis.calculate(dates,0,0,400,geomagnetic_activity=-1)# Plot the dataimportmatplotlib.pyplotasplt# Total mass density over timeplt.plot(dates,data[:,0,0,0,0])plt.show()
note
- The model will automatically download and access the F10.7 and ap data for you if you have an internet connection.
- The returned data structure has shape [ndates, nlons, nlats, nalts, 11], but for this example we only have one point with many dates [ndates, 1, 1, 1, 11].-s The 11 is for each of the species MSIS calculates for each input point. The first element is the Total Mass Density (kg/m3).
TheMSISmodelis developed by the Naval Research Laboratory.
Note that the MSIS2 code is not available for commercial use withoutcontacting NRL. See theMSIS2 license file) for explicitdetails. We do not repackage the MSIS source code in thisrepository for that reason. However, utility functions are provided to easilydownload and extract the original source code. By using that code youagree to their terms and conditions.
Please acknowledge the University of Colorado Space Weather Technology,Research and Education Center (SWx TREC) and cite the original papers ifyou make use of this model in a publication.
Lucas, G. (2022). pymsis [Computer software].doi:10.5281/zenodo.5348502
Emmert, J. T., Jones, M., Siskind, D. E., Drob, D. P., Picone, J. M.,Stevens, M. H., et al. (2022). NRLMSIS 2.1: An empirical model of nitricoxide incorporated into MSIS. Journal of Geophysical Research: SpacePhysics, 127, e2022JA030896.doi:10.1029/2022JA030896
Emmert, J. T., Drob, D. P., Picone, J. M., Siskind, D. E., Jones, M.,Mlynczak, M. G., et al. (2020). NRLMSIS 2.0: A whole‐atmosphereempirical model of temperature and neutral species densities. Earthand Space Science, 7, e2020EA001321.doi:10.1029/2020EA001321
Picone, J. M., Hedin, A. E., Drob, D. P., and Aikin, A. C.,NRLMSISE‐00 empirical model of the atmosphere: Statistical comparisonsand scientific issues, J. Geophys. Res., 107( A12), 1468,doi:10.1029/2002JA009430,2002.
If you make use of the automatic downloads of the F10.7 and ap data,please cite that data in your publication as well. The data is downloadedfrom CelesTrak, which has filled in missing data from the source. Both citationsare given below.
CelesTrak.https://celestrak.org/SpaceData/
Matzka, J., Stolle, C., Yamazaki, Y., Bronkalla, O. and Morschhauser, A.,2021. The geomagnetic Kp index and derived indices of geomagnetic activity.Space Weather,doi:10.1029/2020SW002641.
The easiest way to install pymsis is to install from PyPI.
pip install pymsis
For the most up-to-date pymsis, you can install directly from the gitrepository
pip install git+https://github.com/SWxTREC/pymsis.git
or to work on it locally, you can clone the repository and install thetest dependencies.
git clone https://github.com/SWxTREC/pymsis.gitcd pymsispip install .[test]
The installation is dependent on access to the NRL source code. If thedownload fails, or you have no internet access you can manually installthe Fortran source code as follows. A script to help with this or giveideas on how to achieve this remote installation are provided in thetools directory).
Download the source codeThe source code is hosted on NRL's website:https://map.nrl.navy.mil/map/pub/nrl/NRLMSIS/NRLMSIS2.0/Download the
NRLMSIS2.0.tar.gz
file to your local system.Extract the source filesThe tar file needs to be extracted to the
src/msis2.0
directory.tar -xvzf NRLMSIS2.0.tar.gz -C src/msis2.0/
Install the Python package
pip install.
About
Python interface to the NRLMSIS codes