Skip to content

Commit

Permalink
Function renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyPechnikov committed Sep 23, 2024
1 parent bb176d6 commit 731ced5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions pygmtsar/pygmtsar/Stack_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _align_ref_subswath(self, subswath, debug=False):
#print (reference_line)

# for reference scene
prefix = self.multistem_stem(subswath)
prefix = self.get_subswath_prefix(subswath)
path_prefix = os.path.join(self.basedir, prefix)

# generate PRM, LED, SLC
Expand Down Expand Up @@ -156,7 +156,7 @@ def _align_rep_subswath(self, subswath, date=None, degrees=12.0/3600, debug=Fals
# temporary filenames to be removed
cleanup = []

ref_prefix = self.multistem_stem(subswath)
ref_prefix = self.get_subswath_prefix(subswath)

# define reference image parameters
earth_radius = self.PRM(subswath=subswath).get('earth_radius')
Expand All @@ -166,7 +166,7 @@ def _align_rep_subswath(self, subswath, date=None, degrees=12.0/3600, debug=Fals
topo_llt = self._get_topo_llt(subswath, degrees=degrees)
#topo_llt.shape

rep_prefix = self.multistem_stem(subswath, date)
rep_prefix = self.get_subswath_prefix(subswath, date)

# define relative filenames for PRM
rep_prm = os.path.join(self.basedir, rep_prefix + '.PRM')
Expand Down Expand Up @@ -310,7 +310,7 @@ def baseline_table(self, n_jobs=-1, debug=False):
dates = self.df[self.df.subswath==subswath].date

def get_filename(date):
stem = self.multistem_stem(subswath, date)
stem = self.get_subswath_prefix(subswath, date)
filename = os.path.join(self.basedir, f'{stem}.PRM')
return filename

Expand Down
7 changes: 3 additions & 4 deletions pygmtsar/pygmtsar/Stack_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def to_dataframe(self):
"""
return self.df

def multistem_stem(self, subswath, date=None):
def get_subswath_prefix(self, subswath, date=None):
"""
Define stem and multistem using date
"""
Expand All @@ -41,10 +41,9 @@ def multistem_stem(self, subswath, date=None):
if date is None:
date = self.reference

assert len(date)==10, 'ERROR: multistem_stem date format is not yyyy-mm-dd'
assert len(date)==10, 'ERROR: date format is not yyyy-mm-dd'

prefix = f'{date}_F{subswath}'
return prefix
return f'{date}_F{subswath}'

def set_reference(self, reference):
"""
Expand Down
2 changes: 1 addition & 1 deletion pygmtsar/pygmtsar/Stack_prm.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def PRM(self, date=None, subswath=None):
if date is None:
date == self.reference

prefix = self.multistem_stem(subswath, date)
prefix = self.get_subswath_prefix(subswath, date)
filename = os.path.join(self.basedir, f'{prefix}.PRM')
return PRM.from_file(filename)

Expand Down
2 changes: 1 addition & 1 deletion pygmtsar/pygmtsar/Stack_reframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _reframe_subswath(self, subswath, date, geometry, debug=False):
df = self.get_repeat(subswath, date)
if debug:
print('DEBUG: reframe scenes: ', len(df))
prefix = self.multistem_stem(subswath, date)
prefix = self.get_subswath_prefix(subswath, date)
if debug:
print ('DEBUG: ','prefix', prefix)

Expand Down
6 changes: 3 additions & 3 deletions pygmtsar/pygmtsar/Stack_reframe_gmtsar.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _ext_orb_s1a(self, subswath, date=None, debug=False):

orbit = os.path.relpath(df['orbitpath'].iloc[0], self.basedir)

prefix = self.multistem_stem(subswath, date)
prefix = self.get_subswath_prefix(subswath, date)

argv = ['ext_orb_s1a', f'{prefix}.PRM', orbit, prefix]
if debug:
Expand Down Expand Up @@ -108,7 +108,7 @@ def _make_s1a_tops(self, subswath, date=None, mode=0, rshift_fromfile=None, ashi
# TODO: use subswath
xmlfile = os.path.relpath(df['metapath'].iloc[0], self.basedir)
datafile = os.path.relpath(df['datapath'].iloc[0], self.basedir)
prefix = self.multistem_stem(subswath, date)
prefix = self.get_subswath_prefix(subswath, date)

argv = ['make_s1a_tops', xmlfile, datafile, prefix, str(mode)]
if rshift_fromfile is not None:
Expand Down Expand Up @@ -173,7 +173,7 @@ def _assemble_tops(self, subswath, date, azi_1, azi_2, debug=False):
else:
datapaths = [os.path.relpath(path, self.basedir)[:-5] for path in df['datapath']]
#print ('datapaths', datapaths)
prefix = self.multistem_stem(subswath, date)
prefix = self.get_subswath_prefix(subswath, date)

# round values and convert to strings
azi_1 = np.round(azi_1).astype(int).astype(str)
Expand Down

0 comments on commit 731ced5

Please sign in to comment.