Skip to content
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

Export supplemental gps CSV file #952

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Export supplemental gps CSV file #952

wants to merge 3 commits into from

Conversation

sssangha
Copy link
Contributor

@sssangha sssangha commented Feb 2, 2023

Description of proposed changes

When plotting GPS stations and specifying a specific GPS reference station, it would be convenient if an additional CSV file (e.g. reref_gps_X.csv) would be created which tracks the rereferenced velocity values and accounts for any potential unit factor changes. This would make it easier to make separate, supplemental plots independent of MintPy.

For example, in this case, station 70DM is the reference station and I wish to convert the velocities to cm/yr: (mintpy)

[ssangha@leffe reref]$ more gps_enu2los.csv Site,Lon,Lat,Displacement,Velocity
7ODM,-117.09358508816442,34.11640732493536,-0.13098726,-0.010960488 BBRY,-116.88515702033878,34.26427837432715,-0.04806125,-0.0043038945 P613,-117.04706501804391,34.19618514313232,-0.05000028,-0.0059998427 (mintpy) [ssangha@leffe reref]$
(mintpy) [ssangha@leffe reref]$ more reref_gps_enu2los.csv Site,Lon,Lat,Displacement,Velocity
7ODM,-117.09358508816442,34.11640732493536,0.0,0.0 BBRY,-116.88515702033878,34.26427837432715,0.08292601,0.66565935 P613,-117.04706501804391,34.19618514313232,0.08098697999999999,0.49606452999999995

Reminders

  • Fix #xxxx
  • Pass Pre-commit check (green)
  • Pass Codacy code review (green)
  • Pass Circle CI test (green)
  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • If modifying functionality, describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

When plotting GPS stations and specifying a specific GPS reference station, it would be convenient if an additional CSV file (e.g. reref_gps_X.csv) would be created which tracks the rereferenced velocity values and accounts for any potential unit factor changes. This would make it easier to make separate, supplemental plots independent of MintPy.

For example, in this case, station 70DM is the reference station and I wish to convert the velocities to cm/yr:
(mintpy) [ssangha@leffe reref]$ more gps_enu2los.csv 
Site,Lon,Lat,Displacement,Velocity
7ODM,-117.09358508816442,34.11640732493536,-0.13098726,-0.010960488
BBRY,-116.88515702033878,34.26427837432715,-0.04806125,-0.0043038945
P613,-117.04706501804391,34.19618514313232,-0.05000028,-0.0059998427
(mintpy) [ssangha@leffe reref]$ 
(mintpy) [ssangha@leffe reref]$ more reref_gps_enu2los.csv 
Site,Lon,Lat,Displacement,Velocity
7ODM,-117.09358508816442,34.11640732493536,0.0,0.0
BBRY,-116.88515702033878,34.26427837432715,0.08292601,0.66565935
P613,-117.04706501804391,34.19618514313232,0.08098697999999999,0.49606452999999995
@sssangha sssangha requested a review from yunjunz February 2, 2023 04:44
@sssangha
Copy link
Contributor Author

sssangha commented Feb 2, 2023

Note, this is honestly a quick and dirty hack to get the file I'd want, so I understand if some cleanup/reorganization may be in order to appropriately accommodate this.

Before the updated CSV file was only generated if a reference GPS station were specified. Now, this file is generated and captures at least the unit factor conversion regardless of the specification of a reference GPS station.
@yunjunz
Copy link
Member

yunjunz commented Feb 9, 2023

To achieve your purpose, it seems that we could merge your modification into a new sub-function within mitnpy.object.gps, such as below:

def save_ref_gps_los_obs(csv_file, ref_gps_site, unit_fac):
    ...
    return ref_csv_file

and call it at mintpy.utils.plot.py#L1208:

site_obs, csv_file = gps.get_gps_los_obs(
            meta=metadata,
            obs_type=obs_type,
            site_names=site_names,
            start_date=start_date,
            end_date=end_date,
            gps_comp=inps.gps_component,
            horz_az_angle=inps.horz_az_angle,
            print_msg=print_msg,
            redo=inps.gps_redo,
        )

...

save_ref_gps_los_obs(csv_file, ref_gps_site, unit_fac)

This will be a much cleaner and more independent solution. Could you do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants