Commit 41aaf807 authored by Ananya's avatar Ananya
Browse files

errors rectified in R7 and R17

parent a8a031e9
Pipeline #1379 passed with stage
in 9 minutes and 26 seconds
......@@ -19,11 +19,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.6.23] - 2022-03-31
### Changed
+ errors rectified in R17_Run_Routines1.py and R7_Offset_Correction.py
## [0.6.22] - 2022-03-30
### Changed
+ updated R17_Run_Routines1.py and R7_Offset_Correction.py for differential doppler
+ updated R17_Plot_profiles.py, R17_Run_Routines1.py and
R7_Offset_Correction.py for differential doppler
## [0.6.21] - 2022-03-29
......
[tool.poetry]
name = "radiocc"
version = "0.6.22"
version = "0.6.23"
description = "Radio occultations"
license = "Apache-2.0"
authors = ["Ananya Krishnan <ananyakrishnaniiserk@gmail.com>", "Greg Henry <gregoire.henry@oma.be>"]
......
......@@ -202,30 +202,30 @@ def run(
if Bande == "S":
if radiocc.cfg.use_diff_doppler:
Doppler_debias_dn_iono_s = Diff_Doppler_debias_dn_iono_s
if item == "IONO":
# R8: bending angle & impact parameter up
(
imp_param_up,
bend_ang_up,
delta_r_up,
beta_r_up,
) = R9_BendAng_ImpParam_up.Bend_up(
N_data,
r_MEX_up,
z_MEX_up,
z_GS_up,
vr_MEX_up,
vz_MEX_up,
vr_GS_up,
vz_GS_up,
gamma_up,
beta_e_up,
delta_s_up,
Doppler_debias_up_iono_s,
fsup,
c,
DATA_TYPE,
)
if item == "IONO":
# R8: bending angle & impact parameter up
(
imp_param_up,
bend_ang_up,
delta_r_up,
beta_r_up,
) = R9_BendAng_ImpParam_up.Bend_up(
N_data,
r_MEX_up,
z_MEX_up,
z_GS_up,
vr_MEX_up,
vz_MEX_up,
vr_GS_up,
vz_GS_up,
gamma_up,
beta_e_up,
delta_s_up,
Doppler_debias_up_iono_s,
fsup,
c,
DATA_TYPE,
)
# R8: bending angle & impact parameter down
(
......
......@@ -12,77 +12,77 @@ import radiocc
def Off_Cor(Type, threshold, Doppler, Diff_doppler, ET, N_data, distance, CODE_DIR,i_integral):
if radiocc.cfg.use_diff_doppler:
Doppler = Diff_doppler
Doppler_debias = np.full(N_data, np.nan)
Doppler_biasfit = np.full(N_data, np.nan)
delET = np.full(N_data, np.nan)
Doppler_debias = np.full(N_data, np.nan)
Doppler_biasfit = np.full(N_data, np.nan)
delET = np.full(N_data, np.nan)
# altitude threshold for fit
Corr_ind = 0
for i in range(len(distance)):
if distance[i] > threshold:
Corr_ind += 1
if Corr_ind == len(distance):
Corr_ind = Corr_ind-1
# Search for maximum
# altitude threshold for fit
Corr_ind = 0
for i in range(len(distance)):
if distance[i] > threshold:
Corr_ind += 1
if Corr_ind == len(distance):
Corr_ind = Corr_ind-1
# Search for maximum
if len(Doppler)%2==1 :
taille = len(Doppler)
else:
taille = len(Doppler)-1
if len(Doppler)%2==1 :
taille = len(Doppler)
else:
taille = len(Doppler)-1
Smoothed_Doppler = sg.savgol_filter(Doppler,taille,40)
deriv = np.gradient(Smoothed_Doppler)
Smoothed_Doppler = sg.savgol_filter(Doppler,taille,40)
deriv = np.gradient(Smoothed_Doppler)
good=np.logical_and(deriv[np.array(np.where(deriv[:-1]<1E-5))-1]<0,\
deriv[np.array(np.where(deriv[:-1]<1E-5))+1]>0)
targ=np.where(deriv[:-1]<1E-5)
index = targ[0][good[0]]
good_one = index[-1]
good=np.logical_and(deriv[np.array(np.where(deriv[:-1]<1E-5))-1]<0,\
deriv[np.array(np.where(deriv[:-1]<1E-5))+1]>0)
targ=np.where(deriv[:-1]<1E-5)
index = targ[0][good[0]]
good_one = index[-1]
# FIT
if Type == 'Fit':
p = np.polyfit(np.append(ET[:Corr_ind],ET[good_one])\
,np.append(Doppler[:Corr_ind],Doppler[good_one]),2)
# FIT
if Type == 'Fit':
p = np.polyfit(np.append(ET[:Corr_ind],ET[good_one])\
,np.append(Doppler[:Corr_ind],Doppler[good_one]),2)
for i in range(i_integral,N_data):
Doppler_biasfit[i] = p[0] * ET[i]**2 + p[1]*ET[i] + p[2]
for i in range(i_integral,N_data):
Doppler_biasfit[i] = p[0] * ET[i]**2 + p[1]*ET[i] + p[2]
###########################################################################################
###########################################################################################
for i in range(N_data):
delET[i]= ET[i]-ET[0]
# bias fit
if Type == 'Linear':
p = np.polyfit(delET[i_integral:Corr_ind],Doppler[i_integral:Corr_ind],1)
p0 = p[0]
p1 = p[1]
for i in range(N_data):
delET[i]= ET[i]-ET[0]
# bias fit
if Type == 'Linear':
p = np.polyfit(delET[i_integral:Corr_ind],Doppler[i_integral:Corr_ind],1)
p0 = p[0]
p1 = p[1]
for i in range(N_data):
Doppler_biasfit[i] = p[0] * (delET[i]) + p[1]
elif Type == 'Quadratic':
p = np.polyfit(delET[i_integral:Corr_ind],Doppler[i_integral:Corr_ind],2)
p0 = p[0]
p1 = p[1]
p2 = p[2]
for i in range(N_data):
Doppler_biasfit[i] = p[0] * (delET[i])**2 + p[1]*(delET[i]) + p[2]
else:
print('Type is not recognized')
# subtract bias and scale residual
Doppler_biasfit[i] = p[0] * (delET[i]) + p[1]
elif Type == 'Quadratic':
p = np.polyfit(delET[i_integral:Corr_ind],Doppler[i_integral:Corr_ind],2)
p0 = p[0]
p1 = p[1]
p2 = p[2]
for i in range(N_data):
Doppler_debias[i] = (Doppler[i]- Doppler_biasfit[i])
#print(ET[13542],Doppler[13542],Doppler_biasfit[13542], Doppler_debias[13542])
# back to code directory (why in this subroutine?)
# os.chdir(CODE_DIR)
if Type == 'Linear':
return ET, delET, Doppler_debias, Doppler_biasfit, Corr_ind, p0, p1
if Type == 'Quadraticuadratic':
return ET, delET, Doppler_debias, Doppler_biasfit, Corr_ind, p0, p1,p2
Doppler_biasfit[i] = p[0] * (delET[i])**2 + p[1]*(delET[i]) + p[2]
else:
print('Type is not recognized')
# subtract bias and scale residual
for i in range(N_data):
Doppler_debias[i] = (Doppler[i]- Doppler_biasfit[i])
#print(ET[13542],Doppler[13542],Doppler_biasfit[13542], Doppler_debias[13542])
# back to code directory (why in this subroutine?)
# os.chdir(CODE_DIR)
if Type == 'Linear':
return ET, delET, Doppler_debias, Doppler_biasfit, Corr_ind, p0, p1
if Type == 'Quadratic':
return ET, delET, Doppler_debias, Doppler_biasfit, Corr_ind, p0, p1,p2
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