-
Notifications
You must be signed in to change notification settings - Fork 253
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
euler_pole
: add PMM plotting functions
#935
Conversation
+ add plate boundary files from GSRMv2.1 and MORVEL56 + functions to read the boundary files and plot
42bf86e
to
c1eb0d8
Compare
+ Consistent NNR model file: - src/mintpy/data/plate_boundary/GSRMv2.1/nnr.csv - src/mintpy/data/plate_boundary/MRVL56/nnr.csv - use camelCase plate names (but caplitalize the first character) + Consistent plate boundary file: - src/mintpy/data/plate_boundary/GSRMv2.1/plate_outlines.txt - src/mintpy/data/plate_boundary/MRVL56/plate_outlines.txt - use '> ' before plate abbv. names, good for GMT - use longitude, latitude for the columns, good for GMT + remove useless script: src/mintpy/data/plate_boundary/GSRMv2.1/split_bnds.py + update full reference in README.md under src/mintpy/data/plate_boundary/ + euler_pole.py: update read_plate_attributes() read_plate_outlines()
Checks seem to fail at testing But I did not change this file. |
attempt to fix the unit test error below: ``` Testing /root/tools/MintPy/tests/objects/ionex.py Traceback (most recent call last): File "/root/tools/MintPy/tests/objects/ionex.py", line 110, in <module> test_get_ionex_value() File "/root/tools/MintPy/tests/objects/ionex.py", line 93, in test_get_ionex_value tec_val = ionex.get_ionex_value( File "/root/tools/miniconda3/lib/python3.10/site-packages/mintpy/objects/ionex.py", line 102, in get_ionex_value tec_val = interp_3d_maps( File "/root/tools/miniconda3/lib/python3.10/site-packages/mintpy/objects/ionex.py", line 184, in interp_3d_maps tec_val = interpolate.interpn( File "/root/tools/miniconda3/lib/python3.10/site-packages/scipy/interpolate/_rgi.py", line 654, in interpn return interp(xi) File "/root/tools/miniconda3/lib/python3.10/site-packages/scipy/interpolate/_rgi.py", line 331, in __call__ indices, norm_distances = self._find_indices(xi.T) File "/root/tools/miniconda3/lib/python3.10/site-packages/scipy/interpolate/_rgi.py", line 499, in _find_indices return find_indices(self.grid, xi) File "_rgi_cython.pyx", line 95, in scipy.interpolate._rgi_cython.find_indices File "stringsource", line 660, in View.MemoryView.memoryview_cwrapper File "stringsource", line 350, in View.MemoryView.memoryview.__cinit__ ValueError: ndarray is not C-contiguous ```
This reverts commit b62d748.
This reverts commit 22f88ba.
This reverts commit 5e491ab.
The same test works well locally on my laptop, and I could not find out the reason on circle CI. As you said, this PR did not touch this part of the code, let's ignore this error. Update: this is a bug in |
For the NNR PMM value/tables, maybe it's easier to use if we write them in Python, similar to what we have for ITRM2014-PMM, instead of a data file, which requires extra reading? If so, we could move these variable definitions from Update: I am done with changes on my side for this round of PR review. Please feel free to pull the changes and work on them. |
Yes, I can do that. Now those files have different units compared with our ITRF2014 dictionary. These files still exist just because I need the abbreviated names for the plate polygons. |
+ read GSRM and MORVEL56 model parameters (abbrev) from built-in dictionary + GSRM and MORVEL56 PMM files (csv) are not in used, but keep them for bookkeeping + folder names hosting plate boundaries are modified + use original file names for plate boundaries files (consistent with the source)
Please take a look at the new updates.
But I don't see why we will need to put those dict() in |
refer to: https://github.com/insarlab/MintPy/wiki/plate-motion-package + euler_pole.py: put pmm definitions here, plate abbv are upper case + cli/plate_motion.py: remove pmm definitions + plate_boundary/*/nnr.csv: delete them + to-do: move --plate to --om-cart from mintpy.cli.plate_motion to mintpy.plate_motion
src/mintpy/cli/plate_motion.py will not need this dictionary
from mintpy.objects.euler_pole import ITRF2014_PMM
+ use `MORVEL` instead of `MORVEL56` for the folder name, as it's generic for MORVEL and NNR-MORVEL56, to be consistent of using GSRM, instead of GSRMv2.1 + rename both data files as `plate_outlines.gmt` with shell commands in the README for easy produce + euler_pole: - update data file path from above changes - use `GSRM_V21_PMM` and `NNR_MORVEL56_PMM` for more precise info
src/mintpy/objects/euler_pole.py
Outdated
elif 'MORVEL' in pmm_name: | ||
pmm_name = 'MORVEL' | ||
pmm_dict = NNR_MORVEL56_PMM | ||
coord_order = 'lalo' |
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.
This place should be 'lola' as well.
Because I also flip the order in the file from the original All_boundary
in MORVEL_56.
So we can just set the default as coord_order='lola'
and keep the file as it is (and it also makes sense since it has .gmt
extension.).
But this way, we no longer keep the original downloaded file untouched. But anyway, I already added those >
signs in the file.
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.
As we discussed offline:
- let's keep the original downloaded file content untouched, for reproducibility.
- use
.lonlat
and.latlon
as file extensions, instead of.gmt
, to be more informative. - update the
data/plate_boundary/README.md
file to be consistent with the above changes.
+ use center_lalo to replace center_lat/lon + use satellite_height directly, instead of zoom + map center priority: direct input arg > pts_lalo > polygon centroid + remove vu as it's not used
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 nice PR. I went through everything and am able to produce a nice plot as below. All looks good to me, pending the above comments as we discussed offline.
from matplotlib import pyplot as plt
from mintpy.objects import euler_pole
from shapely import geometry
plate_pmm = euler_pole.ITRF2014_PMM['Arabia']
epole_obj = euler_pole.EulerPole(wx=plate_pmm.omega_x, wy=plate_pmm.omega_y, wz=plate_pmm.omega_z, unit='mas/yr')
plate_boundary = geometry.Polygon(euler_pole.read_plate_outline('GSRM')['Arabia'])
fig, ax = euler_pole.plot_plate_motion(plate_boundary, epole_obj)
plt.show()
+ use the original downloaded files + extensions as .lalo or .lola + modify euler_pole.py accordingly
Thanks @yunjunz for testing. I finish my changes for this PR as we discussed. By the way, now you can do the following to read the dictionary in your notebook:
|
Thank you @yuankailiu for the changes. Built on top of yours, the commit above further simplify the plate_boundary = euler_pole.read_plate_outline('GSRM', 'Arabia') |
euler_pole
: add PMM plotting functions
+ dependency: add shapely to requirements.txt and setup.py file, as it's used in `objects.euler_pole.py` to plot plate motion since insarlab#935. Note that shapely is the dependency for cartopy already, so this won't really affect the mintpy installation.
+ dependency: add shapely to requirements.txt and setup.py file, as it's used in `objects.euler_pole.py` to plot plate motion since insarlab#935. Note that shapely is the dependency for cartopy already, so this won't really affect the mintpy installation. + docs/installation/argcomplete: replace conda with brew for bash installation, so that the bash is independent from the conda directory, which can removed more easily/frequently than /usr/local directory from brew.
+ `dependency`: add `shapely` to `requirements.txt` and `setup.py` file, as it's used in `objects.euler_pole.py` to plot plate motion since #935. Note that 1) shapely is already a dependency for cartopy, so this won't really affect the mintpy installation; 2) shapely has been added explicitly to the dependency on conda-forge for mintpy (conda-forge/mintpy-feedstock#10) + `docs/installation/argcomplete`: replace `conda` with `brew` for bash installation, so that the bash is independent of the conda directory, which can be removed more easily/frequently than `/usr/local directory` from brew.
add plate boundary files from GSRMv2.1 and MORVEL56
functions to read the boundary files and plot
Check here for the usage: https://github.com/yuankailiu/utils/blob/main/notebooks/PMM_plot.ipynb
Description of proposed changes
Reminders