warptool.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:pygeotools 作者: dshean 项目源码 文件源码
def getparser():
    #Note: Don't want to formally specify these choices, as it limits specification of arbitrary filenames
    tr_choices = ['first', 'last', 'min', 'max', 'mean', 'med', 'source', '"fn"', '"res"']
    te_choices = ['first', 'last', 'intersection', 'union', 'source', '"fn"', '"xmin ymin xmax ymax"']
    t_srs_choices = ['first', 'last', '"fn"', '"proj4str"']
    #Should read these directly from GDAL
    r_choices = ['near', 'bilinear', 'cubic', 'cubicspline', 'lanczos', 'average', 'mode']

    epilog = fmt_choices('-tr', tr_choices)
    epilog += fmt_choices('-te', te_choices)
    epilog += fmt_choices('-t_srs', t_srs_choices)

    #Note, the formatter_class is a hack to show the choices in the epilog
    parser = argparse.ArgumentParser(description='Utility to warp stacks of rasters to the same res/extent/proj', \
            epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('-tr', default='first', help='Output resolution (default: %(default)s)') 
    parser.add_argument('-te', default='intersection', help='Output extent (default: %(default)s)')
    parser.add_argument('-t_srs', default='first', help='Output projection (default: %(default)s)')
    parser.add_argument('-dst_ndv', type=float, default=None, help='No data value for output')
    parser.add_argument('-r', type=str, default='cubic', help='Resampling algorithm (default: %(default)s)', choices=r_choices)
    parser.add_argument('-outdir', default=None, help='Specify output directory')
    parser.add_argument('src_fn_list', nargs='+', help='Input filenames (img1.tif img2.tif ...)')
    return parser
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号