nansencenter / nansat

Scientist friendly Python toolbox for processing 2D satellite Earth observation data.
http://nansat.readthedocs.io
GNU General Public License v3.0
182 stars 66 forks source link

netcdf_cf mapper: local variable 'ind_dim_x' referenced before assignment #459

Closed aperrin66 closed 4 years ago

aperrin66 commented 4 years ago

The ind_dim_x and ind_dim_y are defined in a try: block and then used outside of it. If this block raises an IndexError, the exception is ignored and the following code is executed, trying to access variables which have not been defined.

Fix: the code which uses these variables can be moved inside the try: block