Skip to content

krenwick/SageParm

Repository files navigation

This repository contains code associated with the publication titled "Modeling phenological controls on carbon dynamics in dryland sagebrush ecosystems", published in the Journal of Agricultural and Forest Meteorology. The paper is available at https://doi.org/10.1016/j.agrformet.2019.04.003

Notes:

The analysis associated with this project was complex and involved numerous different steps. Provided here is all new code that was generated as part of the project. Several scripts require the LPJ-GUESS model, which must be requested from the original authors. Other scripts were run on Hyalite, a high-performance computing cluster at Montana State University, and are designed to run many tasks in parallel.

Files with the .ins extension are instructional files that set key parameters for each LPJ-GUESS model run.

Model output and reference data (GPP and LAI) are provided here so that the analysis can be recreated.

  1. Data Processing Files in the folder code-processing:
  • merge_RC_flux_data.R
    • Reads in 2 years of flux data, combines into one file, and converts units so compatible with LPJ-GUESS output
    • Output: data/RCflux_15_16.csv
  • convert_modis_monthly.R
    • Reads in all MODIS variables and converts data to monthly time step
    • Output: data/ReynoldsC/MODIS/lai_gpp.csv
  1. Latin Hypercube Sampling Files in the folder code-processing/LHC_scripts:
  • latin_hypercube.R
    • Creates 640 separate ins files with different sets of parameters
    • Reads in automate_tests/LHC.ins
    • Calls automate_tests/split_into_subsets.sh to create bundles of 32 files to run on separate nodes on Hyalite
      • Output gets copied to Hyalite
  • LHC_newphen.R
    • Creates 420 separate ins files with different sets of parameters
    • Reads in automate_tests/LHC_newphen.ins
    • Calls automate_tests/split_into_subsets.sh to create bundles of 32 files to run on separate nodes on hyalite
      • Output gets copied to Hyalite
  • LHC.sh*
    • Copies ins files created by latin_hypercube.R to compute nodes and runs LPJ-GUESS
  • LHC_newphen.sh*
    • Copies ins files created by LHC_newphen.R to compute nodes and runs LPJ-GUESS Files in the folder automate_tests:
  • split_into_substes.sh
    • Called in LHC scripts, divides ins files into folders
  • LHC.ins
    • Read in and modified via latin_hypercube.R
  • LHC_newphen.ins
    • Read in and modified via LHC_newphen.R
  1. Parameter Optimization Files in the optim_hyalite_bundle folder:
  • DE_paroptim.R & DE_paroptim_newphen.R
    • Run optimization function on hyalite for the original model and new phenology models, respectively
    • Output: .RData file containing model object with run history, diagnostics, and final parameter estimates
  • optim1_summergreen.ins & optim2_newphen.ins
    • Ins files with dummy parameters that get replaced in each iteration of the optimization function
  • DEparoptim_slurm.sh & DEparoptim_newphen_slurm.sh
    • Initiates job on hyalite: copies files to compute nodes, runs the R scripts controlling the optimization function, and transfers output into the $STORE directory on hyalite
  • runRDEpar.sh & runRnewphen.sh
    • Tiny scripts called by the slurm scripts that in turn call the R scripts- this is a work-around for some hyalite quirks. Basically R needed to be called from the compute node to set the working directory to whatever compute node was being used, whereas since the slurm scripts run on the head node they couldn't figure out relative path names
  1. Analysis and Plots Files in the code-analyze folder (alphabetical, several dependencies):
  • Calc_percover_lai.R
    • Calculates percent of total LAI that is sagebrush in each model run
    • Output: perclai.tex, Table 4 in the manuscript
  • ESA_plots.R
    • Makes pretty color plots sized for powerpoint
  • fxn_RPCC.R
    • Several functions to calculate RPCC for annual, seasonal, and monthly model output, from both original model runs and runs with the new phenology
  • plot_climate_RC.R
    • Reads in daymet climate data
    • Output: TempPrecip.pdf, Figure 1 in the manuscript
  • plot_compare_mod_out.R
    • Dependency: run plot_gpp_lai_DEoptimparms.R first to generate model output
    • Reads in output from all model runs and compares to reference data
    • Output: GPP_LAI_newmods.pdf, Figure 3 in the manuscript
    • Output: GPP_LAI_newmods_xy.pdf, Figure S3 in the manuscript
  • plot_gpp_lai_DEoptimparms.R^2^
    • Reads in output from optimization run (must copy from Hyalite)
    • Reads in blank ins file (optim_hyalite_bundle/summergreen_optim1_LMpar.ins) and modifies with optimized parameters
    • Runs LPJ-GUESS then reads in the output
    • Repeats previous steps for the new phenology model and compares output
    • Output: LPJ-GUESS output from model runs with optimized parameters
  • plot_modis_vs_field_LAI.R
    • Compares field LAI measurements to MODIS data
    • Output: LAI_field_vs_MODIS.pdf, Figure S1 in the manuscript
  • plot_summer_ever_flux.R
    • Plots standard parameter runs (evergreen, summergreen, raingreen) against flux data
    • Output: GPP_LAI_origpheno.pdf, Figure 2 in the manuscript
  • R2_MAE_table.R
    • Compares output from all model runs to EC GPP and MODIS LAI
    • Calculates R2 and MAE
    • Output: R2MAE2.tex, Table 2 in the manuscript
  • sensitivity_newphen_parms.R
    • Calculates RPCC for variables in sensitivity analysis of new model
    • Output: RPCCecosagenewphen.R, Table S3 in the manuscript
    • Output: RPCC_seas_newphen.R, Table S4 in the manuscript
  • table_parm_estimates.R
    • Output: parm_estimates.tex, Table 3 in the manuscript
  • table_RPCC_total.R
    • Calculates RPCC for variables in sensitivity analysis of original model
    • Output: RPCCecosage.tex, Table S1 in the manuscript
    • Output: RPCC_seas.tex, Table S2 in the manuscript
  • tables_RPCC_grass.R
    • Exploratory analysis: looks at sensitivity of grass biomass to variation in sage and grass parameters
    • Creates several tables not used in manuscript

NOTES

^1^Must be run on Hyalite or a similar high-performance computing cluster

^2^Requires LPJ-GUESS

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages