1
+ ## VirES for Swarm - Magnetic Models, Coordinates and Other Utilities
1
2
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.
7
5
8
6
The repository contains following directories:
9
7
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.
11
10
- ` qdipole ` - Quasi-Dipole apex coordinates evaluation - Fortran code compiled
12
11
as a shared library (dependency of the ` eoxmagmod ` package)
13
12
- ` libcdf ` - [ CDF library] ( https://cdf.gsfc.nasa.gov/ ) source installation
14
13
(dependency of the ` eoxmagmod ` package)
15
14
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 `
17
50
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/ )
19
54
20
55
```
21
56
$ cd libcdf/
@@ -30,7 +65,7 @@ variable:
30
65
$ make install INSTALLDIR=<install directory>
31
66
```
32
67
33
- #### QDIPOLE
68
+ 2 ) Build and install ` qdipole ` library
34
69
35
70
```
36
71
$ cd qdipole/
@@ -39,44 +74,32 @@ $ make build
39
74
$ sudo make install
40
75
```
41
76
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::
46
79
47
80
```
48
- $ cd eoxmagmod/
49
- $ python ./setup.py build
50
- $ sudo python ./setup.py install
81
+ ./configure --prefix=<install prefix>
51
82
```
52
83
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
57
85
58
- 1 ) build the binary dependencies:
59
86
```
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'
64
90
```
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).
67
91
68
- 2 ) install the ` eoxmagmod ` in your conda environment:
92
+ 4 ) Finally, install ` eoxmagmod ` package
93
+
69
94
```
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
79
96
```
80
97
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