atmospheric_lidar/raymetrics.py

Mon, 26 Feb 2018 18:47:42 +0200

author
Iannis <i.binietoglou@impworks.gr>
date
Mon, 26 Feb 2018 18:47:42 +0200
changeset 130
24e450fdd25c
parent 129
6f902a45b83d
child 131
7225c844bdc5
permissions
-rw-r--r--

Improved handling of photodiodes in licel files.

i@125 1 """ Code to read Raymetrics version of Licel binary files."""
i@125 2 import datetime
i@125 3 import logging
i@125 4
i@129 5 import numpy as np
i@125 6 import pytz
i@125 7
i@130 8 from .licel import LicelFile, LicelLidarMeasurement, LicelChannel, PhotodiodeChannel
i@125 9
i@125 10 logger = logging.getLogger(__name__)
i@125 11
i@125 12
i@125 13 class ScanningFile(LicelFile):
i@129 14 licel_file_header_format = ['filename',
i@129 15 'start_date start_time end_date end_time altitude longitude latitude zenith_angle azimuth_angle temperature pressure',
i@129 16 # Appart from Site that is read manually
i@129 17 'azimuth_start azimuth_stop azimuth_step zenith_start zenith_finish zenith_step azimuth_offset',
i@129 18 'LS1 rate_1 LS2 rate_2 number_of_datasets', ]
i@129 19 licel_file_channel_format = 'active analog_photon laser_used number_of_datapoints 1 HV bin_width wavelength d1 d2 d3 d4 ADCbits number_of_shots discriminator ID'
i@125 20
i@125 21 def _read_rest_of_header(self, f):
i@125 22 """ Read the rest of the header lines, after line 2. """
i@125 23 raw_info = {}
i@125 24
i@125 25 third_line = f.readline()
i@125 26 raw_info.update(self.match_lines(third_line, self.licel_file_header_format[2]))
i@125 27
i@125 28 fourth_line = f.readline()
i@125 29 raw_info.update(self.match_lines(fourth_line, self.licel_file_header_format[3]))
i@125 30 return raw_info
i@125 31
i@129 32 def _assign_properties(self):
i@129 33 super(ScanningFile, self)._assign_properties()
i@129 34 self.azimuth_angle = float(self.raw_info['altitude'])
i@129 35 self.temperature = float(self.raw_info['temperature'])
i@129 36 self.pressure = float(self.raw_info['pressure'])
i@129 37 self.azimuth_start = float(self.raw_info['azimuth_start'])
i@129 38 self.azimuth_stop = float(self.raw_info['azimuth_stop'])
i@129 39 self.azimuth_step = float(self.raw_info['azimuth_step'])
i@129 40 self.zenith_start = float(self.raw_info['zenith_start'])
i@129 41 self.zenith_finish = float(self.raw_info['zenith_finish'])
i@129 42 self.zenith_step = float(self.raw_info['zenith_step'])
i@129 43 self.azimuth_offset = float(self.raw_info['azimuth_offset'])
i@129 44
i@129 45
i@129 46 class ScanningChannel(LicelChannel):
i@129 47 def __init__(self):
i@129 48 self.azimuth_start = None
i@129 49 self.azimuth_stop = None
i@129 50 self.azimuth_step = None
i@129 51 self.zenith_start = None
i@129 52 self.zenith_finish = None
i@129 53 self.zenith_step = None
i@129 54 self.azimuth_offset = None
i@129 55 super(ScanningChannel, self).__init__()
i@129 56
i@129 57
i@130 58 class ScanningLidarMeasurement(LicelLidarMeasurement):
i@125 59 file_class = ScanningFile
i@125 60 channel_class = LicelChannel
i@130 61 photodiode_class = PhotodiodeChannel

mercurial