From f4e86793f100167da00d4186ca9747f0c55ad6f3 Mon Sep 17 00:00:00 2001 From: Alexey Pechnikov Date: Wed, 3 May 2023 07:12:25 +0700 Subject: [PATCH] Add limit argument to baseline_pairs() --- pygmtsar/pygmtsar/SBAS_sbas.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pygmtsar/pygmtsar/SBAS_sbas.py b/pygmtsar/pygmtsar/SBAS_sbas.py index 655dc48a..d0769006 100644 --- a/pygmtsar/pygmtsar/SBAS_sbas.py +++ b/pygmtsar/pygmtsar/SBAS_sbas.py @@ -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),