Commit 35cb9695 authored by Nils Brüggemann's avatar Nils Brüggemann
Browse files

pyic_fig.py: Avoid error when units are not set in netcdf variable.

parent bd94afa3
Pipeline #12167 passed with stages
in 8 seconds
......@@ -256,7 +256,11 @@ else:
# --- title, colorbar, and x/y label strings
if iopts.cbar_str=='auto':
iopts.cbar_str = f'{data.long_name} [{data.units}]'
try:
units = data.units
except:
units = 'NA'
iopts.cbar_str = f'{data.long_name} [{units}]'
if (iopts.title_right=='auto') and ('time' in ds[var].dims):
tstr = str(data.time.data)
#tstr = tstr.split('T')[0].replace('-', '')+'T'+tstr.split('T')[1].split('.')[0].replace(':','')+'Z'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment