docs/introduction.rst

Tue, 12 Dec 2017 12:02:39 +0200

author
Iannis <i.binietoglou@impworks.gr>
date
Tue, 12 Dec 2017 12:02:39 +0200
changeset 102
b71252bb7f87
parent 95
efa2d8e1a2e5
permissions
-rw-r--r--

Bug in definition of licel_timezone.

i@95 1 Overview
i@95 2 ========
i@95 3
i@95 4 This package provides utilities to handle raw (atmospheric) lidar input data.
i@95 5 The main format supported are Licel binary files (including the Raymetrics modified format).
i@95 6
i@95 7 The package provides a single command line tool, called licel2scc that can convert Licel binary files to the
i@95 8 EARLINET's Single Calculus Chain NetCDF format.
i@95 9
i@95 10 Installation
i@95 11 ------------
i@95 12
i@95 13 The easiest way to install this module is from the python package index using ``pip``::
i@95 14
i@95 15 pip install atmospheric-lidar
i@95 16
i@95 17 Using it as a Licel to SCC converter
i@95 18 ------------------------------------
i@95 19
i@95 20 Parameter file
i@95 21 ~~~~~~~~~~~~~~
i@95 22 Before converting Licel binary to SCC format, you need to create a file linking Licel channels to SCC channels.
i@95 23
i@95 24 As an example, you can start by changing the file “cf_netcdf_parameters.py” that describe such
i@95 25 parameters for the Clermont Ferrand lidar.
i@95 26
i@95 27 Command line interface
i@95 28 ~~~~~~~~~~~~~~~~~~~~~~
i@95 29 The usage of the ``licel2scc`` program is described below::
i@95 30
i@95 31 A program to convert Licel binary files to the SCC NetCDF format.
i@95 32
i@95 33 positional arguments:
i@95 34 parameter_file The path to a parameter file linking licel and SCC
i@95 35 channels.
i@95 36 files Location of licel files. Use relative path and
i@95 37 filename wildcards. (default './*.*')
i@95 38
i@95 39 optional arguments:
i@95 40 -h, --help show this help message and exit
i@95 41 -i, --id_as_name Use transient digitizer ids as channel names, instead
i@95 42 of descriptive names
i@95 43 -m MEASUREMENT_ID, --measurement_id MEASUREMENT_ID
i@95 44 The new measurement id
i@95 45 -n MEASUREMENT_NUMBER, --measurement_number MEASUREMENT_NUMBER
i@95 46 The measurement number for the date from 00 to 99.
i@95 47 Used if no id is provided
i@95 48 -t TEMPERATURE, --temperature TEMPERATURE
i@95 49 The temperature (in C) at lidar level, required if
i@95 50 using US Standard atmosphere
i@95 51 -p PRESSURE, --pressure PRESSURE
i@95 52 The pressure (in hPa) at lidar level, required if
i@95 53 using US Standard atmosphere
i@95 54 -D DARK_FILES, --dark_files DARK_FILES
i@95 55 Location of files containing dark measurements.
i@95 56 Use relative path and filename wildcars, see 'files'
i@95 57 parameter for example.
i@95 58 -d, --debug Print dubuging information.
i@95 59 -s, --silent Show only warning and error messages.
i@95 60 --version Show current version.
i@95 61
i@95 62 Similarly, the ``licel2scc-depol`` program can be used to convert
i@95 63 Licel files from Delta45 depolarization calibration measurements::
i@95 64
i@95 65 A program to convert Licel binary files from depolarization calibration
i@95 66 measurements to the SCC NetCDF format.
i@95 67
i@95 68 positional arguments:
i@95 69 parameter_file The path to a parameter file linking licel and SCC
i@95 70 channels.
i@95 71 plus45_string Search string for plus 45 degree files (default '*.*')
i@95 72 minus45_string Search string for minus 45 degree files (default
i@95 73 '*.*')
i@95 74
i@95 75 optional arguments:
i@95 76 -h, --help show this help message and exit
i@95 77 -i, --id_as_name Use transient digitizer ids as channel names, instead
i@95 78 of descriptive names
i@95 79 -m MEASUREMENT_ID, --measurement_id MEASUREMENT_ID
i@95 80 The new measurement id
i@95 81 -n MEASUREMENT_NUMBER, --measurement_number MEASUREMENT_NUMBER
i@95 82 The measurement number for the date from 00 to 99.
i@95 83 Used if no id is provided
i@95 84 -t TEMPERATURE, --temperature TEMPERATURE
i@95 85 The temperature (in C) at lidar level, required if
i@95 86 using US Standard atmosphere
i@95 87 -p PRESSURE, --pressure PRESSURE
i@95 88 The pressure (in hPa) at lidar level, required if
i@95 89 using US Standard atmosphere
i@95 90 -d, --debug Print dubuging information.
i@95 91 -s, --silent Show only warning and error messages.
i@95 92 --version Show current version.
i@95 93
i@95 94 Usage in python code
i@95 95 --------------------
i@95 96 System class
i@95 97 ~~~~~~~~~~~~
i@95 98 To read data from a system, you need create a class that describes you system.
i@95 99 This is very simple if your lidar data are in the Licel format, as you only need to specify
i@95 100 the external file with the extra SCC parameters. You can use as an example the file ``cf_netcdf_parameters.py``:
i@95 101
i@95 102 .. code-block:: python
i@95 103
i@95 104 from licel import LicelLidarMeasurement
i@95 105 import cf_netcdf_parameters
i@95 106
i@95 107 class CfLidarMeasurement(LicelLidarMeasurement):
i@95 108 extra_netcdf_parameters = cf_netcdf_parameters
i@95 109
i@95 110 This code assumes that the ``cf_netcdf_parameters.py`` is in your python path.
i@95 111
i@95 112 Using the class
i@95 113 ~~~~~~~~~~~~~~~
i@95 114
i@95 115 Once you have made the above setup you can start using it. The best way to understand how
i@95 116 it works is through an interactive shell (I suggest [ipython](http://ipython.org/)).
i@95 117 In the following example I use the cf_raymetrics setup:
i@95 118
i@95 119 .. code-block:: python
i@95 120
i@95 121 import glob # This is needed to read a list of filenames
i@95 122 import cf_lidar
i@95 123
i@95 124 # Go to the folder where you files are stored
i@95 125 cd /path/to/lidar/files
i@95 126
i@95 127 # Read the filenames
i@95 128 files = glob.glob("*") # The * reads all the files in the folder.
i@95 129
i@95 130 # Read the files
i@95 131 my_measurement = cf_lidar.CfLidarMeasurement(files)
i@95 132
i@95 133 # Now the data have been read, and you have a measurement object to work with:
i@95 134 # See what channels are present
i@95 135 print(my_measurement.channels)
i@95 136
i@95 137 # Quicklooks of all the channels
i@95 138 my_measurements.plot()
i@95 139
i@95 140 Converting to SCC format
i@95 141 ~~~~~~~~~~~~~~~~~~~~~~~~
i@95 142
i@95 143 There are some extra info you need to put in before converting to SCC format, "Measurement_ID", "Temperature", "Pressure":
i@95 144
i@95 145 .. code-block:: python
i@95 146
i@95 147 my_measurement.info["Measurement_ID"] = "20101229op00"
i@95 148 my_measurement.info["Temperature"] = "14"
i@95 149 my_measurement.info["Pressure"] = "1010"
i@95 150
i@95 151 You can use standard values of temperature and pressure by just calling:
i@95 152
i@95 153 .. code-block:: python
i@95 154
i@95 155 my_measurement.get_PT()
i@95 156
i@95 157 You can specify the standard values by overriding your system's ``get_PT`` method:
i@95 158
i@95 159 .. code-block:: python
i@95 160
i@95 161 from licel import LicelLidarMeasurement
i@95 162 import cf_netcdf_parameters
i@95 163
i@95 164 class CfLidarMeasurement(LicelLidarMeasurement):
i@95 165 extra_netcdf_parameters = cf_netcdf_parameters
i@95 166
i@95 167 def get_PT():
i@95 168 self.info['Temperature'] = 25.0
i@95 169 self.info['Pressure'] = 1020.0
i@95 170
i@95 171 If you have an external source of temperature and pressure information (a meteorological station) you can automate
i@95 172 this by reading the appropriate code in the ``get_PT`` method .
i@95 173
i@95 174
i@95 175 After you have used this extra input, you save the file using this command:
i@95 176
i@95 177 .. code-block:: python
i@95 178
i@95 179 my_measurement.save_as_SCC_netcdf("filename")
i@95 180
i@95 181 where you change the output filename to the filename you want to use.

mercurial