Default AMR level line preferences and error handling#422
Default AMR level line preferences and error handling#422plauri wants to merge 1 commit intofmihpc:masterfrom
Conversation
…olormap3dslice does not crash when 1) no colours, linewidths or linestyles have been set and 2) the chosen AMR level is not present in the selected plotting region.
| pt.plot.cell_edgecontours(ax1,XmeshPass,YmeshPass,AMRmap,val-0.1,linewidth=amrlinewidthslist[i], colors=amrcolourslist[i], linestyle=amrlinestyleslist[i]) | ||
| try: | ||
| pt.plot.cell_edgecontours(ax1,XmeshPass,YmeshPass,AMRmap,val-0.1,linewidth=amrlinewidthslist[i], colors=amrcolourslist[i], linestyle=amrlinestyleslist[i]) | ||
| except: |
There was a problem hiding this comment.
See commit 3d6414c
I think this should be changed to an if statement now or at the very least the exception should be printed as it is also possible that matplotlib could fail, in which case this would mask the exception given from it.
I'm not sure the val can even cause an exception to occur alone, or did you have some specific case where it did happen?
There was a problem hiding this comment.
The error message that happens for an AMR level not present in the plotted region is long, non-descript and occurring inside matplotlib/NumPy. I think it happens when the array corresponding to an otherwise valid AMR level is empty. I guess this could be checked before passing the arrays to cell_edgecontours to make the error handling more transparent
There was a problem hiding this comment.
Maybe best to add the handling into the function no? If this is an issue that can occur elsewhere that would be best as this function is also used elsewhere couple times.
so plot_colormap3dslice does not crash when 1) no colours, linewidths or linestyles have been set and 2) the chosen AMR level is not present in the selected plotting region.