DrylandEcology / rSFSTEP2

R program that interfaces with the STEPWAT2 C code and runs in parallel for multiple sites, climate scenarios, disturbance regimes, and time periods
0 stars 1 forks source link

Feature phenology biomass scaling #166

Closed chaukap closed 4 years ago

chaukap commented 4 years ago

Phenology scaling is ready to merge into master.

kpalmqui commented 4 years ago

@chaukap I tested for two sites and for 13 GCMs, 1 RCP, and two future time periods. My test runs completely successfully without error. Now to wade through the derived prod and phen files....

kpalmqui commented 4 years ago

@chaukap I noticed some odd behavior for the phenology values that are generated on the fly. Find below the default phenological activity values provided in the input csv for shrubs (shrub_phenology_inputscsvfile) and the new scaled phenology values for shrubs for site 21 under two future climate scenarios (shrub_phenology_site21_d90yrs.RCP85.CanESM2, shrub_phenology_site21_d90yrs.RCP85.MRI-CGCM3). The odd behavior is that phenological activity can be turned off in a month that was preceeded by a month with phenological activity and by a subsequent month where phenological activity is non-zero. This is not really the behavior we expect. Once a rgroup is phenologically active, it should remain so until its growth ends (it senesces or dies). Thus, we should have periods where plants are continually phenologically active in back to back months followed by phenologically inactive months. This is why the default phenological inputs are specified as they are. For example, shrubs:

0 | 0.025 | 0.1 | 0.125 | 0.15 | 0.25 | 0.15 | 0.1 | 0.0625 | 0.0125 | 0.025 | 0

orig.future.phenology.shrubs.xlsx

I did not think to clarify this point in my description of this task on Github.

@dschlaep do you agree with my assessment?

chaukap commented 4 years ago

@kpalmqui The only place that the actual phenologyical values are modified is in Vegetation.R:

  for (k_scen in seq_len(n_climate.conditions)) {
    temp_clim <- rSOILWAT2::calc_SiteClimate(
      weatherList = sw_weatherList[[n_sites]][[k_scen]], do_C4vars = TRUE, do_Cheatgrass_ClimVars = TRUE,
      latitude = site_latitude[n_sites])

    return_list[[k_scen]] <- rSOILWAT2::adjBiom_by_temp(matrices, temp_clim[["meanMonthlyTempC"]], 
                                                        reference_growing_season = defaultGrowingSeason)
  }

@dschlaep could you confirm that I'm calling this function correctly?

kpalmqui commented 4 years ago

@chaukap thought they were also modified to sum to 1.0 in Main.R?

chaukap commented 4 years ago

@kpalmqui In regards to the legend covering up biomass file comparisons, I changed the legend location to the top left and still encountered overlaps. So instead I increased the y limit to 1.25 and made the image slightly taller. The problem should now be resolved.

chaukap commented 4 years ago

@kpalmqui I have integrated Daniel's new function into the scale_phenology function in Vegetation.R. It should be ready for you to test, and even with my untrained eye the values look more reasonable.

One thing to note:

I created the the new input file InputData_MonthlyTemp.csv to store the default mean monthly temperatures. However, these values need to be adjusted before you test. The dummy values I added are the mean monthly lows for Salt Lake City found at currentresults.com

@dschlaep Feel free to try running the new code as well. Once you run the simulation (or at least the file generation part) you can compare all sites by calling ./compare_files.sh <number of sites> The results will be in rSFSTEP2/R_program_??/STEPWAT_DIST/output where ?? is the site.