Commit c0c99145 authored by Martin Schrön's avatar Martin Schrön
Browse files

Warning message when time resolution is to low for diurnal analysis.

parent a705d69e
......@@ -2171,45 +2171,48 @@ def main(configfile=None, cfg_prefix=None):
elif var == 'diurnal':
print('diurnal... ', end='')
data_diurnal = data.copy()
data_diurnal['Time'] = data_diurnal.index.map(lambda x: x.strftime("%H:%M"))
data_diurnal = data_diurnal.groupby('Time').describe().unstack()
with Fig(fig, title='Diurnal cycle of water content', ylabel='Volumetric water content (in cm$^3$/cm$^3$)', ylim=smrange) as ax:
ax.fill_between(data_diurnal[smv]['mean'].index, data_diurnal[smv]['25%'], data_diurnal[smv]['75%'], color='C0', alpha=0.2, lw=0, step='post', label='Quantiles 25%--75%')
ax.plot(data_diurnal[smv]['mean'].index, data_diurnal[smv]['mean'], color='C0', drawstyle='steps-post', label='Average water content')
ax.legend()
ax.set_xticks(range(0,24))
ax.set_xticklabels(range(0,24))
ax.set_xlim(0,23)
with Fig(fig, title='Diurnal cycle of epithermal neutrons', ylabel='Neutrons cleaned (in cph)') as ax:
ax.fill_between(data_diurnal[Nfinal]['mean'].index, data_diurnal[Nfinal]['25%'], data_diurnal[Nfinal]['75%'], color='C0', alpha=0.2, lw=0, step='post', label='Quantiles 25%--75%')
ax.plot(data_diurnal[Nfinal]['mean'].index, data_diurnal[Nfinal]['mean'], color='C0', drawstyle='steps-post', label='Average count rate')
ax.legend()
ax.set_xticks(range(0,24))
ax.set_xticklabels(range(0,24))
ax.set_xlim(0,23)
if Nth:
with Fig(fig, title='Diurnal cycle of thermal neutrons', ylabel='Thermal neutrons cleaned (in cph)') as ax:
ax.fill_between(data_diurnal[Nthfinal]['mean'].index, data_diurnal[Nthfinal]['25%'], data_diurnal[Nthfinal]['75%'], color='C0', alpha=0.2, lw=0, step='post', label='Quantiles 25%--75%')
ax.plot(data_diurnal[Nthfinal]['mean'].index, data_diurnal[Nthfinal]['mean'], color='C0', drawstyle='steps-post', label='Average count rate')
if data.index.to_series().dropna().diff().median().total_seconds() > 3600:
print('! Diurnal plots are only possible if temporal resolution is < 1 hour.')
else:
print('diurnal... ', end='')
data_diurnal = data.copy()
data_diurnal['Time'] = data_diurnal.index.map(lambda x: x.strftime("%H:%M"))
data_diurnal = data_diurnal.groupby('Time').describe().unstack()
with Fig(fig, title='Diurnal cycle of water content', ylabel='Volumetric water content (in cm$^3$/cm$^3$)', ylim=smrange) as ax:
ax.fill_between(data_diurnal[smv]['mean'].index, data_diurnal[smv]['25%'], data_diurnal[smv]['75%'], color='C0', alpha=0.2, lw=0, step='post', label='Quantiles 25%--75%')
ax.plot(data_diurnal[smv]['mean'].index, data_diurnal[smv]['mean'], color='C0', drawstyle='steps-post', label='Average water content')
ax.legend()
ax.set_xticks(range(0,24))
ax.set_xticklabels(range(0,24))
ax.set_xlim(0,23)
with Fig(fig, title='Diurnal cycle of epithermal neutrons', ylabel='Neutrons cleaned (in cph)') as ax:
ax.fill_between(data_diurnal[Nfinal]['mean'].index, data_diurnal[Nfinal]['25%'], data_diurnal[Nfinal]['75%'], color='C0', alpha=0.2, lw=0, step='post', label='Quantiles 25%--75%')
ax.plot(data_diurnal[Nfinal]['mean'].index, data_diurnal[Nfinal]['mean'], color='C0', drawstyle='steps-post', label='Average count rate')
ax.legend()
ax.set_xticks(range(0,24))
ax.set_xticklabels(range(0,24))
ax.set_xlim(0,23)
with Fig(fig, title='Diurnal cycle of air humidity', ylabel='Air humidity (in g/m3)') as ax:
ax.fill_between(data_diurnal[ah]['mean'].index, data_diurnal[ah]['25%'], data_diurnal[ah]['75%'], color='C0', alpha=0.2, lw=0, step='post', label='Quantiles 25%--75%')
ax.plot(data_diurnal[ah]['mean'].index, data_diurnal[ah]['mean'], color='C0', drawstyle='steps-post', label='Average air humidity')
ax.legend()
ax.set_xticks(range(0,24))
ax.set_xticklabels(range(0,24))
ax.set_xlim(0,23)
if Nth:
with Fig(fig, title='Diurnal cycle of thermal neutrons', ylabel='Thermal neutrons cleaned (in cph)') as ax:
ax.fill_between(data_diurnal[Nthfinal]['mean'].index, data_diurnal[Nthfinal]['25%'], data_diurnal[Nthfinal]['75%'], color='C0', alpha=0.2, lw=0, step='post', label='Quantiles 25%--75%')
ax.plot(data_diurnal[Nthfinal]['mean'].index, data_diurnal[Nthfinal]['mean'], color='C0', drawstyle='steps-post', label='Average count rate')
ax.legend()
ax.set_xticks(range(0,24))
ax.set_xticklabels(range(0,24))
ax.set_xlim(0,23)
with Fig(fig, title='Diurnal cycle of air humidity', ylabel='Air humidity (in g/m3)') as ax:
ax.fill_between(data_diurnal[ah]['mean'].index, data_diurnal[ah]['25%'], data_diurnal[ah]['75%'], color='C0', alpha=0.2, lw=0, step='post', label='Quantiles 25%--75%')
ax.plot(data_diurnal[ah]['mean'].index, data_diurnal[ah]['mean'], color='C0', drawstyle='steps-post', label='Average air humidity')
ax.legend()
ax.set_xticks(range(0,24))
ax.set_xticklabels(range(0,24))
ax.set_xlim(0,23)
#Dx.index = pandas.to_datetime(Dx.index.astype(str))
#Dx.index = pandas.to_datetime(Dx.index.astype(str))
## Plot gridded data (EXPERIMENTAL)
elif var == 'map_grid':
......
Supports Markdown
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