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