Example Usage of the *Field\_Protocol\_Reader.py* Methods ========================================================= Setup ----- Import modules and change current working directory to setup environment: .. code:: python #!/usr/bin/env python # -*- coding: utf-8 -*-from __future__ import print_function from mni2017.field_protocol_reader import field_data, plot_field, create_multiindex_df, create_reasonable_multiindex_df, plot_from_reasonable_df import os # change current working directory to folder with field protocol: path = '/media/thomas/NAS_Data/2017_MNI_campaign/field_data/MULTIPLY' os.chdir(path) # initialize field_data class object, load field data in 'MULTIPLY.xlsx field = field_data(filename='MULTIPLY.xlsx') UPDATE ------ added *create\_reasonable\_multiindex\_df* to facilitate working with the actual data [STRIKEOUT:as default option when initializing the class object.] [STRIKEOUT:One may set the option *create\_df* *False* if additional .xlsx-files should be added to the class object as this only works with the old procedure.] [STRIKEOUT:The dataframe can then afterwards be created via *create\_reasonable\_multiindex\_df(field.data.items())*.] .. code:: python field_df = create_reasonable_multiindex_df(field.data.items()) field_df .. raw:: html
| 301 (WT) high | ... | 542 (WT) medium | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BBCH | Chlorophyll measurement 1 [avarage of 10 SPAD Units] | Chlorophyll measurement 2 [avarage of 10 SPAD Units] | Chlorophyll measurement 3 [avarage of 10 SPAD Units] | Chlorophyll measurement 4 [avarage of 10 SPAD Units] | Chlorophyll measurement 5 [avarage of 10 SPAD Units] | Comments | Dry biomass fruit [g] | Dry biomass leaf [g] | Dry biomass stem [g] | ... | Water content total [%] | Water loss fruit [g] | Water loss leaf [g] | Water loss stem [g] | Water loss total [g] | Weather | Wet biomass fruit [g] | Wet biomass leaf [g] | Wet biomass stem [g] | Wet biomass total [g] | |
| 2017-03-24 | 24.0 | 49.2 | 53.1 | 48.9 | 56.1 | 47.4 | NaN | 0.0 | 4.22 | 0.94 | ... | 75.56 | 0.0 | 9.12 | 0.99 | 10.11 | cloudy | 0.0 | 11.96 | 1.42 | 13.38 |
| 2017-03-28 | 24.0 | 44.2 | 42.1 | 47.8 | 38.9 | 53.2 | NaN | 0.0 | 6.69 | 7.06 | ... | 80.71 | 0.0 | 10.21 | 2.26 | 12.47 | sunny | 0.0 | 12.78 | 2.67 | 15.45 |
| 2017-04-05 | 28.0 | 56.4 | 57.5 | 55.6 | 51.3 | 52.1 | NaN | 0.0 | 6.88 | 3.14 | ... | 84.76 | 0.0 | 22.24 | 6.19 | 28.43 | cloudy | 0.0 | 26.45 | 7.09 | 33.54 |
| 2017-04-10 | 29.0 | 50.1 | 55.9 | 45.5 | 56.2 | 54.6 | NaN | 0.0 | 18.51 | 9.71 | ... | 84.01 | 0.0 | 7.90 | 1.98 | 9.88 | sunny | 0.0 | 9.52 | 2.24 | 11.76 |
| 2017-04-21 | 31.0 | 40.9 | 53.8 | 44.1 | 56.2 | 48.8 | NaN | 0.0 | 18.75 | 13.54 | ... | 81.70 | 0.0 | 18.06 | 9.85 | 27.91 | cloudy | 0.0 | 22.42 | 11.74 | 34.16 |
| 2017-05-02 | 31.0 | 47.7 | 46.7 | 42.4 | 37.2 | 47.5 | NaN | 0.0 | 13.13 | 11.48 | ... | 82.55 | 0.0 | 43.87 | 23.58 | 67.45 | cloudy | 0.0 | 53.85 | 27.86 | 81.71 |
6 rows × 705 columns
| BBCH | Height [cm] | |
|---|---|---|
| 2017-03-24 | 24.0 | 12.0 |
| 2017-03-28 | 24.0 | 10.0 |
| 2017-04-05 | 28.0 | 28.0 |
| 2017-04-10 | 29.0 | 32.0 |
| 2017-04-21 | 31.0 | 37.0 |
| 2017-05-02 | 31.0 | 39.0 |