Emission wavelength and optinal arguments.

Fri, 02 Nov 2018 16:24:47 +0200

author
Iannis <ioannis@inoe.ro>
date
Fri, 02 Nov 2018 16:24:47 +0200
changeset 167
0604a628fb1e
parent 166
ab21bd91bc09
child 168
9fed2446a59f

Emission wavelength and optinal arguments.

atmospheric_lidar/diva.py file | annotate | diff | comparison | revisions
--- a/atmospheric_lidar/diva.py	Fri Nov 02 16:11:06 2018 +0200
+++ b/atmospheric_lidar/diva.py	Fri Nov 02 16:24:47 2018 +0200
@@ -137,8 +137,10 @@
                 laser_rep_rate.long_name = 'nominal laser repetition rate'
                 laser_rep_rate.units = 'Hz'
 
-                # TODO: Emission wavelength ??
-
+                emission_wavelength = g.createVariable('emission_wavelength', datatype='f8', )  # or dimensions=('profile',)
+                emission_wavelength.long_name = 'emission wavelength'
+                emission_wavelength.units = 'nm'
+                emission_wavelength.comment = "could have dimension profile if measured."
 
                 emission_energy = g.createVariable('emission_energy', datatype='f8', )  # or dimensions=('profile',)
                 emission_energy.long_name = 'emission energy per pulse'
@@ -272,6 +274,7 @@
                 # Assign variables
                 name[:len(channel_name)] = channel_name
                 laser_rep_rate[:] = channel_parameters['laser_repetition_rate']
+                emission_wavelength[:] = channel_parameters['emission_wavelength']
                 emission_energy[:] = channel_parameters['emission_energy']
                 emission_pol[:] = self._emission_pol_flag(channel_parameters['emission_polarization'])
                 fov[:] = channel_parameters['fov']
@@ -438,7 +441,7 @@
         self.file_path = file_path
         self.file_name = os.path.basename(file_path)
 
-        self.import_file(file_path, header_only)
+        self.import_file(header_only)
 
     def import_file(self, header_only):
         """ Import data from a single DIVA file.
@@ -511,10 +514,10 @@
         self.channel_name = channel_name
 
         self.long_name = group.long_name
-        self.detector_manufacturer = group.detector_manufacturer
-        self.detector_model = group.detector_model
-        self.daq_manufacturer = group.daq_manufacturer
-        self.daq_model = group.daq_model
+        self.detector_manufacturer = getattr(group, 'detector_manufacturer', None)
+        self.detector_model = getattr(group, 'detector_model', None)
+        self.daq_manufacturer = getattr(group, 'daq_manufacturer', None)
+        self.daq_model = getattr(group, 'daq_model', None)
 
         self.number_of_profiles = len(group.dimensions['profile'])
         self.number_of_bins = len(group.dimensions['range'])
@@ -592,7 +595,7 @@
             return ""
 
         values = {0: 'PMT',
-                  1: 'APD',}
+                  1: 'APD'}
 
         return values[flag]
 
@@ -615,7 +618,7 @@
 
         values = {0: 'linear',
                   1: 'circular',
-                  2: 'total',}
+                  2: 'total'}
 
         return values[flag]
 
@@ -627,7 +630,7 @@
 
         values = {0: 'paralyzable',
                   1: 'non_paralyzable',
-                  2: 'other', }
+                  2: 'other'}
 
         return values[flag]
 

mercurial