-
Notifications
You must be signed in to change notification settings - Fork 263
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
multiple GNSS/GPS sources support #1173
Conversation
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
pre-commit.ci autofix |
I always wanted to rename the GPS naming into GNSS, for a more generic purpose. This includes all the related functions, variables, and option names, and code comments/documentation. As for the |
Sure! And I agree philosophically. |
@rzinke Could you go for this change? I will check more at the PR later this week. |
Yes. I am working on it right now. Would you like the whole module gps.py renamed to gnss.py? |
Yes please. |
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
…efault. Changed Generic to upper case. Added options for JPL-SIDESHOW and GENERIC in arg_utils choices.
Hi @yunjunz, thanks for the feedback. I have incorporated the proposed changes into the gnss.py module. Please have a look when you get the chance. Cheers. |
+ read_JPL_SIDESHOW_station_list(): use `np.loadtxt` for simplicity + search_gnss(): move crop in space/time/# code into here, for simplicity and readability
+ objects.gnss: - search_gnss(): set back the min_num_solution default value to 50 - use os.path.isfile() to check the existence of file, instead of os.path.exists() - rename get_gnss_los_obs() to get_los_obs() - simplify GNSS.__crop_to_date_range__() and display_data() - rename display_data() to plot() - call self.open() when needed in the member functions, so that it can be removed on the user side, to simplify the usage - fix two issues: 1) add __init__() in the child class, define self.file; 2) retry downloading if failed; 3) retry downloading if loadtxt() failed on existing data file, due to download interuption in the previous run - rename child class names, to be consistent with the folder name + utils.plot.plot_gnss(): print the nearest GNSS site to the current reference point, to faciltate the --ref-gnss option setup
+ rename get_stat_lat_lon() to get_site_lat_lon() + rename read_*_station_list() to read_*_site_list()
+ objects.gnss.py - get_los_obs(): use different CSV file name for different sources - add get_ESESES_url_prefix() to speedup the ESESES downloading / calculation - rename file_url to url for member var - add a new member var: url_prefix - move dload_site() to the parent class for better reuse. + utils.plot.plot_gnss(): specify the missing gnss_source arg + utils.ptime.get_date_str_format(): add YYYYMMDD:HHMMSS format
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.
Hi @rzinke, I finished the review of this long PR finally. Everything looks good to me now, except for one last comment below, regarding the plotting code below within GNSS.displacement_enu2los()
.
Let's ignore the Codacy warning: it's fine.
+ displacement_enu2los(): remove the plotting code + move the matplotlib import into the sub-function, to speedup the warmup proc
Description of proposed changes
SUMMARY
I have redefined the
GPS
class to be a dedicated parent class, and have defined several child classes (e.g.,UNR_GPS
,ESESES_GPS
) that will inherit the existing GPS processing routines. Doing so has the dual benefit of providing a straightforward structure for adding new GPS data formats, while requiring as few changes as possible to the existing MintPy code base. Related to nisar-solid/ATBD#3.RATIONALE
The best way of implementing plugins for multiple GNSS sources is, as far as I can tell, using parent and child classes. This will provide a structured format for ingesting potential new data, maximizes reuse of existing code when new data sources are introduced, and minimizes the number of modifications to the existing code base.
The
class GPS
is now a parent class, which maintains the functions one would want to apply to all GPS time series, regardless of where they were processed or how they are archived. Once loaded, the three-component displacement data can be cropped, projected, displayed, and fit with mathematical models as a function of time:The funcitons for loading and formatting the displacement time series should follow a common set of operations (e.g., load, format, etc., ...) and return the same attributes (e.g., dates, displacement components, etc.), but will obviously differ depending on the format of the source data. To account for this, one should define "child" classes, which inherit the properites and subroutines of the parent class, but for which the methods can be redefined.
That way, all one would need to do to get the data into the proper format for all subsequent operations, is to define a new child class, e.g.,
class MyGPS
with the same sequence of subroutines, rewritten for a specific data format.Once a child class has been defined, it can easily be recalled by the parent class using the static method
GPS.get_gps_obj_by_source(<processing_source>)
. This offers both convenience and structure, and reduces the number ofif
statements in the broader code base. For exampleis all one needs to add in order to not break the existing libraries.
Reminders
New functionality
The user can now specify GPS processing source. If not specified, the default source is UNR NGL -- the only source supported currently -- and all functions can be used as before, as if no changes were made.