forked from viscid-hub/Viscid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84fd482
commit 6db25c3
Showing
28 changed files
with
551 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
viscid.calculator.minvar_tools module | ||
===================================== | ||
|
||
.. automodule:: viscid.calculator.minvar_tools | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
viscid.calculator.mpause module | ||
=============================== | ||
|
||
.. automodule:: viscid.calculator.mpause | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
viscid.compat.vimportlib module | ||
=============================== | ||
|
||
.. automodule:: viscid.compat.vimportlib | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
Ionosphere Plots | ||
================ | ||
|
||
.. plot:: | ||
:include-source: | ||
|
||
from matplotlib import pyplot as plt | ||
|
||
import viscid | ||
from viscid.plot import mpl | ||
|
||
iono_file = viscid.load_file(_viscid_root + '/../../sample/sample_xdmf.iof.xdmf') | ||
|
||
fac_tot = 1e9 * iono_file["fac_tot"] | ||
|
||
plot_args = dict(projection="polar", | ||
lin=[-300, 300], | ||
bounding_lat=35.0, | ||
drawcoastlines=True, # for basemap only, probably will never be used | ||
title="Total FAC\n", # make a title, or if a string, use the string as title | ||
gridec='gray', | ||
label_lat=True, | ||
label_mlt=True, | ||
colorbar=dict(pad=0.1) # pad the colorbar away from the plot | ||
) | ||
|
||
ax1 = plt.subplot(121, projection='polar') | ||
mpl.plot(fac_tot, ax=ax1, hemisphere='north', **plot_args) | ||
ax1.annotate('(a)', xy=(0, 0), textcoords="axes fraction", | ||
xytext=(-0.1, 1.0), fontsize=18) | ||
ax2 = plt.subplot(122, projection='polar') | ||
plot_args['gridec'] = False | ||
mpl.plot(fac_tot, ax=ax2, hemisphere="south", style="contourf", | ||
levels=50, extend="both", **plot_args) | ||
ax2.annotate('(b)', xy=(0, 0), textcoords="axes fraction", | ||
xytext=(-0.1, 1.0), fontsize=18) | ||
plt.gcf().set_size_inches(10, 5.0) | ||
mpl.tighten() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
Extracting Magnetopause Information | ||
=================================== | ||
|
||
Viscid has the ability to extract magnetopause information using :py:func:`viscid.get_mp_info`. By default, Viscid will cache the results into a set of hdf5+xdmf files so that it will not always load the larger 3d files. | ||
|
||
.. image:: ../images/mpause-000.png | ||
:align: center | ||
|
||
| | ||
.. image:: ../images/mpause-001.png | ||
:align: center | ||
|
||
| | ||
.. code-block:: python | ||
import numpy as np | ||
import viscid | ||
from viscid.plot import mvi | ||
f = viscid.load_file("$WORK/xi_fte_001/*.3d.[4050f].xdmf") | ||
mp = viscid.get_mp_info(f['pp'], f['b'], f['j'], f['e_cc'], fit='mp_xloc', | ||
slc="x=6.5f:10.5f, y=-4f:4f, z=-4.8f:3f", | ||
cache=False) | ||
y, z = mp['pp_max_xloc'].meshgrid_flat(prune=True) | ||
x = mp['pp_max_xloc'].data.reshape(-1) | ||
Y, Z = mp['pp_max_xloc'].meshgrid(prune=True) | ||
x2 = viscid.paraboloid(Y, Z, *mp['paraboloid'][0]) | ||
skip = 117 | ||
# get normals from paraboloid surface | ||
parab_n = viscid.paraboloid_normal(Y, Z, *mp['paraboloid'][0]) | ||
parab_n = parab_n.reshape(3, -1)[:, ::skip] | ||
# get normals from minvar | ||
minvar_y = Y.reshape(-1)[::skip] | ||
minvar_z = Z.reshape(-1)[::skip] | ||
minvar_n = np.zeros([3, len(minvar_y)]) | ||
for i in range(minvar_n.shape[0]): | ||
p0 = [0.0, minvar_y[i], minvar_z[i]] | ||
p0[0] = mp['pp_max_xloc']['y={0[0]}f, z={0[1]}f'.format(p0)] | ||
lmn = viscid.find_minvar_lmn_around(f['b'], p0, l=2.0, n=64) | ||
minvar_n[:, i] = lmn[2, :] | ||
fig = mvi.mlab.gcf() | ||
fig.scene.background = (1.0, 1.0, 1.0) | ||
fig.scene.foreground = (0.05, 0.05, 0.05) | ||
grey = (0.75, ) * 3 | ||
red = (1, 0, 0) | ||
blue = (0, 0, 1) | ||
mvi.mlab.points3d(x[::skip], y[::skip], z[::skip], scale_factor=0.25, | ||
color=blue) | ||
mp_width = mp['mp_width']['x=0'] | ||
mp_sheath_edge = mp['mp_sheath_edge']['x=0'] | ||
mp_sphere_edge = mp_sheath_edge - mp_width | ||
mvi.mlab.mesh(x2, Y, Z, scalars=mp_width.data) | ||
mvi.mlab.mesh(mp_sheath_edge.data, Y, Z, opacity=0.75, color=grey) | ||
mvi.mlab.mesh(mp_sphere_edge.data, Y, Z, opacity=0.75, color=grey) | ||
mvi.mlab.quiver3d(x2.reshape(-1)[::skip], | ||
Y.reshape(-1)[::skip], | ||
Z.reshape(-1)[::skip], | ||
parab_n[0], parab_n[1], parab_n[2], color=red, | ||
mode='arrow') | ||
mvi.mlab.quiver3d(x2.reshape(-1)[::skip], | ||
Y.reshape(-1)[::skip], | ||
Z.reshape(-1)[::skip], | ||
minvar_n[0], minvar_n[1], minvar_n[2], color=blue, | ||
mode='arrow') | ||
mvi.plot_earth_3d(crd_system="gse") | ||
mvi.resize([600, 400]) | ||
mvi.mlab.view(azimuth=+90.0, elevation=90.0, | ||
distance=20.0, focalpoint=(5.0, 0.0, -1.0)) | ||
mvi.savefig("mpause-000.png") | ||
mvi.mlab.view(azimuth=+90.0 - 45.0, elevation=90.0 - 25.0, | ||
distance=20.0, focalpoint=(6.0, 0.0, -1.0)) | ||
mvi.savefig("mpause-001.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.