Skip to content

utils: refactor time_func.py and add s1_utils.py #661

Merged
yunjunz merged 3 commits intoinsarlab:mainfrom
yunjunz:time_func
Sep 14, 2021
Merged

utils: refactor time_func.py and add s1_utils.py #661
yunjunz merged 3 commits intoinsarlab:mainfrom
yunjunz:time_func

Conversation

@yunjunz
Copy link
Member

@yunjunz yunjunz commented Sep 13, 2021

Description of proposed changes

This PR adds the following new features:

  1. add a new dedicated utility script utils/time_func.py for estimate_time_func() (from timeseries2velocity.py) and get_design_matrix4time_func() (from objects/stack.py and all its sub-functions).
  2. support accurate time of the day info in THH(:)MM style for relevant time functions (step/exp/log) for hyp3: fix incAngle/slantRangeDist + add more attributes (pass full test) #640.
  3. add a new utility script utils/s1_utils.py dedicated for Sentinel-1 specific functionalities, with initial content from Yunjun et al. [in prep]
  4. add new example dataset RidgecrestSenDT71 for hyp3 from @cirrusasf (sbApp_hyp3: update url of the example dataset MintPy-tutorial#26).

Reminders

  • Pass Codacy code review (green)
  • Pass Circle CI / local test (green)
  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • If modifying functionality, describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

@yunjunz yunjunz requested a review from yuankailiu September 13, 2021 22:27
+ add utils.time_func.py:
   - move get_design_matrix4time_func() from objects.stack.py.
      - switch module import/usage in all related scripts: dem_error, gps, simulation, tsview
      - replace the old func definition with a pointer to the utils.time_func.py for backward compatibility.
   - move estimate_time_func() from timeseries2velocity.py
      - switch module import/usage in all related scripts: timeseries2velocity, tsview
   - set all get_design_matrix4*_func() as independent functions for more flexibility

+ utils.s1_utils:
   - add estimate_S1AB_bias()
   - add get_subswath_masks()

+ objects/gps.py: check site name during initialization for more informative error msg against typo in "view.py --ref-gps"

+ docs/api/module_hierarchy.md: add time_func and s1_utils.
This commit adds the capability to feed accurate hour/minute/second info of step/exp/log functions to the design matrix, to support scenarios when the event and SAR acquisition are in the same day, such as The M6.4 Ridgecrest EQ in 4 July 2019.

+ ptime.yyyymmdd2years(): add seconds arg to add the time of the day info to the output list of years in float

+ time_func: add seconds arg to pass to ptime.yyyymmdd2years() to support time of the day info to all functions inside

+ read/prep seconds info to feed to time_func.py in the following scripts:
   - dem_error.py
   - timeseries2velocity.py
   - tsview.py

+ update example usages in smallbaselineApp.cfg file and arg_group.py
+ add RidgecrestSenDT71 as example dataset for HyP3
   - docs/demo*.md: add RidgecrestSenDT71 dataset produced by ASF HyP3 service by Jiang Zhu.
   - mintpy/data/input_files: add RidgecrestSenDT71.txt

+ add RidgecrestSenDT71 as test dataset for hyp3
   - tests/test_smallbaselineApp: add url for RidgecrestSenDT71 prepared using ASF HyP3 by Jiang Zhu.
   - tests/configs/RidgecrestSenDT71.cfg: update setups for faster testing

+ readfile.read_gdal(): use numpy indexing instead of gdal python binding for more robust performance

+ plot.auto_figure_title(): use custom ds name for generic h5 file
@yunjunz
Copy link
Member Author

yunjunz commented Sep 13, 2021

@yuankailiu could you please take a look at the utils/time_func.py related changes when you got a chance?

Note that I added a pointer in the stack.py to the new time_func.py for backward compatibility, so I don't expect impacts on downstream code from users [would recommend switching to the new script though as it's simpler].

@yunjunz
Copy link
Member Author

yunjunz commented Sep 13, 2021

For book keeping, below are the estimated step function for the co-seismic deformation from the two EQs and it's displacement time-series of a pixel near the fault.

step20190706_wrap10
ts

@yuankailiu
Copy link
Contributor

Thank you @yunjunz for making this much cleaner, even with the resolution down to seconds!
I checked utils/time_func.py and related calls from other scripts. They look good to me.

Copy link
Contributor

@yuankailiu yuankailiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They look good to me. I did not modify anything.

[Update]
Below is tested with the postseismic exponential function (at a pixel) from the Ridgecrest EQ.

image

image

(Time-series files are provided by @nabolfat)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants