Added missing variable First_Signal_Rangebin in the supported variables for licel2scc convertion.

Thu, 22 Mar 2018 13:53:18 +0200

author
Iannis B <ioannis@inoe.ro>
date
Thu, 22 Mar 2018 13:53:18 +0200
changeset 142
b1cac5351db6
parent 141
621ec2e3837f
child 143
44c3d7550e63

Added missing variable First_Signal_Rangebin in the supported variables for licel2scc convertion.

atmospheric_lidar/__init__.py file | annotate | diff | comparison | revisions
atmospheric_lidar/generic.py file | annotate | diff | comparison | revisions
atmospheric_lidar/scripts/licel2scc.py file | annotate | diff | comparison | revisions
changelog.rst file | annotate | diff | comparison | revisions
--- a/atmospheric_lidar/__init__.py	Sun Mar 18 11:22:25 2018 +0200
+++ b/atmospheric_lidar/__init__.py	Thu Mar 22 13:53:18 2018 +0200
@@ -1,1 +1,1 @@
-__version__ = '0.3.3'
\ No newline at end of file
+__version__ = '0.3.4'
\ No newline at end of file
--- a/atmospheric_lidar/generic.py	Sun Mar 18 11:22:25 2018 +0200
+++ b/atmospheric_lidar/generic.py	Thu Mar 22 13:53:18 2018 +0200
@@ -539,23 +539,22 @@
 
     def _get_scc_channel_variables(self):
         channel_variables = \
-            {'Background_Low': (('channels',), 'd'),
-             'Background_High': (('channels',), 'd'),
-             'Laser_Repetition_Rate': (('channels',), 'i'),
+            {'Laser_Repetition_Rate': (('channels',), 'i'),
              'Scattering_Mechanism': (('channels',), 'i'),
              'Signal_Type': (('channels',), 'i'),
              'Emitted_Wavelength': (('channels',), 'd'),
              'Detected_Wavelength': (('channels',), 'd'),
              'Raw_Data_Range_Resolution': (('channels',), 'd'),
              'Background_Mode': (('channels',), 'i'),
+             'Background_Low': (('channels',), 'd'),
+             'Background_High': (('channels',), 'd'),
              'Dead_Time_Corr_Type': (('channels',), 'i'),
              'Dead_Time': (('channels',), 'd'),
              'Acquisition_Mode': (('channels',), 'i'),
              'Trigger_Delay': (('channels',), 'd'),
-             'Pol_Calib_Range_Min': (('channels',), 'i'),
-             'Pol_Calib_Range_Max': (('channels',), 'i'),
              'LR_Input': (('channels',), 'i'),
              'DAQ_Range': (('channels',), 'd'),
+             'First_Signal_Rangebin': (('channels',), 'i'),
              }
         return channel_variables
 
--- a/atmospheric_lidar/scripts/licel2scc.py	Sun Mar 18 11:22:25 2018 +0200
+++ b/atmospheric_lidar/scripts/licel2scc.py	Thu Mar 22 13:53:18 2018 +0200
@@ -97,7 +97,26 @@
     return settings
 
 
-def get_cloud_free_files(CustomLidarMeasurement, files, settings):
+def get_cloud_free_files(LidarMeasurementClass, files, settings):
+    """ Find cloud free periods in the given files.
+
+    Depending on the provided settings, it could create plots of cloud mask and
+    selected cloud-free periods.
+
+    Parameters
+    ----------
+    LidarMeasurementClass : class
+       Class used to read the files.
+    files : list
+       A list of raw licel file paths.
+    settings : dict
+       A dictionary of cloud masking settings.
+
+    Returns
+    -------
+    file_list : list of lists
+       A list of lists containing paths to cloud-free files.
+    """
     logger.warning("Starting cloud mask procedure. This is an experimental feature.")
 
     try:
@@ -106,7 +125,7 @@
         logger.error("Cloud mask module could not be loaded. Please install manually.")
         sys.exit(1)
 
-    measurement = CustomLidarMeasurement(files)
+    measurement = LidarMeasurementClass(files)
     channel = measurement.channels[settings['channel']]
     cloud_mask = cloudmask.CloudMaskRaw(channel)
 
@@ -123,13 +142,26 @@
     logger.info("{0} cloud free period(s) found.".format(len(idxs)))
 
     if settings['plot']:
-        output_filename = "cloudfree_{0}_{1}_{2}.png".format(channel.wavelength,
+        # Plot cloud free periods
+        cloudfree_filename = "cloudfree_{0}_{1}_{2}.png".format(channel.wavelength,
                                                              channel.start_time.strftime('%Y%m%d_%H%M%S'),
                                                              channel.stop_time.strftime('%Y%m%d_%H%M%S'))
-        output_path = os.path.join(settings['plot_directory'], output_filename)
+        cloudfree_path = os.path.join(settings['plot_directory'], cloudfree_filename)
         fig, _ = cloud_mask.plot_cloudfree(idxs)
 
-        plt.savefig(output_path)
+        plt.savefig(cloudfree_path)
+        plt.close()
+
+        # Plot cloud mask
+        cloudmask_filename = "cloudmask_{0}_{1}_{2}.png".format(channel.wavelength,
+                                                                channel.start_time.strftime('%Y%m%d_%H%M%S'),
+                                                                channel.stop_time.strftime('%Y%m%d_%H%M%S'))
+        cloudmask_path = os.path.join(settings['plot_directory'], cloudmask_filename)
+
+        fig, _ = cloud_mask.plot_mask()
+
+        plt.savefig(cloudmask_path)
+        plt.close()
 
     file_list = []
     for idx_min, idx_max in idxs:
--- a/changelog.rst	Sun Mar 18 11:22:25 2018 +0200
+++ b/changelog.rst	Thu Mar 22 13:53:18 2018 +0200
@@ -3,6 +3,16 @@
 
 Unreleased
 ----------
+0.3.4 - 2018-03-22
+------------------
+Fixed
+~~~~~
+- Added First_Signal_Rangebin in supported channel variables.
+
+Added
+~~~~~
+- Plotting of cloud-mask
+
 0.3.3 - 2018-03-18
 ------------------
 Fixed

mercurial