readme.rst

Thu, 16 Feb 2017 09:22:05 +0200

author
Ioannis <ioannis@inoe.ro>
date
Thu, 16 Feb 2017 09:22:05 +0200
changeset 48
673843d7f9d8
parent 45
b52cac9a4732
child 56
853ab74421c1
permissions
-rwxr-xr-x

Adding command line script.

Rename of convertion script folder

binietoglou@38 1 Basic instructions
binietoglou@38 2 ==================
binietoglou@38 3
binietoglou@38 4 These classes can be used to handle lidar input data. They are still in a very initial stage. There are many features probably not working, but they work for some specific tasks. They work with Licel input files (and also with the Raymetrics modified format).
binietoglou@38 5
binietoglou@38 6
binietoglou@38 7 Set up
binietoglou@38 8 ------
binietoglou@38 9
binietoglou@43 10 Parameter file
binietoglou@43 11 ~~~~~~~~~~~~~~
binietoglou@38 12 Before using the classes you need to setup some channel parameters, that are used when converting the lidar data to Single Calculus Chain format.
binietoglou@38 13
binietoglou@38 14 All the parameters are read from an external file stored in the same folder as the code. You can start by changing the file “cf_netcdf_parameters.py” that describe such parameters for the Clermont Ferrand lidar.
binietoglou@38 15
binietoglou@43 16 System class
binietoglou@43 17 ~~~~~~~~~~~~
binietoglou@38 18 The next thing you need to create a class that describes you system. This is very simple if your lidar data are in the Licel format, as you only need to specify the external file with the extra SCC parameters. You can use as an example the file “cf_raymetrics.py”:
binietoglou@38 19
ulalume3@45 20 .. code:: python
ulalume3@45 21
ulalume3@45 22 from licel import LicelLidarMeasurement
ulalume3@45 23 import cf_netcdf_parameters
ulalume3@45 24
ulalume3@45 25 class CfLidarMeasurement(LicelLidarMeasurement):
ulalume3@45 26 extra_netcdf_parameters = cf_netcdf_parameters
binietoglou@38 27
binietoglou@38 28
binietoglou@38 29 Using the class
binietoglou@38 30 ---------------
binietoglou@38 31
binietoglou@38 32 Once you have made the above setup you can start using it. The best way to understand how it works is through an interactive shell (I suggest [ipython](http://ipython.org/)). In the following example I use the cf_raymetrics setup:
binietoglou@38 33
ulalume3@45 34 .. code:: python
ulalume3@45 35
ulalume3@45 36 import glob # This is needed to read a list of filenames
ulalume3@45 37 from lidar import cf_raymetrics #If you have saved the files in a directrory called “lidar”
binietoglou@38 38
ulalume3@45 39 # Go to the folder where you files are stored
ulalume3@45 40 cd /path/to/lidar/files
binietoglou@38 41
ulalume3@45 42 # Read the filenames
ulalume3@45 43 files = glob.glob("*") # The * reads all the files in the folder.
ulalume3@45 44
ulalume3@45 45 #Read the files
ulalume3@45 46 my_measurement = cf_raymetrics.CfLidarMeasurement(files)
binietoglou@38 47
ulalume3@45 48 #Now the data have been read, and you have a measurement object to work with:
ulalume3@45 49 # See what channels are present
ulalume3@45 50 print my_measurement.channels
binietoglou@38 51
ulalume3@45 52 # Quicklooks of all the channels
ulalume3@45 53 my_measurements.plot()
binietoglou@38 54
binietoglou@38 55
binietoglou@38 56 Converting to SCC format
binietoglou@38 57 ------------------------
binietoglou@38 58
binietoglou@38 59 There are some extra info you need to put in before converting to SCC format, "Measurement_ID", "Temperature", "Pressure":
binietoglou@38 60
ulalume3@45 61 .. code:: python
ulalume3@45 62
ulalume3@45 63 my_measurement.info["Measurement_ID"] = "20101229op00"
ulalume3@45 64 my_measurement.info["Temperature"] = "14"
ulalume3@45 65 my_measurement.info["Pressure"] = "1010"
binietoglou@38 66
binietoglou@38 67 You can use standard values of temperature and pressure by just calling:
binietoglou@38 68
ulalume3@45 69 .. code:: python
ulalume3@45 70
ulalume3@45 71 my_measurement.get_PT()
binietoglou@38 72
binietoglou@38 73 The standard values can be changed in generic.py. Search the get_PT method and change of what is appropriate for your station. If you have an external source of temperature and pressure information (a meteorological station) you can automate this by overriding the get_PT method in your system"s class (in our example in the cf_raymetrics.py file).
binietoglou@38 74
binietoglou@38 75
binietoglou@38 76 After you have used this extra input, you save the file using this command:
binietoglou@38 77
ulalume3@45 78 .. code:: python
ulalume3@45 79
ulalume3@45 80 my_measurement.save_as_netcdf("filename")
binietoglou@38 81
ulalume3@45 82 where you change the filename to the filename you want to use.

mercurial