readme.rst

changeset 45
b52cac9a4732
parent 43
c0d3f3831539
child 56
853ab74421c1
equal deleted inserted replaced
44:c0da580fdb6e 45:b52cac9a4732
15 15
16 System class 16 System class
17 ~~~~~~~~~~~~ 17 ~~~~~~~~~~~~
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”: 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”:
19 19
20 :::python 20 .. code:: python
21 from licel import LicelLidarMeasurement 21
22 import cf_netcdf_parameters 22 from licel import LicelLidarMeasurement
23 23 import cf_netcdf_parameters
24 class CfLidarMeasurement(LicelLidarMeasurement): 24
25 extra_netcdf_parameters = cf_netcdf_parameters 25 class CfLidarMeasurement(LicelLidarMeasurement):
26 extra_netcdf_parameters = cf_netcdf_parameters
26 27
27 28
28 Using the class 29 Using the class
29 --------------- 30 ---------------
30 31
31 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: 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:
32 33
33 :::python 34 .. code:: python
34 import glob # This is needed to read a list of filenames 35
35 from lidar import cf_raymetrics #If you have saved the files in a directrory called “lidar” 36 import glob # This is needed to read a list of filenames
37 from lidar import cf_raymetrics #If you have saved the files in a directrory called “lidar”
36 38
37 # Go to the folder where you files are stored 39 # Go to the folder where you files are stored
38 cd /path/to/lidar/files 40 cd /path/to/lidar/files
39 41
40 # Read the filenames 42 # Read the filenames
41 files = glob.glob("*") # The * reads all the files in the folder. 43 files = glob.glob("*") # The * reads all the files in the folder.
42 44
43 #Read the files 45 #Read the files
44 my_measurement = cf_raymetrics.CfLidarMeasurement(files) 46 my_measurement = cf_raymetrics.CfLidarMeasurement(files)
45 47
46 #Now the data have been read, and you have a measurement object to work with: 48 #Now the data have been read, and you have a measurement object to work with:
47 # See what channels are present 49 # See what channels are present
48 print my_measurement.channels 50 print my_measurement.channels
49 51
50 #Quicklooks of all the channels 52 # Quicklooks of all the channels
51 my_measurements.plot() 53 my_measurements.plot()
52 54
53 55
54 Converting to SCC format 56 Converting to SCC format
55 ------------------------ 57 ------------------------
56 58
57 There are some extra info you need to put in before converting to SCC format, "Measurement_ID", "Temperature", "Pressure": 59 There are some extra info you need to put in before converting to SCC format, "Measurement_ID", "Temperature", "Pressure":
58 60
59 :::python 61 .. code:: python
60 my_measurement.info["Measurement_ID"] = "20101229op00" 62
61 my_measurement.info["Temperature"] = "14" 63 my_measurement.info["Measurement_ID"] = "20101229op00"
62 my_measurement.info["Pressure"] = "1010" 64 my_measurement.info["Temperature"] = "14"
65 my_measurement.info["Pressure"] = "1010"
63 66
64 You can use standard values of temperature and pressure by just calling: 67 You can use standard values of temperature and pressure by just calling:
65 68
66 :::python 69 .. code:: python
67 my_measurement.get_PT() 70
71 my_measurement.get_PT()
68 72
69 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). 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).
70 74
71 75
72 After you have used this extra input, you save the file using this command: 76 After you have used this extra input, you save the file using this command:
73 77
74 :::python 78 .. code:: python
75 my_measurement.save_as_netcdf("filename") 79
80 my_measurement.save_as_netcdf("filename")
76 81
77 where you change the filename to the filename you want to use. 82 where you change the filename to the filename you want to use.
78

mercurial