pyvlasiator 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyvlasiator might be problematic. Click here for more details.
- pyvlasiator/plot/__init__.py +2 -0
- pyvlasiator/plot/plot.py +39 -22
- pyvlasiator/vlsv/reader.py +11 -10
- pyvlasiator/vlsv/variables.py +1 -0
- {pyvlasiator-0.1.3.dist-info → pyvlasiator-0.1.5.dist-info}/METADATA +6 -3
- pyvlasiator-0.1.5.dist-info/RECORD +11 -0
- {pyvlasiator-0.1.3.dist-info → pyvlasiator-0.1.5.dist-info}/WHEEL +1 -1
- pyvlasiator-0.1.3.dist-info/RECORD +0 -11
- {pyvlasiator-0.1.3.dist-info → pyvlasiator-0.1.5.dist-info}/LICENSE.md +0 -0
pyvlasiator/plot/__init__.py
CHANGED
pyvlasiator/plot/plot.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
|
+
from numpy.typing import ArrayLike
|
|
4
5
|
import math
|
|
5
6
|
import warnings
|
|
6
7
|
from typing import Callable
|
|
@@ -8,7 +9,7 @@ from collections import namedtuple
|
|
|
8
9
|
from enum import Enum
|
|
9
10
|
from pyvlasiator.vlsv import Vlsv
|
|
10
11
|
from pyvlasiator.vlsv.reader import _getdim2d
|
|
11
|
-
from pyvlasiator.vlsv.variables import RE
|
|
12
|
+
from pyvlasiator.vlsv.variables import RE, RMERCURY
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class ColorScale(Enum):
|
|
@@ -35,8 +36,10 @@ class AxisUnit(Enum):
|
|
|
35
36
|
- SI (2): Units from the International System of Units (SI), such as meters, seconds, kilograms, etc.
|
|
36
37
|
"""
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
SI = 1
|
|
40
|
+
KSI = 2
|
|
41
|
+
EARTH = 3
|
|
42
|
+
MERCURY = 4
|
|
40
43
|
|
|
41
44
|
|
|
42
45
|
# Plotting arguments
|
|
@@ -182,6 +185,7 @@ def _plot1d(
|
|
|
182
185
|
|
|
183
186
|
return c
|
|
184
187
|
|
|
188
|
+
|
|
185
189
|
def pcolormesh(
|
|
186
190
|
self: Vlsv,
|
|
187
191
|
var: str = "",
|
|
@@ -609,8 +613,12 @@ def set_args(
|
|
|
609
613
|
|
|
610
614
|
if axisunit == AxisUnit.EARTH:
|
|
611
615
|
unitstr = r"$R_E$"
|
|
612
|
-
|
|
613
|
-
unitstr =
|
|
616
|
+
elif axisunit == AxisUnit.SI:
|
|
617
|
+
unitstr = "m"
|
|
618
|
+
elif axisunit == AxisUnit.MERCURY:
|
|
619
|
+
unitstr = r"$R_M$"
|
|
620
|
+
elif axisunit == AxisUnit.KSI:
|
|
621
|
+
unitstr = "km"
|
|
614
622
|
strx = axislabels[0] + " [" + unitstr + "]"
|
|
615
623
|
stry = axislabels[1] + " [" + unitstr + "]"
|
|
616
624
|
|
|
@@ -771,7 +779,15 @@ def get_axis(axisunit: AxisUnit, plotrange: tuple, sizes: tuple) -> tuple:
|
|
|
771
779
|
A tuple containing the x and y axis coordinates.
|
|
772
780
|
"""
|
|
773
781
|
|
|
774
|
-
|
|
782
|
+
if axisunit == AxisUnit.EARTH:
|
|
783
|
+
scale_factor = 1.0 / RE
|
|
784
|
+
elif axisunit == AxisUnit.MERCURY:
|
|
785
|
+
scale_factor = 1.0 / RMERCURY
|
|
786
|
+
elif axisunit == AxisUnit.KSI:
|
|
787
|
+
scale_factor = 1.0 / 1e3
|
|
788
|
+
else: # SI
|
|
789
|
+
scale_factor = 1.0
|
|
790
|
+
|
|
775
791
|
start = tuple(s * scale_factor for s in plotrange[:2])
|
|
776
792
|
stop = tuple(s * scale_factor for s in plotrange[2:])
|
|
777
793
|
|
|
@@ -794,7 +810,6 @@ def set_colorbar(
|
|
|
794
810
|
v2: float = np.nan,
|
|
795
811
|
data: np.ndarray = np.array([1.0]),
|
|
796
812
|
linthresh: float = 1.0,
|
|
797
|
-
logstep: float = 1.0,
|
|
798
813
|
linscale: float = 0.03,
|
|
799
814
|
):
|
|
800
815
|
"""
|
|
@@ -816,8 +831,6 @@ def set_colorbar(
|
|
|
816
831
|
not provided. Defaults to np.array([1.0]).
|
|
817
832
|
linthresh: float, optional
|
|
818
833
|
The threshold value for symmetric log color scales. Defaults to 1.0.
|
|
819
|
-
logstep: float, optional
|
|
820
|
-
The step size for tick values in log color scales. Defaults to 1.0.
|
|
821
834
|
linscale: float, optional
|
|
822
835
|
A scaling factor for linear regions in symmetric log color scales.
|
|
823
836
|
Defaults to 0.03.
|
|
@@ -833,10 +846,6 @@ def set_colorbar(
|
|
|
833
846
|
------
|
|
834
847
|
ValueError
|
|
835
848
|
If an invalid colorscale type is provided.
|
|
836
|
-
|
|
837
|
-
Notes
|
|
838
|
-
-----
|
|
839
|
-
- The 'SymLog' colorscale is currently not fully implemented.
|
|
840
849
|
"""
|
|
841
850
|
import matplotlib
|
|
842
851
|
|
|
@@ -849,13 +858,10 @@ def set_colorbar(
|
|
|
849
858
|
norm = matplotlib.colors.LogNorm(vmin, vmax)
|
|
850
859
|
ticks = matplotlib.ticker.LogLocator(base=10, subs=range(0, 9))
|
|
851
860
|
else: # symmetric log
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
# norm = matplotlib.colors.SymLogNorm(linthresh, linscale, vmin, vmax, base=10)
|
|
857
|
-
# ticks = [ [-(10.0**x) for x in minlog:-logstep:logthresh]..., 0.0,
|
|
858
|
-
# [10.0**x for x in logthresh:logstep:maxlog]..., ]
|
|
861
|
+
norm = matplotlib.colors.SymLogNorm(
|
|
862
|
+
linthresh=linthresh, linscale=linscale, vmin=vmin, vmax=vmax, base=10
|
|
863
|
+
)
|
|
864
|
+
ticks = matplotlib.ticker.SymmetricalLogLocator(linthresh=linthresh, base=10)
|
|
859
865
|
|
|
860
866
|
return norm, ticks
|
|
861
867
|
|
|
@@ -922,7 +928,6 @@ def vdfslice(
|
|
|
922
928
|
meta: Vlsv,
|
|
923
929
|
location: tuple | list,
|
|
924
930
|
ax=None,
|
|
925
|
-
limits: tuple = (float("-inf"), float("inf"), float("-inf"), float("inf")),
|
|
926
931
|
verbose: bool = False,
|
|
927
932
|
species: str = "proton",
|
|
928
933
|
unit: AxisUnit = AxisUnit.SI,
|
|
@@ -967,7 +972,15 @@ def vdfslice(
|
|
|
967
972
|
|
|
968
973
|
norm = matplotlib.colors.LogNorm(vmin, vmax)
|
|
969
974
|
|
|
970
|
-
h = ax.hist2d(
|
|
975
|
+
h = ax.hist2d(
|
|
976
|
+
v1,
|
|
977
|
+
v2,
|
|
978
|
+
bins=(r1, r2),
|
|
979
|
+
weights=weights,
|
|
980
|
+
norm=norm,
|
|
981
|
+
shading="flat",
|
|
982
|
+
**kwargs,
|
|
983
|
+
)
|
|
971
984
|
|
|
972
985
|
ax.set_title(str_title, fontweight="bold")
|
|
973
986
|
ax.set_xlabel(strx)
|
|
@@ -1012,6 +1025,10 @@ def prep_vdf(
|
|
|
1012
1025
|
|
|
1013
1026
|
if unit == AxisUnit.EARTH:
|
|
1014
1027
|
location = [loc * RE for loc in location]
|
|
1028
|
+
elif unit == AxisUnit.MERCURY:
|
|
1029
|
+
location = [loc * RMERCURY for loc in location]
|
|
1030
|
+
elif unit == AxisUnit.KSI:
|
|
1031
|
+
location = [loc * 1e3 for loc in location]
|
|
1015
1032
|
|
|
1016
1033
|
# Set unit conversion factor
|
|
1017
1034
|
unitvfactor = 1e3 if unitv == "km/s" else 1.0
|
pyvlasiator/vlsv/reader.py
CHANGED
|
@@ -375,16 +375,17 @@ class Vlsv:
|
|
|
375
375
|
"""
|
|
376
376
|
Read variables as numpy arrays from the open vlsv file.
|
|
377
377
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
378
|
+
Args:
|
|
379
|
+
name (str): The name of the variable to read.
|
|
380
|
+
cellids (int, list[int], np.ndarray, optional):
|
|
381
|
+
Specifies which cell IDs to read data for. Defaults to -1, which reads data for all cells.
|
|
382
|
+
- If an integer (except -1), only the data for that specific cell ID is read.
|
|
383
|
+
- If a list or NumPy array of integers, only the data for the specified cell IDs are read.
|
|
384
|
+
- Specifying cell IDs is not supported for "FSgrid" or "ionosphere" variables.
|
|
385
|
+
sorted (bool, optional): If True, the returned array is sorted by cell IDs (only applicable when reading all cells, cellids=-1). Defaults to True.
|
|
386
|
+
|
|
387
|
+
Returns:
|
|
388
|
+
numpy.ndarray
|
|
388
389
|
"""
|
|
389
390
|
|
|
390
391
|
if self.has_variable(name) and name.startswith("fg_"):
|
pyvlasiator/vlsv/variables.py
CHANGED
|
@@ -11,6 +11,7 @@ MU0 = 4 * pi * 1e-7 # Vacuum permeability, [H/m]
|
|
|
11
11
|
EPSILON0 = 1 / (C**2 * MU0) # Vacuum permittivity, [F/m]
|
|
12
12
|
KB = 1.38064852e-23 # Boltzmann constant, [m²kg/(s²K)]
|
|
13
13
|
RE = 6.371e6 # Earth radius, [m]
|
|
14
|
+
RMERCURY = 4.8794e6 # Mercury radius, [m]
|
|
14
15
|
|
|
15
16
|
speciesdict = {
|
|
16
17
|
"avgs": "p",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: pyvlasiator
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Python utilities for processing Vlasiator data
|
|
5
5
|
Author: Hongyang Zhou
|
|
6
6
|
Author-email: hyzhou@umich.edu
|
|
@@ -17,6 +17,9 @@ Description-Content-Type: text/markdown
|
|
|
17
17
|
# pyvlasiator
|
|
18
18
|
|
|
19
19
|
<p align="center">
|
|
20
|
+
<a href="https://badge.fury.io/py/pyvlasiator">
|
|
21
|
+
<img src="https://badge.fury.io/py/pyvlasiator.svg" alt="PyPI version" height="18">
|
|
22
|
+
</a>
|
|
20
23
|
<a href="https://github.com/henry2004y/pyvlasiator/actions">
|
|
21
24
|
<img src="https://github.com/henry2004y/pyvlasiator/actions/workflows/CI.yml/badge.svg">
|
|
22
25
|
</a>
|
|
@@ -31,7 +34,7 @@ Description-Content-Type: text/markdown
|
|
|
31
34
|
</a>
|
|
32
35
|
</p>
|
|
33
36
|
|
|
34
|
-
Lightweight Python package for processing Vlasiator data.
|
|
37
|
+
Lightweight Python package for processing [Vlasiator](https://github.com/fmihpc/vlasiator) data, alternative to [Analysator](https://github.com/fmihpc/analysator).
|
|
35
38
|
|
|
36
39
|
## Installation
|
|
37
40
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
pyvlasiator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
pyvlasiator/plot/__init__.py,sha256=1QgvCaH3js2rCCJs3JoKcFN0fUOVfz7_gFSxyP8auLg,281
|
|
3
|
+
pyvlasiator/plot/plot.py,sha256=X-A9O9KmxH0W_P6UJpfxaP1S8dRyAJYxgx0TNotMY88,35706
|
|
4
|
+
pyvlasiator/pyvlasiator.py,sha256=11dp6PsBPHacbGHtzI7mdS8NreiBNYuwbI5cx_5bfDw,62
|
|
5
|
+
pyvlasiator/vlsv/__init__.py,sha256=T1_Znxt_H7XL-Al5IG0C_CKBw_u2VkeVQ3O1INH29po,81
|
|
6
|
+
pyvlasiator/vlsv/reader.py,sha256=5kUQwlJTy83DV3ReABUPwG2LfkC9WqLtNaRaMbwDslM,35491
|
|
7
|
+
pyvlasiator/vlsv/variables.py,sha256=j_RRonkJramVegV6iqhc7ikPujsxuh9Q92nj9F8Oalc,6030
|
|
8
|
+
pyvlasiator-0.1.5.dist-info/LICENSE.md,sha256=UbZmGbnA73ReemkiNPRNfqgGtpPwiGFJiOZo0gxiP_o,1125
|
|
9
|
+
pyvlasiator-0.1.5.dist-info/METADATA,sha256=lSMywEjaLJelpE7HUs49MO2P53NnElbL1bNf153AjWQ,1953
|
|
10
|
+
pyvlasiator-0.1.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
11
|
+
pyvlasiator-0.1.5.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
pyvlasiator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
pyvlasiator/plot/__init__.py,sha256=c1hFydtCjyvZtxuoNagsXXBZTskei0SkXRXoY4_JhKQ,249
|
|
3
|
-
pyvlasiator/plot/plot.py,sha256=h0cNxtwhzNFhB431aJLXQ8s9ckqoWW4EFAB9-hHRgqk,35523
|
|
4
|
-
pyvlasiator/pyvlasiator.py,sha256=11dp6PsBPHacbGHtzI7mdS8NreiBNYuwbI5cx_5bfDw,62
|
|
5
|
-
pyvlasiator/vlsv/__init__.py,sha256=T1_Znxt_H7XL-Al5IG0C_CKBw_u2VkeVQ3O1INH29po,81
|
|
6
|
-
pyvlasiator/vlsv/reader.py,sha256=wWeQhW1vjuWVz9Wu0wIotYwyuDr2h1iKY0afV6JSUZM,35145
|
|
7
|
-
pyvlasiator/vlsv/variables.py,sha256=JTVGUBTs8CX7aonW_vVNKNca3hNsVsr3DXL7NesqeTo,5987
|
|
8
|
-
pyvlasiator-0.1.3.dist-info/LICENSE.md,sha256=UbZmGbnA73ReemkiNPRNfqgGtpPwiGFJiOZo0gxiP_o,1125
|
|
9
|
-
pyvlasiator-0.1.3.dist-info/METADATA,sha256=HnaVCqlwF8sLZZdbMl6TsxQWvgGFezqkicMF3GB-zVw,1702
|
|
10
|
-
pyvlasiator-0.1.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
11
|
-
pyvlasiator-0.1.3.dist-info/RECORD,,
|
|
File without changes
|