Skip to content

Commit

Permalink
tsview: update to the latest timeseries2velocity (insarlab#798)
Browse files Browse the repository at this point in the history
+ tsview:
   - update its model/time func usage to the latest timeseries2velocity/time_func
   - remove the unnecessary np.array() call while updating image array

+ load_data: align the long global variable names, for readability
  • Loading branch information
yunjunz committed Jun 19, 2022
1 parent f0a8038 commit d17c7d9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
16 changes: 8 additions & 8 deletions mintpy/load_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# primary observation dataset names
OBS_DSET_NAMES = ['unwrapPhase', 'rangeOffset', 'azimuthOffset']

IFGRAM_DSET_NAME2TEMPLATE_KEY = {
IFG_DSET_NAME2TEMPLATE_KEY = {
'unwrapPhase' : 'mintpy.load.unwFile',
'coherence' : 'mintpy.load.corFile',
'connectComponent': 'mintpy.load.connCompFile',
Expand All @@ -51,15 +51,15 @@
'connectComponent': 'mintpy.load.ionConnCompFile',
}

OFFSET_DSET_NAME2TEMPLATE_KEY = {
OFF_DSET_NAME2TEMPLATE_KEY = {
'azimuthOffset' : 'mintpy.load.azOffFile',
'azimuthOffsetStd': 'mintpy.load.azOffStdFile',
'rangeOffset' : 'mintpy.load.rgOffFile',
'rangeOffsetStd' : 'mintpy.load.rgOffStdFile',
'offsetSNR' : 'mintpy.load.offSnrFile',
}

GEOMETRY_DSET_NAME2TEMPLATE_KEY = {
GEOM_DSET_NAME2TEMPLATE_KEY = {
'height' : 'mintpy.load.demFile',
'latitude' : 'mintpy.load.lookupYFile',
'longitude' : 'mintpy.load.lookupXFile',
Expand Down Expand Up @@ -903,9 +903,9 @@ def main(iargs=None):

# geometry in geo / radar coordinates
geom_dset_name2template_key = {
**GEOMETRY_DSET_NAME2TEMPLATE_KEY,
**IFGRAM_DSET_NAME2TEMPLATE_KEY,
**OFFSET_DSET_NAME2TEMPLATE_KEY,
**GEOM_DSET_NAME2TEMPLATE_KEY,
**IFG_DSET_NAME2TEMPLATE_KEY,
**OFF_DSET_NAME2TEMPLATE_KEY,
}
geom_geo_obj, geom_radar_obj = read_inps_dict2geometry_dict_object(iDict, geom_dset_name2template_key)
geom_geo_file = os.path.abspath('./inputs/geometryGeo.h5')
Expand Down Expand Up @@ -933,9 +933,9 @@ def main(iargs=None):
# observations: ifgram, ion or offset
# loop over obs stacks
stack_ds_name2tmpl_key_list = [
IFGRAM_DSET_NAME2TEMPLATE_KEY,
IFG_DSET_NAME2TEMPLATE_KEY,
ION_DSET_NAME2TEMPLATE_KEY,
OFFSET_DSET_NAME2TEMPLATE_KEY,
OFF_DSET_NAME2TEMPLATE_KEY,
]
stack_files = ['ifgramStack.h5', 'ionStack.h5', 'offsetStack.h5']
stack_files = [os.path.abspath(os.path.join('./inputs', x)) for x in stack_files]
Expand Down
2 changes: 2 additions & 0 deletions mintpy/timeseries2velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Copyright (c) 2013, Zhang Yunjun, Heresh Fattahi #
# Author: Zhang Yunjun, Heresh Fattahi, Yuan-Kai Liu, 2013 #
############################################################
# Recommend import:
# from mintpy import timeseries2velocity as ts2vel


import os
Expand Down
7 changes: 2 additions & 5 deletions mintpy/tsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ def cmd_line_parse(iargs=None):
inps.colormap = inps.colormap if inps.colormap else 'jet'
inps.fig_size = inps.fig_size if inps.fig_size else [8.0, 4.5]

# temporal model fitting, initialize the dicts of exp and log funcs
inps = ts2vel.init_exp_log_dicts(inps)

# verbose print using --noverbose option
global vprint
vprint = print if inps.print_msg else lambda *args, **kwargs: None
Expand Down Expand Up @@ -350,7 +347,7 @@ def read_init_info(inps):
inps.cbar_label += '[{}]'.format(inps.disp_unit_img)

## fit a suite of time func to the time series
inps.model, inps.num_param = ts2vel.read_inps2model(inps, date_list=inps.date_list, print_msg=inps.print_msg)
inps.model = time_func.inps2model(inps, date_list=inps.date_list, print_msg=inps.print_msg)

# dense TS for plotting
inps.date_list_fit = ptime.get_date_range(inps.date_list[0], inps.date_list[-1])
Expand Down Expand Up @@ -880,7 +877,7 @@ def update_time_slider(self, val):
self.ax_img.set_title(sub_title, fontsize=self.font_size)

# read/update 2D image data
data_img = np.array(self.ts_data[0][self.idx, :, :])
data_img = self.ts_data[0][self.idx, :, :]
data_img[self.mask == 0] = np.nan
if self.wrap:
if self.disp_unit_img == 'radian':
Expand Down

0 comments on commit d17c7d9

Please sign in to comment.