|
1 | 1 | # NMEG_FluxProc
|
2 | 2 |
|
3 | 3 | [This](https://github.com/gremau/NMEG_FluxProc) is the repository for
|
4 |
| -FluxProc code used to process data from the New Mexico Elevation Gradient. |
5 |
| -It is primarily written in and called from MATLAB. |
| 4 | +FluxProc code used to process data from the New Mexico Elevation Gradient, |
| 5 | +an ecological research project based at the University of New Mexico. |
| 6 | +For project information see [the project website](http://biology.unm.edu/litvak/res_NM_elev.html). |
| 7 | +This code is used to process and quality assure eddy covariance and other |
| 8 | +environmental sensor data. |
6 | 9 |
|
| 10 | +## Documentation |
7 | 11 |
|
8 |
| -## Local setup |
| 12 | +Documentation is found in the `doc` directory -- start [here](doc/README.md). |
9 | 13 |
|
10 |
| -### Data and configuration directories |
| 14 | +## Data releases |
11 | 15 |
|
12 |
| -The FluxProc code performs operations on data in a designated directory |
13 |
| -("FLUXROOT"). An example FLUXROOT directory with data from an imaginary |
14 |
| -site can be downloaded from the socorro ftp and used to test the FluxProc |
15 |
| -code. |
| 16 | +Many of versions of NMEG flux data have been produced by this code as it has |
| 17 | +changed over the years. Recently we have made the effort to version the data |
| 18 | +using a release system that has associated git tags. Release information is |
| 19 | +on the [Releases page](doc/Releases.md) of the docs. |
16 | 20 |
|
17 |
| -Site specific configuration files must also be present in the FLUXROOT |
18 |
| -path, and FluxProc is currently set to look for them in |
19 |
| -"FLUXROOT/FluxProcConfig". Configuration files for NMEG sites, including |
20 |
| -the test site mentioned above can be found [here] |
21 |
| -(https://github.com/gremau/NMEG_FluxProcConfig). |
22 | 21 |
|
23 |
| -### Paths and environment variables. |
24 | 22 |
|
25 |
| -An environment variable must be set for FluxProc to find the FLUXROOT |
26 |
| -directory on the local file structure. In your `startup.m` file, add |
27 |
| -these lines: |
28 |
| - |
29 |
| - setenv('FLUXROOT', '/.../') |
30 |
| - |
31 |
| -where "/.../" is the path to the FLUXROOT directory. This will add the |
32 |
| -needed environment variable each time you start MATLAB. |
33 |
| - |
34 |
| -Once this is done, start MATLAB, add the NMEG_FluxProc to your path: |
35 |
| - |
36 |
| - addpath('path/to/FluxProc') |
37 |
| - |
38 |
| -Enter the directory: |
39 |
| - |
40 |
| - cd 'path/to/FluxProc' |
41 |
| - |
42 |
| -The rest of the paths needed for FluxProc can be set using |
43 |
| - |
44 |
| - fluxproc_setpaths |
45 |
| - |
46 |
| -Now FluxProc code should be initialized and ready to use the data and |
47 |
| -configuration files in the FLUXROOT directory. |
48 |
| - |
49 |
| - |
50 |
| -## Task scripts |
51 |
| - |
52 |
| -Common tasks have scripts that can be run with common configurations, and are easily modified. These scripts can be found in the [scripts](scripts/) directory. Each of these scripts can be set to run for a list of sites and years and to overwrite existing output files or not. |
53 |
| - |
54 |
| -### Create new "fluxall" files |
55 |
| - |
56 |
| -Fluxall files (`{site}_{year}_fluxall.txt`) should contain raw data from all sensors at a site for one year. The [script_make_fluxall.m](/scripts/script_make_fluxall.m) script will make these files, primarily by calling [card_data_processor.m](card_data_processor.m) in various configurations and reading the raw data in 'toa5' and 'ts_data' directories. Though these files should contain all sensor data, in practice there are some sites with dataloggers that have not been configured to be merged into the fluxall file (namely the Valles Caldera sites). |
57 |
| - |
58 |
| -### Create new "qc", "for_gapfilling", and "for_gapfilling_filled" files |
59 |
| - |
60 |
| -There are several files created from the NMEG quality control pipeline, all output to the "processed_flux" directory. These are: |
61 |
| - |
62 |
| -1. "qc" files (`{site}_{years}_fluxall_qc.txt`): Contain all variables that are quality-controlled and then output by the [UNM_RemoveBadData.m](UNM_RemoveBadData.m) script. |
63 |
| - |
64 |
| -2. "for_gapfilling" files (`{site}_flux_all_{year}_for_gap_filling.txt`): Also output by [UNM_RemoveBadData.m](UNM_RemoveBadData.m) script and contain a subset of quality-controlled variables in a format ready to be filled with ancillary met data. |
65 |
| - |
66 |
| -3. "for_gapfilling_filled" files (`{site}_flux_all_{year}_for_gap_filling_filled.txt`): Same as the file above, but gaps in the met variables have been filled with ancillary met data by the [UNM_fill_met_gaps_from_nearby_site.m](UNM_fill_met_gaps_from_nearby_site.m) script. |
67 |
| - |
68 |
| -To make these files, run the [script_make_qc_gf.m](/scripts/script_make_qc_gf.m). This script may also run the REddyProc gapfilling tool by calling on the [R code from the Max Planck institute](https://www.bgc-jena.mpg.de/bgi/index.php/Services/REddyProcWebRPackage), and the output (also in 'processed_flux') can be used to make AmeriFlux files, below, if desired. |
69 |
| - |
70 |
| -### Create new AmeriFlux files |
71 |
| - |
72 |
| -AmeriFlux files (`{af-site}_{year}_gapfilled.txt` and `{af-site}_{year}_with_gaps.txt`) contain quality controlled sensor data, gapfilled met data, gapfilled fluxes, and partitioned C fluxes. There are several steps currently needed to create them. |
73 |
| - |
74 |
| -1. Send the "for_gapfilling_filled" file for each site/year to the [MPI EddyProc web service](http://www.bgc-jena.mpg.de/~MDIwork/eddyproc/upload.php). This service provides gapfilled and partitioned flux data, and is the way we currently have to get Lasslop partitioned fluxes used for the lower elevation NMEG sites. |
75 |
| - |
76 |
| -2. Once you receive notification that the partitioner has finished (by email), copy the job number and run [download_gapfilled_partitioned_flux.m](/retrieve_card_data/download_gapfilled_partitioned_flux.m) with the job number as an argument. This will download the resulting files to the "processed_flux" directory. |
77 |
| - |
78 |
| -3. Run [script_make_ameriflux.m](/scripts/script_make_ameriflux.m), which will call the `UNM_Ameriflux_File_Maker.m` with the specified configuration options and output the new AmeriFlux files to "FLUXROOT/FluxOut/". |
79 |
| - |
80 |
| -### Create soil "qc" and "qc_rbd" files |
81 |
| - |
82 |
| -Running the [script_make_soilmet_qc.m](/scripts/script_make_soilmet_qc.m) script for a site/year runs [soil_met_correct.m](soil_met_correct.m), which assembles all soil temperature, water content, heat flux, and TCAV sensor outputs, applies temperature corrections to VWC, and then removes bad data. The two output files, which are placed in "processed_soil", are: |
83 |
| - |
84 |
| -1. "qc" files (`{site}_{year}_soilmet_qc.txt`): Contains all sensor outputs, with raw outputs converted to VWC and temperature corrected (if applicable), for a site/year. |
85 |
| - |
86 |
| -2. "qc_rbd" files (`{site}_{year}_soilmet_qc.txt`): Same as above, but with outliers, level shifts, and other bad data removed on a site/year basis (see [soil_met_correct.m](soil_met_correct.m) for details. |
87 |
| - |
88 |
| - |
89 |
| -## Additional documentation (in doc/) |
90 |
| - |
91 |
| -* [Ancillary Met Data](/doc/Anc_Met_Readme.md) |
92 |
| -* [The old README](/doc/old_README.md) |
93 |
| -* [The old README](/doc/old_README.md) |
0 commit comments