19 Troubleshooting and Debugging PEcAn

19.0.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.

19.0.2 Warning: 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.

19.0.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:


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.

19.1 Debugging

How to identify the source of a problem.

19.1.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.

See tests README for more information.

19.1.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).