4 Commits

Author SHA1 Message Date
Nikhil Rao
4e98d39444 Merged in external_contrib (pull request #18)
External contrib

Approved-by: Michael Wiltberger
2025-09-30 15:35:22 +00:00
Nikhil Rao
ecd934f5ea Updated kaipy version 2025-09-30 11:28:24 -04:00
Nikhil Rao
85f6611bf9 Merge pull request #1 from darrendezeeuw/master
Enable rotation of the colorbar for GAMERA slice plots
2025-09-30 11:24:51 -04:00
Darren De Zeeuw
6ba3da3661 Enable rotation of the colorbar for GAMERA slice plots 2025-09-04 16:06:30 -04:00
3 changed files with 11 additions and 8 deletions

View File

@@ -652,7 +652,7 @@ def AddIonBoxes(gs, ion):
ion.init_vars('SOUTH')
ax = ion.plot('current', gs=gsRM[-dY-wXY:-dY, dX:dX+wXY], doInset=True)
def plotPlane(gsph, data, xyBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=True, cmap='viridis', doLog=False, midp=None):
def plotPlane(gsph, data, xyBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=True, cmap='viridis', doLog=False, midp=None, doVert=False):
"""
Base plotting routine for gsph plane
@@ -669,6 +669,7 @@ def plotPlane(gsph, data, xyBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco
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).
doVert (bool, optional): Whether to display the colorbar vertically (default is False).
Returns:
None
@@ -685,12 +686,12 @@ def plotPlane(gsph, data, xyBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco
vMax = np.max(np.abs([np.min(data), np.max(data)]))
vMin = -1.0 * vMax
vNorm = kv.genNorm(vMin, vMax=vMax, doLog=doLog, midP=midp)
kv.genCB(AxCB, vNorm, cbT=var, cM=cmap, Ntk=7)
kv.genCB(AxCB, vNorm, cbT=var, cM=cmap, Ntk=7, doVert=doVert)
Ax.pcolormesh(gsph.xxi, gsph.yyi, data, cmap=cmap, norm=vNorm)
kv.SetAx(xyBds, Ax)
return
def plotXY(gsph, nStp, xyBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=True, cmap='viridis', doLog=False, midp=None):
def plotXY(gsph, nStp, xyBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=True, cmap='viridis', doLog=False, midp=None, doVert=False):
"""
Plot a 2D slice of data on the XY plane of the gsph object.
@@ -707,19 +708,20 @@ def plotXY(gsph, nStp, xyBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=Tr
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).
doVert (bool, optional): Whether to display the colorbar vertically (default is False).
Returns:
data: The 2D slice of data.
"""
data = gsph.EggSlice(var, nStp, doEq=True)
plotPlane(gsph, data, xyBds, Ax, AxCB, var, vMin=vMin, vMax=vMax, doDeco=doDeco, cmap=cmap, doLog=doLog, midp=midp)
plotPlane(gsph, data, xyBds, Ax, AxCB, var, vMin=vMin, vMax=vMax, doDeco=doDeco, cmap=cmap, doLog=doLog, midp=midp, doVert=doVert)
if doDeco:
kv.addEarth2D(ax=Ax)
Ax.set_xlabel('SM_X [Re]')
Ax.set_ylabel('SM-Y [Re]')
return data
def plotXZ(gsph, nStp, xzBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=True, cmap='viridis', doLog=False, midp=None):
def plotXZ(gsph, nStp, xzBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=True, cmap='viridis', doLog=False, midp=None, doVert=False):
"""
Plot a 2D slice of data in the XZ plane.
@@ -736,12 +738,13 @@ def plotXZ(gsph, nStp, xzBds, Ax, AxCB, var='D', vMin=None, vMax=None, doDeco=Tr
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.
doVert (bool, optional): Whether to display the colorbar vertically (default is False).
Returns:
data (numpy.ndarray): The 2D slice of data.
"""
data = gsph.EggSlice(var,nStp,doEq=False)
plotPlane(gsph,data,xzBds,Ax,AxCB,var,vMin=vMin,vMax=vMax,doDeco=doDeco,cmap=cmap,doLog=doLog,midp=midp)
plotPlane(gsph,data,xzBds,Ax,AxCB,var,vMin=vMin,vMax=vMax,doDeco=doDeco,cmap=cmap,doLog=doLog,midp=midp,doVert=doVert)
if (doDeco):
kv.addEarth2D(ax=Ax)
Ax.set_xlabel('SM_X [Re]')

View File

@@ -7,7 +7,7 @@ include-package-data = true
[project]
name = "kaipy"
version = "1.1.2"
version = "1.1.3"
authors = [
{name = "Eric Winter", email = "eric.winter@jhuapl.edu"},
]

View File

@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name='kaipy',
version='1.1.2',
version='1.1.3',
description='Python software for CGS MAGE and other Kaiju models',
author='Kaiju team',
author_email='wiltbemj@ucar.edu',