Mon, 14 Nov 2016 23:39:33 +0100
lidar_correction_ghk.py works with Python 2.7 and 3.5, with and without seaborne installed. No need to change something in the code.
lidar_correction_ghk.py | file | annotate | diff | comparison | revisions | |
lidar_correction_ghk_pollyxt.py | file | annotate | diff | comparison | revisions |
--- a/lidar_correction_ghk.py Mon Nov 14 16:31:32 2016 +0100 +++ b/lidar_correction_ghk.py Mon Nov 14 23:39:33 2016 +0100 @@ -17,21 +17,27 @@ Equation reference: http://www.atmos-meas-tech-discuss.net/amt-2015-338/amt-2015-338.pdf With equations code from Appendix C -Python 3.4.2 ,, +Python 3.4.2 """ #!/usr/bin/env python3 + +# 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. from __future__ import print_function #import math import numpy as np import sys import os -#import seaborn as sns +# Comment: the seaborn library makes nicer plots, but the code works also without it. +try: + import seaborn as sns + sns_loaded = True +except ImportError: + sns_loaded = False + import matplotlib.pyplot as plt from time import clock - - #from matplotlib.backends.backend_pdf import PdfPages #pdffile = '{}.pdf'.format('path') #pp = PdfPages(pdffile) @@ -162,6 +168,7 @@ # --- Read actual lidar system parameters from ./optic_input.py (must be in the same directory) +InputFile = 'optic_input_example_lidar.py' #InputFile = 'optic_input_ver6e_POLIS_355.py' #InputFile = 'optic_input_ver6e_POLIS_355_JA.py' #InputFile = 'optic_input_ver6c_POLIS_532.py' @@ -178,7 +185,7 @@ #InputFile = 'optic_input_ver8c_PollyXT_RALPH_4.py' #InputFile = 'optic_input_ver8c_PollyXT_RALPH_5.py' #InputFile = 'optic_input_ver8c_PollyXT_RALPH_6.py' -InputFile = 'optic_input_ver8c_PollyXT_RALPH_7.py' +#InputFile = 'optic_input_ver8c_PollyXT_RALPH_7.py' #InputFile = 'optic_input_ver8a_MOHP_DPL_355.py' #InputFile = 'optic_input_ver9_MOHP_DPL_355.py' #InputFile = 'optic_input_ver6e_RALI.py' @@ -1555,7 +1562,7 @@ LDRCorr = (LDRsim*K0/Etax*(GT0+HT0)-(GR0+HR0))/((GR0-HR0)-LDRsim*K0/Etax*(GT0-HT0)) # -- F11corr from It and Ir and calibration EtaX - Text1 = "F11corr from It and Ir with calibration EtaX: x-axis: F11corr(LDRtrue) / F11corr(LDRtrue = 0.004) - 1" + Text1 = "!!! EXPERIMENTAL !!! F11corr from It and Ir with calibration EtaX: x-axis: F11corr(LDRtrue) / F11corr(LDRtrue = 0.004) - 1" F11corr = 1/(TiO*TiE)*((HR0*Etax/K0*It/TTa-HT0*Ir/TRa)/(HR0*GT0-HT0*GR0)) # IL = 1 Eq.(64) #Text1 = "F11corr from It and Ir without corrections but with calibration EtaX: x-axis: F11corr(LDRtrue) devided by F11corr(LDRtrue = 0.004)" @@ -1603,8 +1610,9 @@ print("\r done in ", "{0:5.0f}".format(btime-atime), "sec") #, end="\r") # --- Plot ----------------------------------------------------------------- -#sns.set_style("whitegrid") -#sns.set_palette("bright", 6) +if (sns_loaded): + sns.set_style("whitegrid") + sns.set_palette("bright", 6) ''' fig2 = plt.figure() @@ -1680,6 +1688,7 @@ print() #print("IT(LDRtrue) devided by IT(LDRtrue = 0.004)") +print(" ############################################################################## ") print(Text1) print()
--- a/lidar_correction_ghk_pollyxt.py Mon Nov 14 16:31:32 2016 +0100 +++ b/lidar_correction_ghk_pollyxt.py Mon Nov 14 23:39:33 2016 +0100 @@ -65,32 +65,6 @@ #if user_yes_no_query('want to exit?') == 1: sys.exit() -''' -## {{{ http://code.activestate.com/recipes/577058/ (r2) -def query_yes_no(question, default="yes"): - valid = {"yes":"yes", "y":"yes", "ye":"yes", - "no":"no", "n":"no"} - if default == None: - prompt = " [y/n] " - elif default == "yes": - prompt = " [Y/n] " - elif default == "no": - prompt = " [y/N] " - else: - raise ValueError("invalid default answer: '%s'" % default) - - while 1: - sys.stdout.write(question + prompt) - choice = input().lower() - if default is not None and choice == '': - return default - elif choice in valid.keys(): - return valid[choice] - else: - sys.stdout.write("Please respond with 'yes' or 'no' "\ - "(or 'y' or 'n').\n") -## end of http://code.activestate.com/recipes/577058/ }}} -''' abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) fname = os.path.basename(abspath) @@ -194,7 +168,7 @@ #InputFile = 'optic_input_ver8c_PollyXT_RALPH_4.py' #InputFile = 'optic_input_ver8c_PollyXT_RALPH_5.py' #InputFile = 'optic_input_ver8c_PollyXT_RALPH_6.py' -InputFile = 'optic_input_ver8c_PollyXT_RALPH_7.py' +InputFile = 'system_settings/optic_input_ver8c_PollyXT_RALPH_7.py' #InputFile = 'optic_input_ver6e_Bertha_b_355.py' #InputFile = 'optic_input_ver6e_Bertha_b_532.py' #InputFile = 'optic_input_ver6e_Bertha_b_1064.py'