MintPy icon indicating copy to clipboard operation
MintPy copied to clipboard

Export supplemental gps CSV file

Open sssangha opened this issue 2 years ago • 2 comments

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.

sssangha avatar Feb 02 '23 04:02 sssangha

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.

sssangha avatar Feb 02 '23 04:02 sssangha

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?

yunjunz avatar Feb 09 '23 05:02 yunjunz