Skip to content

Commit

Permalink
readfile.read_snap_dim: more tolerant exaction on DATE12 (#1208)
Browse files Browse the repository at this point in the history
+ `readfile.read_snap_dim`: support both `:` and `_` as delimiters while extracting DATE12 from the *.dim file, to support the new workflow as done by Sohrab.

---------

Co-authored-by: Zhang Yunjun <[email protected]>
  • Loading branch information
ssharifi1994 and yunjunz authored Jul 31, 2024
1 parent c03694d commit be73ddd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mintpy/utils/readfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,8 @@ def read_snap_dim(fname):
bases = ds.find("MDElem[@name='Baselines']").findall("MDElem")[0].findall("MDElem")

# date12
dates = [x.get('name').split(':')[1].strip() for x in bases]
# support both delimiters of : and _
dates = [re.split(':|_', x.get('name'))[1].strip() for x in bases][-2:]
[date1, date2] = sorted(dt.datetime.strptime(x, '%d%b%Y').strftime('%Y%m%d') for x in dates)
dim_dict['DATE12'] = f'{date1[2:]}-{date2[2:]}'

Expand Down

0 comments on commit be73ddd

Please sign in to comment.