Skip to content

Commit 3d0725f

Browse files
committed
temp fix for intermagnet
1 parent a750fdb commit 3d0725f

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

hapiplot/hapiplot.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,11 @@ def hapiplot(*args, **kwargs):
492492
y = np.asarray(data[name])
493493

494494

495+
remove_mean = False
496+
if 'uk/GIN_' in meta['x_server']:
497+
remove_mean = True
498+
y_mean = np.nanmean(y, axis=0)
499+
495500
if 'fill' in meta["parameters"][i] and meta["parameters"][i]['fill']:
496501
if ptype == 'isotime' or ptype == 'string':
497502
Igood = y != meta["parameters"][i]['fill']
@@ -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:
@@ -634,7 +645,10 @@ def hapiplot(*args, **kwargs):
634645
tsopts['nodata'] = True
635646

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

639653
meta["parameters"][i]['hapiplot']['figure'] = fig
640654

0 commit comments

Comments
 (0)