readme.rst

Mon, 06 Nov 2017 16:01:35 +0200

author
Iannis <i.binietoglou@impworks.gr>
date
Mon, 06 Nov 2017 16:01:35 +0200
changeset 81
b6602134d40f
parent 58
c97f146dfa32
child 68
b0ce0f140b0e
permissions
-rwxr-xr-x

Plotting changes.

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@57 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
binietoglou@38 65
ioannis@56 66 from licel import LicelLidarMeasurement
ioannis@56 67 import cf_netcdf_parameters
ioannis@56 68
ioannis@56 69 class CfLidarMeasurement(LicelLidarMeasurement):
ioannis@56 70 extra_netcdf_parameters = cf_netcdf_parameters
ioannis@56 71
ioannis@57 72 This code assumes that the ``cf_netcdf_parameters.py`` is in your python path.
binietoglou@38 73
binietoglou@38 74 Using the class
ioannis@56 75 ~~~~~~~~~~~~~~~
binietoglou@38 76
ioannis@56 77 Once you have made the above setup you can start using it. The best way to understand how
ioannis@56 78 it works is through an interactive shell (I suggest [ipython](http://ipython.org/)).
ioannis@56 79 In the following example I use the cf_raymetrics setup:
binietoglou@38 80
ioannis@56 81 .. code-block:: python
binietoglou@38 82
ioannis@56 83 import glob # This is needed to read a list of filenames
ioannis@56 84 import cf_lidar
binietoglou@38 85
ioannis@56 86 # Go to the folder where you files are stored
ioannis@56 87 cd /path/to/lidar/files
ulalume3@45 88
ioannis@56 89 # Read the filenames
ioannis@56 90 files = glob.glob("*") # The * reads all the files in the folder.
binietoglou@38 91
ioannis@56 92 # Read the files
ioannis@56 93 my_measurement = cf_lidar.CfLidarMeasurement(files)
binietoglou@38 94
ioannis@56 95 # Now the data have been read, and you have a measurement object to work with:
ioannis@56 96 # See what channels are present
ioannis@56 97 print(my_measurement.channels)
binietoglou@38 98
ioannis@56 99 # Quicklooks of all the channels
ioannis@56 100 my_measurements.plot()
binietoglou@38 101
binietoglou@38 102 Converting to SCC format
ioannis@56 103 ~~~~~~~~~~~~~~~~~~~~~~~~
binietoglou@38 104
binietoglou@38 105 There are some extra info you need to put in before converting to SCC format, "Measurement_ID", "Temperature", "Pressure":
binietoglou@38 106
ioannis@56 107 .. code-block:: python
ulalume3@45 108
ioannis@56 109 my_measurement.info["Measurement_ID"] = "20101229op00"
ioannis@56 110 my_measurement.info["Temperature"] = "14"
ioannis@56 111 my_measurement.info["Pressure"] = "1010"
binietoglou@38 112
binietoglou@38 113 You can use standard values of temperature and pressure by just calling:
binietoglou@38 114
ioannis@56 115 .. code-block:: python
ioannis@56 116
ioannis@56 117 my_measurement.get_PT()
ioannis@56 118
ioannis@56 119 You can specify the standard values by overriding your system's ``get_PT`` method:
ioannis@56 120
ioannis@56 121 .. code-block:: python
binietoglou@38 122
ioannis@56 123 from licel import LicelLidarMeasurement
ioannis@56 124 import cf_netcdf_parameters
ioannis@56 125
ioannis@56 126 class CfLidarMeasurement(LicelLidarMeasurement):
ioannis@56 127 extra_netcdf_parameters = cf_netcdf_parameters
ioannis@56 128
ioannis@56 129 def get_PT():
ioannis@56 130 self.info['Temperature'] = 25.0
ioannis@56 131 self.info['Pressure'] = 1020.0
ioannis@56 132
ioannis@56 133 If you have an external source of temperature and pressure information (a meteorological station) you can automate
ioannis@56 134 this by reading the appropriate code in the ``get_PT`` method .
binietoglou@38 135
binietoglou@38 136
binietoglou@38 137 After you have used this extra input, you save the file using this command:
binietoglou@38 138
ioannis@56 139 .. code-block:: python
binietoglou@38 140
ioannis@56 141 my_measurement.save_as_netcdf("filename")
ioannis@56 142
ioannis@56 143 where you change the output filename to the filename you want to use.

mercurial