@click.group(context_settings=dict(help_option_names=['-h', '--help']))
def plot_glm():
pass
@plot_glm.command()
@click.argument('path_nc')
@click.argument('out_path')
@click.argument('var_name')
@click.option('--xaxis_min', default=0.0, help='')
@click.option('--xaxis_max', default=1.1, help='')
@click.option('--xaxis_step', default=0.1, help='')
@click.option('--annotate_date', help='')
@click.option('--yr', default=0, help='')
@click.option('--date', default=-1, help='')
@click.option('--xlabel', default='', help='')
@click.option('--title', default='', help='')
@click.option('--tme_name', default='time', help='')
@click.option('--show_plot', help='')
@click.option('--any_time_data', help='')
@click.option('--format', default='%.2f', help='')
@click.option('--land_bg', help='')
@click.option('--cmap', default=plt.cm.RdBu, help='')
@click.option('--grid', help='')
@click.option('--fill_mask', help='')
def plot_map_from_nc(path_nc, out_path, var_name, xaxis_min=0.0, xaxis_max=1.1, xaxis_step=0.1,
annotate_date=False, yr=0, date=-1, xlabel='', title='', tme_name='time', show_plot=False,
any_time_data=True, format='%.2f', land_bg=True, cmap=plt.cm.RdBu, grid=False, fill_mask=False)
if __name__ == '__main__':
plot_glm()
I get this error when using python click library (python version 2.7.11, windows 10, click version 6.6):
ctx = Context(self, info_name=info_name, parent=parent, **extra)
TypeError: __init__() got an unexpected keyword argument 'any_time_data'
What can I do to fix this error?
plt.cm.RdBu
is a bound method which takes one argument. So it should be changed tolambda : plt.cm.RdBu(10)
. After fixing this, your code runs normally on my machine. – Bogosianplt.cm.RdBu(10)
but still getting the same error – Abyssany_time_data
go to the__init__
constructor ofContext
. I don't know how it happens on your machine. It may help if you post the full traceback of your error message. – Bogosian