Skip to content

Commit

Permalink
Allow get pairs for a single grid
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Pechnikov committed Aug 23, 2024
1 parent e49be70 commit d675380
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pygmtsar/pygmtsar/Stack_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,15 @@ def get_pairs(self, pairs, dates=False):
# workaround for baseline_pairs() output
pairs = pairs.rename(columns={'ref_date': 'ref', 'rep_date': 'rep'})
elif isinstance(pairs, (xr.DataArray, xr.Dataset)):
# pairs = pd.DataFrame({
# 'ref': pairs.coords['ref'].values,
# 'rep': pairs.coords['rep'].values
# })
refs = pairs.coords['ref'].values
reps = pairs.coords['rep'].values
pairs = pd.DataFrame({
'ref': pairs.coords['ref'].values,
'rep': pairs.coords['rep'].values
'ref': refs if isinstance(refs, np.ndarray) else [refs],
'rep': reps if isinstance(reps, np.ndarray) else [reps]
})
else:
# Convert numpy array to DataFrame
Expand Down

0 comments on commit d675380

Please sign in to comment.