* Python 2 to 3 bug: licel header lines not decoded from bytes.

Thu, 29 Nov 2018 22:24:14 +0200

author
Iannis <ioannis@inoe.ro>
date
Thu, 29 Nov 2018 22:24:14 +0200
changeset 170
9face926ccab
parent 169
eaac8bf97a5e
child 171
322117fa8391
child 172
6bab03750268

* Python 2 to 3 bug: licel header lines not decoded from bytes.
* Fixed wrong number of timescales in SCC depol.

atmospheric_lidar/__init__.py file | annotate | diff | comparison | revisions
atmospheric_lidar/licel.py file | annotate | diff | comparison | revisions
atmospheric_lidar/licel_depol.py file | annotate | diff | comparison | revisions
atmospheric_lidar/raymetrics.py file | annotate | diff | comparison | revisions
atmospheric_lidar/scripts/licel2scc_depol.py file | annotate | diff | comparison | revisions
changelog.rst file | annotate | diff | comparison | revisions
--- a/atmospheric_lidar/__init__.py	Wed Nov 28 22:27:54 2018 +0200
+++ b/atmospheric_lidar/__init__.py	Thu Nov 29 22:24:14 2018 +0200
@@ -1,1 +1,1 @@
-__version__ = '0.4.0'
\ No newline at end of file
+__version__ = '0.4.1'
\ No newline at end of file
--- a/atmospheric_lidar/licel.py	Wed Nov 28 22:27:54 2018 +0200
+++ b/atmospheric_lidar/licel.py	Thu Nov 29 22:24:14 2018 +0200
@@ -240,7 +240,7 @@
         channel_info = []
 
         # Read first line
-        raw_info['Filename'] = f.readline().strip()
+        raw_info['Filename'] = f.readline().decode().strip()
 
         raw_info.update(self._read_second_header_line(f))
 
@@ -270,7 +270,7 @@
 
         # Read the rest of the header.
         for c1 in range(int(raw_info['number_of_datasets'])):
-            channel_info.append(self.match_lines(f.readline(), self.licel_file_channel_format))
+            channel_info.append(self.match_lines(f.readline().decode(), self.licel_file_channel_format))
 
         self.raw_info = raw_info
         self.channel_info = channel_info
@@ -289,7 +289,7 @@
         """ Read the second line of a licel file. """
         raw_info = {}
 
-        second_line = f.readline()
+        second_line = f.readline().decode()
         # Many Licel files don't follow the licel standard. Specifically, the
         # measurement site is not always 8 characters, and can include white
         # spaces. For this, the site name is detect everything before the first
@@ -307,7 +307,7 @@
     def _read_rest_of_header(self, f):
         """ Read the rest of the header lines, after line 2. """
         # Read third line
-        third_line = f.readline()
+        third_line = f.readline().decode()
         raw_dict = self.match_lines(third_line, self.licel_file_header_format[2])
         return raw_dict
 
--- a/atmospheric_lidar/licel_depol.py	Wed Nov 28 22:27:54 2018 +0200
+++ b/atmospheric_lidar/licel_depol.py	Thu Nov 29 22:24:14 2018 +0200
@@ -95,6 +95,8 @@
         self.variables['Raw_Data_Stop_Time'] = [new_stop_time, ]
         self.reset_timescale_id()
 
+        self.dimensions['nb_of_time_scales'] = 1
+
     # def _get_custom_global_attributes(self):
     #     """
     #     NetCDF global attributes that should be included in the final NetCDF file.
--- a/atmospheric_lidar/raymetrics.py	Wed Nov 28 22:27:54 2018 +0200
+++ b/atmospheric_lidar/raymetrics.py	Thu Nov 29 22:24:14 2018 +0200
@@ -78,10 +78,10 @@
         """
         raw_info = {}
 
-        third_line = f.readline()
+        third_line = f.readline().decode()
         raw_info.update(self.match_lines(third_line, self.licel_file_header_format[2]))
 
-        fourth_line = f.readline()
+        fourth_line = f.readline().decode()
         raw_info.update(self.match_lines(fourth_line, self.licel_file_header_format[3]))
         return raw_info
 
--- a/atmospheric_lidar/scripts/licel2scc_depol.py	Wed Nov 28 22:27:54 2018 +0200
+++ b/atmospheric_lidar/scripts/licel2scc_depol.py	Thu Nov 29 22:24:14 2018 +0200
@@ -106,6 +106,7 @@
 
     return CustomLidarMeasurement
 
+
 def read_settings_file(settings_path):
     """ Read the settings file.
 
--- a/changelog.rst	Wed Nov 28 22:27:54 2018 +0200
+++ b/changelog.rst	Thu Nov 29 22:24:14 2018 +0200
@@ -3,10 +3,17 @@
 
 Unreleased
 ----------
+
+0.4.1 - 2018-11-29
+------------------
+Added
+~~~~~
+- Support for Python 3
+
 Fixed
 ~~~~~
 - Bug in Licel2depol script, wrong handling of dark measurements.
-
+- Wrong number of timescales in depolarization calibration netcdf files.
 
 0.3.5 - 2018-10-10
 ------------------

mercurial