AlexeyPechnikov / pygmtsar

PyGMTSAR (Python InSAR): Powerful and Accessible Satellite Interferometry
http://insar.dev/
BSD 3-Clause "New" or "Revised" License
427 stars 95 forks source link

[Help]: Velocity Map from sbas_parralell #113

Open kinreich opened 7 months ago

kinreich commented 7 months ago

Hi, I'm running a long time-series using the previous version of pygmtsar, because all my data progress is saved in the last version.

Last I ran sbas_paralell because sbas.sbas has an issue, and now I have disp grid for each date.

I'm trying to find the code to calculate the velocity displacement from these files, and cannot find any. Could you please help explain how to produce the velocity grd from disp grd in pygmtsar?

OS and software version

AlexeyPechnikov commented 7 months ago

Depending on your PyGMTSAR version, you can try the functions sbas.trend() and sbas.stl(). If these are not available, the linear regression trend can easily be computed as in the trend() function:

    def trend(self, data, deg=1):
        import xarray as xr

        trend = xr.polyval(data.date, data.polyfit('date', deg).polyfit_coefficients)
        return trend

Divide the LOS, vertical, or east-west displacement trend difference (last minus first value per pixel) by your time interval in years to get the velocity in mm/year.