Esempio n. 1
0
def create_parser():
    parser = argparse.ArgumentParser(
        description='Interactive time-series viewer',
        formatter_class=argparse.RawTextHelpFormatter,
        epilog=EXAMPLE)
    parser.add_argument(
        'file',
        nargs='+',
        help='time-series file to display\n'
        'i.e.: timeseries_ERA5_ramp_demErr.h5 (MintPy)\n'
        '      LS-PARAMS.h5 (GIAnT)\n'
        '      S1_IW12_128_0593_0597_20141213_20180619.he5 (HDF-EOS5)')
    parser.add_argument('--label',
                        dest='file_label',
                        nargs='*',
                        help='labels to display for multiple input files')
    parser.add_argument('--ylim',
                        dest='ylim',
                        nargs=2,
                        metavar=('YMIN', 'YMAX'),
                        type=float,
                        help='Y limits for point plotting.')
    parser.add_argument('--tick-right',
                        dest='tick_right',
                        action='store_true',
                        help='set tick and tick label to the right')
    parser.add_argument('-l',
                        '--lookup',
                        dest='lookup_file',
                        type=str,
                        help='lookup table file')

    parser.add_argument('-n',
                        dest='idx',
                        metavar='NUM',
                        type=int,
                        help='Epoch/slice number for initial display.')
    parser.add_argument('--error',
                        dest='error_file',
                        help='txt file with error for each date.')

    # time info
    parser.add_argument('--start-date',
                        dest='start_date',
                        type=str,
                        help='start date of displacement to display')
    parser.add_argument('--end-date',
                        dest='end_date',
                        type=str,
                        help='end date of displacement to display')
    parser.add_argument('--exclude',
                        '--ex',
                        dest='ex_date_list',
                        nargs='*',
                        default=['exclude_date.txt'],
                        help='Exclude date shown as gray.')
    parser.add_argument('--zf',
                        '--zero-first',
                        dest='zero_first',
                        action='store_true',
                        help='Set displacement at first acquisition to zero.')
    parser.add_argument('--off',
                        '--offset',
                        dest='offset',
                        type=float,
                        help='Offset for each timeseries file.')

    parser.add_argument('--noverbose',
                        dest='print_msg',
                        action='store_false',
                        help='Disable the verbose message printing.')

    # temporal model fitting
    parser.add_argument(
        '--nomodel',
        '--nofit',
        dest='plot_model',
        action='store_false',
        help=
        'Do not plot the prediction of the time function (deformation model) fitting.'
    )
    parser.add_argument(
        '--plot-model-conf-int',
        '--plot-fit-conf-int',
        dest='plot_model_conf_int',
        action='store_true',
        help='Plot the time function prediction confidence intervals.\n'
        '[!-- Preliminary feature alert! --!]\n'
        '[!-- This feature is NOT throughly checked. Read the code before use. Interpret at your own risk! --!]'
    )

    parser = arg_group.add_timefunc_argument(parser)

    # pixel of interest
    pixel = parser.add_argument_group('Pixel Input')
    pixel.add_argument('--yx',
                       type=int,
                       metavar=('Y', 'X'),
                       nargs=2,
                       help='initial pixel to plot in Y/X coord')
    pixel.add_argument('--lalo',
                       type=float,
                       metavar=('LAT', 'LON'),
                       nargs=2,
                       help='initial pixel to plot in lat/lon coord')

    pixel.add_argument('--marker',
                       type=str,
                       default='o',
                       help='marker style (default: %(default)s).')
    pixel.add_argument('--ms',
                       '--markersize',
                       dest='marker_size',
                       type=float,
                       default=6.0,
                       help='marker size (default: %(default)s).')
    pixel.add_argument('--lw',
                       '--linewidth',
                       dest='linewidth',
                       type=float,
                       default=0,
                       help='line width (default: %(default)s).')
    pixel.add_argument(
        '--ew',
        '--edgewidth',
        dest='edge_width',
        type=float,
        default=1.0,
        help='Edge width for the error bar (default: %(default)s)')

    # other groups
    parser = arg_group.add_data_disp_argument(parser)
    parser = arg_group.add_dem_argument(parser)
    parser = arg_group.add_figure_argument(parser)
    parser = arg_group.add_gps_argument(parser)
    parser = arg_group.add_mask_argument(parser)
    parser = arg_group.add_map_argument(parser)
    parser = arg_group.add_reference_argument(parser)
    parser = arg_group.add_save_argument(parser)
    parser = arg_group.add_subset_argument(parser)

    return parser
Esempio n. 2
0
def create_parser():
    parser = argparse.ArgumentParser(
        description='Generate transect/profile along a line',
        formatter_class=argparse.RawTextHelpFormatter,
        epilog=EXAMPLE)

    parser.add_argument('file',
                        nargs='+',
                        help='input file to show transection')
    parser.add_argument('--dset', dest='dset', help='Dataset name to read')
    parser.add_argument('-v',
                        '--vlim',
                        dest='vlim',
                        nargs=2,
                        metavar=('VMIN', 'VMAX'),
                        type=float,
                        help='Display limits for matrix plotting.')
    parser.add_argument(
        '--offset',
        '--off',
        dest='offset',
        type=float,
        nargs='+',
        default=[0.05],
        help=
        'offset between transects [for multiple files only; default: %(default)s m].\n'
        'number of input offsets should be:\n'
        '    1 - same (sequential) offset between adjacent transects OR\n'
        '    num_file - different (cumulative) offset for each file, starting from 0.'
    )
    parser.add_argument('--noverbose',
                        dest='print_msg',
                        action='store_false',
                        help='Disable the verbose message printing.')

    lines = parser.add_argument_group('Profile location',
                                      'Start/end points of profile')
    lines.add_argument(
        '--start-yx',
        '--yx0',
        dest='start_yx',
        metavar=('Y0', 'X0'),
        type=int,
        nargs=2,
        help='start point of the profile in pixel number [y, x]')
    lines.add_argument(
        '--end-yx',
        '--yx1',
        dest='end_yx',
        metavar=('Y1', 'X1'),
        type=int,
        nargs=2,
        help='end   point of the profile in pixel number [y, x]')
    lines.add_argument('--start-lalo',
                       '--lalo0',
                       dest='start_lalo',
                       metavar=('LAT0', 'LON0'),
                       type=float,
                       nargs=2,
                       help='start point of the profile in [lat, lon]')
    lines.add_argument('--end-lalo',
                       '--lalo1',
                       dest='end_lalo',
                       metavar=('LAT1', 'LON1'),
                       type=float,
                       nargs=2,
                       help='end   point of the profile in [lat, lon]')
    lines.add_argument(
        '--line-file',
        dest='lola_file',
        help=
        'file with start and end point info in lon lat, same as GMT format.\n'
        + GMT_FILE)

    lines.add_argument(
        '--interpolation',
        default='nearest',
        choices=['nearest', 'bilinear', 'cubic'],
        help=
        'interpolation method while extacting profile along the line. Default: nearest.'
    )
    lines.add_argument('--ms',
                       '--markersize',
                       dest='marker_size',
                       type=float,
                       default=2.0,
                       help='Point marker size. Default: 2.0')

    parser = arg_group.add_figure_argument(parser)
    parser = arg_group.add_save_argument(parser)
    return parser
Esempio n. 3
0
def create_parser():
    parser = argparse.ArgumentParser(
        description='Interactive time-series viewer',
        formatter_class=argparse.RawTextHelpFormatter,
        epilog=EXAMPLE)
    parser.add_argument(
        'file',
        nargs='+',
        help='time-series file to display\n'
        'i.e.: timeseries_ERA5_ramp_demErr.h5 (MintPy)\n'
        '      LS-PARAMS.h5 (GIAnT)\n'
        '      S1_IW12_128_0593_0597_20141213_20180619.he5 (HDF-EOS5)')
    parser.add_argument('--label',
                        dest='file_label',
                        nargs='*',
                        help='labels to display for multiple input files')
    parser.add_argument('--ylim',
                        dest='ylim',
                        nargs=2,
                        metavar=('YMIN', 'YMAX'),
                        type=float,
                        help='Y limits for point plotting.')
    parser.add_argument('--tick-right',
                        dest='tick_right',
                        action='store_true',
                        help='set tick and tick label to the right')

    parser.add_argument('-l',
                        '--lookup',
                        dest='lookup_file',
                        type=str,
                        help='lookup table file')

    pixel = parser.add_argument_group('Pixel Input')
    pixel.add_argument('--yx',
                       type=int,
                       metavar=('Y', 'X'),
                       nargs=2,
                       help='initial pixel to plot in Y/X coord')
    pixel.add_argument('--lalo',
                       type=float,
                       metavar=('LAT', 'LON'),
                       nargs=2,
                       help='initial pixel to plot in lat/lon coord')

    pixel.add_argument('--ms',
                       '--markersize',
                       dest='marker_size',
                       type=float,
                       default=6.0,
                       help='Point marker size. Default: 6')
    pixel.add_argument('--ew',
                       '--edgewidth',
                       dest='edge_width',
                       type=float,
                       default=1.0,
                       help='Edge width. Default: 1.0')

    parser.add_argument('-n',
                        dest='idx',
                        metavar='NUM',
                        type=int,
                        help='Epoch/slice number to display.')
    parser.add_argument('--error',
                        dest='error_file',
                        help='txt file with error for each date.')

    parser.add_argument('--start-date',
                        dest='start_date',
                        type=str,
                        help='start date of displacement to display')
    parser.add_argument('--end-date',
                        dest='end_date',
                        type=str,
                        help='end date of displacement to display')
    parser.add_argument('--exclude',
                        '--ex',
                        dest='ex_date_list',
                        nargs='*',
                        default=['exclude_date.txt'],
                        help='Exclude date shown as gray.')
    parser.add_argument('--zf',
                        '--zero-first',
                        dest='zero_first',
                        action='store_true',
                        help='Set displacement at first acquisition to zero.')
    parser.add_argument('--off',
                        '--offset',
                        dest='offset',
                        type=float,
                        help='Offset for each timeseries file.')

    parser.add_argument('--noverbose',
                        dest='print_msg',
                        action='store_false',
                        help='Disable the verbose message printing.')

    parser = arg_group.add_data_disp_argument(parser)
    parser = arg_group.add_dem_argument(parser)
    parser = arg_group.add_figure_argument(parser)
    parser = arg_group.add_gps_argument(parser)
    parser = arg_group.add_mask_argument(parser)
    parser = arg_group.add_map_argument(parser)
    parser = arg_group.add_reference_argument(parser)
    parser = arg_group.add_save_argument(parser)
    parser = arg_group.add_subset_argument(parser)

    return parser