nisar-solid / ATBD

Notebooks for NISAR Solid Earth Algorithm Theoretical Basis Document
34 stars 22 forks source link

Create NISAR_SES_Coseismic_Requirement_Validation_v1_PR.ipynb #16

Closed EJFielding closed 2 years ago

EJFielding commented 2 years ago

Coseismic notebook with Puerto Rico coseismic descending track analysis

review-notebook-app[bot] commented 2 years ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

EJFielding commented 2 years ago

@yunjunz Note that this first Puerto Rico notebook does not successfully extract all of the GPS coseismic displacements. I tracked this down to the fact that the GPS data is missing from three of the GPS stations in the two days after the earthquake, at least at the Nevada Geodetic Laboratory. I was thinking of adding a function to check the extracted displacements and then try some later dates if the first date is not available.

yunjunz commented 2 years ago

You want to try mintpy.utils.time_func.estimate_time_func(). It should work regardless of InSAR or GNSS time series.

EJFielding commented 2 years ago

Thanks @yunjunz. It looked to me like that utils function only worked on InSAR time series. Do you have any example of using it for GNSS time series?

yunjunz commented 2 years ago

Thanks @yunjunz. It looked to me like that utils function only worked on InSAR time series. Do you have any example of using it for GNSS time series?

I don't have a working example for GNSS data. This is not a high-level function, please check the function comments for usage, they are documented in detail.

andreadonnellan commented 2 years ago

We have a GNSS notebook posted here: https://github.com/GeoGateway/JupyterNotebooks/tree/master/getDisplacement

Andrea

From: Zhang Yunjun @.> Reply-To: nisar-solid/ATBD @.> Date: Monday, March 7, 2022 at 3:03 PM To: nisar-solid/ATBD @.> Cc: Subscribed @.> Subject: [EXTERNAL] Re: [nisar-solid/ATBD] Create NISAR_SES_Coseismic_Requirement_Validation_v1_PR.ipynb (PR #16)

Thanks @yunjunzhttps://urldefense.us/v3/__https:/github.com/yunjunz__;!!PvBDto6Hs4WbVuu7!bbrKsZ46Mbb-780AJ3iUREam7gOUIZjZAI22Kx6JCDlYso_dMnnD0aNeeX2XLFg4Lw$. It looked to me like that utils function only worked on InSAR time series. Do you have any example of using it for GNSS time series?

I don't have a working example for GNSS data. This is not a high-level function, please check the function comments for usage, they are documented in detail.

— Reply to this email directly, view it on GitHubhttps://urldefense.us/v3/__https:/github.com/nisar-solid/ATBD/pull/16*issuecomment-1061230008__;Iw!!PvBDto6Hs4WbVuu7!bbrKsZ46Mbb-780AJ3iUREam7gOUIZjZAI22Kx6JCDlYso_dMnnD0aNeeX35ivli9A$, or unsubscribehttps://urldefense.us/v3/__https:/github.com/notifications/unsubscribe-auth/ARO5M4O7UEUEGILWGK2QJW3U62DNNANCNFSM5P65AUSQ__;!!PvBDto6Hs4WbVuu7!bbrKsZ46Mbb-780AJ3iUREam7gOUIZjZAI22Kx6JCDlYso_dMnnD0aNeeX19ZgBN0A$. Triage notifications on the go with GitHub Mobile for iOShttps://urldefense.us/v3/__https:/apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!PvBDto6Hs4WbVuu7!bbrKsZ46Mbb-780AJ3iUREam7gOUIZjZAI22Kx6JCDlYso_dMnnD0aNeeX2likfujA$ or Androidhttps://urldefense.us/v3/__https:/play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!PvBDto6Hs4WbVuu7!bbrKsZ46Mbb-780AJ3iUREam7gOUIZjZAI22Kx6JCDlYso_dMnnD0aNeeX2D_E3lIQ$. You are receiving this because you are subscribed to this thread.Message ID: @.***>

EJFielding commented 2 years ago

@andreadonnellan Thanks for the reminder about your GeoGateway notebook. I think I found the part of the code in getDisplacementNGL.py that does the coseismic displacement calculation with a weighted difference between before and after time windows, but it is buried in a lot of extra code that generates KML files and maps. The core displacement calculation also has no comments so I am not sure exactly what all the variables are, so I am not sure I can separate that from the other parts. Is there another version of this that only does the displacement calculation without all the KML generation?

EJFielding commented 2 years ago

After I installed all the requirements for the GeoGateway notebook, I found that the getDisplacementNGL.py code also returns a basic data table, in addition to generating the KML files, so maybe I can use it without modification and ignore the extra output files.

andreadonnellan commented 2 years ago

Hi Erik – yes. There should be output table for all cases.

Andrea

From: Eric Fielding @.> Reply-To: nisar-solid/ATBD @.> Date: Tuesday, March 8, 2022 at 9:11 AM To: nisar-solid/ATBD @.> Cc: Andrea Donnellan @.>, Mention @.***> Subject: [EXTERNAL] Re: [nisar-solid/ATBD] Create NISAR_SES_Coseismic_Requirement_Validation_v1_PR.ipynb (PR #16)

After I installed all the requirements for the GeoGateway notebook, I found that the getDisplacementNGL.py code also returns a basic data table, in addition to generating the KML files, so maybe I can use it without modification and ignore the extra output files.

— Reply to this email directly, view it on GitHubhttps://urldefense.us/v3/__https:/github.com/nisar-solid/ATBD/pull/16*issuecomment-1062008354__;Iw!!PvBDto6Hs4WbVuu7!Y_6BiOiuk-jNkAmEt73IfzsQFZv1I0Nakhqai9ZzQwOlKerCroUuwTGr_xRGtPlThg$, or unsubscribehttps://urldefense.us/v3/__https:/github.com/notifications/unsubscribe-auth/ARO5M4KJKUFAQMIDQDQMN3DU66C3TANCNFSM5P65AUSQ__;!!PvBDto6Hs4WbVuu7!Y_6BiOiuk-jNkAmEt73IfzsQFZv1I0Nakhqai9ZzQwOlKerCroUuwTGr_xThTU-fwg$. Triage notifications on the go with GitHub Mobile for iOShttps://urldefense.us/v3/__https:/apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!PvBDto6Hs4WbVuu7!Y_6BiOiuk-jNkAmEt73IfzsQFZv1I0Nakhqai9ZzQwOlKerCroUuwTGr_xRfscbIGA$ or Androidhttps://urldefense.us/v3/__https:/play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!PvBDto6Hs4WbVuu7!Y_6BiOiuk-jNkAmEt73IfzsQFZv1I0Nakhqai9ZzQwOlKerCroUuwTGr_xSA_wAqhA$. You are receiving this because you were mentioned.Message ID: @.***>

yunjunz commented 2 years ago

Hi @EJFielding, below is an example.

I issued a minor mintpy PR (https://github.com/insarlab/MintPy/pull/756) to support this note (to make it simpler), please update your mintpy code to run this note.

%matplotlib inline
import os
import numpy as np
from matplotlib import pyplot as plt
from mintpy.utils import ptime, time_func
from mintpy.objects import gps
plt.rcParams.update({'font.size': 12})

work_dir = os.path.expanduser('~/data/test/test_gnss_time_func')
os.chdir(work_dir)
print('Go to directory:', work_dir)

# 1. download & read GNSS displacement time series
site_id = 'P593'
gps_obj = gps.GPS(site=site_id, data_dir=os.path.join(work_dir, 'GPS'))
gps_obj.open()

# 2. fit time function
model = {
    'polynomial' : 2,
    'periodic'   : [1.0],
    'step'       : ['20190706'],
}
G, m, e2 = time_func.estimate_time_func(model, gps_obj.date_list, gps_obj.dis_n)

# 3. reconstruct time series from estimated time function parameters
date_list_fit = ptime.get_date_range(gps_obj.date_list[0], gps_obj.date_list[-1])
dates_fit = ptime.date_list2vector(date_list_fit)[0]
G_fit = time_func.get_design_matrix4time_func(date_list_fit, model)
dis_ts_fit = np.matmul(G_fit, m)

# plot
fig, ax = plt.subplots(figsize=[12, 4])
ax.plot(gps_obj.dates, gps_obj.dis_n, '.', ms=4)
ax.plot(dates_fit, dis_ts_fit, lw=4, alpha=0.8)
ax.set_ylabel('North displacement [m]')
ax.set_title(f'Site {site_id} at [{gps_obj.site_lon:.6f}, {gps_obj.site_lat:.6f}]')
plt.show()

gnss_ts_fit

dbekaert commented 2 years ago

@EJFielding Can you confirm to have updated based on @yunjunz comment. If so i think we should be good to merge.

EJFielding commented 2 years ago

Yes, the latest version of this PR has all the suggestions implemented.

dbekaert commented 2 years ago

Yes, the latest version of this PR has all the suggestions implemented.

Great, saw it in the ridgecrest notebook.