This repo exists to host code that is being moved from IDL to Python. For the most part, I try to follow flake8 formatting standards (Warnings/Errors I ignore are W291, W504, E402, and E741).
Flake8 etc setup for Visual Studio Code Flake8 etc setup for vim
Cristian's IDL code (calc_hope_pressure.pro
) uses formulas from this paper to calculate pressure of ion species (H+, He+, O+).
My internship ended 2022/08/12 and code is not fully implemented and may not be maintained in the future. Feel free to make issues and pull requests, please keep in mind the license.
Python is required, a conda installation is reccomended. My current conda environment uses python 3.9.12.
- Install conda (I suggest miniconda, but anaconda might be better depending on the system)
- Create a new conda environment (see this link), or install everything into the
base
environment if you're only using it for this (not reccomended, but it's what I did). Regardless, install numpy in the conda environment you chose withconda install numpy
. - Run
pip install pyspedas python-dotenv tqdm cdflib
in the conda environment. The Conda blog suggests adding--upgrade-strategy only-if-needed
to pip install commands. In all honesty I didn't because I forgot, but it's probably best practice. - After the packages install, create a file called
.env
in the same directory as the files from this repo. - In the
.env
file, add a line that is your OS type in all caps (e.g.MAC
,WINDOWS
, orLINUX
), followed by_HOME_DIR =
then the path to the folder of the files from this repo. - You can now run the Python code from this repo. Email ev.hansen@umbc.edu for assistance.
- Some of the test code requires spacepy's
pycdf
. You need to follow instructions from spacepy's website to install on your machine, as there are some platform-specific instructions for thespacepy
package. Also see this page when configuringpycdf
. - Copy the
.env
file from the project's parent directory, but replace the wordHOME
withTEST
and make sure all the paths are for thetest code
folder instead of the parent. - You will need to include the
CDF_LIB
path in the.env
file in thetest code
directory. To do this, add a line that is your OS type in all caps (e.g.MAC
,WINDOWS
, orLINUX
), followed by_CDF_LIB =
then the path to your local CDF installation from step 1. - When using the test code, make sure to
cd
into that directory instead of running from the parent directory, as the parent directory has a different.env
file - Some test code may have additional packages installed. I suggest checking the imports and installing missing packages via pip before running code in that directory.
- Correct fluxes (skip for now)
- Calculate Pressure (
calc_pressure
inHopeCalculations
) - Pitchangle avg flux
- Calculate mean energy
- Smooth data
- Replace 0s w/ NANs
- Average Pressures
- Create plot data
- Change CDF dict data object to an Xarray for easier operations
- Restructure class to be compatable with other data operations, maybe multiple files?
- Rename class
- Look at other plasma parameters (other calculations, density, mean energy)
- Recreate loop (handler/wrapper)
- Recreate binning
- Plot data
- Recreate dial plot (may be possible w/ matplotlib)
- Plasma density plots?
- Solar wind + curvature of magnetic field (?)