-
Notifications
You must be signed in to change notification settings - Fork 297
diff.py btw. time-series and velocity + other changes
#1018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
+ will read the velocity file and re-construct the timeseries + take care of referencing + do the timeseries diff as usual + To-Do: this commit is motivated for doing correction based on ITRF.h5 velocity model in the time-series domain. Thus, the commit only provides a time function model `m` hard-coded as a linear function. Later, we can write a new ts2velo.hdf5_dataset2model() to produce this m based on the dataset_list names in general velocity files.
+ add median filter from skimage.filters.median + handle NaN holes in lowpass gaussian filter
+ allow for input argument --vmin, --vmax for plotting the result plotting
+ Kai: handle 0 in when 'numTriNonzeroIntAmbiguity.h5' as mask_file. 0 of this file is good. Non-zero is bad
+ change --unit to --scale to be more accurate + merge --vmin/vmax into -v / --vlim option, to be consistent with view.py + use the same name in argparse and sub-functions + scale the calculated vmin/vmax from the data with the same factor.
diff.py and other changesdiff.py btw. time-series and velocity + other changes
+ rename `diff_timeseries_velocity()` to `diff_timeseries_and_velocity()` for consistency + remove unit_fac, which is for giant, and not applicable here + use one date_list as multiple date lists and their common elements are not applicable here + use REF_DATE from file1 only to check if temporal referencing is needed or not, as no reference date info is available from the velocity dataset, even though REF_DATE metadata may be available in file2. + remove periodic / step functions from the model construction, as their corresponding datasets are not read form the h5 file, for simplicity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @yuankailiu for the useful PR. For the diff.py time-series and velocity functionality, I modified the code on top of yours. A test based on the SanFranSenDT42 example dataset between timeseries.h5 and velocity.h5 shows a reasonable result, but I don't have a large dataset at hand, could you re-confirm the effectiveness of plate motion correction?
For the other changes, I left a few minor comments below. Take a look and let me know what you think please.
+ separate mask (output) and mask_data (data read from the mask file), for clarity + if input is numTriNonzeroIntAmbiguity.h5 file, keep pixels with value of 0, and mask out the rest, only if no --mask-vmin/vmax option is specified, as they should and do have higher priority than the default translation of numTriNonzeroIntAmbiguity. + remove prior_good variable, and move all the operations in the later stage of the code, for clarity
|
Looks all good to me. |
Thanks! Appreciate for reviewing and refactoring them! I will merge it. |
|
I saw that you added the nice way to ignore nans here, but that it's only for lowpass gaussian right now. Sorry I didn't see this in time, but what if we changed this MintPy/src/mintpy/spatial_filter.py Lines 68 to 70 in 6fffa3b
to be elif filter_type == "highpass_gaussian":
return data - filter_data(data, "lowpass_gaussian", filter_par=filter_par):so we don't have to redo the logic twice? |
|
Good catch @scottstanie. I missed it as well. Could you issue a PR for it? |

Description of proposed changes
Several modifications.
diff.py: does (timeseries) - (velocity) = (timeseries_new)diff_timeseries_velocity()inputs/ITRF.h5velocity model in the time-series domain. Thus, the commit only allows a time function modelmto identify linear, annual, and semiannual functions. Later, we can write a new ts2velo.hdf5_dataset2model() to produce this m based on the dataset_list names in general velocity files.spatial_filter.py: add a median filter fromskimage.filters.medianimage_stitch.py: allow for vmin/vmax, cmap, and display unitplot.py: numTriNonzeroIntAmbiguity.h5 mask out the non-zero values (non-zero is bad pixels) for mask creatinggps.pyobject: GPS time function fit with a user-defined modelReminders