1+ ## VirES for Swarm - Magnetic Models, Coordinates and Other Utilities
12
2-
3- ## Magnetic Model
4-
5- This repository contains various utilities related to Earth magnetic field
6- modelling and spherical harmonics.
3+ This repository contains various utilities for calculation of Earth magnetic
4+ field models, magnetic coordinates and other auxiliary variables.
75
86The repository contains following directories:
97
10- - ` eoxmagmod ` - Collection models of the Earth magnetic field - python module
8+ - ` eoxmagmod ` - Python package for calculation of the Earth magnetic field,
9+ magnetic coordinates, time conversions and other auxiliary variables.
1110- ` qdipole ` - Quasi-Dipole apex coordinates evaluation - Fortran code compiled
1211 as a shared library (dependency of the ` eoxmagmod ` package)
1312- ` libcdf ` - [ CDF library] ( https://cdf.gsfc.nasa.gov/ ) source installation
1413 (dependency of the ` eoxmagmod ` package)
1514
16- ### Installation from Sources
15+ For more details read the [ on-line documentation] ( https://esa-vires.github.io/MagneticModel/ )
16+
17+ ### Installation
18+
19+ #### Conda Installation
20+
21+ Step in the MagneticModel directory and follow these steps:
22+
23+ 1 ) Build the binary dependencies:
24+ ```
25+ conda install conda-build
26+ conda build ./qdipole
27+ conda build ./libcdf
28+ conda build purge
29+ ```
30+ Tested on GNU/Linux. Possibly works on other POSIX systems.
31+
32+ 2 ) Create an new Conda environment and install ` eoxmagmod ` dependencies
33+
34+ ```
35+ conda env create -n <environment-name> -f conda_env.yaml
36+ ```
37+
38+ 3 ) Install ` eoxmagmod ` in your new Conda environment:
39+ ```
40+ conda activate <environment-name>
41+ pip install ./eoxmagmod
42+ ```
43+
44+ #### Installation from Sources
45+
46+ The installation requires:
47+ - GCC C compiler
48+ - GFortran Fortran compiler
49+ - ` make `
1750
18- #### CDF
51+ 1 ) Build and install ` cdf ` library
52+
53+ The CDF build script download sources and builds the [ NASA CDF library] ( https://cdf.gsfc.nasa.gov/ )
1954
2055```
2156$ cd libcdf/
@@ -30,7 +65,7 @@ variable:
3065$ make install INSTALLDIR=<install directory>
3166```
3267
33- #### QDIPOLE
68+ 2 ) Build and install ` qdipole ` library
3469
3570```
3671$ cd qdipole/
@@ -39,44 +74,32 @@ $ make build
3974$ sudo make install
4075```
4176
42- #### EOxMagMod
43- Requires QDIPOLE, CDF libraries + NumPy and SpacePy Python packages
44- to be installed.
45- NumPy and SpacePy can be installed using ` pip ` .
77+ By default the `` qdipole `` library is installed in the `` /usr `` system directory.
78+ To install the library in a custom location use configuration with a custom prefix::
4679
4780```
48- $ cd eoxmagmod/
49- $ python ./setup.py build
50- $ sudo python ./setup.py install
81+ ./configure --prefix=<install prefix>
5182```
5283
53- ### Conda installation
54-
55- The package contains the ` conda-build ` scripts allowing local conda build and
56- installation following this procedure:
84+ 3 ) Build and install ` eoxmagmod ` pip dependencies
5785
58- 1 ) build the binary dependencies:
5986```
60- conda install conda-build
61- conda build ./qdipole
62- conda build ./libcdf
63- conda build purge
87+ pip3 install 'numpy<2'
88+ pip3 install scipy
89+ pip3 install 'SpacePy>0.5'
6490```
65- Tested on GNU/Linux. Possibly works on other POSIX systems. Does not work on MS
66- Windows (primarily because of a missing Fortran compiler).
6791
68- 2 ) install the ` eoxmagmod ` in your conda environment:
92+ 4 ) Finally, install ` eoxmagmod ` package
93+
6994```
70- conda activate <target-environment>
71- conda install --use-local qdipole cdf
72- conda install numpy scipy matplotlib h5py networkx
73- conda install gcc_linux-64 # spacepy and eoxmagmod require C compiler
74- conda install gfortran_linux-64 # spacepy requires Fortran compiler
75- conda deactivate
76- conda activate <target-environment> # re-activation is required to update the environment variables
77- pip install spacepy
78- pip install ./eoxmagmod
95+ pip3 install ./eoxmagmod
7996```
8097
81- The ` gfortran_linux-64 ` and` gcc_linux-64 ` compilers work on a x86_64 GNU/Linux system.
82- Other platforms might provide different compilers.
98+ ### Testing
99+
100+ To test the fresh installation, leave the ` MagneticModel ` directory and run
101+ the following command:
102+
103+ ```
104+ python3 -m unittest discover -p '[a-z]*.py' -v eoxmagmod
105+ ```
0 commit comments