readme.rst

Thu, 16 Feb 2017 17:19:10 +0200

author
Ioannis <ioannis@inoe.ro>
date
Thu, 16 Feb 2017 17:19:10 +0200
changeset 56
853ab74421c1
parent 45
b52cac9a4732
child 57
103b093f9895
permissions
-rwxr-xr-x

Updated readme.rst and various documentation.

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

mercurial