NCAS-CMS / cf-plot

Code-light plotting for earth science and aligned research
https://ncas-cms.github.io/cf-plot/build/
MIT License
12 stars 8 forks source link

Consolidate `else`/`if` conditional logic #49

Open sadielbartholomew opened 5 months ago

sadielbartholomew commented 5 months ago

There are lots of locations in the code I have noticed where the conditional if/else logic can be streamlined or improved, so it flows more intuitively and reduces the need for extra levels of indentation, etc.

This is both in the sense of direct small-scale conversions, for example, there is a whole similar block that can be reduced with elif statements here:

https://github.com/NCAS-CMS/cf-plot/blob/efe94c7551a08dac1b5af56e77d06f504c0657ea/cfplot/cfplot.py#L8967-L8990

as well as larger-scale changes to the conditional structure. All of which should not change the behaviour of the code in any way, only its implementation, to make it easier to work with and develop on top of.