Fixed bug in Licel depol scripts.

Wed, 10 Oct 2018 15:33:43 +0300

author
Iannis <i.binietoglou@impworks.gr>
date
Wed, 10 Oct 2018 15:33:43 +0300
changeset 160
db28629317fa
parent 159
c31f5388b482
child 161
eac5d8892c98

Fixed bug in Licel depol scripts.

Some information that were read from the licel files were not handled correctly in the licel depol classes.

atmospheric_lidar/licel_depol.py file | annotate | diff | comparison | revisions
atmospheric_lidar/scripts/licel2scc_depol.py file | annotate | diff | comparison | revisions
--- a/atmospheric_lidar/licel_depol.py	Wed Oct 10 14:01:42 2018 +0300
+++ b/atmospheric_lidar/licel_depol.py	Wed Oct 10 15:33:43 2018 +0300
@@ -17,11 +17,18 @@
         self.minus45_files = minus45_files
 
         if plus45_files and minus45_files:
+            self.files = plus45_files + minus45_files
+
             self.check_equal_length()
-
             self.read_channel_data()
             self.update()
 
+    def subset_by_scc_channels(self):
+        m = super(LicelCalibrationMeasurement, self).subset_by_scc_channels()
+        m.plus45_measurement = self.plus45_measurement.subset_by_scc_channels()
+        m.minus45_measurement = self.minus45_measurement.subset_by_scc_channels()
+        return m
+
     def update(self):
         """ Correct timescales after each update.
         """
@@ -39,12 +46,13 @@
                             "Input timeseries have different length: %s vs %s." % (len_plus, len_minus))
 
     def read_channel_data(self):
-
         # Read plus and minus 45 measurements
         self.plus45_measurement = LicelLidarMeasurement(self.plus45_files, self.use_id_as_name, self.licel_timezone)
+        self.plus45_measurement.extra_netcdf_parameters = self.extra_netcdf_parameters
         self.plus45_measurement.rename_channels(suffix='_p45')
 
         self.minus45_measurement = LicelLidarMeasurement(self.minus45_files, self.use_id_as_name, self.licel_timezone)
+        self.minus45_measurement.extra_netcdf_parameters = self.extra_netcdf_parameters
         self.minus45_measurement.rename_channels(suffix='_m45')
 
         # Combine them in this object
@@ -52,6 +60,9 @@
         self.channels.update(self.plus45_measurement.channels)
         self.channels.update(self.minus45_measurement.channels)
 
+        self.raw_info = self.plus45_measurement.raw_info.copy()
+        self.raw_info.update(self.minus45_measurement.raw_info)
+
     def correct_timescales(self):
         self.check_timescales_are_two()
         self.combine_scales()
@@ -69,6 +80,14 @@
         self.variables['Raw_Data_Stop_Time'] = [new_stop_time, ]
         self.reset_timescale_id()
 
+    # def _get_custom_global_attributes(self):
+    #     """
+    #     NetCDF global attributes that should be included in the final NetCDF file.
+    #
+    #     Using the values of just p45 measurements.
+    #     """
+    #     return self.plus45_measurement._get_custom_global_attributes()
+
     def reset_timescale_id(self):
         """
         Set all timescales to 0
--- a/atmospheric_lidar/scripts/licel2scc_depol.py	Wed Oct 10 14:01:42 2018 +0300
+++ b/atmospheric_lidar/scripts/licel2scc_depol.py	Wed Oct 10 15:33:43 2018 +0300
@@ -36,7 +36,8 @@
     CustomLidarMeasurement:
        A custom sub-class of LicelLidarMeasurement
     """
-
+    # TODO: Remove the custom netcdf parameter artifact: pass parameters as optional input argument,
+    # TODO: change setting format to YAML.
     custom_netcdf_parameters = read_settings_file(custom_netcdf_parameter_path)
 
     class CustomLidarMeasurement(LicelCalibrationMeasurement):

mercurial