Skip to content
Snippets Groups Projects
Commit 916f0924 authored by Nils Brüggemann's avatar Nils Brüggemann
Browse files

pyic_fig.py: Allow for atm pressure level data. Get vertical axes dimension from netcdf dimension.

parent 5edcf717
No related branches found
No related tags found
No related merge requests found
...@@ -139,8 +139,6 @@ import sys ...@@ -139,8 +139,6 @@ import sys
from pathlib import Path from pathlib import Path
sys.path.append(f'{Path.home()}/pyicon/') sys.path.append(f'{Path.home()}/pyicon/')
import pyicon as pyic import pyicon as pyic
from pathlib import Path
from netCDF4 import Dataset
print('Done modules.') print('Done modules.')
arrange_axes = pyic.arrange_axes arrange_axes = pyic.arrange_axes
...@@ -240,6 +238,8 @@ elif 'lev' in data.dims: ...@@ -240,6 +238,8 @@ elif 'lev' in data.dims:
depth_name = 'lev' depth_name = 'lev'
elif 'lev_2' in data.dims: elif 'lev_2' in data.dims:
depth_name = 'lev_2' depth_name = 'lev_2'
elif 'plev' in data.dims:
depth_name = 'plev'
else: else:
depth_name = 'none' depth_name = 'none'
...@@ -325,7 +325,11 @@ if (iopts.title_right=='auto') and ('time' in ds[var].dims): ...@@ -325,7 +325,11 @@ if (iopts.title_right=='auto') and ('time' in ds[var].dims):
if (iopts.title_center=='auto'): if (iopts.title_center=='auto'):
iopts.title_center = '' iopts.title_center = ''
if (iopts.title_left=='auto') and (depth_name!='none'): if (iopts.title_left=='auto') and (depth_name!='none'):
iopts.title_left = f'depth = {data[depth_name].data:.1f}m' try:
depth_units = data[depth_name].units
except:
depth_units = ''
iopts.title_left = f'{depth_name} = {data[depth_name].data:.1f} {depth_units}'
elif iopts.title_left=='auto': elif iopts.title_left=='auto':
iopts.title_left = '' iopts.title_left = ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment