Skip to content

Commit 7311b19

Browse files
committed
Refactor pfss_table update logic to use pd.concat for adding reference point data
1 parent 0d408cb commit 7311b19

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

solarmach/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,10 +579,17 @@ def __init__(self, date, body_list, vsw_list=[], reference_long=None, reference_
579579
self.coord_table['Longitudinal separation between body and reference_long'] = longsep_list
580580
self.coord_table[
581581
"Longitudinal separation between body's magnetic footpoint and reference_long"] = footp_longsep_list
582-
self.pfss_table.loc[len(self.pfss_table.index)] = ["Reference Point", self.reference_long, self.reference_lat, 1, np.nan]
583582
if self.reference_lat is not None:
584583
self.coord_table['Latitudinal separation between body and reference_lat'] = latsep_list
585-
self.pfss_table.loc[self.pfss_table["Spacecraft/Body"]=="Reference Point", f"{coord_sys} latitude (°)"] = self.reference_lat
584+
585+
if self.reference_long is not None or self.reference_lat is not None:
586+
self.pfss_table = pd.concat([self.pfss_table,
587+
pd.DataFrame({"Spacecraft/Body": ["Reference Point"],
588+
f"{coord_sys} longitude (°)": [self.reference_long],
589+
f"{coord_sys} latitude (°)": [self.reference_lat],
590+
"Heliocentric_distance (R_Sun)": [1],
591+
"Vsw": [np.nan]})],
592+
ignore_index=True)
586593

587594
# Does this still have a use?
588595
pass

0 commit comments

Comments
 (0)