CNS Database Description
The CNS system uses a flat-file database to store processed climate data. This database exists in a directory called data that is a sub-directory of the main CNS directory (See Figure 1).
Figure 1.
The CNS data directory has multiple sub-directories named using two digits. Each directory stores a year of climate data in text files, where the directory name is the last two digits of a year. Refer to Figure 2 to see the contents of the cns data directory. As as example, the 08 directory stores data for 2008, and the 89 directory stores data for 1989.
Figure 2.
The year directories contain multiple files that store interpolated daily and hourly climate values, as well as un-modified daily and hourly climate values. The file extension denotes what type of data is stored in the file. The following list describes the file extensions:
- .daq -- Daily un-modified climate values.
- .dal -- Daily interpolated climate values.
- .hrq -- Hourly un-modified climate values.
- .hrl -- Hourly interpolated climate values.
These files share a common format. They contain rows of comma separated values (CSV) representing a date-time stamp and climate data. The following table shows a value index in the CSV row, and a description of the value at that index (index values start at 0):
Value Index |
Description |
0 |
Month |
1 |
Day of Month |
2 |
Year |
3 |
Hour |
4 |
Max Temperature (deg F) |
5 |
Max Temperature QC Flag |
6 |
Min Temperature (deg F) |
7 |
Min Temperature QC Flag |
8 |
Mean Temperature (deg F) |
9 |
Mean Temperature QC Flag |
10 |
Accumulated Temperature (deg F) |
11 |
Accumulated Temperature QC Flag |
12 |
Max RH |
13 |
Max RH QC Flag |
14 |
Min RH |
15 |
Min RH QC Flag |
16 |
Mean RH |
17 |
Mean RH QC Flag |
18 |
Accumulated RH |
19 |
Accumulated RH QC Flag |
20 |
Max Precipitation (Inches) |
21 |
Max Precipitation QC Flag |
22 |
Min Precipitation (Inches) |
23 |
Min Precipitation QC Flag |
24 |
Mean Precipitation (Inches) |
25 |
Mean Precipitation QC Flag |
26 |
Accumulated Precipitation (Inches) |
27 |
Accumulated Precipitation QC Flag |
28 |
Max Wind Speed (MPH) |
29 |
Max Wind Speed QC Flag |
30 |
Min Wind Speed (MPH) |
31 |
Min Wind Speed QC Flag |
32 |
Mean Wind Speed (MPH) |
33 |
Mean Wind Speed QC Flag |
34 |
Accumulated Wind Speed (MPH) |
35 |
Accumulated Wind Speed QC Flag |
36 |
Max Wind Direction |
37 |
Max Wind Direction QC Flag |
38 |
Min Wind Direction |
39 |
Min Wind Direction QC Flag |
40 |
Mean Wind Direction |
41 |
Mean Wind Direction QC Flag |
42 |
Accumulated Wind Direction |
43 |
Accumulated Wind Direction QC Flag |
44 |
Max Solar Radiation (Langleys/hour) |
45 |
Max Solar Radiation QC Flag |
46 |
Min Solar Radiation (Langleys/hour) |
47 |
Min Solar Radiation QC Flag |
48 |
Mean Solar Radiation (Langleys/hour) |
49 |
Mean Solar Radiation QC Flag |
50 |
Accumulated Solar Radiation (Langleys/hour) |
51 |
Accumulated Solar Radiation QC Flag |
52 |
Max Soil Temperature (deg F) |
53 |
Max Soil Temperature QC Flag |
54 |
Min Soil Temperature (deg F) |
55 |
Min Soil Temperature QC Flag |
56 |
Mean Soil Temperature (deg F) |
57 |
Mean Soil Temperature QC Flag |
58 |
Accumulated Soil Temperature (deg F) |
59 |
Accumulated Soil Temperature QC Flag |
60 |
? |
Table 1
As shown in Table 1, a QC value exists after every value representing a climate variable. The following table describes the possible QC flag values for .dal and .hrl files:
Value |
Meaning |
0 |
Interpolated or Missing Data |
1 |
Good Data |
2 |
Datum Above Sensor Max |
3 |
Datum Below Sensor Min |
4 |
Difference From Last Reading Too Great |
5 |
Generated Data (Daily Data Generated from Hourly) |
The data is read by logernet and put in the the web raw data file http://virga.nmsu.edu/raw_data/ In each of these folders is a excell file that give the file raw input name and the name of the station that this file represents. Example
NMCC-RA-1 |
Alcalde ASC |
NMCC |
USA |
NM |
2 |
RA |
36.091 |
-106.057 |
1734 |
-7 |
REP |
1/1/1985 |
|
The designation is name of climate system, then county in New Mexico and then station number 1,2,3 in that county.
The data is copied from the raw_data directory into the cns directory in folder and then processed by the cns software with the resulted process data put into the cns data directory where it is read to be displayed by the web browser.
Loggernet call a convert program that takes cr1000 data in a table formate and converts it to a line format. These file have a _24_hour or _1_ hour name indicating that two file exist that have to be use for the input file to the cns process program. If only one name exists with the RA-1 designation then the data is a cr10 and contains both the daily and hourly data. In some cases the file do not contain a year stamp. If this is the case then the raw data has to be seperated into differnt years and then put into the correct cns in folder. Other wise the cns program will take the first day in the file and put it into the current year day slot even though it represent last years data. The name in the raw _ data file are use in the processed data area in the CNS directory with the extension changed to :
daq -- Daily un-modified climate values.
- .dal -- Daily interpolated climate values.
- .hrq -- Hourly un-modified climate values.
- .hrl -- Hourly interpolated climate values.
as stated above
The translator changes the name from wine-da-1_24_hour to _ to wine-da-1_24_hour_pp.dat in the raw_data file area. Example:
cr1000_translator.py -s d:/webroot/raw_data/wine/wine-da-1_24_hour.dat -d d:/webroot/raw_data/wine/wine-da-1_24_hour_pp.dat --daily