readme.rst

Thu, 02 Mar 2017 10:20:58 +0200

author
Iannis <ulalume3@yahoo.com>
date
Thu, 02 Mar 2017 10:20:58 +0200
changeset 69
e5e561439b27
parent 68
b0ce0f140b0e
child 75
33826498a125
permissions
-rwxr-xr-x

Use id.

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

mercurial