ioannis@56: Overview ioannis@56: ======== binietoglou@38: ioannis@56: This package provides utilities to handle raw (atmospheric) lidar input data. ioannis@56: The main format supported are Licel binary files (including the Raymetrics modified format). ioannis@56: ioannis@56: The package provides a single command line tool, called licel2scc that can convert Licel binary files to the ioannis@56: EARLINET's Single Calculus Chain NetCDF format. binietoglou@38: ulalume3@68: Installation ulalume3@68: ============ ulalume3@68: ulalume3@68: The easiest way to install this module is from the python package index using ``pip``:: ulalume3@68: ulalume3@68: pip install atmospheric-lidar binietoglou@38: ioannis@56: Using it as a Licel to SCC converter ioannis@56: ==================================== binietoglou@38: binietoglou@43: Parameter file ioannis@56: -------------- ioannis@56: Before converting Licel binary to SCC format, you need to create a file linking Licel channels to SCC channels. ioannis@56: ioannis@56: As an example, you can start by changing the file “cf_netcdf_parameters.py” that describe such ioannis@56: parameters for the Clermont Ferrand lidar. ioannis@56: ioannis@56: Command line interface ioannis@56: ---------------------- ulalume3@68: The usage of the ``licel2scc`` program is described below:: ioannis@56: ulalume3@68: A program to convert Licel binary files to the SCC NetCDF format. ioannis@56: ioannis@56: positional arguments: ioannis@56: parameter_file The path to a parameter file linking licel and SCC ioannis@56: channels. victor@75: files Location of licel files. Use relative path and victor@75: filename wildcards. (default './*.*') binietoglou@38: ioannis@56: optional arguments: ioannis@56: -h, --help show this help message and exit ioannis@56: -i, --id_as_name Use transient digitizer ids as channel names, instead ioannis@56: of descriptive names ioannis@56: -m MEASUREMENT_ID, --measurement_id MEASUREMENT_ID ioannis@56: The new measurement id ioannis@56: -n MEASUREMENT_NUMBER, --measurement_number MEASUREMENT_NUMBER ioannis@56: The measurement number for the date from 00 to 99. ioannis@56: Used if no id is provided ioannis@56: -t TEMPERATURE, --temperature TEMPERATURE ioannis@56: The temperature (in C) at lidar level, required if ioannis@56: using US Standard atmosphere ioannis@56: -p PRESSURE, --pressure PRESSURE ioannis@56: The pressure (in hPa) at lidar level, required if ioannis@56: using US Standard atmosphere ioannis@56: -d, --debug Print dubuging information. ioannis@56: -s, --silent Show only warning and error messages. ulalume3@68: --version Show current version. binietoglou@38: ulalume3@68: Similarly, the ``licel2scc-depol`` program can be used to convert ulalume3@68: Licel files from Delta45 depolarization calibration measurements:: ulalume3@68: ulalume3@68: A program to convert Licel binary files from depolarization calibration ulalume3@68: measurements to the SCC NetCDF format. ulalume3@68: ulalume3@68: positional arguments: ulalume3@68: parameter_file The path to a parameter file linking licel and SCC ulalume3@68: channels. ulalume3@68: plus45_string Search string for plus 45 degree files (default '*.*') ulalume3@68: minus45_string Search string for minus 45 degree files (default ulalume3@68: '*.*') ulalume3@68: ulalume3@68: optional arguments: ulalume3@68: -h, --help show this help message and exit ulalume3@68: -i, --id_as_name Use transient digitizer ids as channel names, instead ulalume3@68: of descriptive names ulalume3@68: -m MEASUREMENT_ID, --measurement_id MEASUREMENT_ID ulalume3@68: The new measurement id ulalume3@68: -n MEASUREMENT_NUMBER, --measurement_number MEASUREMENT_NUMBER ulalume3@68: The measurement number for the date from 00 to 99. ulalume3@68: Used if no id is provided ulalume3@68: -t TEMPERATURE, --temperature TEMPERATURE ulalume3@68: The temperature (in C) at lidar level, required if ulalume3@68: using US Standard atmosphere ulalume3@68: -p PRESSURE, --pressure PRESSURE ulalume3@68: The pressure (in hPa) at lidar level, required if ulalume3@68: using US Standard atmosphere ulalume3@68: -d, --debug Print dubuging information. ulalume3@68: -s, --silent Show only warning and error messages. ulalume3@68: --version Show current version. ioannis@56: ioannis@56: Usage in python code ioannis@56: -------------------- binietoglou@43: System class binietoglou@43: ~~~~~~~~~~~~ ioannis@56: To read data from a system, you need create a class that describes you system. ioannis@56: This is very simple if your lidar data are in the Licel format, as you only need to specify ioannis@57: the external file with the extra SCC parameters. You can use as an example the file ``cf_netcdf_parameters.py``: binietoglou@38: ioannis@56: .. code-block:: python binietoglou@38: ioannis@56: from licel import LicelLidarMeasurement ioannis@56: import cf_netcdf_parameters ioannis@56: ioannis@56: class CfLidarMeasurement(LicelLidarMeasurement): ioannis@56: extra_netcdf_parameters = cf_netcdf_parameters ioannis@56: ioannis@57: This code assumes that the ``cf_netcdf_parameters.py`` is in your python path. binietoglou@38: binietoglou@38: Using the class ioannis@56: ~~~~~~~~~~~~~~~ binietoglou@38: ioannis@56: Once you have made the above setup you can start using it. The best way to understand how ioannis@56: it works is through an interactive shell (I suggest [ipython](http://ipython.org/)). ioannis@56: In the following example I use the cf_raymetrics setup: binietoglou@38: ioannis@56: .. code-block:: python binietoglou@38: ioannis@56: import glob # This is needed to read a list of filenames ioannis@56: import cf_lidar binietoglou@38: ioannis@56: # Go to the folder where you files are stored ioannis@56: cd /path/to/lidar/files ulalume3@45: ioannis@56: # Read the filenames ioannis@56: files = glob.glob("*") # The * reads all the files in the folder. binietoglou@38: ioannis@56: # Read the files ioannis@56: my_measurement = cf_lidar.CfLidarMeasurement(files) binietoglou@38: ioannis@56: # Now the data have been read, and you have a measurement object to work with: ioannis@56: # See what channels are present ioannis@56: print(my_measurement.channels) binietoglou@38: ioannis@56: # Quicklooks of all the channels ioannis@56: my_measurements.plot() binietoglou@38: binietoglou@38: Converting to SCC format ioannis@56: ~~~~~~~~~~~~~~~~~~~~~~~~ binietoglou@38: binietoglou@38: There are some extra info you need to put in before converting to SCC format, "Measurement_ID", "Temperature", "Pressure": binietoglou@38: ioannis@56: .. code-block:: python ulalume3@45: ioannis@56: my_measurement.info["Measurement_ID"] = "20101229op00" ioannis@56: my_measurement.info["Temperature"] = "14" ioannis@56: my_measurement.info["Pressure"] = "1010" binietoglou@38: binietoglou@38: You can use standard values of temperature and pressure by just calling: binietoglou@38: ioannis@56: .. code-block:: python ioannis@56: ioannis@56: my_measurement.get_PT() ioannis@56: ioannis@56: You can specify the standard values by overriding your system's ``get_PT`` method: ioannis@56: ioannis@56: .. code-block:: python binietoglou@38: ioannis@56: from licel import LicelLidarMeasurement ioannis@56: import cf_netcdf_parameters ioannis@56: ioannis@56: class CfLidarMeasurement(LicelLidarMeasurement): ioannis@56: extra_netcdf_parameters = cf_netcdf_parameters ioannis@56: ioannis@56: def get_PT(): ioannis@56: self.info['Temperature'] = 25.0 ioannis@56: self.info['Pressure'] = 1020.0 ioannis@56: ioannis@56: If you have an external source of temperature and pressure information (a meteorological station) you can automate ioannis@56: this by reading the appropriate code in the ``get_PT`` method . binietoglou@38: binietoglou@38: binietoglou@38: After you have used this extra input, you save the file using this command: binietoglou@38: ioannis@56: .. code-block:: python binietoglou@38: ioannis@56: my_measurement.save_as_netcdf("filename") ioannis@56: ioannis@56: where you change the output filename to the filename you want to use.