Gamera package
kaipy.gamera.deltabViz module
- kaipy.gamera.deltabViz.CheckLevel(dbdata, k0, Re)
Check if the given vertical level is valid and return the corresponding height.
- Parameters:
dbdata (numpy.ndarray) – The database data object.
k0 (int) – The vertical level to check.
Re (float) – The Earth’s radius.
- Returns:
The height corresponding to the given vertical level.
- Return type:
float
- Raises:
SystemExit – If the given vertical level is invalid.
- kaipy.gamera.deltabViz.DecorateDBAxis(Ax, crs, utDT)
Decorates the given axis with gridlines, coastlines, and nightshade feature.
- Parameters:
Ax (matplotlib.axes.Axes) – The axis to decorate.
crs (cartopy.crs.Projection) – The projection of the axis.
utDT (datetime.datetime) – The datetime object representing the Universal Time.
- Returns:
None
- kaipy.gamera.deltabViz.GenTStr(Ax, fname, nStp, doVerb=True)
Generate a title string for a plot based on the given parameters.
- Parameters:
Ax (matplotlib.axes.Axes) – The axes object on which the title will be displayed.
fname (str) – The file name.
nStp (int) – The time step.
doVerb (bool, optional) – Whether to enable verbose mode. Defaults to True.
- Returns:
The generated title string.
- Return type:
str
- kaipy.gamera.deltabViz.GenUniformLL(dbdata, k0=0)
Generate uniform latitude and longitude grids based on the given data.
- Parameters:
dbdata (numpy.ndarray) – The input data.
k0 (int, optional) – The index of the data to use (default is 0).
- Returns:
A tuple containing the latitude grid, longitude grid, latitude grid at cell centers, and longitude grid at cell centers.
- Return type:
tuple
- kaipy.gamera.deltabViz.GetCoords(fname)
Retrieves the coordinates and radius of the Earth from the given file.
- Parameters:
fname (str) – The file name or path.
- Returns:
A tuple containing the coordinates ID and the radius of the Earth.
- Return type:
tuple
kaipy.gamera.gamGrids module
- kaipy.gamera.gamGrids.Aug2D(XX, YY, doEps=False, TINY=1e-08, KeepOut=True, Rpx=1.15)
Perform 2D augmentation on the given XX and YY arrays.
- Parameters:
XX (ndarray) – 2D array representing the x-coordinates.
YY (ndarray) – 2D array representing the y-coordinates.
doEps (bool, optional) – Flag indicating whether to perform epsilon adjustment. Defaults to False.
TINY (float, optional) – Small value used for epsilon adjustment. Defaults to 1.0e-8.
KeepOut (bool, optional) – Flag indicating whether to keep the inner boundary outside. Defaults to True.
Rpx (float, optional) – Critical radius for the inner boundary. Defaults to 1.15.
- Returns:
Augmented xxG array. ndarray: Augmented yyG array.
- Return type:
ndarray
- kaipy.gamera.gamGrids.Aug2Dext(XX, YY, Nadd)
Extend a 2D grid by adding points in the i-direction.
- Parameters:
XX (ndarray) – Input grid in the x-direction.
YY (ndarray) – Input grid in the y-direction.
Nadd (int) – Number of points to add in the i-direction.
- Returns:
Extended grid in the x-direction. ndarray: Extended grid in the y-direction.
- Return type:
ndarray
- kaipy.gamera.gamGrids.Aug3D(xxG, yyG, Nk=32, TINY=1e-08)
Generate a 3D grid with augmented dimensions.
- Parameters:
xxG (ndarray) – 2D array representing the x-coordinates of the grid.
yyG (ndarray) – 2D array representing the y-coordinates of the grid.
Nk (int) – Number of grid points in the z-direction (default: 32).
TINY (float) – Small value used for spacing error check (default: 1.0e-8).
- Returns:
3D array representing the augmented x-coordinates of the grid. Y3 (ndarray): 3D array representing the augmented y-coordinates of the grid. Z3 (ndarray): 3D array representing the augmented z-coordinates of the grid.
- Return type:
X3 (ndarray)
- kaipy.gamera.gamGrids.Egglipses(Ni=32, Nj=64, Rin=3.0, Rout=30.0, rtail=250.0, NumSph=5)
Compute the parameters of ellipses.
- Parameters:
Ni (int) – Number of points in the x-direction.
Nj (int) – Number of points in the y-direction.
Rin (float) – Inner radius of the ellipses.
Rout (float) – Outer radius of the ellipses.
rtail (float) – Tail radius of the ellipses.
NumSph (int) – Number of spheres.
- Returns:
- A tuple containing the following parameters:
x0 (ndarray): x-coordinate of the center of the ellipses.
a (ndarray): Semi-major axis of the ellipses.
b (ndarray): Semi-minor axis of the ellipses.
- Return type:
tuple
- kaipy.gamera.gamGrids.GenKSph(Ni=32, Nj=64, Nk=32, Rin=5, Rout=40, tMin=0.2, tMax=0.8)
Generate a spherical grid in 3D.
- Parameters:
Ni – Number of grid points in the radial direction.
Nj – Number of grid points in the polar angle direction.
Nk – Number of grid points in the azimuthal angle direction.
Rin – Inner radius of the grid.
Rout – Outer radius of the grid.
tMin – Minimum polar angle of the grid.
tMax – Maximum polar angle of the grid.
- Returns:
X-coordinate values of the grid points. Y3: Y-coordinate values of the grid points. Z3: Z-coordinate values of the grid points.
- Return type:
X3
- kaipy.gamera.gamGrids.GenKSphNonU(Ni=32, Nj=64, Nk=32, Rin=5, Rout=40, tMin=0.2, tMax=0.8)
Generate a non-uniform spherical grid.
- Parameters:
Ni (int) – Number of nodes in the radial direction.
Nj (int) – Number of nodes in the polar angle direction.
Nk (int) – Number of nodes in the azimuthal angle direction.
Rin (float) – Inner radius of the grid.
Rout (float) – Outer radius of the grid.
tMin (float) – Minimum value of the polar angle.
tMax (float) – Maximum value of the polar angle.
- Returns:
x-coordinates of the grid points. Y3 (ndarray): y-coordinates of the grid points. Z3 (ndarray): z-coordinates of the grid points.
- Return type:
X3 (ndarray)
- kaipy.gamera.gamGrids.GenKSphNonUGL(Ni=32, Nj=64, Nk=32, Rin=5, Rout=40, tMin=0.2, tMax=0.8)
Generate a non-uniform grid in a spherical coordinate system.
- Parameters:
Ni – Number of grid points in the radial direction.
Nj – Number of grid points in the polar angle direction.
Nk – Number of grid points in the azimuthal angle direction.
Rin – Inner radius of the grid.
Rout – Outer radius of the grid.
tMin – Minimum value of the polar angle.
tMax – Maximum value of the polar angle.
- Returns:
Array of x-coordinates of the grid points. Y3: Array of y-coordinates of the grid points. Z3: Array of z-coordinates of the grid points.
- Return type:
X3
- kaipy.gamera.gamGrids.LoadTabG(fIn='lfmG', Nc=0)
LoadTabG function loads tabular data from files LFM X and Y grid files.
- Parameters:
fIn (str) – The base filename of the input files (without extension). Default is “lfmG”.
Nc (int) – The number of rows to exclude from the loaded data. Default is 0.
- Returns:
A tuple containing two numpy arrays, xxi and yyi, representing the loaded data.
- Return type:
tuple
- kaipy.gamera.gamGrids.PrintRing(NCh, rID='safe', doWarn=False)
Print the ring configuration.
- Parameters:
NCh (numpy array) – Array containing the number of channels for each ring.
rID (str) – Identifier for the ring configuration. Default is “safe”.
doWarn (bool) – Flag indicating whether to display a warning message. Default is False.
- kaipy.gamera.gamGrids.RampUp(r, rC, lC)
Calculate the ramp-up value based on the given parameters.
- Parameters:
r (float) – The input value.
rC (float) – The center value for the ramp-up.
lC (float) – The length of the ramp-up.
- Returns:
The ramp-up value.
- Return type:
float
- kaipy.gamera.gamGrids.VizGrid(XX, YY, xxG=None, yyG=None, doGhost=False, doShow=True, xyBds=None, fOut='grid.png')
Visualizes a grid using matplotlib.
- Parameters:
XX (numpy.ndarray) – X-coordinates of the grid.
YY (numpy.ndarray) – Y-coordinates of the grid.
xxG (numpy.ndarray, optional) – X-coordinates of the ghost points.
yyG (numpy.ndarray, optional) – Y-coordinates of the ghost points.
doGhost (bool, optional) – Whether to plot the ghost points.
doShow (bool, optional) – Whether to display the plot.
xyBds (list, optional) – Bounds of the plot in the form [x_max, x_min, y_min, y_max].
fOut (str, optional) – Output file name for the plot.
- Returns:
None
- kaipy.gamera.gamGrids.WriteChimp(X3, Y3, Z3, fOut='cGrid.h5')
Write the CHIMP X, Y, and Z arrays to a grid file in single precision.
- Parameters:
X3 (ndarray) – The X array.
Y3 (ndarray) – The Y array.
Z3 (ndarray) – The Z array.
fOut (str, optional) – The output file name. Defaults to “cGrid.h5”.
- kaipy.gamera.gamGrids.WriteGrid(X3, Y3, Z3, fOut='gGrid.h5')
Write the grid data to an HDF5 file.
- Parameters:
X3 (numpy.ndarray) – The X coordinates of the grid.
Y3 (numpy.ndarray) – The Y coordinates of the grid.
Z3 (numpy.ndarray) – The Z coordinates of the grid.
fOut (str) – The output file name. Default is “gGrid.h5”.
- kaipy.gamera.gamGrids.genEgg(Ni=32, Nj=64, Rin=3.0, Rout=30.0, xtail=250, NumSph=5, TINY=1e-08, A=0.0)
Generate an egg-shaped grid.
- Parameters:
Ni (int) – Number of grid points in the x-direction.
Nj (int) – Number of grid points in the y-direction.
Rin (float) – Inner radius of the egg.
Rout (float) – Outer radius of the egg.
xtail (int) – Tail length of the egg.
NumSph (int) – Number of spheres in the egg.
TINY (float) – A small value used for numerical stability.
A (float) – Warping parameter for the egg shape.
- Returns:
A tuple containing the x-coordinates and y-coordinates of the grid points.
- Return type:
tuple
- kaipy.gamera.gamGrids.genEllip(Ni=32, Nj=64, Rin=3.0, Rout=30, TINY=1e-08)
Generate an elliptical grid.
- Parameters:
Ni (int) – Number of grid points in the x-direction. Default is Ni0.
Nj (int) – Number of grid points in the y-direction. Default is Nj0.
Rin (float) – Inner radius of the ellipse. Default is 3.0.
Rout (float) – Outer radius of the ellipse. Default is 30.0.
TINY (float) – A small value to avoid division by zero. Default is 1.0e-8.
- Returns:
A tuple containing the x-coordinates and y-coordinates of the grid points.
- Return type:
tuple
- kaipy.gamera.gamGrids.genFatEgg(Ni=32, Nj=64, Rin=3.0, Rout=30.0, xtail=250, NumSph=5, TINY=1e-08, A=0.0)
Generate a fat egg-shaped grid.
- Parameters:
Ni (int) – Number of grid points in the x-direction. Default is Ni0.
Nj (int) – Number of grid points in the y-direction. Default is Nj0.
Rin (float) – Inner radius of the egg. Default is 3.0.
Rout (float) – Outer radius of the egg. Default is 30.0.
xtail (int) – Tail length of the egg. Default is 250.
NumSph (int) – Number of spheres in the egg. Default is 5.
TINY (float) – A small value used for numerical stability. Default is 1.0e-8.
A (float) – Warping parameter. Default is 0.0.
- Returns:
A tuple containing the x-coordinates and y-coordinates of the grid points.
- Return type:
tuple
- kaipy.gamera.gamGrids.genRing(XX, YY, Nk=64, Tol=1.0, doVerb=False)
Generate a ring grid based on the input coordinates.
- Parameters:
XX (ndarray) – Array of x-coordinates.
YY (ndarray) – Array of y-coordinates.
Nk (int) – Number of divisions in the ring grid. Default is 64.
Tol (float) – Tolerance value for determining the maximum scale of each ring. Default is 1.0.
doVerb (bool) – Flag to enable verbose output. Default is False.
- Returns:
None
- kaipy.gamera.gamGrids.genSph(Ni=32, Nj=64, Rin=3.0, Rout=30, TINY=1e-08)
Generate a spherical grid.
- Parameters:
Ni (int) – Number of grid points in the radial direction.
Nj (int) – Number of grid points in the angular direction.
Rin (float) – Inner radial bound of the grid.
Rout (float) – Outer radial bound of the grid.
TINY (float) – A small value used for numerical stability.
- Returns:
- A tuple containing two numpy arrays (XX, YY) representing the coordinates of the grid points.
XX (numpy.ndarray): Array of shape (Ni+1, Nj+1) containing the x-coordinates of the grid points. YY (numpy.ndarray): Array of shape (Ni+1, Nj+1) containing the y-coordinates of the grid points.
- Return type:
tuple
- kaipy.gamera.gamGrids.regrid(xxi, yyi, Ni, Nj, Rin=0.0, Rout=0.0, TINY=1e-08, scale=False)
Regrids a grid defined by xxi and yyi onto a new grid with dimensions Ni and Nj.
- Parameters:
xxi (ndarray) – The x-coordinate values of the original grid.
yyi (ndarray) – The y-coordinate values of the original grid.
Ni (int) – The number of points in the x-direction of the new grid.
Nj (int) – The number of points in the y-direction of the new grid.
Rin (float, optional) – The minimum radial value for rescaling. Defaults to 0.0.
Rout (float, optional) – The maximum radial value for rescaling. Defaults to 0.0.
TINY (float, optional) – A small value used for numerical stability. Defaults to 1.0e-8.
scale (bool, optional) – Whether to extend the grid for low Mach numbers. Defaults to False.
- Returns:
The x-coordinate values of the regridded grid. ndarray: The y-coordinate values of the regridded grid.
- Return type:
ndarray
kaipy.gamera.gampp module
- class kaipy.gamera.gampp.GameraPipe(fdir, ftag, doFast=False, doVerbose=True, doParallel=False, nWorkers=4)
Bases:
objectGameraPipe class represents a pipe object for Gamera.
- Parameters:
fdir (str) – Directory to h5 files.
ftag (str) – Stub of h5 files.
doFast (bool) – Flag indicating whether to use fast mode. Default is False.
doVerbose (bool) – Flag indicating whether to print verbose output. Default is True.
doParallel (bool) – Flag indicating whether to use parallel processing. Default is False.
nWorkers (int) – Number of workers for parallel processing. Default is 4.
- GetGrid(doVerbose)
Load Grid from Gamera HDF5 file
- Parameters:
doVerbose (bool) – Flag indicating whether to display verbose output.
- Returns:
None
- GetGridParallel(doVerbose)
Parallel read of grid datasets
This method performs a parallel read of grid datasets using multiple processes. It populates the X, Y, and Z arrays with the corresponding dataset values.
- Parameters:
doVerbose (bool) – Flag indicating whether to display verbose output.
- Returns:
None
- GetRootSlice(vID, ijkdir='idir', n=1, vScl=None, doVerb=True)
Retrieves the root slice of a given variable.
- Parameters:
vID (int) – The ID of the variable.
ijkdir (str) – The direction of the slice. Defaults to ‘idir’.
n (int) – The number of slices to retrieve. Defaults to 1.
vScl (float) – The scaling factor for the variable. Defaults to None.
doVerb (bool) – Whether to print verbose output. Defaults to True.
- Returns:
The root slice of the variable.
- Return type:
Vs
- GetRootVar(vID, vScl=None, doVerb=True)
Get the root variable with the given ID.
- Parameters:
vID (str) – The ID of the variable.
vScl (float, optional) – The scale of the variable.
doVerb (bool, optional) – Whether to perform verbose logging.
- Returns:
The root variable with the given ID.
- Return type:
np.ndarray
- GetSlice(vID, sID, ijkdir='idir', n=1, vScl=None, doVerb=True)
Get variable slice of constant i, j, k Directions = idir/jdir/kdir strings Indexing = (1, Nijk)
- Parameters:
vID (str) – The variable ID.
sID (int) – The step ID.
ijkdir (str, optional) – The slice direction. Defaults to ‘idir’.
n (int, optional) – The slice index. Defaults to 1.
vScl (float, optional) – The variable scale. Defaults to None.
doVerb (bool, optional) – Whether to print verbose information. Defaults to True.
- Returns:
The sliced variable.
- Return type:
Vs (ndarray)
- GetVar(vID, sID=None, vScl=None, doVerb=True)
Reads a variable with the given name.
- Parameters:
vID (str) – The name of the variable to be read.
sID (int, optional) – The step ID. Default is None.
vScl (float, optional) – The scaling factor for the variable. Default is None.
doVerb (bool, optional) – A flag indicating whether to display progress bar and verbose output. Default is True.
- Returns:
The variable data read from the file.
- Return type:
np.ndarray
- GetVarParallel(vID, sID=None, vScl=None, doVerb=True)
Parallel read of Var
This method performs a parallel read of a variable from the dataset.
- Parameters:
vID (str) – The ID of the variable to read.
sID (int, optional) – The step ID. Defaults to None.
vScl (float, optional) – The scaling factor for the variable. Defaults to None.
doVerb (bool, optional) – Whether to display progress bars and verbose output. Defaults to True.
- Returns:
The variable data as a NumPy array.
- Return type:
ndarray
- OpenPipe(doVerbose=True)
Opens a pipe for reading data from a database file.
- Parameters:
doVerbose (bool) – Flag indicating whether to print verbose output. Default is True.
- Returns:
None
- Raises:
None –
- SetUnits(f0)
Sets the units for the given file.
- Parameters:
f0 (str) – The file path.
- Returns:
None
kaipy.gamera.magsphere module
- class kaipy.gamera.magsphere.GamsphPipe(fdir, ftag, doFast=False, uID='Earth')
Bases:
GameraPipe- AddCPCP(n, Ax, xy=[0.9, 0.95], cLab='black', fs='medium', doBox=True, BoxC='lightgrey')
Adds CPCP (North/South) text to the given Axes object.
- Parameters:
n (int) – The value of n.
Ax (matplotlib.axes.Axes) – The Axes object to add the text to.
xy (list, optional) – The coordinates of the text in the Axes object. Default is [0.9, 0.95].
cLab (str, optional) – The color of the text. Default is dLabC.
fs (float, optional) – The font size of the text. Default is dLabFS.
doBox (bool, optional) – Whether to add a rounded box around the text. Default is True.
BoxC (str, optional) – The color of the box. Default is dBoxC.
- AddSW(n, Ax, xy=[0.725, 0.025], cLab='black', fs='medium', T0=0.0, doBox=True, BoxC='lightgrey', doAll=True)
Adds solar wind data to the plot.
- Parameters:
n (int) – The index of the solar wind data.
Ax (matplotlib.axes.Axes) – The axes object to add the text to.
xy (list, optional) – The coordinates of the text box. Default is [0.725, 0.025].
cLab (str, optional) – The color of the text. Default is dLabC.
fs (float, optional) – The font size of the text. Default is dLabFS.
T0 (float, optional) – The initial time. Default is 0.0.
doBox (bool, optional) – Whether to add a box around the text. Default is True.
BoxC (str, optional) – The color of the box. Default is dBoxC.
doAll (bool, optional) – Whether to include all solar wind data. Default is True.
- AddTime(n, Ax, xy=[0.9, 0.95], cLab='black', fs='medium', T0=0.0, doBox=True, BoxC='lightgrey')
Adds time information to the plot.
- Parameters:
n (int) – The index of the time value to be added.
Ax (matplotlib.axes.Axes) – The axes object on which the time information will be added.
xy (list, optional) – The coordinates of the text box. Default is [0.9, 0.95].
cLab (str, optional) – The color of the text. Default is dLabC.
fs (float, optional) – The font size of the text. Default is dLabFS.
T0 (float, optional) – The reference time. Default is 0.0.
doBox (bool, optional) – Whether to add a text box around the time information. Default is True.
BoxC (str, optional) – The color of the text box. Default is dBoxC.
- CMIViz(AxM=None, nStp=0, doNorth=True, loc='upper left', dxy=[20, 20])
Visualizes the potential and field-aligned current of a magnetic sphere.
- Parameters:
AxM (matplotlib.axes.Axes, optional) – A matplotlib Axes object to plot the visualization on.
nStp (int, default=0) – The time step index.
doNorth (bool, default=True) – Flag indicating whether to visualize the north or south hemisphere.
loc (str, default="upper left") – The location of the legend in the plot.
dxy (list, default=[20,20]) – The spacing between grid points in the plot.
- Returns:
None
- DelBz(s0=0)
Calculate the change in Bz.
- Parameters:
s0 (float) – The value of s0 (default: 0).
- Returns:
The change in Bz.
- Return type:
dbz (numpy.ndarray)
- EggSlice(vID, sID=None, vScl=None, doEq=True, doVerb=True, numGhost=0)
Slice the 3D variable along the egg-shaped region.
- Parameters:
vID (int) – The ID of the variable to slice.
sID (int, optional) – The ID of the slice to retrieve. Defaults to None.
vScl (float, optional) – The scaling factor for the variable. Defaults to None.
doEq (bool, optional) – Whether to slice the upper and lower half planes equally. Defaults to True.
doVerb (bool, optional) – Whether to print verbose output. Defaults to True.
numGhost (int, optional) – The number of ghost cells. Defaults to 0.
- Returns:
The sliced variable.
- Return type:
Qk (ndarray)
- Gam2Remix(n)
Returns the remix value for a given Gamera time step.
- Parameters:
n (int) – The index of the time slice.
- Returns:
The remix value for the given time slice. If no remix value is available, returns None.
- Return type:
fMix
- GetCPCP(n)
Get the CPCP (Cross Polar Cap Convection) for a given time index.
- Parameters:
n (int) – The time index.
- Returns:
A list containing the CPCP values [nCPCP, sCPCP].
- Return type:
list
- GetM0()
Get the value of M0 from the h5py file.
- Returns:
The value of M0.
- Return type:
float
- OpenPipe(doVerbose=True)
Opens the GameraPipe and performs magnetosphere specific operations.
- Parameters:
doVerbose (bool) – Flag indicating whether to print verbose output. Default is True.
- bStream(s0=0, xyBds=[-35, 25, -25, 25], dx=0.05)
Calculates the streamlines of the magnetic field vector in the specified region.
- Parameters:
s0 (float) – The value of the slice parameter.
xyBds (list) – The bounding box of the region in the form [xmin, xmax, ymin, ymax].
dx (float) – The grid spacing for the streamlines.
- Returns:
The x-coordinates of the streamlines. y1 (ndarray): The y-coordinates of the streamlines. gu (ndarray): The x-components of the magnetic field vector along the streamlines. gv (ndarray): The y-components of the magnetic field vector along the streamlines. gM (ndarray): The magnitudes of the magnetic field vector along the streamlines.
- Return type:
x1 (ndarray)
- doStream(U, V, xyBds=[-35, 25, -25, 25], dx=0.05)
Interpolates the given velocity components (U, V) onto a Cartesian grid and returns the interpolated values.
- Parameters:
U (ndarray) – Array of x-component of velocity values.
V (ndarray) – Array of y-component of velocity values.
xyBds (list, optional) – List of x and y bounds for the Cartesian grid. Default is [-35, 25, -25, 25].
dx (float, optional) – Spacing between grid points. Default is 0.05.
- Returns:
Array of x-coordinates of the Cartesian grid. y1 (ndarray): Array of y-coordinates of the Cartesian grid. gu (ndarray): Interpolated x-component of velocity values on the Cartesian grid. gv (ndarray): Interpolated y-component of velocity values on the Cartesian grid. gM (ndarray): Interpolated magnitude of velocity values on the Cartesian grid.
- Return type:
x1 (ndarray)
- eqMagB(s0=0)
Calculate the equivalent magnetic field magnitude.
- Parameters:
s0 (float) – The scaling factor for the magnetic field components. Default is 0.
- Returns:
The equivalent magnetic field magnitude.
- Return type:
float
- vStream(s0=0, xyBds=[-35, 25, -25, 25], dx=0.05)
Calculate the streamlines of the vector field.
- Parameters:
s0 (float) – The value of the parameter s at which to evaluate the vector field. Default is 0.
xyBds (list) – The bounding box of the x-y plane in which to calculate the streamlines. Default is [-35,25,-25,25].
dx (float) – The spacing between grid points in the x-y plane. Default is 0.05.
- Returns:
The x-coordinates of the streamlines. y1 (array): The y-coordinates of the streamlines. gu (array): The x-components of the vector field along the streamlines. gv (array): The y-components of the vector field along the streamlines. gM (array): The magnitudes of the vector field along the streamlines.
- Return type:
x1 (array)
kaipy.gamera.magsphereRescale module
- kaipy.gamera.magsphereRescale.MaxDiv(M)
Calculate the maximum and mean divergence of a given 3D array.
- Parameters:
M (ndarray) – The input 3D array of shape (Nd, Nkc, Njc, Nic), where Nd, Nkc, Njc, Nic are the dimensions of the array.
- Returns:
- The divergence array of shape (Nk, Nj, Ni), where
Nk = Nkc - 1, Nj = Njc - 1, and Ni = Nic - 1.
- Return type:
ndarray
- kaipy.gamera.magsphereRescale.PullRestartMPI(bStr, nRes, Ri, Rj, Rk, dIn=None, oH5=None)
Reads and pulls data from multiple files and returns the combined data.
- Parameters:
bStr (str) – Base string used to generate file names.
nRes (int) – Number of resolutions.
Ri (int) – Number of iterations in the i-direction.
Rj (int) – Number of iterations in the j-direction.
Rk (int) – Number of iterations in the k-direction.
dIn (str, optional) – Directory path for input data files. Defaults to None.
oH5 (str, optional) – Output H5 file path. Defaults to None.
- Returns:
- A tuple containing the following arrays:
G: Gas array with shape (Ns, Nv, Nk, Nj, Ni).
M: MagFlux array with shape (3, Nk+1, Nj+1, Ni+1).
G0: Gas0 array with shape (Ns, Nv, Nk, Nj, Ni) or None if not available.
oG: oGas array with shape (Ns, Nv, Nk, Nj, Ni).
oM: omagFlux array with shape (3, Nk+1, Nj+1, Ni+1).
- Return type:
tuple
- kaipy.gamera.magsphereRescale.PushRestartMPI(outid, nRes, Ri, Rj, Rk, X, Y, Z, G, M, oG, oM, fInA, G0=None)
Generate and write restart files for MPI simulation.
- Parameters:
outid (int) – Output ID.
nRes (int) – Number of restarts.
Ri (int) – Number of MPI processes in the i-direction.
Rj (int) – Number of MPI processes in the j-direction.
Rk (int) – Number of MPI processes in the k-direction.
X (ndarray) – Grid coordinates in the X-direction.
Y (ndarray) – Grid coordinates in the Y-direction.
Z (ndarray) – Grid coordinates in the Z-direction.
G (ndarray) – Gas data.
M (ndarray) – Magnetic flux data.
oG (ndarray) – Offset gas data.
oM (ndarray) – Offset magnetic flux data.
fInA (str) – Input file name.
G0 (ndarray, optional) – Additional gas data. Defaults to None.
- kaipy.gamera.magsphereRescale.Volume(Xg, Yg, Zg)
Calculate the volume of a grid.
- Parameters:
Xg (ndarray) – X-coordinate grid.
Yg (ndarray) – Y-coordinate grid.
Zg (ndarray) – Z-coordinate grid.
- Returns:
Volume of the grid.
- Return type:
ndarray
- kaipy.gamera.magsphereRescale.downFlux(X, Y, Z, M, Xu, Yu, Zu)
Downscale the face fluxes of a given 4D array.
- Parameters:
X (ndarray) – Array of X coordinates.
Y (ndarray) – Array of Y coordinates.
Z (ndarray) – Array of Z coordinates.
M (ndarray) – 4D array of face fluxes.
Xu (ndarray) – Array of X coordinates for the upscaled grid.
Yu (ndarray) – Array of Y coordinates for the upscaled grid.
Zu (ndarray) – Array of Z coordinates for the upscaled grid.
- Returns:
4D array of downscaled face fluxes.
- Return type:
ndarray
- kaipy.gamera.magsphereRescale.downGas(X, Y, Z, G, Xd, Yd, Zd)
Downscale gas variables from a coarse grid to a fine grid.
- Parameters:
X (ndarray) – X-coordinates of the coarse grid.
Y (ndarray) – Y-coordinates of the coarse grid.
Z (ndarray) – Z-coordinates of the coarse grid.
G (ndarray) – Gas variables on the coarse grid.
Xd (ndarray) – X-coordinates of the fine grid.
Yd (ndarray) – Y-coordinates of the fine grid.
Zd (ndarray) – Z-coordinates of the fine grid.
- Returns:
Gas variables downscaled to the fine grid.
- Return type:
ndarray
- kaipy.gamera.magsphereRescale.downGrid(X, Y, Z)
Rescales a grid by reducing its size by half in each dimension.
- Parameters:
X (ndarray) – The X-coordinate grid.
Y (ndarray) – The Y-coordinate grid.
Z (ndarray) – The Z-coordinate grid.
- Returns:
The rescaled X-coordinate grid. ndarray: The rescaled Y-coordinate grid. ndarray: The rescaled Z-coordinate grid.
- Return type:
ndarray
- kaipy.gamera.magsphereRescale.downMIX(Q)
Downmixes a given matrix by averaging 2x2 blocks of values.
- Parameters:
Q (ndarray) – Input matrix of shape (Ni, Nj).
- Returns:
Downmixed matrix of shape (Ni//2, Nj//2).
- Return type:
ndarray
- kaipy.gamera.magsphereRescale.downVolt(G)
Downscale the volt variables in the input array G.
- Parameters:
G (ndarray) – Input array of shape (Nd, Nk, Nj, Ni) representing the volt variables.
- Returns:
Downscaled array of shape (Nd, Nk//2, Nj//2, Ni) representing the downscaled volt variables.
- Return type:
ndarray
- kaipy.gamera.magsphereRescale.upFlux(X, Y, Z, M, Xu, Yu, Zu)
Upscale magnetic fluxes (M) on grid X,Y,Z (w/ ghosts) to doubled grid.
- Parameters:
X (array) – X coordinates.
Y (array) – Y coordinates.
Z (array) – Z coordinates.
M (array) – Input fluxes.
Xu (array) – Upscaled X coordinates.
Yu (array) – Upscaled Y coordinates.
Zu (array) – Upscaled Z coordinates.
- Returns:
Upscaled fluxes.
- Return type:
array
- kaipy.gamera.magsphereRescale.upGas(X, Y, Z, G, Xu, Yu, Zu)
Upscales gas variables from a coarse grid to a finer grid.
- Parameters:
X (ndarray) – Coarse grid X coordinates.
Y (ndarray) – Coarse grid Y coordinates.
Z (ndarray) – Coarse grid Z coordinates.
G (ndarray) – Coarse grid gas variables.
Xu (ndarray) – Fine grid X coordinates.
Yu (ndarray) – Fine grid Y coordinates.
Zu (ndarray) – Fine grid Z coordinates.
- Returns:
Upscaled gas variables on the fine grid.
- Return type:
ndarray
- Raises:
None –
- kaipy.gamera.magsphereRescale.upGrid(X, Y, Z)
Rescales the grid by doubling the number of grid points in each dimension.
- Parameters:
X (ndarray) – The X-coordinate grid.
Y (ndarray) – The Y-coordinate grid.
Z (ndarray) – The Z-coordinate grid.
- Returns:
The rescaled X-coordinate grid. ndarray: The rescaled Y-coordinate grid. ndarray: The rescaled Z-coordinate grid.
- Return type:
ndarray
- kaipy.gamera.magsphereRescale.upMIX(Q)
Upscales a MIX Q by a factor of 2 in both dimensions.
- Parameters:
Q (ndarray) – Input matrix of shape (Ni, Nj).
- Returns:
Upscaled matrix of shape (2*Ni, 2*Nj).
- Return type:
ndarray
- kaipy.gamera.magsphereRescale.upRCM(Q, Ni=1, Nj=1, Nk=1)
Upscales the input array Q for Rice Convection Model (RCM).
- Parameters:
Q (numpy.ndarray) – The input array to be upscaled.
Ni (int, optional) – Number of columns in the output array. Default is 1.
Nj (int, optional) – Number of rows in the output array. Default is 1.
Nk (int, optional) – Number of slices in the output array. Default is 1.
- Returns:
The upscaled array.
- Return type:
numpy.ndarray
Notes
If the input array Q has 3 dimensions or more, the upscaled array will have the shape (Nk, (Nj-2)*2+2, Ni).
If the input array Q has 1 dimension, the upscaled array will have the shape (Nj, 1).
If the input array Q has any other number of dimensions, the upscaled array will have the same shape as Q.
- kaipy.gamera.magsphereRescale.upRCM1D(Q)
Rescales a 1D array by duplicating each element.
- Parameters:
Q (ndarray) – Input array of shape (Ni, Nj).
- Returns:
Rescaled array of shape (2*Ni, Nj).
- Return type:
ndarray
- kaipy.gamera.magsphereRescale.upRCM1Dw(Q)
Upscale the input array Q for RCM using its wrapping method.
Parameters: Q (ndarray): Input array of shape (Ni, Nj).
Returns: Qr (ndarray): Upscaled array of shape (Nri, Nj).
- kaipy.gamera.magsphereRescale.upRCMCpl(Q, N=1)
Upscales the input array Q for the Rice Convection Model Plasma Variable (RCM).
- Parameters:
Q (numpy.ndarray) – The input array to be upscaled.
N (int, optional) – The number of times to upscale the array. Default is 1.
- Returns:
The upscaled array.
- Return type:
numpy.ndarray
Examples
>>> Q = np.array([[1, 2], [3, 4]]) >>> upRCMCpl(Q) array([[1., 1., 2.], [1., 1., 2.], [3., 3., 4.]])
- kaipy.gamera.magsphereRescale.upVolt(G)
kaipy.gamera.msphViz module
- kaipy.gamera.msphViz.AddIonBoxes(gs, ion)
Adds ion boxes to the given gs (GridSpec) object.
- Parameters:
gs (GridSpec) – The GridSpec object to which the ion boxes will be added.
ion – The ion object.
- Returns:
None
- kaipy.gamera.msphViz.AddSizeArgs(parser)
Add size arguments to the parser.
- Parameters:
parser (argparse.ArgumentParser) – The argument parser object.
- Returns:
None
- kaipy.gamera.msphViz.CalcTotalErrAbs(gsphP, gsphO, nStp, fieldNames, doVerb=True, meanAxis=None)
Calculate the total absolute error between two sets of data.
- Parameters:
gsphP (gsph) – The first set of data.
gsphO (gsph) – The second set of data.
nStp (int) – Step number to use
fieldNames (list) – A list of field names.
doVerb (bool, optional) – Whether to print verbose output (default is True).
meanAxis (int, optional) – The axis along which to calculate the mean (default is None).
- Returns:
The mean of the absolute error.
- Return type:
float
- kaipy.gamera.msphViz.CalcTotalErrRel(gsphP, gsphO, nStp, fieldNames, doVerb=True, meanAxis=None)
Calculate the total relative error for given field names.
- Parameters:
gsphP (object) – The gsphP object.
gsphO (object) – The gsphO object.
nStp (int) – Step number to use
fieldNames (list) – A list of field names.
doVerb (bool) – Whether to print verbose output. Default is True.
meanAxis (int) – The axis along which to compute the mean. Default is None.
- Returns:
The mean of the total relative error.
- Return type:
float
- kaipy.gamera.msphViz.GetSizeBds(args)
Calculate the bounding box size based on the given size argument.
- Parameters:
args (dict) – A dictionary containing the size argument.
- Returns:
A list containing the bounding box coordinates [xTail, xSun, -yMax, yMax].
- Return type:
list
- kaipy.gamera.msphViz.PlotEqB(gsph, nStp, xyBds, Ax, AxCB=None, doClear=True, doDeco=True, doBz=False)
Plot the equatorial magnetic field.
- Parameters:
gsph (object) – The gsph object containing the data.
nStp (int) – Step number to use
xyBds (tuple) – The x and y boundaries.
Ax (object) – The axis object for the main plot.
AxCB (object, optional) – The axis object for the colorbar. Defaults to None.
doClear (bool, optional) – Whether to clear the axis before plotting. Defaults to True.
doDeco (bool, optional) – Whether to add decorations to the plot. Defaults to True.
doBz (bool, optional) – Whether to plot the vertical field (Bz) or the residual field (dbz). Defaults to False.
- Returns:
The plotted data.
- Return type:
Bz (array)
- kaipy.gamera.msphViz.PlotEqEphi(gsph, nStp, xyBds, Ax, AxCB=None, doClear=True, doDeco=True)
PlotEqEphi function plots the electric field in the phi direction (E_phi) on a given axis.
- Parameters:
gsph (object) – The gsph object representing the spherical grid.
nStp (int) – Step number to use
xyBds (tuple) – The bounds of the x and y coordinates.
Ax (object) – The axis object on which to plot the electric field.
AxCB (object, optional) – The axis object for the colorbar. (default: None)
doClear (bool, optional) – Whether to clear the axis before plotting. (default: True)
doDeco (bool, optional) – Whether to add decorations to the plot. (default: True)
- Returns:
None
- kaipy.gamera.msphViz.PlotEqErrAbs(gsphP, gsphO, nStp, xyBds, Ax, fieldNames, AxCB=None, doClear=True, doDeco=True, vMin=1e-09, vMax=0.0001, doLog=True, doVerb=True)
PlotEqErrAbs function plots the absolute error between two gsph objects.
- Parameters:
gsphP (gsph) – The gsph object representing the predicted values.
gsphO (gsph) – The gsph object representing the observed values.
nStp (int) – Step number to use
xyBds (list) – The bounds of the x and y axes.
Ax (matplotlib.axes.Axes) – The matplotlib Axes object to plot on.
fieldNames (list) – A list of field names.
AxCB (matplotlib.axes.Axes, optional) – The matplotlib Axes object to add the colorbar to. (default: None)
doClear (bool, optional) – Whether to clear the Axes object before plotting. (default: True)
doDeco (bool, optional) – Whether to add additional decorations to the plot. (default: True)
vMin (float, optional) – The minimum value for the colorbar. (default: 1e-9)
vMax (float, optional) – The maximum value for the colorbar. (default: 1e-4)
doLog (bool, optional) – Whether to use logarithmic scale for the colorbar. (default: True)
doVerb (bool, optional) – Whether to print verbose output. (default: True)
- Returns:
The absolute error data.
- Return type:
dataAbs (ndarray)
- kaipy.gamera.msphViz.PlotEqErrRel(gsphP, gsphO, nStp, xyBds, Ax, fieldNames, AxCB=None, doClear=True, doDeco=True, vMin=1e-16, vMax=1, doLog=True, doVerb=True)
PlotEqErrRel function plots the relative error between two gsph objects.
- Parameters:
gsphP (gsph) – The gsph object representing the predicted values.
gsphO (gsph) – The gsph object representing the observed values.
nStp (int) – Step number to use
xyBds (list) – The bounds of the x and y axes.
Ax (matplotlib.axes.Axes) – The matplotlib axis object to plot on.
fieldNames (list) – A list of field names to plot.
AxCB (matplotlib.axes.Axes, optional) – The matplotlib axis object to add the colorbar to. (default: None)
doClear (bool, optional) – Whether to clear the axis before plotting. (default: True)
doDeco (bool, optional) – Whether to add additional decorations to the plot. (default: True)
vMin (float, optional) – The minimum value for the colorbar. (default: 1e-16)
vMax (float, optional) – The maximum value for the colorbar. (default: 1)
doLog (bool, optional) – Whether to use logarithmic scale for the colorbar. (default: True)
doVerb (bool, optional) – Whether to print verbose output. (default: True)
- Returns:
The relative error data.
- Return type:
dataRel (ndarray)
- kaipy.gamera.msphViz.PlotJyXZ(gsph, nStp, xyBds, Ax, AxCB=None, jScl=None, doDeco=True)
Plot the Jy component of a spherical grid on the XZ plane.
- Parameters:
gsph (object) – The spherical grid object.
nStp (int) – Step number to use
xyBds (tuple) – The bounds of the X and Y axes.
Ax (object) – The matplotlib axis object to plot on.
AxCB (object) – The matplotlib colorbar axis object.
jScl (float) – The scaling factor for the Jy component.
doDeco (bool) – Whether to add additional decorations to the plot.
- Returns:
None
- kaipy.gamera.msphViz.PlotLogicalErrAbs(gsphP, gsphO, nStp, Ax, fieldNames, meanAxis, AxCB=None, doClear=True, doDeco=True, vMin=1e-16, vMax=1, doLog=True, doVerb=True)
Plot the absolute error between two gsph objects.
- Parameters:
gsphP (gsph) – The gsph object representing the predicted values.
gsphO (gsph) – The gsph object representing the observed values.
nStp (int) – Step number to use
Ax (matplotlib.axes.Axes) – The matplotlib Axes object to plot on.
fieldNames (list) – A list of field names.
meanAxis (int) – The axis along which to calculate the mean.
AxCB (matplotlib.axes.Axes, optional) – The matplotlib Axes object to add the colorbar to.
doClear (bool, optional) – Whether to clear the Axes before plotting. (default: True)
doDeco (bool, optional) – Whether to add decorations to the plot. (default: True)
vMin (float, optional) – The minimum value for the colorbar. (default: 1e-16)
vMax (float, optional) – The maximum value for the colorbar. (default: 1)
doLog (bool, optional) – Whether to use logarithmic scale for the colorbar. (default: True)
doVerb (bool, optional) – Whether to print verbose output. (default: True)
- Returns:
The calculated absolute error data.
- Return type:
ndarray
- kaipy.gamera.msphViz.PlotLogicalErrRel(gsphP, gsphO, nStp, Ax, fieldNames, meanAxis, AxCB=None, doClear=True, doDeco=True, vMin=1e-16, vMax=1, doLog=True, doVerb=True)
Plot the logical error relative to the observed values.
- Parameters:
gsphP (gsph) – The predicted gsph object.
gsphO (gsph) – The observed gsph object.
nStp (int) – Step number to use
Ax (matplotlib.axes.Axes) – The matplotlib Axes object to plot on.
fieldNames (list) – A list of field names.
meanAxis (int) – The axis along which to calculate the mean.
AxCB (matplotlib.axes.Axes, optional) – The matplotlib Axes object to add the colorbar to. (default: None)
doClear (bool, optional) – Whether to clear the Axes object before plotting. (default: True)
doDeco (bool, optional) – Whether to add decorations to the plot. (default: True)
vMin (float, optional) – The minimum value for the colorbar. (default: 1e-16)
vMax (float, optional) – The maximum value for the colorbar. (default: 1)
doLog (bool, optional) – Whether to use logarithmic scale for the colorbar. (default: True)
doVerb (bool, optional) – Whether to print verbose output. (default: True)
- Returns:
The calculated relative error data.
- Return type:
dataRel (ndarray)
- kaipy.gamera.msphViz.PlotMPI(gsph, Ax, ashd=0.5)
Add the MPI (Message Passing Interface) boundaries to the visualization.
- Parameters:
gsph (object) – The gsph object containing the data for plotting.
Ax (object) – The matplotlib Axes object on which to plot.
ashd (float, optional) – The alpha shading value for the plot (default: 0.5).
- Returns:
None
- kaipy.gamera.msphViz.PlotMerid(gsph, nStp, xyBds, Ax, doDen=False, doRCM=False, AxCB=None, doClear=True, doDeco=True, doSrc=False)
Plot the meridional slice of a spherical grid.
- Parameters:
gsph (object) – The spherical grid object.
nStp (int) – Step number to use
xyBds (tuple) – The bounds of the plot.
Ax (object) – The matplotlib axis object to plot on.
doDen (bool, optional) – Whether to plot density (default: False).
doRCM (bool, optional) – Whether to use RCM normalization (default: False).
AxCB (object, optional) – The matplotlib axis object to add the colorbar to (default: None).
doClear (bool, optional) – Whether to clear the axis before plotting (default: True).
doDeco (bool, optional) – Whether to add Earth decoration to the plot (default: True).
doSrc (bool, optional) – Whether to plot source density or pressure (default: False).
- kaipy.gamera.msphViz.plotPlane(gsph, data, xyBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=True, cmap='viridis', doLog=False, midp=None)
Base plotting routine for gsph plane
- Parameters:
gsph (object) – The gsph object representing the plane.
data (array) – The data to be plotted.
xyBds (tuple) – The bounds of the x and y axes.
Ax (object) – The axis on which to plot the plane.
AxCB (object) – The colorbar axis.
var (str, optional) – The variable to be plotted (default is ‘D’).
vMin (float, optional) – The minimum value for the colorbar (default is None).
vMax (float, optional) – The maximum value for the colorbar (default is None).
doDeco (bool, optional) – Whether to apply decorations to the plot (default is True).
cmap (str, optional) – The colormap to be used (default is ‘viridis’).
doLog (bool, optional) – Whether to use logarithmic scaling for the colorbar (default is False).
midp (float, optional) – The midpoint value for the colorbar (default is None).
- Returns:
None
- kaipy.gamera.msphViz.plotXY(gsph, nStp, xyBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=True, cmap='viridis', doLog=False, midp=None)
Plot a 2D slice of data on the XY plane of the gsph object.
- Parameters:
gsph (object) – The gsph object containing the data.
nStp (int) – Step number to use for the slice.
xyBds (tuple) – The bounds of the XY plane.
Ax (object) – The matplotlib axis to plot on.
AxCB (object) – The matplotlib colorbar axis.
var (str, optional) – The variable to plot (default is ‘D’).
vMin (float, optional) – The minimum value for the colorbar (default is None).
vMax (float, optional) – The maximum value for the colorbar (default is None).
doDeco (bool, optional) – Whether to add additional decorations to the plot (default is True).
cmap (str, optional) – The colormap to use for the plot (default is ‘viridis’).
doLog (bool, optional) – Whether to use a logarithmic scale for the colorbar (default is False).
midp (float, optional) – The midpoint value for the colorbar (default is None).
- Returns:
The 2D slice of data.
- Return type:
data
- kaipy.gamera.msphViz.plotXZ(gsph, nStp, xzBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=True, cmap='viridis', doLog=False, midp=None)
Plot a 2D slice of data in the XZ plane.
- Parameters:
gsph (GameraSphere) – The GameraSphere object containing the data.
nStp (int) – Step number to use for the slice.
xzBds (tuple) – The bounds of the XZ plane in the form (xmin, xmax, zmin, zmax).
Ax (Axes) – The matplotlib Axes object to plot on.
AxCB (Axes) – The matplotlib Axes object to use for the colorbar.
var (str) – The variable to plot. Default is ‘D’.
vMin (float) – The minimum value for the colorbar. Default is None.
vMax (float) – The maximum value for the colorbar. Default is None.
doDeco (bool) – Whether to add Earth decoration to the plot. Default is True.
cmap (str) – The colormap to use. Default is ‘viridis’.
doLog (bool) – Whether to use a logarithmic scale for the colorbar. Default is False.
midp (float) – The midpoint value for the colorbar. Default is None.
- Returns:
The 2D slice of data.
- Return type:
data (numpy.ndarray)
kaipy.gamera.rcmpp module
- kaipy.gamera.rcmpp.AddRCMBox(Ax)
Add a rectangular box to the given Axes object.
- Parameters:
Ax – The Axes object to which the rectangle will be added.
- Returns:
None
- kaipy.gamera.rcmpp.GetMask(rcmdata, nStp, doVerb=True)
Generate a mask based on the given rcmdata, nStp, and doVerb parameters.
- Parameters:
rcmdata – The rcmdata object containing the data.
nStp – The value of nStp parameter.
doVerb – A boolean indicating whether to enable verbose mode (default is True).
- Returns:
The generated mask.
- Return type:
I
- kaipy.gamera.rcmpp.GetPotential(rcmdata, nStp, I=None, NumCP=25, doVerb=True)
Calculate the potential and potential values for a given rcmdata.
- Parameters:
rcmdata – The rcmdata object containing the data.
nStp – The time step index.
I – The mask array. If None, it will be calculated using GetMask.
NumCP – The number of potential values to generate.
doVerb – Whether to print verbose output.
- Returns:
The calculated potential. pVals: The potential values.
- Return type:
pot
- kaipy.gamera.rcmpp.GetVarMask(rcmdata, nStp, Qid='P', I=None, doVerb=True)
Get the variable mask for a given RCM data.
- Parameters:
rcmdata – The RCM data object.
nStp – The time step index.
Qid – The variable identifier (default is “P”).
I – The mask array (default is None).
doVerb – Whether to print verbose information (default is True).
- Returns:
The variable array with the mask applied.
- Return type:
Q
- kaipy.gamera.rcmpp.RCMEq(rcmdata, nStp, doMask=False, doXYZ=True, doVerb=True)
Calculate the RCMEq values for the given rcmdata and time step.
- Parameters:
rcmdata – The rcmdata object containing the data.
nStp – The time step index.
doMask – A boolean indicating whether to apply a mask to the calculated values. Default is False.
doXYZ – A boolean indicating whether to calculate the values in XYZ coordinates. Default is doXYZ.
doVerb – A boolean indicating whether to print verbose output. Default is True.
- Returns:
The calculated X values. bmY: The calculated Y values.
- Return type:
bmX
- kaipy.gamera.rcmpp.RCMInset(AxRCM, rcmdata, nStp, vP, pCol='k', doPP=True)
Plot the RCM pressure inset on a given axis.
- Parameters:
AxRCM (matplotlib.axes.Axes) – The axis on which to plot the RCM pressure inset.
rcmdata (numpy.ndarray) – The RCM data.
nStp (int) – The number of steps.
vP (matplotlib.colors.Normalize) – The normalization object for the color map.
pCol (str, optional) – The color of the contour lines. Defaults to “k”.
doPP (bool, optional) – Whether to plot the Npp contour. Defaults to True.
kaipy.gamera.remixpp module
- kaipy.gamera.remixpp.AddCBs(Ax1, Ax2, Lab1='Potential [kV]', Lab2='FAC', Ntk1=7, Ntk2=5, doFlip=True)
Add colorbars to the given axes.
- Parameters:
Ax1 (matplotlib.axes.Axes) – The first axes object to add the colorbar to.
Ax2 (matplotlib.axes.Axes) – The second axes object to add the colorbar to.
Lab1 (str, optional) – The label for the colorbar on Ax1. Default is “Potential [kV]”.
Lab2 (str, optional) – The label for the colorbar on Ax2. Default is “FAC”.
Ntk1 (int, optional) – The number of ticks for the colorbar on Ax1. Default is 7.
Ntk2 (int, optional) – The number of ticks for the colorbar on Ax2. Default is 5.
doFlip (bool, optional) – Whether to flip the colorbar on Ax2. Default is True.
- kaipy.gamera.remixpp.AddPotCB(Ax, Lab='Potential [kV]', Ntk=7)
Add a potential colorbar to the given axis.
- Parameters:
Ax (matplotlib.axes.Axes) – The axis to add the colorbar to.
Lab (str, optional) – The label for the colorbar. Default is “Potential [kV]”.
Ntk (int, optional) – The number of ticks on the colorbar. Default is 7.
- kaipy.gamera.remixpp.CMIPic(nLat, nLon, llBC, P, C, AxM=None, doNorth=True, loc='upper left', dxy=[20, 20])
Generate a map plot using Cartopy and plot data on it.
- Parameters:
nLat (int) – Number of latitude lines.
nLon (int) – Number of longitude lines.
llBC (float) – Bounding latitude for the map.
P (numpy.ndarray) – Data to be plotted as contours.
C (numpy.ndarray) – Data to be plotted as pcolormesh.
AxM (matplotlib.axes.Axes, optional) – The axes to add the inset figure to. If not provided, the current axes will be used.
doNorth (bool, optional) – Flag indicating whether the map is in the northern hemisphere. Default is True.
loc (str, optional) – Location of the inset figure. Default is “upper left”.
dxy (list, optional) – Width and height of the inset figure as a percentage of the parent axes. Default is [20, 20].