Skip to content

Commit 8ee09a7

Browse files
committed
remove mean for intermagnet plots (temp fix)
1 parent 16f541f commit 8ee09a7

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

hapiplot/hapiplot.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,11 @@ def hapiplot(*args, **kwargs):
491491
else:
492492
y = np.asarray(data[name])
493493

494+
remove_mean = False
495+
if 'uk/GIN_' in meta['x_server']:
496+
remove_mean = True
497+
y_mean = np.nanmean(y, axis=0)
498+
494499

495500
if 'fill' in meta["parameters"][i] and meta["parameters"][i]['fill']:
496501
if ptype == 'isotime' or ptype == 'string':
@@ -586,13 +591,19 @@ def hapiplot(*args, **kwargs):
586591
if nodata:
587592
col_name = col_name + " [no data in interval]"
588593

594+
if remove_mean:
595+
col_name = "{0:s} - {1:.2f}".format(col_name, y_mean[l])
596+
589597
if 'label' in meta['parameters'][i] and \
590598
type(meta['parameters'][i]['label']) == list and \
591599
len(meta['parameters'][i]['label']) > l and \
592600
meta['parameters'][i]['label'][l].strip() != '':
593601
col_name = meta['parameters'][i]['label'][l]
594602
if nodata:
595603
col_name = col_name + " [no data in interval]"
604+
else:
605+
if remove_mean:
606+
col_name = "{0:s} - {1:.2f}".format(col_name, y_mean[l])
596607

597608
if type(units) == list:
598609
if len(units) == 1:
@@ -633,8 +644,12 @@ def hapiplot(*args, **kwargs):
633644
if nodata == True:
634645
tsopts['nodata'] = True
635646

636-
with rc_context(rc=opts['rcParams']):
637-
fig = timeseries(Time, y, **tsopts)
647+
if remove_mean:
648+
with rc_context(rc=opts['rcParams']):
649+
fig = timeseries(Time, y-y_mean, **tsopts)
650+
else:
651+
with rc_context(rc=opts['rcParams']):
652+
fig = timeseries(Time, y, **tsopts)
638653

639654
meta["parameters"][i]['hapiplot']['figure'] = fig
640655

0 commit comments

Comments
 (0)