Skip to content

Commit

Permalink
Add limit argument to baseline_pairs()
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyPechnikov committed May 3, 2023
1 parent 8979bdd commit f4e8679
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pygmtsar/pygmtsar/SBAS_sbas.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,24 @@ def ondemand(date, dt):
return pd.DataFrame(data).set_index('date')

# returns sorted baseline pairs
def baseline_pairs(self, days=100, meters=150, invert=False, n_jobs=-1, debug=False):
def baseline_pairs(self, days=100, meters=150, limit=None, invert=False, n_jobs=-1, debug=False):
import numpy as np
import pandas as pd

tbl = self.baseline_table(n_jobs=n_jobs, debug=debug)
data = []
for line1 in tbl.itertuples():
counter = 0
for line2 in tbl.itertuples():
#print (line1, line2)
if limit is not None and counter >= limit:
continue
if not (line1.YDAY < line2.YDAY and line2.YDAY - line1.YDAY < days):
continue
if not (abs(line1.BPR - line2.BPR)< meters):
continue

counter += 1
if not invert:
data.append({'ref_date':line1.Index, 'rep_date': line2.Index,
'ref_timeline': np.round(line1.YDAY/365.25+2014, 2), 'ref_baseline': np.round(line1.BPR, 2),
Expand Down

0 comments on commit f4e8679

Please sign in to comment.