lidar_correction_ghk.py

changeset 11
453b23dd7f94
parent 10
a69e0c8ca55c
child 13
f08818615e3a
equal deleted inserted replaced
10:a69e0c8ca55c 11:453b23dd7f94
15 OF ANY KIND, either express or implied. See the Licence for the specific language governing 15 OF ANY KIND, either express or implied. See the Licence for the specific language governing
16 permissions and limitations under the Licence. 16 permissions and limitations under the Licence.
17 17
18 Equation reference: http://www.atmos-meas-tech-discuss.net/amt-2015-338/amt-2015-338.pdf 18 Equation reference: http://www.atmos-meas-tech-discuss.net/amt-2015-338/amt-2015-338.pdf
19 With equations code from Appendix C 19 With equations code from Appendix C
20 Python 3.4.2 ,, 20 Python 3.4.2
21 """ 21 """
22 #!/usr/bin/env python3 22 #!/usr/bin/env python3
23
24 # Comment: The code works with Python 2.7 with the help of following line, which enables Python2 to correctly interpret the Python 3 print statements.
23 from __future__ import print_function 25 from __future__ import print_function
24 #import math 26 #import math
25 import numpy as np 27 import numpy as np
26 import sys 28 import sys
27 import os 29 import os
28 30
29 #import seaborn as sns 31 # Comment: the seaborn library makes nicer plots, but the code works also without it.
32 try:
33 import seaborn as sns
34 sns_loaded = True
35 except ImportError:
36 sns_loaded = False
37
30 import matplotlib.pyplot as plt 38 import matplotlib.pyplot as plt
31 from time import clock 39 from time import clock
32
33
34 40
35 #from matplotlib.backends.backend_pdf import PdfPages 41 #from matplotlib.backends.backend_pdf import PdfPages
36 #pdffile = '{}.pdf'.format('path') 42 #pdffile = '{}.pdf'.format('path')
37 #pp = PdfPages(pdffile) 43 #pp = PdfPages(pdffile)
38 ## pp.savefig can be called multiple times to save to multiple pages 44 ## pp.savefig can be called multiple times to save to multiple pages
160 # end of initial definition of variables 166 # end of initial definition of variables
161 # ******************************************************************************************************************************* 167 # *******************************************************************************************************************************
162 168
163 # --- Read actual lidar system parameters from ./optic_input.py (must be in the same directory) 169 # --- Read actual lidar system parameters from ./optic_input.py (must be in the same directory)
164 170
171 InputFile = 'optic_input_example_lidar.py'
165 #InputFile = 'optic_input_ver6e_POLIS_355.py' 172 #InputFile = 'optic_input_ver6e_POLIS_355.py'
166 #InputFile = 'optic_input_ver6e_POLIS_355_JA.py' 173 #InputFile = 'optic_input_ver6e_POLIS_355_JA.py'
167 #InputFile = 'optic_input_ver6c_POLIS_532.py' 174 #InputFile = 'optic_input_ver6c_POLIS_532.py'
168 #InputFile = 'optic_input_ver6e_POLIS_532.py' 175 #InputFile = 'optic_input_ver6e_POLIS_532.py'
169 #InputFile = 'optic_input_ver8c_POLIS_532.py' 176 #InputFile = 'optic_input_ver8c_POLIS_532.py'
176 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_2.py' 183 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_2.py'
177 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_3.py' 184 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_3.py'
178 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_4.py' 185 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_4.py'
179 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_5.py' 186 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_5.py'
180 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_6.py' 187 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_6.py'
181 InputFile = 'optic_input_ver8c_PollyXT_RALPH_7.py' 188 #InputFile = 'optic_input_ver8c_PollyXT_RALPH_7.py'
182 #InputFile = 'optic_input_ver8a_MOHP_DPL_355.py' 189 #InputFile = 'optic_input_ver8a_MOHP_DPL_355.py'
183 #InputFile = 'optic_input_ver9_MOHP_DPL_355.py' 190 #InputFile = 'optic_input_ver9_MOHP_DPL_355.py'
184 #InputFile = 'optic_input_ver6e_RALI.py' 191 #InputFile = 'optic_input_ver6e_RALI.py'
185 #InputFile = 'optic_input_ver6e_RALI_JA.py' 192 #InputFile = 'optic_input_ver6e_RALI_JA.py'
186 #InputFile = 'optic_input_ver6e_RALI_new.py' 193 #InputFile = 'optic_input_ver6e_RALI_new.py'
1553 # ----- Backward correction 1560 # ----- Backward correction
1554 # Corrected LDRCorr from forward simulated LDRsim (atrue) with assumed true G0,H0,K0 1561 # Corrected LDRCorr from forward simulated LDRsim (atrue) with assumed true G0,H0,K0
1555 LDRCorr = (LDRsim*K0/Etax*(GT0+HT0)-(GR0+HR0))/((GR0-HR0)-LDRsim*K0/Etax*(GT0-HT0)) 1562 LDRCorr = (LDRsim*K0/Etax*(GT0+HT0)-(GR0+HR0))/((GR0-HR0)-LDRsim*K0/Etax*(GT0-HT0))
1556 1563
1557 # -- F11corr from It and Ir and calibration EtaX 1564 # -- F11corr from It and Ir and calibration EtaX
1558 Text1 = "F11corr from It and Ir with calibration EtaX: x-axis: F11corr(LDRtrue) / F11corr(LDRtrue = 0.004) - 1" 1565 Text1 = "!!! EXPERIMENTAL !!! F11corr from It and Ir with calibration EtaX: x-axis: F11corr(LDRtrue) / F11corr(LDRtrue = 0.004) - 1"
1559 F11corr = 1/(TiO*TiE)*((HR0*Etax/K0*It/TTa-HT0*Ir/TRa)/(HR0*GT0-HT0*GR0)) # IL = 1 Eq.(64) 1566 F11corr = 1/(TiO*TiE)*((HR0*Etax/K0*It/TTa-HT0*Ir/TRa)/(HR0*GT0-HT0*GR0)) # IL = 1 Eq.(64)
1560 1567
1561 #Text1 = "F11corr from It and Ir without corrections but with calibration EtaX: x-axis: F11corr(LDRtrue) devided by F11corr(LDRtrue = 0.004)" 1568 #Text1 = "F11corr from It and Ir without corrections but with calibration EtaX: x-axis: F11corr(LDRtrue) devided by F11corr(LDRtrue = 0.004)"
1562 #F11corr = 0.5/(TiO*TiE)*(Etax*It/TTa+Ir/TRa) # IL = 1 Eq.(64) 1569 #F11corr = 0.5/(TiO*TiE)*(Etax*It/TTa+Ir/TRa) # IL = 1 Eq.(64)
1563 1570
1601 # --- END loop 1608 # --- END loop
1602 btime = clock() 1609 btime = clock()
1603 print("\r done in ", "{0:5.0f}".format(btime-atime), "sec") #, end="\r") 1610 print("\r done in ", "{0:5.0f}".format(btime-atime), "sec") #, end="\r")
1604 1611
1605 # --- Plot ----------------------------------------------------------------- 1612 # --- Plot -----------------------------------------------------------------
1606 #sns.set_style("whitegrid") 1613 if (sns_loaded):
1607 #sns.set_palette("bright", 6) 1614 sns.set_style("whitegrid")
1615 sns.set_palette("bright", 6)
1608 1616
1609 ''' 1617 '''
1610 fig2 = plt.figure() 1618 fig2 = plt.figure()
1611 plt.plot(aA[2,:],'b.') 1619 plt.plot(aA[2,:],'b.')
1612 plt.plot(aA[3,:],'r.') 1620 plt.plot(aA[3,:],'r.')
1678 plt.show() 1686 plt.show()
1679 plt.close 1687 plt.close
1680 1688
1681 print() 1689 print()
1682 #print("IT(LDRtrue) devided by IT(LDRtrue = 0.004)") 1690 #print("IT(LDRtrue) devided by IT(LDRtrue = 0.004)")
1691 print(" ############################################################################## ")
1683 print(Text1) 1692 print(Text1)
1684 print() 1693 print()
1685 1694
1686 iLDR = 5 1695 iLDR = 5
1687 for LDRTrue in LDRrange: 1696 for LDRTrue in LDRrange:

mercurial