mirror of
https://github.com/JHUAPL/kaipy.git
synced 2026-01-09 14:28:02 -05:00
Merged development into shellGridXDMF
This commit is contained in:
@@ -434,7 +434,7 @@ def fetch_helio_spacecraft_HGS_trajectory(spacecraft, t_start, t_end, mjdc):
|
||||
"""
|
||||
# Read the CDAWeb spacecraft database.
|
||||
spacecraft_data_file = os.path.join(
|
||||
os.environ["KAIJUHOME"], "kaipy", "satcomp", "sc_helio.json"
|
||||
os.environ["KAIPYHOME"], "kaipy", "satcomp", "sc_helio.json"
|
||||
)
|
||||
sc_info = scutils.getScIds(spacecraft_data_file=spacecraft_data_file)
|
||||
|
||||
@@ -508,7 +508,7 @@ def fetch_helio_spacecraft_trajectory(sc_id, t_start, t_end):
|
||||
"""
|
||||
# Read the CDAWeb spacecraft database.
|
||||
sc_metadata_path = os.path.join(
|
||||
os.environ["KAIJUHOME"], "kaipy", "satcomp", "sc_helio.json"
|
||||
os.environ["KAIPYHOME"], "kaipy", "satcomp", "sc_helio.json"
|
||||
)
|
||||
sc_metadata = scutils.getScIds(spacecraft_data_file=sc_metadata_path)
|
||||
|
||||
@@ -546,7 +546,7 @@ def ingest_helio_spacecraft_trajectory(sc_id, sc_data, MJDc):
|
||||
"""
|
||||
# Read the CDAWeb spacecraft database.
|
||||
sc_metadata_path = os.path.join(
|
||||
os.environ["KAIJUHOME"], "kaipy", "satcomp", "sc_helio.json"
|
||||
os.environ["KAIPYHOME"], "kaipy", "satcomp", "sc_helio.json"
|
||||
)
|
||||
sc_metadata = scutils.getScIds(spacecraft_data_file=sc_metadata_path)
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ class GameraPipe(object):
|
||||
None
|
||||
"""
|
||||
|
||||
uID = kh5.PullAtt(f0, "UnitsID")
|
||||
uID = kh5.PullAtt(f0, "UnitsID",a0="CODE") #Setting default
|
||||
#with h5py.File(f0, 'r') as hf:
|
||||
# uID = hf.attrs.get("UnitsID", "CODE")
|
||||
if not isinstance(uID, str):
|
||||
|
||||
@@ -795,9 +795,9 @@ def PlotMerBrNorm(
|
||||
shading="auto")
|
||||
|
||||
# Plot the heliospheric current sheet.
|
||||
Ax.contour(np.sqrt(xr_c**2 + yr_c**2), zr_c, Br_r, [0.],
|
||||
Ax.contour(np.sqrt(xr_c**2 + yr_c**2), zr_c, Br_l, [0.],
|
||||
colors='black')
|
||||
Ax.contour(-np.sqrt(xl_c**2 + yl_c**2), zl_c, Br_l, [0.],
|
||||
Ax.contour(-np.sqrt(xl_c**2 + yl_c**2), zl_c, Br_r, [0.],
|
||||
colors='black')
|
||||
|
||||
else:
|
||||
|
||||
@@ -585,7 +585,7 @@ def PullVar(fname, vID, s0=None, slice=()):
|
||||
return V
|
||||
|
||||
#Get attribute data from Step#s0 or root (s0=None)
|
||||
def PullAtt(fname, vID, s0=None):
|
||||
def PullAtt(fname, vID, s0=None, a0=None):
|
||||
'''
|
||||
Retrieve an attribute from an HDF5 file.
|
||||
|
||||
@@ -593,7 +593,7 @@ def PullAtt(fname, vID, s0=None):
|
||||
fname (str): The path to the HDF5 file.
|
||||
vID (str): The name of the attribute to retrieve.
|
||||
s0 (int, optional): The step number. If provided, the attribute will be retrieved from the group corresponding to the step number.
|
||||
|
||||
a0 (whatevs, optional): The default for the attribute if it's not in the file
|
||||
Returns:
|
||||
The value of the attribute.
|
||||
|
||||
@@ -604,9 +604,16 @@ def PullAtt(fname, vID, s0=None):
|
||||
CheckOrDie(fname)
|
||||
with h5py.File(fname, 'r') as hf:
|
||||
if s0 is None:
|
||||
Q = hf.attrs[vID]
|
||||
hfA = hf.attrs
|
||||
else:
|
||||
gID = "/Step#%d" % (s0)
|
||||
Q = hf[gID].attrs[vID]
|
||||
hfA = hf[gID].attrs
|
||||
|
||||
if (vID not in hfA.keys()):
|
||||
#Use default
|
||||
Q = a0
|
||||
else:
|
||||
Q = hfA[vID]
|
||||
|
||||
return Q
|
||||
|
||||
|
||||
Reference in New Issue
Block a user