Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError in Visualizing Results On Provided Example Files After Quickstart #9

Closed
ekschuman opened this issue Aug 10, 2020 · 1 comment

Comments

@ekschuman
Copy link

Review: openjournals/joss-reviews#2123

Working through the "Product generation" and "Visualizing results" sections of the API Reference in the documentation, I ran into a few errors when trying to run the cloudnetpy.plotting generate_figure function given as examples. This happened on the following 3 commands:

generate_figure('iwc_file.nc', ['iwc', 'iwc_error', 'iwc_retrieval_status'])
generate_figure('lwc_file.nc', ['lwc', 'lwc_error', 'lwc_retrieval_status'], max_y=4)
generate_figure('classification_file.nc', ['target_classification', 'detection_status'])

I downloaded the example files provided by the Quickstart documentation, and followed through all of the quickstart steps to generate these files. I then wen through all of the steps in "Product generation" in the API reference without issue, until I got to the "Visualizing results" section.

Running the figure generation resulted in a few variants of the same error, but the plots still seemed to be generated. (note that the examples using the categorize_file and the drizzle_file did not throw these errors):

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-17-66eb155af8df> in <module>
----> 1 generate_figure('iwc.nc', ['iwc', 'iwc_error', 'iwc_retrieval_status'])

~/anaconda/envs/cloudnet/lib/python3.8/site-packages/cloudnetpy/plotting/plotting.py in generate_figure(nc_file, field_names, show, save_path, max_y, dpi, image_name, sub_title, title)
     57 
     58         elif plot_type == 'segment':
---> 59             _plot_segment_data(ax, field, name, ax_value)
     60 
     61         else:

~/anaconda/envs/cloudnet/lib/python3.8/site-packages/cloudnetpy/plotting/plotting.py in _plot_segment_data(ax, data, name, axes)
    226     colorbar = _init_colorbar(pl, ax)
    227     colorbar.set_ticks(np.arange(len(clabel) + 1))
--> 228     colorbar.ax.set_yticklabels(clabel, fontsize=13)
    229 
    230 

~/anaconda/envs/cloudnet/lib/python3.8/site-packages/matplotlib/axes/_base.py in wrapper(self, *args, **kwargs)
     61 
     62         def wrapper(self, *args, **kwargs):
---> 63             return get_method(self)(*args, **kwargs)
     64 
     65         wrapper.__module__ = owner.__module__

~/anaconda/envs/cloudnet/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py in wrapper(*args, **kwargs)
    449                 "parameter will become keyword-only %(removal)s.",
    450                 name=name, obj_type=f"parameter of {func.__name__}()")
--> 451         return func(*args, **kwargs)
    452 
    453     return wrapper

~/anaconda/envs/cloudnet/lib/python3.8/site-packages/matplotlib/axis.py in _set_ticklabels(self, labels, fontdict, minor, **kwargs)
   1791         if fontdict is not None:
   1792             kwargs.update(fontdict)
-> 1793         return self.set_ticklabels(labels, minor=minor, **kwargs)
   1794 
   1795     @cbook._make_keyword_only("3.2", "minor")

~/anaconda/envs/cloudnet/lib/python3.8/site-packages/matplotlib/axis.py in set_ticklabels(self, ticklabels, minor, **kwargs)
   1712             # remove all tick labels, so only error for > 0 ticklabels
   1713             if len(locator.locs) != len(ticklabels) and len(ticklabels) != 0:
-> 1714                 raise ValueError(
   1715                     "The number of FixedLocator locations"
   1716                     f" ({len(locator.locs)}), usually from a call to"

ValueError: The number of FixedLocator locations (8), usually from a call to set_ticks, does not match the number of ticklabels (7).
@tukiains tukiains pinned this issue Aug 10, 2020
@tukiains tukiains unpinned this issue Aug 10, 2020
@tukiains
Copy link
Contributor

This was caused by a bug in the colorbar ticks. Thanks for spotting! It is fixed in 22fc3d4, included in https://github.com/actris-cloudnet/cloudnetpy/releases/tag/v1.2.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants