rali.py

changeset 22
a2355e871b23
parent 20
18a77f8065c1
--- a/rali.py	Thu Mar 20 09:17:09 2014 +0200
+++ b/rali.py	Mon May 12 11:14:44 2014 +0300
@@ -1,88 +1,33 @@
-general_parameters =  \
-{'System': '\'RALI\'',
- 'Laser_Pointing_Angle': 0,
- 'Molecular_Calc': 0,
- 'Latitude_degrees_north': 44.348,
- 'Longitude_degrees_east': 26.029,
- 'Altitude_meter_asl': 93.0} # This should be float
+import radiometer
+
+from licel import LicelLidarMeasurement
+
+import rali_netcdf_parameters
 
-channel_parameters = \
-{'01064.o_an': {'channel_ID': 89,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input': 1,
-         'DAQ_Range': 100.0,
-         'Depolarization_Factor': 0,},
- '00355.o_an': {'channel_ID': 98,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input': 1,
-         'DAQ_Range': 100.0,
-         'Depolarization_Factor': 0,},
- '00355.o_ph': {'channel_ID': 99,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input': 1,
-         'DAQ_Range': 0,
-         'Depolarization_Factor': 0,},
- '00387.o_an': {'channel_ID': 90,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input': 1,
-         'DAQ_Range': 20.0,
-         'Depolarization_Factor': 0,},
- '00387.o_ph': {'channel_ID': 91,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input': 1,
-         'DAQ_Range': 0,
-         'Depolarization_Factor': 0,},
- '00532.p_an': {'channel_ID': 94,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input': 1,
-         'DAQ_Range': 100.0,
-         'Depolarization_Factor': 0,},
- '00532.p_ph': {'channel_ID': 95,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input': 1,
-         'DAQ_Range': 0,
-         'Depolarization_Factor': 0,},
- '00532.s_an': {'channel_ID': 96,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input': 1,
-         'DAQ_Range': 20.0,
-         'Depolarization_Factor': 0.0441,},
- '00532.s_ph': {'channel_ID': 97,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input': 1,
-         'DAQ_Range': 0,
-         'Depolarization_Factor': 0.0441,},
- '00607.o_an': {'channel_ID': 92,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input': 1,
-         'DAQ_Range': 20.0,
-         'Depolarization_Factor': 0,},
- '00607.o_pc': {'channel_ID': 93,
-         'Background_Low': 50000,
-         'Background_High': 60000,
-         'Laser_Shots': 600,
-         'LR_Input':1,
-         'DAQ_Range':20.0,
-         'Depolarization_Factor': 0,},
-         }
+class RaliLidarMeasurement(LicelLidarMeasurement):
+    extra_netcdf_parameters = rali_netcdf_parameters
+    
+    def get_PT(self):
+        ''' Gets the pressure and temperature from Radiometer data.
+        If no data file is found, mean values from past measurements are 
+        used.
+        '''
+        
+        start_time = self.info['start_time']
+        stop_time = self.info['stop_time']
+        dt = stop_time - start_time
+        mean_time = start_time + dt/2
+        
+        meteo_triplet = radiometer.get_mean_PT(mean_time)
+        
+        if meteo_triplet:
+            pressure, temperature, humidity = meteo_triplet
+        else:
+            print "Radiometer meteo data not available. Using past values."
+            pressure = radiometer.P_mean[mean_time.month - 1, mean_time.hour]
+            temperature = radiometer.T_mean[mean_time.month - 1, mean_time.hour]
+            
+        self.info['Temperature'] = temperature - 273.15
+        self.info['Pressure'] = pressure
 
+

mercurial