Merge branch 'master' of github.com:PecanProject/pecan
added functions for regridding data, and also for writing gridded data (array) to netcdf
in SIPNET code, moved a bunch of libraries out of Depends and into Imports or Suggests in order to get the library to load quicker (this is the bottleneck on Sipnet runs). Need to verify that the other SIPNET functions still work properly when running the demos start to finish
modified run.ensemble.analysis and run.sensitivity.analysis to include the variable and years in the name of the PDF output. Probably should go back and add this feature to the other objects written by these functions, but that may make later reading more complicated (though with better provenance)
modified run.write.configs to use the posteriors, post.distn.Rdata, rather than the priors if this file is available
added flux.uncertainty to the export from the uncertainty module so that it can be used in the flux data assimilation
modified approx.posterior to work with a MCMC matrix of parameters in addition to it's current support for the meta-analysis posteriors.
Massive rewrite of workflow.pda. I've stripped out the parts that are not directly supporting the MCMC (e.g. running ensemble analyses before and after) and adding the database and webpage logging functinality so the results of this workflow show up in both places. Added an explicit loading of priors, either specified in the settings of the most recent posterior in the database for this PFT. Switched variable specification to be by name not row in the priors table. Added a bunch of code for processing the MCMC output into the posterior objects that PEcAn expects, though I haven't yet added the writing of a new Posteriors table entry.
Large update to pda.mcmc: dropped model as arg, added settings and prior; added use of workflow.id and ensemble.id; removed my.start.run since write.configs now uses job.sh; removed read.SIPNET.NEE and now have generalized to read the standard netCDF output for any model. Added quantile functions for priors, qprior, to allow specification of prior median as the initial condition. This particularly important for cases where only a few variables are being modified. Switch flux data to L4. added counter for run number. added logging of run.id in the database and the use of standard run.id's when doing a database write. Added output of a README for the run that logs the settings and can be viewed in the webpage. added the listing of each run in the runs.txt so that start.model.runs can be used to execute the runs (which should support remote execution, though this has not been tested). Updated the reading of model outputs to use read.output. Added insert of loglikelihood into the Likelihood table.
added writing of posterior files to Posteriors table. Still need to set parent_id
data.land module: added tree ring functions to the namespace and updated plot2AGB to use the JAGS output of the tree ring estimates, to return the NPP and AGB estimates, and to sample over the allometries.
Allometry module: in AllomAve, updated to export the covariance matrix; in query.allom.data, updated to use more recent tables (inputs instead of raws) and the postgre capitialization differences
First half of updated treering assimilation workflow. Updated the files used, switched to the new functions for tree ring processing, added allometries, added database connection. Tested up through plot2AGB, which runs but the JAGS code in InventoryGrowthFusion seem to balk at large n.iter and there's some bug in the JAGS visualization that hasn't been tracked down yet
added plot.flux.uncertainty to namespace and fixed a few small errors in workflow.pda
fix bug in write.configs.SIPNET that wasn't writing inputs
added ciEnvelope to the visualization namespace
workflow.treering: added obs, IC, and priors
modified plot2AGB to save & return the AGB and NPP MCMC objects (rather than just the mean and sd); added plot2AGB to the data.land NAMESPACE
misc small bug fixes in data assimilation
sda.enkf: complete rewrite of assimilation code to start from a different place (proposed IC & param sample rather than output of initial ensemble run); writes ensemble and run to database, writes run README & uses updated job.sh. Because job.sh checks for existing runs code has to go in and move sipnet.out. In the current version not all state variables are being set and the units on all variables have not yet been checked. Added some noise to the snow state variable to prevent numerical singularies if all states = 0. Tried to implement the EAKF as an alternative updated but currently the updated mean is correct but the variance is too large -- haven't tracked down the bug yet. At the current moment the code INSIDE this function appears to work but the function itself will not work since I haven't cleaned up the old code or flushed out the basic visualizations.