# 35 Debugging

How to identify the source of a problem.

### 35.0.1 Using tests/workflow.R

This script, along with model-specific settings files in the tests folder, provide a working example. From inside the tests folder, R CMD --vanilla -- --settings pecan.<model>.xml < workflow.R should work.

The next step is to add debugonce(<broken.function.name>) before running the test workflow.

This allows you can step through the function and evaluate the different objects as they are created and/or transformed.

### 35.0.2 Useful scripts

The following scripts (in qaqc/vignettes identify, respectively:

1. relationships among functions across packages
2. function inputs and outputs (e.g. that will identify which functions and outputs are used in a workflow).

## 35.1 Troubleshooting PEcAn

### 35.1.1 Cookies and pecan web pages

You may need to disable cookies specifically for the pecan webserver in your browser. This shouldn’t be a problem running from the virtual machine, but your installation of php can include a ‘PHPSESSID’ that is quite long, and this can overflow the params field of the workflows table, depending on how long your hostname, model name, site name, etc are.

### 35.1.2Warning: mkdir() [function.mkdir]: No such file or directory

If you are seeing: Warning: mkdir() [function.mkdir]: No such file or directory in /path/to/pecan/web/runpecan.php at line 169 it is because you have used a relative path for \$output_folder in system.php.

### 35.1.3 After creating a new PFT the tag for PFT not passed to config.xml in ED

This is a result of the rather clunky way we currently have adding PFTs to PEcAn. This is happening because you need to edit the ./pecan/models/ed/data/pftmapping.csv file to include your new PFTs.

This is what the file looks like:

PEcAn;ED
ebifarm.acru;11
ebifarm.acsa3;11
...

You just need to edit this file (in a text editor, no Excel) and add your PFT names and associated number to the end of the file. Once you do this, recompile PEcAn and it should then work for you. We currently need to reference this file in order to properly set the PFT number and maintain internal consistency between PEcAn and ED2.

## 35.2 PEcAn Project use to teach Ecological model-data synthesis

### 35.2.1 University classes

#### 35.2.1.1 GE 375 - Environmental Modeling - Spring 2013, 2014 (Mike Dietze, Boston University)

The final “Case Study: Terrestrial Ecosystem Models” is a PEcAn-based hands-on activity. Each class has been 25 students.

GE 585 - Ecological forecasting Fall 2013 (Mike Dietze, Boston University)

### 35.2.2 Summer Courses / Workshops

#### 35.2.2.1 Annual summer course in flux measurement and advanced modeling (Mike Dietze, Ankur Desai) Niwot Ridge, CO

About 1/3 lecture, 2/3 hands-on (the syllabus is actually wrong as it list the other way around). Each class has 24 students.

2013 Syllabus see Tuesday Week 2 Data Assimilation lectures and PEcAn demo and the Class projects and presentations on Thursday and Friday. (Most students use PEcAn for their group projects. 2014 will be the third year that PEcAn has been used for this course.

#### 35.2.2.2 Assimilating Long-Term Data into Ecosystem Models: Paleo-Ecological Observatory Network (PalEON) Project

Here is a link to the course: https://www3.nd.edu/~paleolab/paleonproject/summer-course/

This course uses the same demo as above, including collecting data in the field and assimilating it (part 3)

#### 35.2.2.3 Integrating Evidence on Forest Response to Climate Change: Physiology to Regional Abundance

http://blue.for.msu.edu/macrosystems/workshop

May 13-14, 2013

Session 4: Integrating Forest Data Into Ecosystem Models

#### 35.2.2.4 Ecological Society of America meetings

Workshop: Combining Field Measurements and Ecosystem Models

### 35.2.3 Selected Publications

1. Dietze, M.C., D.S LeBauer, R. Kooper (2013) On improving the communication between models and data. Plant, Cell, & Environment doi:10.1111/pce.12043
2. LeBauer, D.S., D. Wang, K. Richter, C. Davidson, & M.C. Dietze. (2013). Facilitating feedbacks between field measurements and ecosystem models. Ecological Monographs. doi:10.1890/12-0137.1