Skip to content

Commit 02b9113

Browse files
author
R Bailey
committed
Changed calculation of bt and by when adjusting for solar wind expansion.
1 parent 5392d52 commit 02b9113

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

predstorm/data.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,9 @@ def shift_wind_to_L1(self):
895895
"""Corrects for differences in B and density values due to solar wind
896896
expansion at different radii.
897897
898-
********* TO DO CHECK exponents - are others better?
898+
Exponents taken from Kivelson and Russell, Introduction to Space Physics (Ch. 4.3.2).
899+
Density, btot, bt, bn, bx and bz are scaled according to 1/r**2.
900+
bt and by are scaled according to 1/r.
899901
900902
Parameters
901903
==========
@@ -909,11 +911,15 @@ def shift_wind_to_L1(self):
909911
dttime = [num2date(t).replace(tzinfo=None) for t in self['time']]
910912
L1Pos = get_l1_position(dttime, units=self.pos.h['Units'], refframe=self.pos.h['ReferenceFrame'])
911913

912-
corr_factor = (self.pos['r']/L1Pos['r'])**-2
913-
shift_var_list = ['btot', 'br', 'bt', 'bn', 'bx', 'by', 'bz', 'density']
914-
shift_vars = [v for v in shift_var_list if v in self.vars]
914+
shift_vars_2 = ['density', 'btot', 'bt', 'bn', 'bx', 'bz'] # behave according to inverse-square law
915+
shift_vars = [v for v in shift_vars_2 if v in self.vars]
915916
for var in shift_vars:
916-
self[var] = self[var] * corr_factor
917+
self[var] = self[var] * (self.pos['r']/L1Pos['r'])**(-2.)
918+
919+
shift_vars_1 = ['bt', 'by']
920+
shift_vars = [v for v in shift_vars_1 if v in self.vars] # behave according to 1/r
921+
for var in shift_vars:
922+
self[var] = self[var] * (self.pos['r']/L1Pos['r'])**(-1.)
917923
logger.info("shift_wind_to_L1: Extrapolated B and density values to L1 distance")
918924

919925
return self
@@ -1881,7 +1887,7 @@ def get_omni_data(starttime=None, endtime=None, filepath='', download=False, dld
18811887
if download == False:
18821888
if filepath != '' and not os.path.exists(filepath):
18831889
raise Exception("get_omni_data: {} does not exist! Run get_omni_data(download=True) to download file.".format(filepath))
1884-
else:
1890+
if filepath == '':
18851891
raise Exception("get_omni_data: no data source specified! Run get_omni_data(download=True) or get_omni_data(filepath=path) to specify source.".format(filepath))
18861892

18871893
if download:

0 commit comments

Comments
 (0)