Improved exposure of handling properties in handling level.

Tue, 27 Feb 2018 18:41:06 +0200

author
Iannis <i.binietoglou@impworks.gr>
date
Tue, 27 Feb 2018 18:41:06 +0200
changeset 131
7225c844bdc5
parent 130
24e450fdd25c
child 132
dc48952c383d

Improved exposure of handling properties in handling level.

atmospheric_lidar/licel.py file | annotate | diff | comparison | revisions
atmospheric_lidar/raymetrics.py file | annotate | diff | comparison | revisions
--- a/atmospheric_lidar/licel.py	Mon Feb 26 18:47:42 2018 +0200
+++ b/atmospheric_lidar/licel.py	Tue Feb 27 18:41:06 2018 +0200
@@ -355,15 +355,15 @@
         self.hv = []
         self.data = {}
 
-    def append_file(self, file_start_time, file_channel):
+    def append_file(self, current_file, file_channel):
         """ Append file to the current object """
 
-        self._assign_properties(file_channel)
+        self._assign_properties(current_file, file_channel)
 
         self.binwidth = self.resolution * 2. / c  # in seconds
         self.z = file_channel.z
 
-        self.data[file_start_time] = file_channel.data
+        self.data[current_file.start_time] = file_channel.data
         self.raw_info.append(file_channel.raw_info)
         self.laser_shots.append(file_channel.number_of_shots)
         self.duration.append(file_channel.duration)
@@ -371,7 +371,7 @@
         self.discriminator.append(file_channel.discriminator)
         self.hv.append(file_channel.hv)
 
-    def _assign_properties(self, file_channel):
+    def _assign_properties(self, current_file, file_channel):
         self._assign_unique_property('name', file_channel.channel_name)
         self._assign_unique_property('resolution', file_channel.dz)
         self._assign_unique_property('wavelength', file_channel.wavelength)
@@ -408,7 +408,7 @@
 
 class PhotodiodeChannel(LicelChannel):
 
-    def _assign_properties(self, file_channel):
+    def _assign_properties(self, current_channel, file_channel):
         """ In contrast with normal channels, don't check for constant points."""
         self._assign_unique_property('name', file_channel.channel_name)
         self._assign_unique_property('resolution', file_channel.dz)
@@ -459,12 +459,12 @@
         for channel_name, channel in current_file.channels.items():
             if channel_name not in self.channels:
                 self.channels[channel_name] = self.channel_class()
-            self.channels[channel_name].append_file(current_file.start_time, channel)
+            self.channels[channel_name].append_file(current_file, channel)
 
         for photodiode_name, photodiode in current_file.photodiodes.items():
             if photodiode_name not in self.photodiodes:
                 self.photodiodes[photodiode_name] = self.photodiode_class()
-            self.photodiodes[photodiode_name].append_file(current_file.start_time, photodiode)
+            self.photodiodes[photodiode_name].append_file(current_file, photodiode)
 
     def append(self, other):
 
--- a/atmospheric_lidar/raymetrics.py	Mon Feb 26 18:47:42 2018 +0200
+++ b/atmospheric_lidar/raymetrics.py	Tue Feb 27 18:41:06 2018 +0200
@@ -45,6 +45,8 @@
 
 class ScanningChannel(LicelChannel):
     def __init__(self):
+        super(ScanningChannel, self).__init__()
+
         self.azimuth_start = None
         self.azimuth_stop = None
         self.azimuth_step = None
@@ -52,10 +54,25 @@
         self.zenith_finish = None
         self.zenith_step = None
         self.azimuth_offset = None
-        super(ScanningChannel, self).__init__()
+        self.zenith_angles = []
+        self.azimuth_angles = []
+
+    def append_file(self, current_file, file_channel):
+        super(ScanningChannel, self).append_file(current_file, file_channel)
+        self.zenith_angles.append(current_file.zenith_angle)
+        self.azimuth_angles.append(current_file.azimuth_angle)
+
+    def _assign_properties(self, current_file, file_channel):
+        super(ScanningChannel, self)._assign_properties(current_file, file_channel)
+        self._assign_unique_property('azimuth_start', current_file.azimuth_start)
+        self._assign_unique_property('azimuth_stop', current_file.azimuth_stop)
+        self._assign_unique_property('azimuth_step', current_file.azimuth_step)
+        self._assign_unique_property('zenith_start', current_file.zenith_start)
+        self._assign_unique_property('zenith_finish', current_file.zenith_finish)
+        self._assign_unique_property('zenith_step', current_file.zenith_step)
 
 
 class ScanningLidarMeasurement(LicelLidarMeasurement):
     file_class = ScanningFile
-    channel_class = LicelChannel
+    channel_class = ScanningChannel
     photodiode_class = PhotodiodeChannel

mercurial