From 496ee06bbd4c16fb0b8288c7354054d6dd27c457 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Tue, 25 Nov 2025 14:06:33 -0700 Subject: [PATCH 01/57] Add MAX_TLAI_PERHARV history output. --- .../testmods_dirs/clm/crop/user_nl_clm | 2 +- src/biogeochem/CNPhenologyMod.F90 | 7 +++++++ src/biogeochem/CNVegStructUpdateMod.F90 | 4 ++++ src/biogeochem/CropType.F90 | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm index 56d4696774..ad64950313 100644 --- a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm @@ -13,7 +13,7 @@ hist_fincl2 += 'DYN_COL_SOIL_ADJUSTMENTS_C' ! Note that, under normal circumstances, these should only be saved annually. ! That's needed for the mxsowings and mxharvests axes to make sense. ! However, for testing purposes, it makes sense to save more frequently. -hist_fincl3 = 'SDATES', 'SDATES_PERHARV', 'SYEARS_PERHARV', 'HDATES', 'GRAINC_TO_FOOD_PERHARV', 'GRAINC_TO_FOOD_ANN', 'GRAINN_TO_FOOD_PERHARV', 'GRAINN_TO_FOOD_ANN', 'GRAINC_TO_SEED_PERHARV', 'GRAINC_TO_SEED_ANN', 'GRAINN_TO_SEED_PERHARV', 'GRAINN_TO_SEED_ANN', 'HDATES', 'GDDHARV_PERHARV', 'GDDACCUM_PERHARV', 'HUI_PERHARV', 'SOWING_REASON_PERHARV', 'HARVEST_REASON_PERHARV', 'SWINDOW_STARTS', 'SWINDOW_ENDS', 'GDD20_BASELINE', 'GDD20_SEASON_START', 'GDD20_SEASON_END' +hist_fincl3 = 'SDATES', 'SDATES_PERHARV', 'SYEARS_PERHARV', 'HDATES', 'GRAINC_TO_FOOD_PERHARV', 'GRAINC_TO_FOOD_ANN', 'GRAINN_TO_FOOD_PERHARV', 'GRAINN_TO_FOOD_ANN', 'GRAINC_TO_SEED_PERHARV', 'GRAINC_TO_SEED_ANN', 'GRAINN_TO_SEED_PERHARV', 'GRAINN_TO_SEED_ANN', 'HDATES', 'GDDHARV_PERHARV', 'GDDACCUM_PERHARV', 'HUI_PERHARV', 'SOWING_REASON_PERHARV', 'HARVEST_REASON_PERHARV', 'SWINDOW_STARTS', 'SWINDOW_ENDS', 'GDD20_BASELINE', 'GDD20_SEASON_START', 'GDD20_SEASON_END', 'MAX_TLAI_PERHARV' hist_nhtfrq = -24,-8,-24 hist_mfilt = 1,1,1 hist_type1d_pertape(3) = 'PFTS' diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index fb43c37804..d5d408de14 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2092,6 +2092,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & fertnitro => crop_inst%fertnitro_patch , & ! Input: [real(r8) (:) ] fertilizer nitrogen hui => crop_inst%hui_patch , & ! Input: [real(r8) (:) ] crop patch heat unit index (growing degree-days); set to 0 at sowing and accumulated until harvest + max_tlai => crop_inst%max_tlai_patch , & ! Input: [real(r8) (:) ] maximum total projected leaf area seen this season (m2/m2); set to 0 at sowing and tracked until harvest leafout => crop_inst%gddtsoi_patch , & ! Input: [real(r8) (:) ] gdd from top soil layer temperature harvdate => crop_inst%harvdate_patch , & ! Output: [integer (:) ] harvest date croplive => crop_inst%croplive_patch , & ! Output: [logical (:) ] Flag, true if planted, not harvested @@ -2180,6 +2181,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & cnveg_state_inst%gddmaturity_thisyr(p,s) = -1._r8 crop_inst%gddaccum_thisyr_patch(p,s) = -1._r8 crop_inst%hui_thisyr_patch(p,s) = -1._r8 + crop_inst%max_tlai_thisyr_patch(p,s) = -1._r8 crop_inst%sowing_reason_perharv_patch(p,s) = -1._r8 crop_inst%harvest_reason_thisyr_patch(p,s) = -1._r8 do k = repr_grain_min, repr_grain_max @@ -2546,6 +2548,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & crop_inst%sowing_reason_perharv_patch(p, harvest_count(p)) = real(crop_inst%sowing_reason_patch(p), r8) crop_inst%sowing_reason_patch(p) = -1 ! "Reason for most recent sowing of this patch." So in the line above we save, and here we reset. crop_inst%harvest_reason_thisyr_patch(p, harvest_count(p)) = harvest_reason + crop_inst%max_tlai_thisyr_patch(p, harvest_count(p)) = crop_inst%max_tlai_patch(p) endif croplive(p) = .false. ! no re-entry in greater if-block @@ -2809,6 +2812,7 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, & harvdate => crop_inst%harvdate_patch , & ! Output: [integer (:) ] harvest date sowing_count => crop_inst%sowing_count , & ! Inout: [integer (:) ] number of sowing events this year for this patch sowing_reason => crop_inst%sowing_reason_thisyr_patch , & ! Output: [real(r8) (:) ] reason for each sowing this year for this patch + max_tlai => crop_inst%max_tlai_patch , & ! Output: [real(r8) (:) ] maximum total projected leaf area seen this season gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Output: [real(r8) (:) ] gdd needed to harvest idop => cnveg_state_inst%idop_patch , & ! Output: [integer (:) ] date of planting iyop => cnveg_state_inst%iyop_patch , & ! Output: [integer (:) ] year of planting @@ -2955,6 +2959,9 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, & arepr(p,k) = 0._r8 end do + ! Initialize other stuff + max_tlai = 0._r8 + end associate end subroutine PlantCrop diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 index 007478b573..0055c9f240 100644 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ b/src/biogeochem/CNVegStructUpdateMod.F90 @@ -127,6 +127,7 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & peaklai => cnveg_state_inst%peaklai_patch , & ! Output: [integer (:) ] 1: max allowed lai; 0: not at max harvdate => crop_inst%harvdate_patch , & ! Input: [integer (:) ] harvest date + max_tlai => crop_inst%max_tlai_patch , & ! Output: [real(r8) (:) ] maximum total projected leaf area seen this season ! *** Key Output from CN*** tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow @@ -260,6 +261,9 @@ subroutine CNVegStructUpdate(bounds,num_soilp, filter_soilp, & htop(p) = max(0.05_r8, max(htmx(p),htop(p))) hbot(p) = 0.02_r8 + ! Maximum LAI seen this season + max_tlai(p) = max(max_tlai(p), tlai(p)) + else ! generic crops and ... ! grasses diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 48f9cb9cad..2d7b4efe21 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -68,6 +68,8 @@ module CropType real(r8), pointer :: harvest_reason_thisyr_patch (:,:) ! reason for each harvest for this patch this year [patch, mxharvests] integer , pointer :: sowing_count (:) ! number of sowing events this year for this patch integer , pointer :: harvest_count (:) ! number of sowing events this year for this patch + real(r8), pointer :: max_tlai_patch (:) ! maximum total projected leaf area seen this season (m2/m2) [patch] + real(r8), pointer :: max_tlai_thisyr_patch (:,:) ! maximum total projected leaf area for harvests in this patch this year (m2/m2) [patch] ! gddaccum tracks the actual growing degree-days accumulated over the growing season. ! hui also accumulates growing degree-days, but can be boosted if full leafout is ! achieved before the GDD threshold for grain fill has been reached; see CropPhenology(). @@ -254,6 +256,8 @@ subroutine InitAllocate(this, bounds) allocate(this%harvest_reason_thisyr_patch(begp:endp,1:mxharvests)) ; this%harvest_reason_thisyr_patch(:,:) = spval allocate(this%sowing_count(begp:endp)) ; this%sowing_count(:) = 0 allocate(this%harvest_count(begp:endp)) ; this%harvest_count(:) = 0 + allocate(this%max_tlai_patch(begp:endp)) ; this%max_tlai_patch(:) = spval + allocate(this%max_tlai_thisyr_patch(begp:endp,1:mxharvests)) ; this%max_tlai_thisyr_patch(:,:) = spval end subroutine InitAllocate @@ -347,6 +351,11 @@ subroutine InitHistory(this, bounds) avgflag='I', long_name='At-harvest accumulated heat unit index for crop; should only be output annually', & ptr_patch=this%hui_thisyr_patch, default='inactive') + this%max_tlai_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='MAX_TLAI_PERHARV', units='m^2/m^2', type2d='mxharvests', & + avgflag='I', long_name='Maximum total projected leaf area index in season of each harvest this year; should only be output annually', & + ptr_patch=this%max_tlai_thisyr_patch, default='inactive') + this%sowing_reason_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='SOWING_REASON', units='unitless', type2d='mxsowings', & avgflag='I', long_name='Reason for each crop sowing; should only be output annually', & @@ -643,6 +652,10 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) dim1name='pft', long_name='vernalization factor', units='', & interpinic_flag='interp', readvar=readvar, data=this%vf_patch) + call restartvar(ncid=ncid, flag=flag, varname='max_tlai', xtype=ncd_double, & + dim1name='pft', long_name='maximum total projected leaf area seen this season', units='m^2/m^2', & + interpinic_flag='interp', readvar=readvar, data=this%max_tlai_patch) + call restartvar(ncid=ncid, flag=flag, varname='cphase',xtype=ncd_double, & dim1name='pft', long_name='crop phenology phase', & units='0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest', & @@ -720,6 +733,11 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) long_name='accumulated heat unit index at harvest for this patch this year', units='ddays', & scale_by_thickness=.false., & interpinic_flag='interp', readvar=readvar, data=this%hui_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='max_tlai_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Maximum total projected leaf area index in season of each harvest this year', units='m^2/m^2', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%max_tlai_thisyr_patch) call restartvar(ncid=ncid, flag=flag, varname='sowing_reason_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxsowings', switchdim=.true., & long_name='reason for each sowing for this patch this year', units='unitless', & From 7f9ef13bb32097a50748f5c50218ef793fa68762 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Sun, 2 Nov 2025 11:35:33 -0700 Subject: [PATCH 02/57] PlantCrop: Add namelist option to suppress low gddmaturity warning. --- bld/namelist_files/namelist_defaults_ctsm.xml | 1 + bld/namelist_files/namelist_definition_ctsm.xml | 5 +++++ src/biogeochem/CNPhenologyMod.F90 | 6 ++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 4a4c3a8e07..7ea603f8d0 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -703,6 +703,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. .true. +.false. .true. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 75d43fb80a..1fad95097d 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1472,6 +1472,11 @@ Set to .true. in order to override crop harvesting logic and to instead harvest Set to .false. in order to ignore crop PFT parameter for maximum growing season length (mxmat). Must be set to .false. when generate_crop_gdds is .true. + +If set to .true., suppress the warning message when a prescribed cultivar GDD requirement is below the minimum allowed value and is replaced with min_gddmaturity. Useful when using prescribed crop calendars with intentionally low GDD requirements. + + Method for determining what the minimum critical day length for seasonal decidious leaf offset depends on diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index d5d408de14..515e5d073a 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -146,6 +146,7 @@ module CNPhenologyMod real(r8) :: min_gddmaturity = 1._r8 ! Weird things can happen if gddmaturity is tiny logical, public :: generate_crop_gdds = .false. ! If true, harvest the day before next sowing logical, public :: use_mxmat = .true. ! If true, ignore crop maximum growing season length + logical, private :: suppress_gddmaturity_warning = .false. ! If true, suppress warning when using min_gddmaturity ! For use with adapt_cropcal_rx_cultivar_gdds .true. real(r8), parameter :: min_gdd20_baseline = 0._r8 ! If gdd20_baseline_patch is ≤ this, do not consider baseline. @@ -200,7 +201,7 @@ subroutine CNPhenologyReadNML( NLFilename ) !----------------------------------------------------------------------- namelist /cnphenology/ initial_seed_at_planting, onset_thresh_depends_on_veg, & min_critical_dayl_method, generate_crop_gdds, & - use_mxmat + use_mxmat, suppress_gddmaturity_warning ! Initialize options to default values, in case they are not specified in ! the namelist @@ -226,6 +227,7 @@ subroutine CNPhenologyReadNML( NLFilename ) call shr_mpi_bcast (min_critical_dayl_method, mpicom) call shr_mpi_bcast (generate_crop_gdds, mpicom) call shr_mpi_bcast (use_mxmat, mpicom) + call shr_mpi_bcast (suppress_gddmaturity_warning, mpicom) if ( min_critical_dayl_method == "DependsOnLat" )then critical_daylight_method = critical_daylight_depends_on_lat @@ -2936,7 +2938,7 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, & if (gddmaturity(p) < min_gddmaturity) then if (use_cropcal_rx_cultivar_gdds .or. generate_crop_gdds) then - if (did_rx_gdds) then + if (did_rx_gdds .and. .not. suppress_gddmaturity_warning) then write(iulog,*) 'Some patch with ivt ',ivt(p),' has rx gddmaturity ',gddmaturity(p),'; using min_gddmaturity instead (',min_gddmaturity,')' end if gddmaturity(p) = min_gddmaturity From e9219a26d62e237c439f8c16e73b682b695dd7c1 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Tue, 25 Nov 2025 14:12:51 -0700 Subject: [PATCH 03/57] Fix a comment --- src/biogeochem/CropType.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 2d7b4efe21..f195dc2ef0 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -67,7 +67,7 @@ module CropType real(r8), pointer :: sowing_reason_perharv_patch (:,:) ! reason for each sowing of crops *harvested* this year [patch, mxharvests] real(r8), pointer :: harvest_reason_thisyr_patch (:,:) ! reason for each harvest for this patch this year [patch, mxharvests] integer , pointer :: sowing_count (:) ! number of sowing events this year for this patch - integer , pointer :: harvest_count (:) ! number of sowing events this year for this patch + integer , pointer :: harvest_count (:) ! number of harvest events this year for this patch real(r8), pointer :: max_tlai_patch (:) ! maximum total projected leaf area seen this season (m2/m2) [patch] real(r8), pointer :: max_tlai_thisyr_patch (:,:) ! maximum total projected leaf area for harvests in this patch this year (m2/m2) [patch] ! gddaccum tracks the actual growing degree-days accumulated over the growing season. From 4ee9e6e4a5e6fc3f0bdbe8cab526db9c38267bac Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Tue, 25 Nov 2025 15:58:24 -0700 Subject: [PATCH 04/57] Add crop phase transition biomass outputs. --- .../testmods_dirs/clm/crop/user_nl_clm | 5 + src/biogeochem/CNPhenologyMod.F90 | 60 +++- src/biogeochem/CropType.F90 | 312 ++++++++++++++++++ 3 files changed, 376 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm index ad64950313..3a20434caf 100644 --- a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm @@ -14,6 +14,11 @@ hist_fincl2 += 'DYN_COL_SOIL_ADJUSTMENTS_C' ! That's needed for the mxsowings and mxharvests axes to make sense. ! However, for testing purposes, it makes sense to save more frequently. hist_fincl3 = 'SDATES', 'SDATES_PERHARV', 'SYEARS_PERHARV', 'HDATES', 'GRAINC_TO_FOOD_PERHARV', 'GRAINC_TO_FOOD_ANN', 'GRAINN_TO_FOOD_PERHARV', 'GRAINN_TO_FOOD_ANN', 'GRAINC_TO_SEED_PERHARV', 'GRAINC_TO_SEED_ANN', 'GRAINN_TO_SEED_PERHARV', 'GRAINN_TO_SEED_ANN', 'HDATES', 'GDDHARV_PERHARV', 'GDDACCUM_PERHARV', 'HUI_PERHARV', 'SOWING_REASON_PERHARV', 'HARVEST_REASON_PERHARV', 'SWINDOW_STARTS', 'SWINDOW_ENDS', 'GDD20_BASELINE', 'GDD20_SEASON_START', 'GDD20_SEASON_END', 'MAX_TLAI_PERHARV' +hist_fincl3 += 'FROOTC_AT_EMERGENCE_PERHARV', 'FROOTC_AT_ANTHESIS_PERHARV', 'FROOTC_AT_MATURITY_PERHARV' +hist_fincl3 += 'LIVECROOTC_AT_EMERGENCE_PERHARV', 'LIVECROOTC_AT_ANTHESIS_PERHARV', 'LIVECROOTC_AT_MATURITY_PERHARV' +hist_fincl3 += 'LIVESTEMC_AT_EMERGENCE_PERHARV', 'LIVESTEMC_AT_ANTHESIS_PERHARV', 'LIVESTEMC_AT_MATURITY_PERHARV' +hist_fincl3 += 'LEAFC_AT_EMERGENCE_PERHARV', 'LEAFC_AT_ANTHESIS_PERHARV', 'LEAFC_AT_MATURITY_PERHARV' +hist_fincl3 += 'GRAINC_AT_EMERGENCE_PERHARV', 'GRAINC_AT_ANTHESIS_PERHARV', 'GRAINC_AT_MATURITY_PERHARV' hist_nhtfrq = -24,-8,-24 hist_mfilt = 1,1,1 hist_type1d_pertape(3) = 'PFTS' diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 515e5d073a..70308a46af 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2056,6 +2056,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & real(r8) avg_dayspyr ! average number of days per year real(r8) crmcorn ! comparitive relative maturity for corn real(r8) ndays_on ! number of days to fertilize + real(r8) cphase_orig ! crop phase before updating logical has_rx_sowing_date ! does the crop have a single sowing date instead of a window? logical is_in_sowing_window ! is the crop in its sowing window? logical is_end_sowing_window ! is it the last day of the crop's sowing window? @@ -2157,6 +2158,8 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ! Should never be saved as zero, but including this so it's initialized just in case harvest_reason = 0._r8 + cphase_orig = cphase(p) + ! --------------------------------- ! from AgroIBIS subroutine planting ! --------------------------------- @@ -2184,6 +2187,21 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & crop_inst%gddaccum_thisyr_patch(p,s) = -1._r8 crop_inst%hui_thisyr_patch(p,s) = -1._r8 crop_inst%max_tlai_thisyr_patch(p,s) = -1._r8 + crop_inst%frootc_emergence_thisyr_patch(p,s) = -1._r8 + crop_inst%frootc_anthesis_thisyr_patch(p,s) = -1._r8 + crop_inst%frootc_maturity_thisyr_patch(p,s) = -1._r8 + crop_inst%livecrootc_emergence_thisyr_patch(p,s) = -1._r8 + crop_inst%livecrootc_anthesis_thisyr_patch(p,s) = -1._r8 + crop_inst%livecrootc_maturity_thisyr_patch(p,s) = -1._r8 + crop_inst%livestemc_emergence_thisyr_patch(p,s) = -1._r8 + crop_inst%livestemc_anthesis_thisyr_patch(p,s) = -1._r8 + crop_inst%livestemc_maturity_thisyr_patch(p,s) = -1._r8 + crop_inst%leafc_emergence_thisyr_patch(p,s) = -1._r8 + crop_inst%leafc_anthesis_thisyr_patch(p,s) = -1._r8 + crop_inst%leafc_maturity_thisyr_patch(p,s) = -1._r8 + crop_inst%grainc_emergence_thisyr_patch(p,s) = -1._r8 + crop_inst%grainc_anthesis_thisyr_patch(p,s) = -1._r8 + crop_inst%grainc_maturity_thisyr_patch(p,s) = -1._r8 crop_inst%sowing_reason_perharv_patch(p,s) = -1._r8 crop_inst%harvest_reason_thisyr_patch(p,s) = -1._r8 do k = repr_grain_min, repr_grain_max @@ -2511,6 +2529,9 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ! similar changes in CropPhase. if ((.not. do_harvest) .and. leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p) .and. idpp < mxmat) then cphase(p) = cphase_leafemerge + if (cphase(p) /= cphase_orig) then + call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst, cnveg_carbonflux_inst) + end if if (abs(onset_counter(p)) > 1.e-6_r8) then onset_flag(p) = 1._r8 onset_counter(p) = dt @@ -2536,6 +2557,9 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ! changes to the offset subroutine below else if (do_harvest) then + cphase(p) = cphase_harvest + call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst, cnveg_carbonflux_inst) + ! Don't update these if you're just harvesting because of incorrect Dec. ! 31 planting if (.not. fake_harvest) then @@ -2551,10 +2575,26 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & crop_inst%sowing_reason_patch(p) = -1 ! "Reason for most recent sowing of this patch." So in the line above we save, and here we reset. crop_inst%harvest_reason_thisyr_patch(p, harvest_count(p)) = harvest_reason crop_inst%max_tlai_thisyr_patch(p, harvest_count(p)) = crop_inst%max_tlai_patch(p) + + ! Crop phase transition biomass sizes + crop_inst%frootc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%frootc_emergence_patch(p) + crop_inst%frootc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%frootc_anthesis_patch(p) + crop_inst%frootc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%frootc_maturity_patch(p) + crop_inst%livecrootc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%livecrootc_emergence_patch(p) + crop_inst%livecrootc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%livecrootc_anthesis_patch(p) + crop_inst%livecrootc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%livecrootc_maturity_patch(p) + crop_inst%livestemc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%livestemc_emergence_patch(p) + crop_inst%livestemc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%livestemc_anthesis_patch(p) + crop_inst%livestemc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%livestemc_maturity_patch(p) + crop_inst%leafc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%leafc_emergence_patch(p) + crop_inst%leafc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%leafc_anthesis_patch(p) + crop_inst%leafc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%leafc_maturity_patch(p) + crop_inst%grainc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%grainc_emergence_patch(p) + crop_inst%grainc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%grainc_anthesis_patch(p) + crop_inst%grainc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%grainc_maturity_patch(p) endif croplive(p) = .false. ! no re-entry in greater if-block - cphase(p) = cphase_harvest if (tlai(p) > 0._r8) then ! plant had emerged before harvest offset_flag(p) = 1._r8 offset_counter(p) = dt @@ -2585,6 +2625,9 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & else if (hui(p) >= huigrain(p)) then cphase(p) = cphase_grainfill + if (cphase(p) /= cphase_orig) then + call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst, cnveg_carbonflux_inst) + end if bglfr(p) = 1._r8/(leaf_long(ivt(p))*avg_dayspyr*secspday) end if @@ -2963,6 +3006,21 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, & ! Initialize other stuff max_tlai = 0._r8 + crop_inst%frootc_emergence_patch(p) = -1._r8 + crop_inst%frootc_anthesis_patch(p) = -1._r8 + crop_inst%frootc_maturity_patch(p) = -1._r8 + crop_inst%livecrootc_emergence_patch(p) = -1._r8 + crop_inst%livecrootc_anthesis_patch(p) = -1._r8 + crop_inst%livecrootc_maturity_patch(p) = -1._r8 + crop_inst%livestemc_emergence_patch(p) = -1._r8 + crop_inst%livestemc_anthesis_patch(p) = -1._r8 + crop_inst%livestemc_maturity_patch(p) = -1._r8 + crop_inst%leafc_emergence_patch(p) = -1._r8 + crop_inst%leafc_anthesis_patch(p) = -1._r8 + crop_inst%leafc_maturity_patch(p) = -1._r8 + crop_inst%grainc_emergence_patch(p) = -1._r8 + crop_inst%grainc_anthesis_patch(p) = -1._r8 + crop_inst%grainc_maturity_patch(p) = -1._r8 end associate diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index f195dc2ef0..85d8dc0fcd 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -70,6 +70,39 @@ module CropType integer , pointer :: harvest_count (:) ! number of harvest events this year for this patch real(r8), pointer :: max_tlai_patch (:) ! maximum total projected leaf area seen this season (m2/m2) [patch] real(r8), pointer :: max_tlai_thisyr_patch (:,:) ! maximum total projected leaf area for harvests in this patch this year (m2/m2) [patch] + + ! biomass pool sizes at different crop phase transitions + real(r8), pointer :: frootc_emergence_patch (:) ! Fine root C at emergence for this patch this season (gC/m2) [patch] + real(r8), pointer :: frootc_anthesis_patch (:) ! Fine root C at anthesis for this patch this season (gC/m2) [patch] + real(r8), pointer :: frootc_maturity_patch (:) ! Fine root C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: livecrootc_emergence_patch (:) ! Live coarse root C at emergence for this patch this season (gC/m2) [patch] + real(r8), pointer :: livecrootc_anthesis_patch (:) ! Live coarse root C at anthesis for this patch this season (gC/m2) [patch] + real(r8), pointer :: livecrootc_maturity_patch (:) ! Live coarse root C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: livestemc_emergence_patch (:) ! Live stem C at emergence for this patch this season (gC/m2) [patch] + real(r8), pointer :: livestemc_anthesis_patch (:) ! Live stem C at anthesis for this patch this season (gC/m2) [patch] + real(r8), pointer :: livestemc_maturity_patch (:) ! Live stem C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: leafc_emergence_patch (:) ! Leaf C at emergence for this patch this season (gC/m2) [patch] + real(r8), pointer :: leafc_anthesis_patch (:) ! Leaf C at anthesis for this patch this season (gC/m2) [patch] + real(r8), pointer :: leafc_maturity_patch (:) ! Leaf C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: grainc_emergence_patch (:) ! Grain C at emergence for this patch this season (gC/m2) [patch] + real(r8), pointer :: grainc_anthesis_patch (:) ! Grain C at anthesis for this patch this season (gC/m2) [patch] + real(r8), pointer :: grainc_maturity_patch (:) ! Grain C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: frootc_emergence_thisyr_patch (:,:) ! Fine root C at emergence for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: frootc_anthesis_thisyr_patch (:,:) ! Fine root C at anthesis for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: frootc_maturity_thisyr_patch (:,:) ! Fine root C at maturity for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: livecrootc_emergence_thisyr_patch (:,:) ! Live coarse root C at emergence for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: livecrootc_anthesis_thisyr_patch (:,:) ! Live coarse root C at anthesis for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: livecrootc_maturity_thisyr_patch (:,:) ! Live coarse root C at maturity for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: livestemc_emergence_thisyr_patch (:,:) ! Live stem C at emergence for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: livestemc_anthesis_thisyr_patch (:,:) ! Live stem C at anthesis for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: livestemc_maturity_thisyr_patch (:,:) ! Live stem C at maturity for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: leafc_emergence_thisyr_patch (:,:) ! Leaf C at emergence for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: leafc_anthesis_thisyr_patch (:,:) ! Leaf C at anthesis for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: leafc_maturity_thisyr_patch (:,:) ! Leaf C at maturity for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: grainc_emergence_thisyr_patch (:,:) ! Grain C at emergence for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: grainc_anthesis_thisyr_patch (:,:) ! Grain C at anthesis for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: grainc_maturity_thisyr_patch (:,:) ! Grain C at maturity for harvests in this patch this year (gC/m2) [patch] + ! gddaccum tracks the actual growing degree-days accumulated over the growing season. ! hui also accumulates growing degree-days, but can be boosted if full leafout is ! achieved before the GDD threshold for grain fill has been reached; see CropPhenology(). @@ -91,6 +124,7 @@ module CropType procedure, public :: CropUpdateAccVars procedure, public :: CropIncrementYear + procedure, public :: CropPhaseTransitionBiomass ! Private routines procedure, private :: InitAllocate @@ -258,6 +292,36 @@ subroutine InitAllocate(this, bounds) allocate(this%harvest_count(begp:endp)) ; this%harvest_count(:) = 0 allocate(this%max_tlai_patch(begp:endp)) ; this%max_tlai_patch(:) = spval allocate(this%max_tlai_thisyr_patch(begp:endp,1:mxharvests)) ; this%max_tlai_thisyr_patch(:,:) = spval + allocate(this%frootc_emergence_patch(begp:endp)) ; this%frootc_emergence_patch(:) = spval + allocate(this%frootc_anthesis_patch(begp:endp)) ; this%frootc_anthesis_patch(:) = spval + allocate(this%frootc_maturity_patch(begp:endp)) ; this%frootc_maturity_patch(:) = spval + allocate(this%livecrootc_emergence_patch(begp:endp)) ; this%livecrootc_emergence_patch(:) = spval + allocate(this%livecrootc_anthesis_patch(begp:endp)) ; this%livecrootc_anthesis_patch(:) = spval + allocate(this%livecrootc_maturity_patch(begp:endp)) ; this%livecrootc_maturity_patch(:) = spval + allocate(this%livestemc_emergence_patch(begp:endp)) ; this%livestemc_emergence_patch(:) = spval + allocate(this%livestemc_anthesis_patch(begp:endp)) ; this%livestemc_anthesis_patch(:) = spval + allocate(this%livestemc_maturity_patch(begp:endp)) ; this%livestemc_maturity_patch(:) = spval + allocate(this%leafc_emergence_patch(begp:endp)) ; this%leafc_emergence_patch(:) = spval + allocate(this%leafc_anthesis_patch(begp:endp)) ; this%leafc_anthesis_patch(:) = spval + allocate(this%leafc_maturity_patch(begp:endp)) ; this%leafc_maturity_patch(:) = spval + allocate(this%grainc_emergence_patch(begp:endp)) ; this%grainc_emergence_patch(:) = spval + allocate(this%grainc_anthesis_patch(begp:endp)) ; this%grainc_anthesis_patch(:) = spval + allocate(this%grainc_maturity_patch(begp:endp)) ; this%grainc_maturity_patch(:) = spval + allocate(this%frootc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%frootc_emergence_thisyr_patch(:,:) = spval + allocate(this%frootc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%frootc_anthesis_thisyr_patch(:,:) = spval + allocate(this%frootc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%frootc_maturity_thisyr_patch(:,:) = spval + allocate(this%livecrootc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%livecrootc_emergence_thisyr_patch(:,:) = spval + allocate(this%livecrootc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%livecrootc_anthesis_thisyr_patch(:,:) = spval + allocate(this%livecrootc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%livecrootc_maturity_thisyr_patch(:,:) = spval + allocate(this%livestemc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%livestemc_emergence_thisyr_patch(:,:) = spval + allocate(this%livestemc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%livestemc_anthesis_thisyr_patch(:,:) = spval + allocate(this%livestemc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%livestemc_maturity_thisyr_patch(:,:) = spval + allocate(this%leafc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%leafc_emergence_thisyr_patch(:,:) = spval + allocate(this%leafc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%leafc_anthesis_thisyr_patch(:,:) = spval + allocate(this%leafc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%leafc_maturity_thisyr_patch(:,:) = spval + allocate(this%grainc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%grainc_emergence_thisyr_patch(:,:) = spval + allocate(this%grainc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%grainc_anthesis_thisyr_patch(:,:) = spval + allocate(this%grainc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%grainc_maturity_thisyr_patch(:,:) = spval end subroutine InitAllocate @@ -356,6 +420,81 @@ subroutine InitHistory(this, bounds) avgflag='I', long_name='Maximum total projected leaf area index in season of each harvest this year; should only be output annually', & ptr_patch=this%max_tlai_thisyr_patch, default='inactive') + this%frootc_emergence_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='FROOTC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Fine root C at emergence for each harvest this year; should only be output annually', & + ptr_patch=this%frootc_emergence_thisyr_patch, default='inactive') + + this%frootc_anthesis_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='FROOTC_AT_ANTHESIS_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Fine root C at anthesis for each harvest this year; should only be output annually', & + ptr_patch=this%frootc_anthesis_thisyr_patch, default='inactive') + + this%frootc_maturity_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='FROOTC_AT_MATURITY_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Fine root C at maturity for each harvest this year; should only be output annually', & + ptr_patch=this%frootc_maturity_thisyr_patch, default='inactive') + + this%livecrootc_emergence_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LIVECROOTC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Live coarse root C at emergence for each harvest this year; should only be output annually', & + ptr_patch=this%livecrootc_emergence_thisyr_patch, default='inactive') + + this%livecrootc_anthesis_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LIVECROOTC_AT_ANTHESIS_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Live coarse root C at anthesis for each harvest this year; should only be output annually', & + ptr_patch=this%livecrootc_anthesis_thisyr_patch, default='inactive') + + this%livecrootc_maturity_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LIVECROOTC_AT_MATURITY_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Live coarse root C at maturity for each harvest this year; should only be output annually', & + ptr_patch=this%livecrootc_maturity_thisyr_patch, default='inactive') + + this%livestemc_emergence_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LIVESTEMC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Live stem C at emergence for each harvest this year; should only be output annually', & + ptr_patch=this%livestemc_emergence_thisyr_patch, default='inactive') + + this%livestemc_anthesis_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LIVESTEMC_AT_ANTHESIS_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Live stem C at anthesis for each harvest this year; should only be output annually', & + ptr_patch=this%livestemc_anthesis_thisyr_patch, default='inactive') + + this%livestemc_maturity_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LIVESTEMC_AT_MATURITY_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Live stem C at maturity for each harvest this year; should only be output annually', & + ptr_patch=this%livestemc_maturity_thisyr_patch, default='inactive') + + this%leafc_emergence_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LEAFC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Leaf C at emergence for each harvest this year; should only be output annually', & + ptr_patch=this%leafc_emergence_thisyr_patch, default='inactive') + + this%leafc_anthesis_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LEAFC_AT_ANTHESIS_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Leaf C at anthesis for each harvest this year; should only be output annually', & + ptr_patch=this%leafc_anthesis_thisyr_patch, default='inactive') + + this%leafc_maturity_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LEAFC_AT_MATURITY_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Leaf C at maturity for each harvest this year; should only be output annually', & + ptr_patch=this%leafc_maturity_thisyr_patch, default='inactive') + + this%grainc_emergence_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='GRAINC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Grain C at emergence for each harvest this year; should only be output annually', & + ptr_patch=this%grainc_emergence_thisyr_patch, default='inactive') + + this%grainc_anthesis_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='GRAINC_AT_ANTHESIS_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Grain C at anthesis for each harvest this year; should only be output annually', & + ptr_patch=this%grainc_anthesis_thisyr_patch, default='inactive') + + this%grainc_maturity_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='GRAINC_AT_MATURITY_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Grain C at maturity for each harvest this year; should only be output annually', & + ptr_patch=this%grainc_maturity_thisyr_patch, default='inactive') + this%sowing_reason_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='SOWING_REASON', units='unitless', type2d='mxsowings', & avgflag='I', long_name='Reason for each crop sowing; should only be output annually', & @@ -656,6 +795,53 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) dim1name='pft', long_name='maximum total projected leaf area seen this season', units='m^2/m^2', & interpinic_flag='interp', readvar=readvar, data=this%max_tlai_patch) + ! Crop phase transition biomass sizes + call restartvar(ncid=ncid, flag=flag, varname='frootc_emergence_patch', xtype=ncd_double, & + dim1name='pft', long_name='Fine root C at emergence for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%frootc_emergence_patch) + call restartvar(ncid=ncid, flag=flag, varname='livecrootc_emergence_patch', xtype=ncd_double, & + dim1name='pft', long_name='Live coarse root C at emergence for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%livecrootc_emergence_patch) + call restartvar(ncid=ncid, flag=flag, varname='livestemc_emergence_patch', xtype=ncd_double, & + dim1name='pft', long_name='Live stem C at emergence for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%livestemc_emergence_patch) + call restartvar(ncid=ncid, flag=flag, varname='leafc_emergence_patch', xtype=ncd_double, & + dim1name='pft', long_name='Leaf C at emergence for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%leafc_emergence_patch) + call restartvar(ncid=ncid, flag=flag, varname='grainc_emergence_patch', xtype=ncd_double, & + dim1name='pft', long_name='Grain C at emergence for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%grainc_emergence_patch) + call restartvar(ncid=ncid, flag=flag, varname='frootc_anthesis_patch', xtype=ncd_double, & + dim1name='pft', long_name='Fine root C at anthesis for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%frootc_anthesis_patch) + call restartvar(ncid=ncid, flag=flag, varname='livecrootc_anthesis_patch', xtype=ncd_double, & + dim1name='pft', long_name='Live coarse root C at anthesis for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%livecrootc_anthesis_patch) + call restartvar(ncid=ncid, flag=flag, varname='livestemc_anthesis_patch', xtype=ncd_double, & + dim1name='pft', long_name='Live stem C at anthesis for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%livestemc_anthesis_patch) + call restartvar(ncid=ncid, flag=flag, varname='leafc_anthesis_patch', xtype=ncd_double, & + dim1name='pft', long_name='Leaf C at anthesis for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%leafc_anthesis_patch) + call restartvar(ncid=ncid, flag=flag, varname='grainc_anthesis_patch', xtype=ncd_double, & + dim1name='pft', long_name='Grain C at anthesis for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%grainc_anthesis_patch) + call restartvar(ncid=ncid, flag=flag, varname='frootc_maturity_patch', xtype=ncd_double, & + dim1name='pft', long_name='Fine root C at maturity for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%frootc_maturity_patch) + call restartvar(ncid=ncid, flag=flag, varname='livecrootc_maturity_patch', xtype=ncd_double, & + dim1name='pft', long_name='Live coarse root C at maturity for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%livecrootc_maturity_patch) + call restartvar(ncid=ncid, flag=flag, varname='livestemc_maturity_patch', xtype=ncd_double, & + dim1name='pft', long_name='Live stem C at maturity for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%livestemc_maturity_patch) + call restartvar(ncid=ncid, flag=flag, varname='leafc_maturity_patch', xtype=ncd_double, & + dim1name='pft', long_name='Leaf C at maturity for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%leafc_maturity_patch) + call restartvar(ncid=ncid, flag=flag, varname='grainc_maturity_patch', xtype=ncd_double, & + dim1name='pft', long_name='Grain C at maturity for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%grainc_maturity_patch) + call restartvar(ncid=ncid, flag=flag, varname='cphase',xtype=ncd_double, & dim1name='pft', long_name='crop phenology phase', & units='0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest', & @@ -754,6 +940,83 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) scale_by_thickness=.false., & interpinic_flag='interp', readvar=readvar, data=this%harvest_reason_thisyr_patch) + ! Crop phase transition biomass sizes + call restartvar(ncid=ncid, flag=flag, varname='frootc_emergence_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Fine root C at emergence for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%frootc_emergence_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='livecrootc_emergence_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Live coarse root C at emergence for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%livecrootc_emergence_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='livestemc_emergence_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Live stem C at emergence for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%livestemc_emergence_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='leafc_emergence_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Leaf C at emergence for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%leafc_emergence_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='grainc_emergence_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Grain C at emergence for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%grainc_emergence_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='frootc_anthesis_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Fine root C at anthesis for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%frootc_anthesis_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='livecrootc_anthesis_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Live coarse root C at anthesis for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%livecrootc_anthesis_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='livestemc_anthesis_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Live stem C at anthesis for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%livestemc_anthesis_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='leafc_anthesis_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Leaf C at anthesis for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%leafc_anthesis_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='grainc_anthesis_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Grain C at anthesis for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%grainc_anthesis_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='frootc_maturity_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Fine root C at maturity for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%frootc_maturity_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='livecrootc_maturity_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Live coarse root C at maturity for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%livecrootc_maturity_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='livestemc_maturity_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Live stem C at maturity for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%livestemc_maturity_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='leafc_maturity_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Leaf C at maturity for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%leafc_maturity_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='grainc_maturity_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Grain C at maturity for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%grainc_maturity_thisyr_patch) + ! Fill variable(s) derived from read-in variable(s) if (flag == 'read') then jday = get_curr_calday() @@ -958,6 +1221,55 @@ subroutine CropIncrementYear (this, num_pcropp, filter_pcropp) end subroutine CropIncrementYear + !----------------------------------------------------------------------- + subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, cnveg_carbonflux_inst) + ! + ! !DESCRIPTION: + ! Update crop-phase-transition biomass history outputs for a patch. Should only be called AT + ! the phase transition---i.e., immediately after cphase is changed. + ! + ! !USES: + use CNVegCarbonStateType, only : cnveg_carbonstate_type + use CNVegCarbonFluxType, only : cnveg_carbonflux_type + ! + ! !ARGUMENTS: + class(crop_type) :: this + integer , intent(in) :: p ! Patch index + type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst + type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst + ! + ! !LOCALS: + real(r8) :: frootc, livecrootc, livestemc, leafc, grainc + + frootc = cnveg_carbonstate_inst%frootc_patch(p) + livecrootc = cnveg_carbonstate_inst%livecrootc_patch(p) + livestemc = cnveg_carbonstate_inst%livestemc_patch(p) + leafc = cnveg_carbonstate_inst%leafc_patch(p) + ! sum over all grain tisues and destinations + grainc = sum(cnveg_carbonflux_inst%repr_grainc_to_food_patch(p,:) + cnveg_carbonflux_inst%repr_grainc_to_seed_patch(p,:)) + + if (this%cphase_patch(p) == cphase_leafemerge) then + this%frootc_emergence_patch(p) = frootc + this%livecrootc_emergence_patch(p) = livecrootc + this%livestemc_emergence_patch(p) = livestemc + this%leafc_emergence_patch(p) = leafc + this%grainc_emergence_patch(p) = grainc + else if (this%cphase_patch(p) == cphase_grainfill) then + this%frootc_anthesis_patch(p) = frootc + this%livecrootc_anthesis_patch(p) = livecrootc + this%livestemc_anthesis_patch(p) = livestemc + this%leafc_anthesis_patch(p) = leafc + this%grainc_anthesis_patch(p) = grainc + else if (this%cphase_patch(p) == cphase_harvest) then + this%frootc_maturity_patch(p) = frootc + this%livecrootc_maturity_patch(p) = livecrootc + this%livestemc_maturity_patch(p) = livestemc + this%leafc_maturity_patch(p) = leafc + this%grainc_maturity_patch(p) = grainc + end if + + end subroutine CropPhaseTransitionBiomass + !----------------------------------------------------------------------- subroutine checkDates( ) ! From 291a15866d2ae1243c0b790d65210859466cb4b7 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 26 Nov 2025 07:27:46 -0700 Subject: [PATCH 05/57] Rename GRAINC_AT hist vars to HARVORGANC_AT to fix LREPRSTRUCT tests. --- .../testdefs/testmods_dirs/clm/crop/user_nl_clm | 2 +- src/biogeochem/CropType.F90 | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm index 3a20434caf..483c0dd90c 100644 --- a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm @@ -18,7 +18,7 @@ hist_fincl3 += 'FROOTC_AT_EMERGENCE_PERHARV', 'FROOTC_AT_ANTHESIS_PERHARV', 'FRO hist_fincl3 += 'LIVECROOTC_AT_EMERGENCE_PERHARV', 'LIVECROOTC_AT_ANTHESIS_PERHARV', 'LIVECROOTC_AT_MATURITY_PERHARV' hist_fincl3 += 'LIVESTEMC_AT_EMERGENCE_PERHARV', 'LIVESTEMC_AT_ANTHESIS_PERHARV', 'LIVESTEMC_AT_MATURITY_PERHARV' hist_fincl3 += 'LEAFC_AT_EMERGENCE_PERHARV', 'LEAFC_AT_ANTHESIS_PERHARV', 'LEAFC_AT_MATURITY_PERHARV' -hist_fincl3 += 'GRAINC_AT_EMERGENCE_PERHARV', 'GRAINC_AT_ANTHESIS_PERHARV', 'GRAINC_AT_MATURITY_PERHARV' +hist_fincl3 += 'HARVORGANC_AT_EMERGENCE_PERHARV', 'HARVORGANC_AT_ANTHESIS_PERHARV', 'HARVORGANC_AT_MATURITY_PERHARV' hist_nhtfrq = -24,-8,-24 hist_mfilt = 1,1,1 hist_type1d_pertape(3) = 'PFTS' diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 85d8dc0fcd..d6ad967bc9 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -481,18 +481,18 @@ subroutine InitHistory(this, bounds) ptr_patch=this%leafc_maturity_thisyr_patch, default='inactive') this%grainc_emergence_thisyr_patch(begp:endp,:) = spval - call hist_addfld2d (fname='GRAINC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & - avgflag='I', long_name='Grain C at emergence for each harvest this year; should only be output annually', & + call hist_addfld2d (fname='HARVORGANC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Harvestable organ (grain) C at emergence for each harvest this year; should only be output annually', & ptr_patch=this%grainc_emergence_thisyr_patch, default='inactive') this%grainc_anthesis_thisyr_patch(begp:endp,:) = spval - call hist_addfld2d (fname='GRAINC_AT_ANTHESIS_PERHARV', units='gC/m^2', type2d='mxharvests', & - avgflag='I', long_name='Grain C at anthesis for each harvest this year; should only be output annually', & + call hist_addfld2d (fname='HARVORGANC_AT_ANTHESIS_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Harvestable organ (grain) C at anthesis for each harvest this year; should only be output annually', & ptr_patch=this%grainc_anthesis_thisyr_patch, default='inactive') this%grainc_maturity_thisyr_patch(begp:endp,:) = spval - call hist_addfld2d (fname='GRAINC_AT_MATURITY_PERHARV', units='gC/m^2', type2d='mxharvests', & - avgflag='I', long_name='Grain C at maturity for each harvest this year; should only be output annually', & + call hist_addfld2d (fname='HARVORGANC_AT_MATURITY_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Harvestable organ (grain) C at maturity for each harvest this year; should only be output annually', & ptr_patch=this%grainc_maturity_thisyr_patch, default='inactive') this%sowing_reason_thisyr_patch(begp:endp,:) = spval From 7c89b24dc72c89ba2837b9a7f7b1a94497e9cf07 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 1 Dec 2025 15:47:10 -0700 Subject: [PATCH 06/57] Rename HARVORGANC_AT history vars to REPRC_AT. --- .../testdefs/testmods_dirs/clm/crop/user_nl_clm | 2 +- src/biogeochem/CropType.F90 | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm index 483c0dd90c..1517a24e0f 100644 --- a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm @@ -18,7 +18,7 @@ hist_fincl3 += 'FROOTC_AT_EMERGENCE_PERHARV', 'FROOTC_AT_ANTHESIS_PERHARV', 'FRO hist_fincl3 += 'LIVECROOTC_AT_EMERGENCE_PERHARV', 'LIVECROOTC_AT_ANTHESIS_PERHARV', 'LIVECROOTC_AT_MATURITY_PERHARV' hist_fincl3 += 'LIVESTEMC_AT_EMERGENCE_PERHARV', 'LIVESTEMC_AT_ANTHESIS_PERHARV', 'LIVESTEMC_AT_MATURITY_PERHARV' hist_fincl3 += 'LEAFC_AT_EMERGENCE_PERHARV', 'LEAFC_AT_ANTHESIS_PERHARV', 'LEAFC_AT_MATURITY_PERHARV' -hist_fincl3 += 'HARVORGANC_AT_EMERGENCE_PERHARV', 'HARVORGANC_AT_ANTHESIS_PERHARV', 'HARVORGANC_AT_MATURITY_PERHARV' +hist_fincl3 += 'REPRC_AT_EMERGENCE_PERHARV', 'REPRC_AT_ANTHESIS_PERHARV', 'REPRC_AT_MATURITY_PERHARV' hist_nhtfrq = -24,-8,-24 hist_mfilt = 1,1,1 hist_type1d_pertape(3) = 'PFTS' diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index d6ad967bc9..71692c6a59 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -481,18 +481,18 @@ subroutine InitHistory(this, bounds) ptr_patch=this%leafc_maturity_thisyr_patch, default='inactive') this%grainc_emergence_thisyr_patch(begp:endp,:) = spval - call hist_addfld2d (fname='HARVORGANC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & - avgflag='I', long_name='Harvestable organ (grain) C at emergence for each harvest this year; should only be output annually', & + call hist_addfld2d (fname='REPRC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Reproductive C at emergence for each harvest this year; should only be output annually', & ptr_patch=this%grainc_emergence_thisyr_patch, default='inactive') this%grainc_anthesis_thisyr_patch(begp:endp,:) = spval - call hist_addfld2d (fname='HARVORGANC_AT_ANTHESIS_PERHARV', units='gC/m^2', type2d='mxharvests', & - avgflag='I', long_name='Harvestable organ (grain) C at anthesis for each harvest this year; should only be output annually', & + call hist_addfld2d (fname='REPRC_AT_ANTHESIS_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Reproductive C at anthesis for each harvest this year; should only be output annually', & ptr_patch=this%grainc_anthesis_thisyr_patch, default='inactive') this%grainc_maturity_thisyr_patch(begp:endp,:) = spval - call hist_addfld2d (fname='HARVORGANC_AT_MATURITY_PERHARV', units='gC/m^2', type2d='mxharvests', & - avgflag='I', long_name='Harvestable organ (grain) C at maturity for each harvest this year; should only be output annually', & + call hist_addfld2d (fname='REPRC_AT_MATURITY_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Reproductive C at maturity for each harvest this year; should only be output annually', & ptr_patch=this%grainc_maturity_thisyr_patch, default='inactive') this%sowing_reason_thisyr_patch(begp:endp,:) = spval From a263a922aed68d78649aa841215f3bc59e4c63cd Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 1 Dec 2025 15:51:11 -0700 Subject: [PATCH 07/57] Rename grainc_at vars to reprc_at. --- src/biogeochem/CNPhenologyMod.F90 | 18 +++---- src/biogeochem/CropType.F90 | 82 +++++++++++++++---------------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 70308a46af..922da09aee 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2199,9 +2199,9 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & crop_inst%leafc_emergence_thisyr_patch(p,s) = -1._r8 crop_inst%leafc_anthesis_thisyr_patch(p,s) = -1._r8 crop_inst%leafc_maturity_thisyr_patch(p,s) = -1._r8 - crop_inst%grainc_emergence_thisyr_patch(p,s) = -1._r8 - crop_inst%grainc_anthesis_thisyr_patch(p,s) = -1._r8 - crop_inst%grainc_maturity_thisyr_patch(p,s) = -1._r8 + crop_inst%reprc_emergence_thisyr_patch(p,s) = -1._r8 + crop_inst%reprc_anthesis_thisyr_patch(p,s) = -1._r8 + crop_inst%reprc_maturity_thisyr_patch(p,s) = -1._r8 crop_inst%sowing_reason_perharv_patch(p,s) = -1._r8 crop_inst%harvest_reason_thisyr_patch(p,s) = -1._r8 do k = repr_grain_min, repr_grain_max @@ -2589,9 +2589,9 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & crop_inst%leafc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%leafc_emergence_patch(p) crop_inst%leafc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%leafc_anthesis_patch(p) crop_inst%leafc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%leafc_maturity_patch(p) - crop_inst%grainc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%grainc_emergence_patch(p) - crop_inst%grainc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%grainc_anthesis_patch(p) - crop_inst%grainc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%grainc_maturity_patch(p) + crop_inst%reprc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%reprc_emergence_patch(p) + crop_inst%reprc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%reprc_anthesis_patch(p) + crop_inst%reprc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%reprc_maturity_patch(p) endif croplive(p) = .false. ! no re-entry in greater if-block @@ -3018,9 +3018,9 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, & crop_inst%leafc_emergence_patch(p) = -1._r8 crop_inst%leafc_anthesis_patch(p) = -1._r8 crop_inst%leafc_maturity_patch(p) = -1._r8 - crop_inst%grainc_emergence_patch(p) = -1._r8 - crop_inst%grainc_anthesis_patch(p) = -1._r8 - crop_inst%grainc_maturity_patch(p) = -1._r8 + crop_inst%reprc_emergence_patch(p) = -1._r8 + crop_inst%reprc_anthesis_patch(p) = -1._r8 + crop_inst%reprc_maturity_patch(p) = -1._r8 end associate diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 71692c6a59..1657e5dfb3 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -84,9 +84,9 @@ module CropType real(r8), pointer :: leafc_emergence_patch (:) ! Leaf C at emergence for this patch this season (gC/m2) [patch] real(r8), pointer :: leafc_anthesis_patch (:) ! Leaf C at anthesis for this patch this season (gC/m2) [patch] real(r8), pointer :: leafc_maturity_patch (:) ! Leaf C at maturity for this patch this season (gC/m2) [patch] - real(r8), pointer :: grainc_emergence_patch (:) ! Grain C at emergence for this patch this season (gC/m2) [patch] - real(r8), pointer :: grainc_anthesis_patch (:) ! Grain C at anthesis for this patch this season (gC/m2) [patch] - real(r8), pointer :: grainc_maturity_patch (:) ! Grain C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: reprc_emergence_patch (:) ! Reproductive C at emergence for this patch this season (gC/m2) [patch] + real(r8), pointer :: reprc_anthesis_patch (:) ! Reproductive C at anthesis for this patch this season (gC/m2) [patch] + real(r8), pointer :: reprc_maturity_patch (:) ! Reproductive C at maturity for this patch this season (gC/m2) [patch] real(r8), pointer :: frootc_emergence_thisyr_patch (:,:) ! Fine root C at emergence for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: frootc_anthesis_thisyr_patch (:,:) ! Fine root C at anthesis for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: frootc_maturity_thisyr_patch (:,:) ! Fine root C at maturity for harvests in this patch this year (gC/m2) [patch] @@ -99,9 +99,9 @@ module CropType real(r8), pointer :: leafc_emergence_thisyr_patch (:,:) ! Leaf C at emergence for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: leafc_anthesis_thisyr_patch (:,:) ! Leaf C at anthesis for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: leafc_maturity_thisyr_patch (:,:) ! Leaf C at maturity for harvests in this patch this year (gC/m2) [patch] - real(r8), pointer :: grainc_emergence_thisyr_patch (:,:) ! Grain C at emergence for harvests in this patch this year (gC/m2) [patch] - real(r8), pointer :: grainc_anthesis_thisyr_patch (:,:) ! Grain C at anthesis for harvests in this patch this year (gC/m2) [patch] - real(r8), pointer :: grainc_maturity_thisyr_patch (:,:) ! Grain C at maturity for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: reprc_emergence_thisyr_patch (:,:) ! Reproductive C at emergence for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: reprc_anthesis_thisyr_patch (:,:) ! Reproductive C at anthesis for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: reprc_maturity_thisyr_patch (:,:) ! Reproductive C at maturity for harvests in this patch this year (gC/m2) [patch] ! gddaccum tracks the actual growing degree-days accumulated over the growing season. ! hui also accumulates growing degree-days, but can be boosted if full leafout is @@ -304,9 +304,9 @@ subroutine InitAllocate(this, bounds) allocate(this%leafc_emergence_patch(begp:endp)) ; this%leafc_emergence_patch(:) = spval allocate(this%leafc_anthesis_patch(begp:endp)) ; this%leafc_anthesis_patch(:) = spval allocate(this%leafc_maturity_patch(begp:endp)) ; this%leafc_maturity_patch(:) = spval - allocate(this%grainc_emergence_patch(begp:endp)) ; this%grainc_emergence_patch(:) = spval - allocate(this%grainc_anthesis_patch(begp:endp)) ; this%grainc_anthesis_patch(:) = spval - allocate(this%grainc_maturity_patch(begp:endp)) ; this%grainc_maturity_patch(:) = spval + allocate(this%reprc_emergence_patch(begp:endp)) ; this%reprc_emergence_patch(:) = spval + allocate(this%reprc_anthesis_patch(begp:endp)) ; this%reprc_anthesis_patch(:) = spval + allocate(this%reprc_maturity_patch(begp:endp)) ; this%reprc_maturity_patch(:) = spval allocate(this%frootc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%frootc_emergence_thisyr_patch(:,:) = spval allocate(this%frootc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%frootc_anthesis_thisyr_patch(:,:) = spval allocate(this%frootc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%frootc_maturity_thisyr_patch(:,:) = spval @@ -319,9 +319,9 @@ subroutine InitAllocate(this, bounds) allocate(this%leafc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%leafc_emergence_thisyr_patch(:,:) = spval allocate(this%leafc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%leafc_anthesis_thisyr_patch(:,:) = spval allocate(this%leafc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%leafc_maturity_thisyr_patch(:,:) = spval - allocate(this%grainc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%grainc_emergence_thisyr_patch(:,:) = spval - allocate(this%grainc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%grainc_anthesis_thisyr_patch(:,:) = spval - allocate(this%grainc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%grainc_maturity_thisyr_patch(:,:) = spval + allocate(this%reprc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%reprc_emergence_thisyr_patch(:,:) = spval + allocate(this%reprc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%reprc_anthesis_thisyr_patch(:,:) = spval + allocate(this%reprc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%reprc_maturity_thisyr_patch(:,:) = spval end subroutine InitAllocate @@ -480,20 +480,20 @@ subroutine InitHistory(this, bounds) avgflag='I', long_name='Leaf C at maturity for each harvest this year; should only be output annually', & ptr_patch=this%leafc_maturity_thisyr_patch, default='inactive') - this%grainc_emergence_thisyr_patch(begp:endp,:) = spval + this%reprc_emergence_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='REPRC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & avgflag='I', long_name='Reproductive C at emergence for each harvest this year; should only be output annually', & - ptr_patch=this%grainc_emergence_thisyr_patch, default='inactive') + ptr_patch=this%reprc_emergence_thisyr_patch, default='inactive') - this%grainc_anthesis_thisyr_patch(begp:endp,:) = spval + this%reprc_anthesis_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='REPRC_AT_ANTHESIS_PERHARV', units='gC/m^2', type2d='mxharvests', & avgflag='I', long_name='Reproductive C at anthesis for each harvest this year; should only be output annually', & - ptr_patch=this%grainc_anthesis_thisyr_patch, default='inactive') + ptr_patch=this%reprc_anthesis_thisyr_patch, default='inactive') - this%grainc_maturity_thisyr_patch(begp:endp,:) = spval + this%reprc_maturity_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='REPRC_AT_MATURITY_PERHARV', units='gC/m^2', type2d='mxharvests', & avgflag='I', long_name='Reproductive C at maturity for each harvest this year; should only be output annually', & - ptr_patch=this%grainc_maturity_thisyr_patch, default='inactive') + ptr_patch=this%reprc_maturity_thisyr_patch, default='inactive') this%sowing_reason_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='SOWING_REASON', units='unitless', type2d='mxsowings', & @@ -808,9 +808,9 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) call restartvar(ncid=ncid, flag=flag, varname='leafc_emergence_patch', xtype=ncd_double, & dim1name='pft', long_name='Leaf C at emergence for this patch this season', units='unitless', & interpinic_flag='interp', readvar=readvar, data=this%leafc_emergence_patch) - call restartvar(ncid=ncid, flag=flag, varname='grainc_emergence_patch', xtype=ncd_double, & - dim1name='pft', long_name='Grain C at emergence for this patch this season', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_emergence_patch) + call restartvar(ncid=ncid, flag=flag, varname='reprc_emergence_patch', xtype=ncd_double, & + dim1name='pft', long_name='Reproductive C at emergence for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%reprc_emergence_patch) call restartvar(ncid=ncid, flag=flag, varname='frootc_anthesis_patch', xtype=ncd_double, & dim1name='pft', long_name='Fine root C at anthesis for this patch this season', units='unitless', & interpinic_flag='interp', readvar=readvar, data=this%frootc_anthesis_patch) @@ -823,9 +823,9 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) call restartvar(ncid=ncid, flag=flag, varname='leafc_anthesis_patch', xtype=ncd_double, & dim1name='pft', long_name='Leaf C at anthesis for this patch this season', units='unitless', & interpinic_flag='interp', readvar=readvar, data=this%leafc_anthesis_patch) - call restartvar(ncid=ncid, flag=flag, varname='grainc_anthesis_patch', xtype=ncd_double, & - dim1name='pft', long_name='Grain C at anthesis for this patch this season', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_anthesis_patch) + call restartvar(ncid=ncid, flag=flag, varname='reprc_anthesis_patch', xtype=ncd_double, & + dim1name='pft', long_name='Reproductive C at anthesis for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%reprc_anthesis_patch) call restartvar(ncid=ncid, flag=flag, varname='frootc_maturity_patch', xtype=ncd_double, & dim1name='pft', long_name='Fine root C at maturity for this patch this season', units='unitless', & interpinic_flag='interp', readvar=readvar, data=this%frootc_maturity_patch) @@ -838,9 +838,9 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) call restartvar(ncid=ncid, flag=flag, varname='leafc_maturity_patch', xtype=ncd_double, & dim1name='pft', long_name='Leaf C at maturity for this patch this season', units='unitless', & interpinic_flag='interp', readvar=readvar, data=this%leafc_maturity_patch) - call restartvar(ncid=ncid, flag=flag, varname='grainc_maturity_patch', xtype=ncd_double, & - dim1name='pft', long_name='Grain C at maturity for this patch this season', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_maturity_patch) + call restartvar(ncid=ncid, flag=flag, varname='reprc_maturity_patch', xtype=ncd_double, & + dim1name='pft', long_name='Reproductive C at maturity for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%reprc_maturity_patch) call restartvar(ncid=ncid, flag=flag, varname='cphase',xtype=ncd_double, & dim1name='pft', long_name='crop phenology phase', & @@ -961,11 +961,11 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) long_name='Leaf C at emergence for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & interpinic_flag='interp', readvar=readvar, data=this%leafc_emergence_thisyr_patch) - call restartvar(ncid=ncid, flag=flag, varname='grainc_emergence_thisyr_patch', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='reprc_emergence_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxharvests', switchdim=.true., & - long_name='Grain C at emergence for harvests in this patch this year', units='unitless', & + long_name='Reproductive C at emergence for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & - interpinic_flag='interp', readvar=readvar, data=this%grainc_emergence_thisyr_patch) + interpinic_flag='interp', readvar=readvar, data=this%reprc_emergence_thisyr_patch) call restartvar(ncid=ncid, flag=flag, varname='frootc_anthesis_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxharvests', switchdim=.true., & long_name='Fine root C at anthesis for harvests in this patch this year', units='unitless', & @@ -986,11 +986,11 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) long_name='Leaf C at anthesis for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & interpinic_flag='interp', readvar=readvar, data=this%leafc_anthesis_thisyr_patch) - call restartvar(ncid=ncid, flag=flag, varname='grainc_anthesis_thisyr_patch', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='reprc_anthesis_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxharvests', switchdim=.true., & - long_name='Grain C at anthesis for harvests in this patch this year', units='unitless', & + long_name='Reproductive C at anthesis for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & - interpinic_flag='interp', readvar=readvar, data=this%grainc_anthesis_thisyr_patch) + interpinic_flag='interp', readvar=readvar, data=this%reprc_anthesis_thisyr_patch) call restartvar(ncid=ncid, flag=flag, varname='frootc_maturity_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxharvests', switchdim=.true., & long_name='Fine root C at maturity for harvests in this patch this year', units='unitless', & @@ -1011,11 +1011,11 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) long_name='Leaf C at maturity for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & interpinic_flag='interp', readvar=readvar, data=this%leafc_maturity_thisyr_patch) - call restartvar(ncid=ncid, flag=flag, varname='grainc_maturity_thisyr_patch', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='reprc_maturity_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxharvests', switchdim=.true., & - long_name='Grain C at maturity for harvests in this patch this year', units='unitless', & + long_name='Reproductive C at maturity for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & - interpinic_flag='interp', readvar=readvar, data=this%grainc_maturity_thisyr_patch) + interpinic_flag='interp', readvar=readvar, data=this%reprc_maturity_thisyr_patch) ! Fill variable(s) derived from read-in variable(s) if (flag == 'read') then @@ -1239,33 +1239,33 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, cnveg_ca type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst ! ! !LOCALS: - real(r8) :: frootc, livecrootc, livestemc, leafc, grainc + real(r8) :: frootc, livecrootc, livestemc, leafc, reprc frootc = cnveg_carbonstate_inst%frootc_patch(p) livecrootc = cnveg_carbonstate_inst%livecrootc_patch(p) livestemc = cnveg_carbonstate_inst%livestemc_patch(p) leafc = cnveg_carbonstate_inst%leafc_patch(p) ! sum over all grain tisues and destinations - grainc = sum(cnveg_carbonflux_inst%repr_grainc_to_food_patch(p,:) + cnveg_carbonflux_inst%repr_grainc_to_seed_patch(p,:)) + reprc = sum(cnveg_carbonflux_inst%repr_grainc_to_food_patch(p,:) + cnveg_carbonflux_inst%repr_grainc_to_seed_patch(p,:)) if (this%cphase_patch(p) == cphase_leafemerge) then this%frootc_emergence_patch(p) = frootc this%livecrootc_emergence_patch(p) = livecrootc this%livestemc_emergence_patch(p) = livestemc this%leafc_emergence_patch(p) = leafc - this%grainc_emergence_patch(p) = grainc + this%reprc_emergence_patch(p) = reprc else if (this%cphase_patch(p) == cphase_grainfill) then this%frootc_anthesis_patch(p) = frootc this%livecrootc_anthesis_patch(p) = livecrootc this%livestemc_anthesis_patch(p) = livestemc this%leafc_anthesis_patch(p) = leafc - this%grainc_anthesis_patch(p) = grainc + this%reprc_anthesis_patch(p) = reprc else if (this%cphase_patch(p) == cphase_harvest) then this%frootc_maturity_patch(p) = frootc this%livecrootc_maturity_patch(p) = livecrootc this%livestemc_maturity_patch(p) = livestemc this%leafc_maturity_patch(p) = leafc - this%grainc_maturity_patch(p) = grainc + this%reprc_maturity_patch(p) = reprc end if end subroutine CropPhaseTransitionBiomass From 319be7642240465e9ca9ddd518d7fc80a3b06a0d Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 1 Dec 2025 16:07:02 -0700 Subject: [PATCH 08/57] CropPhaseTransitionBiomass() bugfix for reproductive C. Was using repr_grainc_to_food_patch + repr_grainc_to_seed_patch, but those don't get updated until after the harvest in CropPhenology, which is where the last CropPhaseTransitionBiomass() is called. They also, obviously, only include grain. Now using reproductivec_patch. --- src/biogeochem/CNPhenologyMod.F90 | 6 +++--- src/biogeochem/CropType.F90 | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 922da09aee..330ff59b48 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2530,7 +2530,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & if ((.not. do_harvest) .and. leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p) .and. idpp < mxmat) then cphase(p) = cphase_leafemerge if (cphase(p) /= cphase_orig) then - call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst, cnveg_carbonflux_inst) + call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst) end if if (abs(onset_counter(p)) > 1.e-6_r8) then onset_flag(p) = 1._r8 @@ -2558,7 +2558,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & else if (do_harvest) then cphase(p) = cphase_harvest - call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst, cnveg_carbonflux_inst) + call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst) ! Don't update these if you're just harvesting because of incorrect Dec. ! 31 planting @@ -2626,7 +2626,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & else if (hui(p) >= huigrain(p)) then cphase(p) = cphase_grainfill if (cphase(p) /= cphase_orig) then - call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst, cnveg_carbonflux_inst) + call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst) end if bglfr(p) = 1._r8/(leaf_long(ivt(p))*avg_dayspyr*secspday) end if diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 1657e5dfb3..107117874e 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -1222,7 +1222,7 @@ subroutine CropIncrementYear (this, num_pcropp, filter_pcropp) end subroutine CropIncrementYear !----------------------------------------------------------------------- - subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, cnveg_carbonflux_inst) + subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst) ! ! !DESCRIPTION: ! Update crop-phase-transition biomass history outputs for a patch. Should only be called AT @@ -1236,7 +1236,6 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, cnveg_ca class(crop_type) :: this integer , intent(in) :: p ! Patch index type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst ! ! !LOCALS: real(r8) :: frootc, livecrootc, livestemc, leafc, reprc @@ -1246,7 +1245,7 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, cnveg_ca livestemc = cnveg_carbonstate_inst%livestemc_patch(p) leafc = cnveg_carbonstate_inst%leafc_patch(p) ! sum over all grain tisues and destinations - reprc = sum(cnveg_carbonflux_inst%repr_grainc_to_food_patch(p,:) + cnveg_carbonflux_inst%repr_grainc_to_seed_patch(p,:)) + reprc = sum(cnveg_carbonstate_inst%reproductivec_patch(p,:)) if (this%cphase_patch(p) == cphase_leafemerge) then this%frootc_emergence_patch(p) = frootc From a7e66aae6e80afc6730f2baceff6c0f1b4bfe0f2 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 8 Jan 2026 14:20:47 -0700 Subject: [PATCH 09/57] PlantCrop: Fix setting max_tlai_patch. --- src/biogeochem/CNPhenologyMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 330ff59b48..ec0a4505ce 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -3005,7 +3005,7 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, & end do ! Initialize other stuff - max_tlai = 0._r8 + max_tlai(p) = 0._r8 crop_inst%frootc_emergence_patch(p) = -1._r8 crop_inst%frootc_anthesis_patch(p) = -1._r8 crop_inst%frootc_maturity_patch(p) = -1._r8 From eb3237aac8ef0a67cdae36b43a7a36a36ebf2b67 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 9 Jan 2026 15:42:59 -0700 Subject: [PATCH 10/57] CropPhenology(): New variable is_mature. --- src/biogeochem/CNPhenologyMod.F90 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index ec0a4505ce..0b426a8d94 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2072,6 +2072,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & logical fake_harvest ! Dealing with incorrect Dec. 31 planting logical did_plant_prescribed_today ! Was the crop sown today? logical vernalization_forces_harvest ! Was the crop killed by freezing during vernalization? + logical is_mature ! Has the crop reached maturity? !------------------------------------------------------------------------ associate( & @@ -2466,6 +2467,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & mxmat = 999 end if + is_mature = .false. if (jday == 1 .and. croplive(p) .and. idop(p) == 1 .and. sowing_count(p) == 0) then ! BACKWARDS_COMPATIBILITY(ssr, 2022-02-03): To get rid of crops incorrectly planted in last time step of Dec. 31. That was fixed in commit dadbc62 ("Call CropPhenology regardless of doalb"), but this handles restart files with the old behavior. fake_harvest ensures that outputs aren't polluted. do_harvest = .true. @@ -2504,7 +2506,8 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & harvest_reason = HARVEST_REASON_VERNFREEZEKILL else ! Original harvest rule - do_harvest = hui(p) >= gddmaturity(p) .or. idpp >= mxmat + is_mature = hui(p) >= gddmaturity(p) + do_harvest = is_mature .or. idpp >= mxmat ! Always harvest the day before the next prescribed sowing date, if still alive. ! WARNING: This implementation assumes that prescribed sowing dates don't change over time! @@ -2512,7 +2515,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ! sowing dates. do_harvest = do_harvest .or. do_plant_prescribed_tomorrow - if (hui(p) >= gddmaturity(p)) then + if (is_mature) then harvest_reason = HARVEST_REASON_MATURE else if (idpp >= mxmat) then harvest_reason = HARVEST_REASON_MAXSEASLENGTH From 533383fba70d8ba226cd0c4018c58b2dfd3e544f Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 9 Jan 2026 15:31:45 -0700 Subject: [PATCH 11/57] Only save crop maturity biomass if mature. Always save new harvest biomass. --- .../testmods_dirs/clm/crop/user_nl_clm | 10 +- src/biogeochem/CNPhenologyMod.F90 | 17 ++- src/biogeochem/CropType.F90 | 112 +++++++++++++++++- 3 files changed, 127 insertions(+), 12 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm index 1517a24e0f..121af981a5 100644 --- a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm @@ -14,11 +14,11 @@ hist_fincl2 += 'DYN_COL_SOIL_ADJUSTMENTS_C' ! That's needed for the mxsowings and mxharvests axes to make sense. ! However, for testing purposes, it makes sense to save more frequently. hist_fincl3 = 'SDATES', 'SDATES_PERHARV', 'SYEARS_PERHARV', 'HDATES', 'GRAINC_TO_FOOD_PERHARV', 'GRAINC_TO_FOOD_ANN', 'GRAINN_TO_FOOD_PERHARV', 'GRAINN_TO_FOOD_ANN', 'GRAINC_TO_SEED_PERHARV', 'GRAINC_TO_SEED_ANN', 'GRAINN_TO_SEED_PERHARV', 'GRAINN_TO_SEED_ANN', 'HDATES', 'GDDHARV_PERHARV', 'GDDACCUM_PERHARV', 'HUI_PERHARV', 'SOWING_REASON_PERHARV', 'HARVEST_REASON_PERHARV', 'SWINDOW_STARTS', 'SWINDOW_ENDS', 'GDD20_BASELINE', 'GDD20_SEASON_START', 'GDD20_SEASON_END', 'MAX_TLAI_PERHARV' -hist_fincl3 += 'FROOTC_AT_EMERGENCE_PERHARV', 'FROOTC_AT_ANTHESIS_PERHARV', 'FROOTC_AT_MATURITY_PERHARV' -hist_fincl3 += 'LIVECROOTC_AT_EMERGENCE_PERHARV', 'LIVECROOTC_AT_ANTHESIS_PERHARV', 'LIVECROOTC_AT_MATURITY_PERHARV' -hist_fincl3 += 'LIVESTEMC_AT_EMERGENCE_PERHARV', 'LIVESTEMC_AT_ANTHESIS_PERHARV', 'LIVESTEMC_AT_MATURITY_PERHARV' -hist_fincl3 += 'LEAFC_AT_EMERGENCE_PERHARV', 'LEAFC_AT_ANTHESIS_PERHARV', 'LEAFC_AT_MATURITY_PERHARV' -hist_fincl3 += 'REPRC_AT_EMERGENCE_PERHARV', 'REPRC_AT_ANTHESIS_PERHARV', 'REPRC_AT_MATURITY_PERHARV' +hist_fincl3 += 'FROOTC_AT_EMERGENCE_PERHARV', 'FROOTC_AT_ANTHESIS_PERHARV', 'FROOTC_AT_MATURITY_PERHARV', 'FROOTC_AT_HARVEST_PERHARV' +hist_fincl3 += 'LIVECROOTC_AT_EMERGENCE_PERHARV', 'LIVECROOTC_AT_ANTHESIS_PERHARV', 'LIVECROOTC_AT_MATURITY_PERHARV', 'LIVECROOTC_AT_HARVEST_PERHARV' +hist_fincl3 += 'LIVESTEMC_AT_EMERGENCE_PERHARV', 'LIVESTEMC_AT_ANTHESIS_PERHARV', 'LIVESTEMC_AT_MATURITY_PERHARV', 'LIVESTEMC_AT_HARVEST_PERHARV' +hist_fincl3 += 'LEAFC_AT_EMERGENCE_PERHARV', 'LEAFC_AT_ANTHESIS_PERHARV', 'LEAFC_AT_MATURITY_PERHARV', 'LEAFC_AT_HARVEST_PERHARV' +hist_fincl3 += 'REPRC_AT_EMERGENCE_PERHARV', 'REPRC_AT_ANTHESIS_PERHARV', 'REPRC_AT_MATURITY_PERHARV', 'REPRC_AT_HARVEST_PERHARV' hist_nhtfrq = -24,-8,-24 hist_mfilt = 1,1,1 hist_type1d_pertape(3) = 'PFTS' diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 0b426a8d94..6fba35fe2c 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2191,18 +2191,23 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & crop_inst%frootc_emergence_thisyr_patch(p,s) = -1._r8 crop_inst%frootc_anthesis_thisyr_patch(p,s) = -1._r8 crop_inst%frootc_maturity_thisyr_patch(p,s) = -1._r8 + crop_inst%frootc_harvest_thisyr_patch(p,s) = -1._r8 crop_inst%livecrootc_emergence_thisyr_patch(p,s) = -1._r8 crop_inst%livecrootc_anthesis_thisyr_patch(p,s) = -1._r8 crop_inst%livecrootc_maturity_thisyr_patch(p,s) = -1._r8 + crop_inst%livecrootc_harvest_thisyr_patch(p,s) = -1._r8 crop_inst%livestemc_emergence_thisyr_patch(p,s) = -1._r8 crop_inst%livestemc_anthesis_thisyr_patch(p,s) = -1._r8 crop_inst%livestemc_maturity_thisyr_patch(p,s) = -1._r8 + crop_inst%livestemc_harvest_thisyr_patch(p,s) = -1._r8 crop_inst%leafc_emergence_thisyr_patch(p,s) = -1._r8 crop_inst%leafc_anthesis_thisyr_patch(p,s) = -1._r8 crop_inst%leafc_maturity_thisyr_patch(p,s) = -1._r8 + crop_inst%leafc_harvest_thisyr_patch(p,s) = -1._r8 crop_inst%reprc_emergence_thisyr_patch(p,s) = -1._r8 crop_inst%reprc_anthesis_thisyr_patch(p,s) = -1._r8 crop_inst%reprc_maturity_thisyr_patch(p,s) = -1._r8 + crop_inst%reprc_harvest_thisyr_patch(p,s) = -1._r8 crop_inst%sowing_reason_perharv_patch(p,s) = -1._r8 crop_inst%harvest_reason_thisyr_patch(p,s) = -1._r8 do k = repr_grain_min, repr_grain_max @@ -2561,7 +2566,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & else if (do_harvest) then cphase(p) = cphase_harvest - call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst) + call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst, is_mature) ! Don't update these if you're just harvesting because of incorrect Dec. ! 31 planting @@ -2583,18 +2588,23 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & crop_inst%frootc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%frootc_emergence_patch(p) crop_inst%frootc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%frootc_anthesis_patch(p) crop_inst%frootc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%frootc_maturity_patch(p) + crop_inst%frootc_harvest_thisyr_patch(p, harvest_count(p)) = crop_inst%frootc_harvest_patch(p) crop_inst%livecrootc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%livecrootc_emergence_patch(p) crop_inst%livecrootc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%livecrootc_anthesis_patch(p) crop_inst%livecrootc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%livecrootc_maturity_patch(p) + crop_inst%livecrootc_harvest_thisyr_patch(p, harvest_count(p)) = crop_inst%livecrootc_harvest_patch(p) crop_inst%livestemc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%livestemc_emergence_patch(p) crop_inst%livestemc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%livestemc_anthesis_patch(p) crop_inst%livestemc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%livestemc_maturity_patch(p) + crop_inst%livestemc_harvest_thisyr_patch(p, harvest_count(p)) = crop_inst%livestemc_harvest_patch(p) crop_inst%leafc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%leafc_emergence_patch(p) crop_inst%leafc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%leafc_anthesis_patch(p) crop_inst%leafc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%leafc_maturity_patch(p) + crop_inst%leafc_harvest_thisyr_patch(p, harvest_count(p)) = crop_inst%leafc_harvest_patch(p) crop_inst%reprc_emergence_thisyr_patch(p, harvest_count(p)) = crop_inst%reprc_emergence_patch(p) crop_inst%reprc_anthesis_thisyr_patch(p, harvest_count(p)) = crop_inst%reprc_anthesis_patch(p) crop_inst%reprc_maturity_thisyr_patch(p, harvest_count(p)) = crop_inst%reprc_maturity_patch(p) + crop_inst%reprc_harvest_thisyr_patch(p, harvest_count(p)) = crop_inst%reprc_harvest_patch(p) endif croplive(p) = .false. ! no re-entry in greater if-block @@ -3012,18 +3022,23 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, & crop_inst%frootc_emergence_patch(p) = -1._r8 crop_inst%frootc_anthesis_patch(p) = -1._r8 crop_inst%frootc_maturity_patch(p) = -1._r8 + crop_inst%frootc_harvest_patch(p) = -1._r8 crop_inst%livecrootc_emergence_patch(p) = -1._r8 crop_inst%livecrootc_anthesis_patch(p) = -1._r8 crop_inst%livecrootc_maturity_patch(p) = -1._r8 + crop_inst%livecrootc_harvest_patch(p) = -1._r8 crop_inst%livestemc_emergence_patch(p) = -1._r8 crop_inst%livestemc_anthesis_patch(p) = -1._r8 crop_inst%livestemc_maturity_patch(p) = -1._r8 + crop_inst%livestemc_harvest_patch(p) = -1._r8 crop_inst%leafc_emergence_patch(p) = -1._r8 crop_inst%leafc_anthesis_patch(p) = -1._r8 crop_inst%leafc_maturity_patch(p) = -1._r8 + crop_inst%leafc_harvest_patch(p) = -1._r8 crop_inst%reprc_emergence_patch(p) = -1._r8 crop_inst%reprc_anthesis_patch(p) = -1._r8 crop_inst%reprc_maturity_patch(p) = -1._r8 + crop_inst%reprc_harvest_patch(p) = -1._r8 end associate diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 107117874e..f6ff7309dc 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -75,33 +75,43 @@ module CropType real(r8), pointer :: frootc_emergence_patch (:) ! Fine root C at emergence for this patch this season (gC/m2) [patch] real(r8), pointer :: frootc_anthesis_patch (:) ! Fine root C at anthesis for this patch this season (gC/m2) [patch] real(r8), pointer :: frootc_maturity_patch (:) ! Fine root C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: frootc_harvest_patch (:) ! Fine root C at harvest for this patch this season (gC/m2) [patch] real(r8), pointer :: livecrootc_emergence_patch (:) ! Live coarse root C at emergence for this patch this season (gC/m2) [patch] real(r8), pointer :: livecrootc_anthesis_patch (:) ! Live coarse root C at anthesis for this patch this season (gC/m2) [patch] real(r8), pointer :: livecrootc_maturity_patch (:) ! Live coarse root C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: livecrootc_harvest_patch (:) ! Live coarse root C at harvest for this patch this season (gC/m2) [patch] real(r8), pointer :: livestemc_emergence_patch (:) ! Live stem C at emergence for this patch this season (gC/m2) [patch] real(r8), pointer :: livestemc_anthesis_patch (:) ! Live stem C at anthesis for this patch this season (gC/m2) [patch] real(r8), pointer :: livestemc_maturity_patch (:) ! Live stem C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: livestemc_harvest_patch (:) ! Live stem C at harvest for this patch this season (gC/m2) [patch] real(r8), pointer :: leafc_emergence_patch (:) ! Leaf C at emergence for this patch this season (gC/m2) [patch] real(r8), pointer :: leafc_anthesis_patch (:) ! Leaf C at anthesis for this patch this season (gC/m2) [patch] real(r8), pointer :: leafc_maturity_patch (:) ! Leaf C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: leafc_harvest_patch (:) ! Leaf C at harvest for this patch this season (gC/m2) [patch] real(r8), pointer :: reprc_emergence_patch (:) ! Reproductive C at emergence for this patch this season (gC/m2) [patch] real(r8), pointer :: reprc_anthesis_patch (:) ! Reproductive C at anthesis for this patch this season (gC/m2) [patch] real(r8), pointer :: reprc_maturity_patch (:) ! Reproductive C at maturity for this patch this season (gC/m2) [patch] + real(r8), pointer :: reprc_harvest_patch (:) ! Reproductive C at harvest for this patch this season (gC/m2) [patch] real(r8), pointer :: frootc_emergence_thisyr_patch (:,:) ! Fine root C at emergence for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: frootc_anthesis_thisyr_patch (:,:) ! Fine root C at anthesis for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: frootc_maturity_thisyr_patch (:,:) ! Fine root C at maturity for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: frootc_harvest_thisyr_patch (:,:) ! Fine root C at harvest for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: livecrootc_emergence_thisyr_patch (:,:) ! Live coarse root C at emergence for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: livecrootc_anthesis_thisyr_patch (:,:) ! Live coarse root C at anthesis for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: livecrootc_maturity_thisyr_patch (:,:) ! Live coarse root C at maturity for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: livecrootc_harvest_thisyr_patch (:,:) ! Live coarse root C at harvest for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: livestemc_emergence_thisyr_patch (:,:) ! Live stem C at emergence for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: livestemc_anthesis_thisyr_patch (:,:) ! Live stem C at anthesis for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: livestemc_maturity_thisyr_patch (:,:) ! Live stem C at maturity for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: livestemc_harvest_thisyr_patch (:,:) ! Live stem C at harvest for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: leafc_emergence_thisyr_patch (:,:) ! Leaf C at emergence for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: leafc_anthesis_thisyr_patch (:,:) ! Leaf C at anthesis for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: leafc_maturity_thisyr_patch (:,:) ! Leaf C at maturity for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: leafc_harvest_thisyr_patch (:,:) ! Leaf C at harvest for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: reprc_emergence_thisyr_patch (:,:) ! Reproductive C at emergence for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: reprc_anthesis_thisyr_patch (:,:) ! Reproductive C at anthesis for harvests in this patch this year (gC/m2) [patch] real(r8), pointer :: reprc_maturity_thisyr_patch (:,:) ! Reproductive C at maturity for harvests in this patch this year (gC/m2) [patch] + real(r8), pointer :: reprc_harvest_thisyr_patch (:,:) ! Reproductive C at harvest for harvests in this patch this year (gC/m2) [patch] ! gddaccum tracks the actual growing degree-days accumulated over the growing season. ! hui also accumulates growing degree-days, but can be boosted if full leafout is @@ -295,33 +305,43 @@ subroutine InitAllocate(this, bounds) allocate(this%frootc_emergence_patch(begp:endp)) ; this%frootc_emergence_patch(:) = spval allocate(this%frootc_anthesis_patch(begp:endp)) ; this%frootc_anthesis_patch(:) = spval allocate(this%frootc_maturity_patch(begp:endp)) ; this%frootc_maturity_patch(:) = spval + allocate(this%frootc_harvest_patch(begp:endp)) ; this%frootc_harvest_patch(:) = spval allocate(this%livecrootc_emergence_patch(begp:endp)) ; this%livecrootc_emergence_patch(:) = spval allocate(this%livecrootc_anthesis_patch(begp:endp)) ; this%livecrootc_anthesis_patch(:) = spval allocate(this%livecrootc_maturity_patch(begp:endp)) ; this%livecrootc_maturity_patch(:) = spval + allocate(this%livecrootc_harvest_patch(begp:endp)) ; this%livecrootc_harvest_patch(:) = spval allocate(this%livestemc_emergence_patch(begp:endp)) ; this%livestemc_emergence_patch(:) = spval allocate(this%livestemc_anthesis_patch(begp:endp)) ; this%livestemc_anthesis_patch(:) = spval allocate(this%livestemc_maturity_patch(begp:endp)) ; this%livestemc_maturity_patch(:) = spval + allocate(this%livestemc_harvest_patch(begp:endp)) ; this%livestemc_harvest_patch(:) = spval allocate(this%leafc_emergence_patch(begp:endp)) ; this%leafc_emergence_patch(:) = spval allocate(this%leafc_anthesis_patch(begp:endp)) ; this%leafc_anthesis_patch(:) = spval allocate(this%leafc_maturity_patch(begp:endp)) ; this%leafc_maturity_patch(:) = spval + allocate(this%leafc_harvest_patch(begp:endp)) ; this%leafc_harvest_patch(:) = spval allocate(this%reprc_emergence_patch(begp:endp)) ; this%reprc_emergence_patch(:) = spval allocate(this%reprc_anthesis_patch(begp:endp)) ; this%reprc_anthesis_patch(:) = spval allocate(this%reprc_maturity_patch(begp:endp)) ; this%reprc_maturity_patch(:) = spval + allocate(this%reprc_harvest_patch(begp:endp)) ; this%reprc_harvest_patch(:) = spval allocate(this%frootc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%frootc_emergence_thisyr_patch(:,:) = spval allocate(this%frootc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%frootc_anthesis_thisyr_patch(:,:) = spval allocate(this%frootc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%frootc_maturity_thisyr_patch(:,:) = spval + allocate(this%frootc_harvest_thisyr_patch(begp:endp,1:mxharvests)) ; this%frootc_harvest_thisyr_patch(:,:) = spval allocate(this%livecrootc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%livecrootc_emergence_thisyr_patch(:,:) = spval allocate(this%livecrootc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%livecrootc_anthesis_thisyr_patch(:,:) = spval allocate(this%livecrootc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%livecrootc_maturity_thisyr_patch(:,:) = spval + allocate(this%livecrootc_harvest_thisyr_patch(begp:endp,1:mxharvests)) ; this%livecrootc_harvest_thisyr_patch(:,:) = spval allocate(this%livestemc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%livestemc_emergence_thisyr_patch(:,:) = spval allocate(this%livestemc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%livestemc_anthesis_thisyr_patch(:,:) = spval allocate(this%livestemc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%livestemc_maturity_thisyr_patch(:,:) = spval + allocate(this%livestemc_harvest_thisyr_patch(begp:endp,1:mxharvests)) ; this%livestemc_harvest_thisyr_patch(:,:) = spval allocate(this%leafc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%leafc_emergence_thisyr_patch(:,:) = spval allocate(this%leafc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%leafc_anthesis_thisyr_patch(:,:) = spval allocate(this%leafc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%leafc_maturity_thisyr_patch(:,:) = spval + allocate(this%leafc_harvest_thisyr_patch(begp:endp,1:mxharvests)) ; this%leafc_harvest_thisyr_patch(:,:) = spval allocate(this%reprc_emergence_thisyr_patch(begp:endp,1:mxharvests)) ; this%reprc_emergence_thisyr_patch(:,:) = spval allocate(this%reprc_anthesis_thisyr_patch(begp:endp,1:mxharvests)) ; this%reprc_anthesis_thisyr_patch(:,:) = spval allocate(this%reprc_maturity_thisyr_patch(begp:endp,1:mxharvests)) ; this%reprc_maturity_thisyr_patch(:,:) = spval + allocate(this%reprc_harvest_thisyr_patch(begp:endp,1:mxharvests)) ; this%reprc_harvest_thisyr_patch(:,:) = spval end subroutine InitAllocate @@ -435,6 +455,11 @@ subroutine InitHistory(this, bounds) avgflag='I', long_name='Fine root C at maturity for each harvest this year; should only be output annually', & ptr_patch=this%frootc_maturity_thisyr_patch, default='inactive') + this%frootc_harvest_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='FROOTC_AT_HARVEST_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Fine root C at harvest for each harvest this year; should only be output annually', & + ptr_patch=this%frootc_harvest_thisyr_patch, default='inactive') + this%livecrootc_emergence_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='LIVECROOTC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & avgflag='I', long_name='Live coarse root C at emergence for each harvest this year; should only be output annually', & @@ -450,6 +475,11 @@ subroutine InitHistory(this, bounds) avgflag='I', long_name='Live coarse root C at maturity for each harvest this year; should only be output annually', & ptr_patch=this%livecrootc_maturity_thisyr_patch, default='inactive') + this%livecrootc_harvest_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LIVECROOTC_AT_HARVEST_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Live coarse root C at harvest for each harvest this year; should only be output annually', & + ptr_patch=this%livecrootc_harvest_thisyr_patch, default='inactive') + this%livestemc_emergence_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='LIVESTEMC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & avgflag='I', long_name='Live stem C at emergence for each harvest this year; should only be output annually', & @@ -465,6 +495,11 @@ subroutine InitHistory(this, bounds) avgflag='I', long_name='Live stem C at maturity for each harvest this year; should only be output annually', & ptr_patch=this%livestemc_maturity_thisyr_patch, default='inactive') + this%livestemc_harvest_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LIVESTEMC_AT_HARVEST_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Live stem C at harvest for each harvest this year; should only be output annually', & + ptr_patch=this%livestemc_harvest_thisyr_patch, default='inactive') + this%leafc_emergence_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='LEAFC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & avgflag='I', long_name='Leaf C at emergence for each harvest this year; should only be output annually', & @@ -480,6 +515,11 @@ subroutine InitHistory(this, bounds) avgflag='I', long_name='Leaf C at maturity for each harvest this year; should only be output annually', & ptr_patch=this%leafc_maturity_thisyr_patch, default='inactive') + this%leafc_harvest_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='LEAFC_AT_HARVEST_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Leaf C at harvest for each harvest this year; should only be output annually', & + ptr_patch=this%leafc_harvest_thisyr_patch, default='inactive') + this%reprc_emergence_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='REPRC_AT_EMERGENCE_PERHARV', units='gC/m^2', type2d='mxharvests', & avgflag='I', long_name='Reproductive C at emergence for each harvest this year; should only be output annually', & @@ -495,6 +535,11 @@ subroutine InitHistory(this, bounds) avgflag='I', long_name='Reproductive C at maturity for each harvest this year; should only be output annually', & ptr_patch=this%reprc_maturity_thisyr_patch, default='inactive') + this%reprc_harvest_thisyr_patch(begp:endp,:) = spval + call hist_addfld2d (fname='REPRC_AT_HARVEST_PERHARV', units='gC/m^2', type2d='mxharvests', & + avgflag='I', long_name='Reproductive C at harvest for each harvest this year; should only be output annually', & + ptr_patch=this%reprc_harvest_thisyr_patch, default='inactive') + this%sowing_reason_thisyr_patch(begp:endp,:) = spval call hist_addfld2d (fname='SOWING_REASON', units='unitless', type2d='mxsowings', & avgflag='I', long_name='Reason for each crop sowing; should only be output annually', & @@ -841,6 +886,21 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) call restartvar(ncid=ncid, flag=flag, varname='reprc_maturity_patch', xtype=ncd_double, & dim1name='pft', long_name='Reproductive C at maturity for this patch this season', units='unitless', & interpinic_flag='interp', readvar=readvar, data=this%reprc_maturity_patch) + call restartvar(ncid=ncid, flag=flag, varname='frootc_harvest_patch', xtype=ncd_double, & + dim1name='pft', long_name='Fine root C at harvest for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%frootc_harvest_patch) + call restartvar(ncid=ncid, flag=flag, varname='livecrootc_harvest_patch', xtype=ncd_double, & + dim1name='pft', long_name='Live coarse root C at harvest for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%livecrootc_harvest_patch) + call restartvar(ncid=ncid, flag=flag, varname='livestemc_harvest_patch', xtype=ncd_double, & + dim1name='pft', long_name='Live stem C at harvest for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%livestemc_harvest_patch) + call restartvar(ncid=ncid, flag=flag, varname='leafc_harvest_patch', xtype=ncd_double, & + dim1name='pft', long_name='Leaf C at harvest for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%leafc_harvest_patch) + call restartvar(ncid=ncid, flag=flag, varname='reprc_harvest_patch', xtype=ncd_double, & + dim1name='pft', long_name='Reproductive C at harvest for this patch this season', units='unitless', & + interpinic_flag='interp', readvar=readvar, data=this%reprc_harvest_patch) call restartvar(ncid=ncid, flag=flag, varname='cphase',xtype=ncd_double, & dim1name='pft', long_name='crop phenology phase', & @@ -1016,6 +1076,31 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) long_name='Reproductive C at maturity for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & interpinic_flag='interp', readvar=readvar, data=this%reprc_maturity_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='frootc_maturity_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Fine root C at maturity for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%frootc_maturity_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='livecrootc_maturity_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Live coarse root C at maturity for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%livecrootc_maturity_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='livestemc_maturity_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Live stem C at maturity for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%livestemc_maturity_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='leafc_maturity_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Leaf C at maturity for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%leafc_maturity_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='reprc_maturity_thisyr_patch', xtype=ncd_double, & + dim1name='pft', dim2name='mxharvests', switchdim=.true., & + long_name='Reproductive C at maturity for harvests in this patch this year', units='unitless', & + scale_by_thickness=.false., & + interpinic_flag='interp', readvar=readvar, data=this%reprc_maturity_thisyr_patch) ! Fill variable(s) derived from read-in variable(s) if (flag == 'read') then @@ -1222,7 +1307,7 @@ subroutine CropIncrementYear (this, num_pcropp, filter_pcropp) end subroutine CropIncrementYear !----------------------------------------------------------------------- - subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst) + subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, is_mature_in) ! ! !DESCRIPTION: ! Update crop-phase-transition biomass history outputs for a patch. Should only be called AT @@ -1236,9 +1321,17 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst) class(crop_type) :: this integer , intent(in) :: p ! Patch index type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst + logical , intent(in), optional :: is_mature_in ! ! !LOCALS: real(r8) :: frootc, livecrootc, livestemc, leafc, reprc + logical :: is_mature + + if (present(is_mature_in)) then + is_mature = is_mature_in + else + is_mature = .false. + end if frootc = cnveg_carbonstate_inst%frootc_patch(p) livecrootc = cnveg_carbonstate_inst%livecrootc_patch(p) @@ -1260,11 +1353,18 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst) this%leafc_anthesis_patch(p) = leafc this%reprc_anthesis_patch(p) = reprc else if (this%cphase_patch(p) == cphase_harvest) then - this%frootc_maturity_patch(p) = frootc - this%livecrootc_maturity_patch(p) = livecrootc - this%livestemc_maturity_patch(p) = livestemc - this%leafc_maturity_patch(p) = leafc - this%reprc_maturity_patch(p) = reprc + this%frootc_harvest_patch(p) = frootc + this%livecrootc_harvest_patch(p) = livecrootc + this%livestemc_harvest_patch(p) = livestemc + this%leafc_harvest_patch(p) = leafc + this%reprc_harvest_patch(p) = reprc + if (is_mature) then + this%frootc_maturity_patch(p) = frootc + this%livecrootc_maturity_patch(p) = livecrootc + this%livestemc_maturity_patch(p) = livestemc + this%leafc_maturity_patch(p) = leafc + this%reprc_maturity_patch(p) = reprc + end if end if end subroutine CropPhaseTransitionBiomass From 7e480b92edabf59f7ab355685f159c13d1ac5a39 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 12 Jan 2026 09:40:02 -0700 Subject: [PATCH 12/57] CropPhenology(): Add a comment. --- src/biogeochem/CNPhenologyMod.F90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 6fba35fe2c..39312e030c 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2566,6 +2566,10 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & else if (do_harvest) then cphase(p) = cphase_harvest + + ! Unlike other calls of CropPhaseTransitionBiomass(), we don't need a check for + ! cphase(p) /= cphase_orig here. This is because do_harvest already implies we're at + ! a phase transition: "cphase(p) isn't cphase_harvest but now it should be." call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst, is_mature) ! Don't update these if you're just harvesting because of incorrect Dec. From 71bc137e842038c268fb0d17688fb3f0cb352363 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 12 Jan 2026 09:41:59 -0700 Subject: [PATCH 13/57] Fix restart of _harvest_ biomass variables. --- src/biogeochem/CropType.F90 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index f6ff7309dc..8782bec051 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -1076,31 +1076,31 @@ subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) long_name='Reproductive C at maturity for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & interpinic_flag='interp', readvar=readvar, data=this%reprc_maturity_thisyr_patch) - call restartvar(ncid=ncid, flag=flag, varname='frootc_maturity_thisyr_patch', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='frootc_harvest_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxharvests', switchdim=.true., & - long_name='Fine root C at maturity for harvests in this patch this year', units='unitless', & + long_name='Fine root C at harvest for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & - interpinic_flag='interp', readvar=readvar, data=this%frootc_maturity_thisyr_patch) - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_maturity_thisyr_patch', xtype=ncd_double, & + interpinic_flag='interp', readvar=readvar, data=this%frootc_harvest_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='livecrootc_harvest_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxharvests', switchdim=.true., & - long_name='Live coarse root C at maturity for harvests in this patch this year', units='unitless', & + long_name='Live coarse root C at harvest for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_maturity_thisyr_patch) - call restartvar(ncid=ncid, flag=flag, varname='livestemc_maturity_thisyr_patch', xtype=ncd_double, & + interpinic_flag='interp', readvar=readvar, data=this%livecrootc_harvest_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='livestemc_harvest_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxharvests', switchdim=.true., & - long_name='Live stem C at maturity for harvests in this patch this year', units='unitless', & + long_name='Live stem C at harvest for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_maturity_thisyr_patch) - call restartvar(ncid=ncid, flag=flag, varname='leafc_maturity_thisyr_patch', xtype=ncd_double, & + interpinic_flag='interp', readvar=readvar, data=this%livestemc_harvest_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='leafc_harvest_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxharvests', switchdim=.true., & - long_name='Leaf C at maturity for harvests in this patch this year', units='unitless', & + long_name='Leaf C at harvest for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & - interpinic_flag='interp', readvar=readvar, data=this%leafc_maturity_thisyr_patch) - call restartvar(ncid=ncid, flag=flag, varname='reprc_maturity_thisyr_patch', xtype=ncd_double, & + interpinic_flag='interp', readvar=readvar, data=this%leafc_harvest_thisyr_patch) + call restartvar(ncid=ncid, flag=flag, varname='reprc_harvest_thisyr_patch', xtype=ncd_double, & dim1name='pft', dim2name='mxharvests', switchdim=.true., & - long_name='Reproductive C at maturity for harvests in this patch this year', units='unitless', & + long_name='Reproductive C at harvest for harvests in this patch this year', units='unitless', & scale_by_thickness=.false., & - interpinic_flag='interp', readvar=readvar, data=this%reprc_maturity_thisyr_patch) + interpinic_flag='interp', readvar=readvar, data=this%reprc_harvest_thisyr_patch) ! Fill variable(s) derived from read-in variable(s) if (flag == 'read') then From af1ed719dd8c09225310fdda7d405cb89b7a987a Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 12 Jan 2026 09:48:40 -0700 Subject: [PATCH 14/57] CropPhaseTransitionBiomass(): Delete an unused 'use'. --- src/biogeochem/CropType.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 8782bec051..1f249346c0 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -1315,7 +1315,6 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, is_matur ! ! !USES: use CNVegCarbonStateType, only : cnveg_carbonstate_type - use CNVegCarbonFluxType, only : cnveg_carbonflux_type ! ! !ARGUMENTS: class(crop_type) :: this From 365fda33898548b82435d29cbddaacfcf692e795 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 12 Jan 2026 13:34:40 -0700 Subject: [PATCH 15/57] CropPhaseTransitionBiomass(): Require is_mature arg if cphase is harvest. --- src/biogeochem/CropType.F90 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 1f249346c0..2d33088b7c 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -1307,7 +1307,7 @@ subroutine CropIncrementYear (this, num_pcropp, filter_pcropp) end subroutine CropIncrementYear !----------------------------------------------------------------------- - subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, is_mature_in) + subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, is_mature) ! ! !DESCRIPTION: ! Update crop-phase-transition biomass history outputs for a patch. Should only be called AT @@ -1320,17 +1320,10 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, is_matur class(crop_type) :: this integer , intent(in) :: p ! Patch index type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - logical , intent(in), optional :: is_mature_in + logical , intent(in), optional :: is_mature ! ! !LOCALS: real(r8) :: frootc, livecrootc, livestemc, leafc, reprc - logical :: is_mature - - if (present(is_mature_in)) then - is_mature = is_mature_in - else - is_mature = .false. - end if frootc = cnveg_carbonstate_inst%frootc_patch(p) livecrootc = cnveg_carbonstate_inst%livecrootc_patch(p) @@ -1357,6 +1350,10 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, is_matur this%livestemc_harvest_patch(p) = livestemc this%leafc_harvest_patch(p) = leafc this%reprc_harvest_patch(p) = reprc + + if (.not. present(is_mature)) then + call endrun(msg=' ERROR: When called at harvest, CropPhaseTransitionBiomass() needs argument is_mature') + end if if (is_mature) then this%frootc_maturity_patch(p) = frootc this%livecrootc_maturity_patch(p) = livecrootc From df3c1cd08c77c1140008be31aa85b137e9c4a5ec Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 12 Jan 2026 13:36:08 -0700 Subject: [PATCH 16/57] Move some var inits from PlantCrop() to new CropType%InitPlantCrop(). This is useful for unit testing. More things could eventually be moved there. --- src/biogeochem/CNPhenologyMod.F90 | 25 ++--------------------- src/biogeochem/CropType.F90 | 34 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 39312e030c..dc217f8a8d 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2874,7 +2874,6 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, & harvdate => crop_inst%harvdate_patch , & ! Output: [integer (:) ] harvest date sowing_count => crop_inst%sowing_count , & ! Inout: [integer (:) ] number of sowing events this year for this patch sowing_reason => crop_inst%sowing_reason_thisyr_patch , & ! Output: [real(r8) (:) ] reason for each sowing this year for this patch - max_tlai => crop_inst%max_tlai_patch , & ! Output: [real(r8) (:) ] maximum total projected leaf area seen this season gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Output: [real(r8) (:) ] gdd needed to harvest idop => cnveg_state_inst%idop_patch , & ! Output: [integer (:) ] date of planting iyop => cnveg_state_inst%iyop_patch , & ! Output: [integer (:) ] year of planting @@ -3021,28 +3020,8 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, & arepr(p,k) = 0._r8 end do - ! Initialize other stuff - max_tlai(p) = 0._r8 - crop_inst%frootc_emergence_patch(p) = -1._r8 - crop_inst%frootc_anthesis_patch(p) = -1._r8 - crop_inst%frootc_maturity_patch(p) = -1._r8 - crop_inst%frootc_harvest_patch(p) = -1._r8 - crop_inst%livecrootc_emergence_patch(p) = -1._r8 - crop_inst%livecrootc_anthesis_patch(p) = -1._r8 - crop_inst%livecrootc_maturity_patch(p) = -1._r8 - crop_inst%livecrootc_harvest_patch(p) = -1._r8 - crop_inst%livestemc_emergence_patch(p) = -1._r8 - crop_inst%livestemc_anthesis_patch(p) = -1._r8 - crop_inst%livestemc_maturity_patch(p) = -1._r8 - crop_inst%livestemc_harvest_patch(p) = -1._r8 - crop_inst%leafc_emergence_patch(p) = -1._r8 - crop_inst%leafc_anthesis_patch(p) = -1._r8 - crop_inst%leafc_maturity_patch(p) = -1._r8 - crop_inst%leafc_harvest_patch(p) = -1._r8 - crop_inst%reprc_emergence_patch(p) = -1._r8 - crop_inst%reprc_anthesis_patch(p) = -1._r8 - crop_inst%reprc_maturity_patch(p) = -1._r8 - crop_inst%reprc_harvest_patch(p) = -1._r8 + ! Initialize other things in crop_inst + call crop_inst%InitPlantCrop(p) end associate diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 2d33088b7c..99a0efaf24 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -124,6 +124,7 @@ module CropType procedure, public :: Init ! Initialize the crop type procedure, public :: InitAccBuffer procedure, public :: InitAccVars + procedure, public :: InitPlantCrop procedure, public :: Restart procedure, public :: ReadNML ! Read in the crop_inparm namelist @@ -714,6 +715,39 @@ subroutine InitAccVars(this, bounds) end subroutine InitAccVars + subroutine InitPlantCrop(this, p) + ! + ! !DESCRIPTION: + ! Initialize some things as they are needed during PlantCrop(). + ! + ! !ARGUMENTS: + class(crop_type), intent(inout) :: this + integer, intent(in) :: p ! patch index + + this%max_tlai_patch(p) = 0._r8 + this%frootc_emergence_patch(p) = -1._r8 + this%frootc_anthesis_patch(p) = -1._r8 + this%frootc_maturity_patch(p) = -1._r8 + this%frootc_harvest_patch(p) = -1._r8 + this%livecrootc_emergence_patch(p) = -1._r8 + this%livecrootc_anthesis_patch(p) = -1._r8 + this%livecrootc_maturity_patch(p) = -1._r8 + this%livecrootc_harvest_patch(p) = -1._r8 + this%livestemc_emergence_patch(p) = -1._r8 + this%livestemc_anthesis_patch(p) = -1._r8 + this%livestemc_maturity_patch(p) = -1._r8 + this%livestemc_harvest_patch(p) = -1._r8 + this%leafc_emergence_patch(p) = -1._r8 + this%leafc_anthesis_patch(p) = -1._r8 + this%leafc_maturity_patch(p) = -1._r8 + this%leafc_harvest_patch(p) = -1._r8 + this%reprc_emergence_patch(p) = -1._r8 + this%reprc_anthesis_patch(p) = -1._r8 + this%reprc_maturity_patch(p) = -1._r8 + this%reprc_harvest_patch(p) = -1._r8 + + end subroutine InitPlantCrop + !----------------------------------------------------------------------- subroutine Restart(this, bounds, ncid, cnveg_state_inst, flag) ! From cf7d3fe6effad4b73618c9ce294f301d9531c7f9 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 12 Jan 2026 13:51:33 -0700 Subject: [PATCH 17/57] Add tests for CropType%CropPhaseTransitionBiomass(). 2 fail. --- src/biogeochem/CNVegCarbonStateType.F90 | 2 +- src/biogeochem/test/CMakeLists.txt | 1 + .../CMakeLists.txt | 8 + .../test_CropPhaseTransitionBiomass.pf | 408 ++++++++++++++++++ 4 files changed, 418 insertions(+), 1 deletion(-) create mode 100644 src/biogeochem/test/CropPhaseTransitionBiomass_test/CMakeLists.txt create mode 100644 src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index 3604821057..3078215767 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -215,7 +215,7 @@ module CNVegCarbonStateType procedure , public :: Summary => Summary_carbonstate procedure , public :: DynamicPatchAdjustments ! adjust state variables when patch areas change - procedure , private :: InitAllocate ! Allocate arrays + procedure , public :: InitAllocate ! Allocate arrays. PUBLIC FOR UNIT TESTING ONLY procedure , private :: InitReadNML ! Read in namelist procedure , private :: InitHistory ! Initialize history procedure , private :: InitCold ! Initialize arrays for a cold-start diff --git a/src/biogeochem/test/CMakeLists.txt b/src/biogeochem/test/CMakeLists.txt index e47e2429b6..5a2b247f88 100644 --- a/src/biogeochem/test/CMakeLists.txt +++ b/src/biogeochem/test/CMakeLists.txt @@ -2,6 +2,7 @@ add_subdirectory(Species_test) add_subdirectory(CIsoAtmTimeSeries_test) add_subdirectory(CNVegComputeSeed_test) add_subdirectory(CNPhenology_test) +add_subdirectory(CropPhaseTransitionBiomass_test) add_subdirectory(Latbaset_test) add_subdirectory(DustEmis_test) add_subdirectory(CNFireFactory_test) diff --git a/src/biogeochem/test/CropPhaseTransitionBiomass_test/CMakeLists.txt b/src/biogeochem/test/CropPhaseTransitionBiomass_test/CMakeLists.txt new file mode 100644 index 0000000000..4342a1b502 --- /dev/null +++ b/src/biogeochem/test/CropPhaseTransitionBiomass_test/CMakeLists.txt @@ -0,0 +1,8 @@ +set (pfunit_sources + test_CropPhaseTransitionBiomass.pf) + +add_pfunit_ctest(CropPhaseTransitionBiomass + TEST_SOURCES "${pfunit_sources}" + LINK_LIBRARIES clm csm_share esmf + EXTRA_FINALIZE unittest_finalize_esmf + EXTRA_USE unittestInitializeAndFinalize) diff --git a/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf b/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf new file mode 100644 index 0000000000..d8b4b77bd9 --- /dev/null +++ b/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf @@ -0,0 +1,408 @@ +module test_CropPhaseTransitionBiomass + + ! Tests of CropType + + use funit + use landunit_varcon, only : istcrop + use unittestSubgridMod, only : unittest_subgrid_setup_start, unittest_subgrid_setup_end + use unittestSubgridMod, only : unittest_subgrid_teardown + use unittestSubgridMod, only : unittest_add_gridcell, unittest_add_landunit + use unittestSubgridMod, only : unittest_add_column, unittest_add_patch + use unittestSubgridMod, only : bounds, gi, li, ci, pi + use CropType, only : crop_type + use CropType, only : cphase_not_planted, cphase_planted, cphase_leafemerge + use CropType, only : cphase_grainfill, cphase_harvest + use decompMod, only : bounds_type + use shr_kind_mod , only : r8 => shr_kind_r8 + use CNVegCarbonStateType, only : cnveg_carbonstate_type + use CropReprPoolsMod, only : nrepr + + implicit none + + @TestCase + type, extends(TestCase) :: TestCropType + type(crop_type) :: crop_inst + type(cnveg_carbonstate_type) :: cnveg_carbonstate_inst + contains + procedure :: setUp + procedure :: tearDown + procedure :: increase_biomass_pools + end type TestCropType + + real(r8), parameter :: tol = 1.e-13_r8 + +contains + + subroutine setUp(this) + class(TestCropType), intent(inout) :: this + integer :: cft ! crop functional type + integer :: ctype ! column type + + ! Based on set_landunit_crop_noncompete() + cft = 17 + ctype = istcrop*100 + cft + + ! Create a gridcell with just a crop landunit and one patch. + call unittest_subgrid_setup_start() + call unittest_add_gridcell() + call unittest_add_landunit(my_gi=gi, ltype=istcrop, wtgcell=1._r8) + call unittest_add_column(my_li=li, ctype=ctype, wtlunit=1._r8) + call unittest_add_patch(my_ci=ci, ptype=cft, wtcol=1._r8) + call unittest_subgrid_setup_end() + + call this%crop_inst%Init(bounds) + call this%crop_inst%InitPlantCrop(pi) + + call this%cnveg_carbonstate_inst%InitAllocate(bounds, .true.) + this%cnveg_carbonstate_inst%frootc_patch(pi) = 1._r8 + this%cnveg_carbonstate_inst%livecrootc_patch(pi) = 2._r8 + this%cnveg_carbonstate_inst%livestemc_patch(pi) = 3._r8 + this%cnveg_carbonstate_inst%leafc_patch(pi) = 4._r8 + this%cnveg_carbonstate_inst%reproductivec_patch(pi, :) = 5._r8 + + end subroutine setUp + + subroutine tearDown(this) + ! clean up stuff set up in setup() + class(TestCropType), intent(inout) :: this + + call unittest_subgrid_teardown() + + end subroutine tearDown + + subroutine increase_biomass_pools(this, increment) + class(TestCropType), intent(inout) :: this + real(r8) :: increment + + associate( & + frootc => this%cnveg_carbonstate_inst%frootc_patch, & + livecrootc => this%cnveg_carbonstate_inst%livecrootc_patch, & + livestemc => this%cnveg_carbonstate_inst%livestemc_patch, & + leafc => this%cnveg_carbonstate_inst%leafc_patch, & + reproductivec => this%cnveg_carbonstate_inst%reproductivec_patch & + ) + + frootc(pi) = frootc(pi) + increment + livecrootc(pi) = livecrootc(pi) + increment + livestemc(pi) = livestemc(pi) + increment + leafc(pi) = leafc(pi) + increment + reproductivec(pi,:) = reproductivec(pi,:) + increment + + end associate + end subroutine increase_biomass_pools + + @Test + subroutine test_not_planted(this) + ! If called at not_planted, nothing should be set (i.e., everything should be negative) + class(TestCropType), intent(inout) :: this + + this%crop_inst%cphase_patch(pi) = cphase_not_planted + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + + @assertLessThan(this%crop_inst%frootc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_emergence_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_anthesis_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_maturity_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_harvest_patch(pi), 0._r8) + + end subroutine test_not_planted + + @Test + subroutine test_planted(this) + ! If called at planted (i.e., before emergence), nothing should be set + class(TestCropType), intent(inout) :: this + + this%crop_inst%cphase_patch(pi) = cphase_planted + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + + @assertLessThan(this%crop_inst%frootc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_emergence_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_anthesis_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_maturity_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_harvest_patch(pi), 0._r8) + + end subroutine test_planted + + @Test + subroutine test_leafemerge(this) + ! If called at leafemerge (i.e., after emergence), only emergence variables should be set + class(TestCropType), intent(inout) :: this + + this%crop_inst%cphase_patch(pi) = cphase_leafemerge + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + + @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_emergence_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_emergence_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_emergence_patch(pi)) + + @assertLessThan(this%crop_inst%frootc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_anthesis_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_maturity_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_harvest_patch(pi), 0._r8) + + end subroutine test_leafemerge + + @Test + subroutine test_grainfill(this) + ! If called during grainfill, only emergence and anthesis variables should be set + class(TestCropType), intent(inout) :: this + + ! Before reaching grainfill, the crop should have gone through leafemerge + this%crop_inst%cphase_patch(pi) = cphase_leafemerge + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + + ! Increase biomass pools before moving to next phase + call this%increase_biomass_pools(5._r8) + + ! Now save status at anthesis + this%crop_inst%cphase_patch(pi) = cphase_grainfill + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + + @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_emergence_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_emergence_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_emergence_patch(pi)) + + @assertEqual(6._r8, this%crop_inst%frootc_anthesis_patch(pi)) + @assertEqual(7._r8, this%crop_inst%livecrootc_anthesis_patch(pi)) + @assertEqual(8._r8, this%crop_inst%livestemc_anthesis_patch(pi)) + @assertEqual(9._r8, this%crop_inst%leafc_anthesis_patch(pi)) + @assertEqual(10._r8 * nrepr, this%crop_inst%reprc_anthesis_patch(pi)) + + @assertLessThan(this%crop_inst%frootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_maturity_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_harvest_patch(pi), 0._r8) + + end subroutine test_grainfill + + @Test + subroutine test_harvest_immature(this) + ! If called at harvest before maturity, only maturity variables should be set + class(TestCropType), intent(inout) :: this + + ! Before reaching grainfill, the crop should have gone through leafemerge + this%crop_inst%cphase_patch(pi) = cphase_leafemerge + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + + ! Increase biomass pools before moving to next phase + call this%increase_biomass_pools(5._r8) + + ! Now save status at anthesis + this%crop_inst%cphase_patch(pi) = cphase_grainfill + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + + ! Increase biomass pools before moving to next phase + call this%increase_biomass_pools(5._r8) + + ! Now save status at harvest + this%crop_inst%cphase_patch(pi) = cphase_harvest + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst, is_mature=.false.) + + @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_emergence_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_emergence_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_emergence_patch(pi)) + + @assertEqual(6._r8, this%crop_inst%frootc_anthesis_patch(pi)) + @assertEqual(7._r8, this%crop_inst%livecrootc_anthesis_patch(pi)) + @assertEqual(8._r8, this%crop_inst%livestemc_anthesis_patch(pi)) + @assertEqual(9._r8, this%crop_inst%leafc_anthesis_patch(pi)) + @assertEqual(10._r8 * nrepr, this%crop_inst%reprc_anthesis_patch(pi)) + + @assertLessThan(this%crop_inst%frootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_maturity_patch(pi), 0._r8) + + @assertEqual(11._r8, this%crop_inst%frootc_harvest_patch(pi)) + @assertEqual(12._r8, this%crop_inst%livecrootc_harvest_patch(pi)) + @assertEqual(13._r8, this%crop_inst%livestemc_harvest_patch(pi)) + @assertEqual(14._r8, this%crop_inst%leafc_harvest_patch(pi)) + @assertEqual(15._r8 * nrepr, this%crop_inst%reprc_harvest_patch(pi)) + + end subroutine test_harvest_immature + + @Test + subroutine test_harvest_mature(this) + ! If called at harvest after maturity, all variables should be set + class(TestCropType), intent(inout) :: this + + ! Before reaching grainfill, the crop should have gone through leafemerge + this%crop_inst%cphase_patch(pi) = cphase_leafemerge + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + + ! Increase biomass pools before moving to next phase + call this%increase_biomass_pools(5._r8) + + ! Now save status at anthesis + this%crop_inst%cphase_patch(pi) = cphase_grainfill + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + + ! Increase biomass pools before moving to next phase + call this%increase_biomass_pools(5._r8) + + ! Now save status at harvest + this%crop_inst%cphase_patch(pi) = cphase_harvest + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst, is_mature=.true.) + + @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_emergence_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_emergence_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_emergence_patch(pi)) + + @assertEqual(6._r8, this%crop_inst%frootc_anthesis_patch(pi)) + @assertEqual(7._r8, this%crop_inst%livecrootc_anthesis_patch(pi)) + @assertEqual(8._r8, this%crop_inst%livestemc_anthesis_patch(pi)) + @assertEqual(9._r8, this%crop_inst%leafc_anthesis_patch(pi)) + @assertEqual(10._r8 * nrepr, this%crop_inst%reprc_anthesis_patch(pi)) + + @assertEqual(11._r8, this%crop_inst%frootc_maturity_patch(pi)) + @assertEqual(12._r8, this%crop_inst%livecrootc_maturity_patch(pi)) + @assertEqual(13._r8, this%crop_inst%livestemc_maturity_patch(pi)) + @assertEqual(14._r8, this%crop_inst%leafc_maturity_patch(pi)) + @assertEqual(15._r8 * nrepr, this%crop_inst%reprc_maturity_patch(pi)) + + @assertEqual(11._r8, this%crop_inst%frootc_harvest_patch(pi)) + @assertEqual(12._r8, this%crop_inst%livecrootc_harvest_patch(pi)) + @assertEqual(13._r8, this%crop_inst%livestemc_harvest_patch(pi)) + @assertEqual(14._r8, this%crop_inst%leafc_harvest_patch(pi)) + @assertEqual(15._r8 * nrepr, this%crop_inst%reprc_harvest_patch(pi)) + + end subroutine test_harvest_mature + + @Test + subroutine test_direct_to_grainfill(this) + ! If calling during grainfill that was reached without a timestep in leafemerge, both leafemerge + ! and grainfill variables should be filled (and no others). + class(TestCropType), intent(inout) :: this + + ! Save status at anthesis + this%crop_inst%cphase_patch(pi) = cphase_grainfill + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + + @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_emergence_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_emergence_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_emergence_patch(pi)) + + @assertEqual(1._r8, this%crop_inst%frootc_anthesis_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_anthesis_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_anthesis_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_anthesis_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_anthesis_patch(pi)) + + @assertLessThan(this%crop_inst%frootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_maturity_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_harvest_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_harvest_patch(pi), 0._r8) + + end subroutine test_direct_to_grainfill + + @Test + subroutine test_direct_to_harvest_mature(this) + ! If calling during mature harvest that was reached without a timestep in leafemerge or + ! grainfill, all variables should be filled. + class(TestCropType), intent(inout) :: this + + this%crop_inst%cphase_patch(pi) = cphase_harvest + call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst, is_mature=.true.) + + @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_emergence_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_emergence_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_emergence_patch(pi)) + + @assertEqual(1._r8, this%crop_inst%frootc_anthesis_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_anthesis_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_anthesis_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_anthesis_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_anthesis_patch(pi)) + + @assertEqual(1._r8, this%crop_inst%frootc_maturity_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_maturity_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_maturity_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_maturity_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_maturity_patch(pi)) + + @assertEqual(1._r8, this%crop_inst%frootc_harvest_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_harvest_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_harvest_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_harvest_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_harvest_patch(pi)) + + end subroutine test_direct_to_harvest_mature + + +end module test_CropPhaseTransitionBiomass From f26b8e2d45510a467ce07035c9ccf2539ee939b4 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 12 Jan 2026 13:52:09 -0700 Subject: [PATCH 18/57] CropPhaseTransitionBiomass: Fix behavior if skipping phases. --- src/biogeochem/CropType.F90 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 99a0efaf24..cac8bc179d 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -1366,19 +1366,24 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, is_matur ! sum over all grain tisues and destinations reprc = sum(cnveg_carbonstate_inst%reproductivec_patch(p,:)) - if (this%cphase_patch(p) == cphase_leafemerge) then + if (this%cphase_patch(p) >= cphase_leafemerge .and. this%frootc_emergence_patch(p) < 0._r8) then this%frootc_emergence_patch(p) = frootc this%livecrootc_emergence_patch(p) = livecrootc this%livestemc_emergence_patch(p) = livestemc this%leafc_emergence_patch(p) = leafc this%reprc_emergence_patch(p) = reprc - else if (this%cphase_patch(p) == cphase_grainfill) then + end if + + if (this%cphase_patch(p) >= cphase_grainfill .and. this%frootc_anthesis_patch(p) < 0._r8) then this%frootc_anthesis_patch(p) = frootc this%livecrootc_anthesis_patch(p) = livecrootc this%livestemc_anthesis_patch(p) = livestemc this%leafc_anthesis_patch(p) = leafc this%reprc_anthesis_patch(p) = reprc - else if (this%cphase_patch(p) == cphase_harvest) then + end if + + ! Don't need >= etc. here because harvest is the maximum (final) phase + if (this%cphase_patch(p) == cphase_harvest) then this%frootc_harvest_patch(p) = frootc this%livecrootc_harvest_patch(p) = livecrootc this%livestemc_harvest_patch(p) = livestemc From 08b93e7cf8888f18153bc7756fecf190c2e234f7 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 12 Jan 2026 15:18:18 -0700 Subject: [PATCH 19/57] CropPhaseTransitionBiomass(): Assert cphase in expected range. --- src/biogeochem/CropType.F90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index cac8bc179d..31621fb0f1 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -1359,6 +1359,11 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, is_matur ! !LOCALS: real(r8) :: frootc, livecrootc, livestemc, leafc, reprc + call shr_assert(this%cphase_patch(p) >= cphase_not_planted, msg="cphase < cphase_not_planted", & + file=__FILE__, line=__LINE__) + call shr_assert(this%cphase_patch(p) <= cphase_harvest, msg="cphase > cphase_harvest", & + file=__FILE__, line=__LINE__) + frootc = cnveg_carbonstate_inst%frootc_patch(p) livecrootc = cnveg_carbonstate_inst%livecrootc_patch(p) livestemc = cnveg_carbonstate_inst%livestemc_patch(p) @@ -1382,7 +1387,7 @@ subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, is_matur this%reprc_anthesis_patch(p) = reprc end if - ! Don't need >= etc. here because harvest is the maximum (final) phase + ! Don't need >= etc. here because harvest is the maximum (final) phase (as checked above) if (this%cphase_patch(p) == cphase_harvest) then this%frootc_harvest_patch(p) = frootc this%livecrootc_harvest_patch(p) = livecrootc From 56e29f7f305fab6839c9d548acbb9b204ae1e4dc Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 22 Jan 2026 11:54:28 -0700 Subject: [PATCH 20/57] Factor new subroutine EnergyBalanceCheck out of BalanceCheck. --- src/biogeophys/BalanceCheckMod.F90 | 170 +++++++++++++++++++---------- 1 file changed, 110 insertions(+), 60 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 65d2a1f81a..be004283ac 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -48,6 +48,7 @@ module BalanceCheckMod public :: WaterGridcellBalance ! Grid cell-level water balance check public :: BeginWaterColumnBalance ! Initialize column-level water balance check public :: BalanceCheck ! Water & energy balance checks + public :: EnergyBalanceCheck ! Energy balance checks public :: GetBalanceCheckSkipSteps ! Get the number of steps to skip for the balance check public :: BalanceCheckClean ! Clean up for BalanceCheck @@ -446,13 +447,10 @@ subroutine BalanceCheck( bounds, & ! ! !DESCRIPTION: ! This subroutine accumulates the numerical truncation errors of the water - ! and energy balance calculation. It is helpful to see the performance of - ! the process of integration. - ! - ! The error for energy balance: + ! and then calls a different subroutine for the energy balance calculation. + ! It is helpful to see the performance of the process of integration. ! - ! error = abs(Net radiation - change of internal energy - Sensible heat - ! - Latent heat) + ! The error for energy balance is described in EnergyBalanceCheck. ! ! The error for water balance: ! @@ -501,26 +499,17 @@ subroutine BalanceCheck( bounds, & real(r8) :: errh2o_max_val ! Maximum value of error in water conservation error over all columns [mm H2O] real(r8) :: errh2osno_max_val ! Maximum value of error in h2osno conservation error over all columns [kg m-2] - real(r8) :: errsol_max_val ! Maximum value of error in solar radiation conservation error over all columns [W m-2] - real(r8) :: errlon_max_val ! Maximum value of error in longwave radiation conservation error over all columns [W m-2] - real(r8) :: errseb_max_val ! Maximum value of error in surface energy conservation error over all columns [W m-2] - real(r8) :: errsoi_col_max_val ! Maximum value of column-level soil/lake energy conservation error over all columns [W m-2] real(r8), parameter :: h2o_warning_thresh = 1.e-9_r8 ! Warning threshhold for error in errh2o and errh2osnow - real(r8), parameter :: energy_warning_thresh = 1.e-7_r8 ! Warning threshhold for error in errsol, errsol, errseb, errlonv real(r8), parameter :: error_thresh = 1.e-5_r8 ! Error threshhold for conservation error !----------------------------------------------------------------------- associate( & - forc_solad_col => atm2lnd_inst%forc_solad_downscaled_col , & ! Input: [real(r8) (:,:) ] direct beam radiation (vis=forc_sols , nir=forc_soll ) - forc_solad => atm2lnd_inst%forc_solad_not_downscaled_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (vis=forc_sols , nir=forc_soll ) - forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] diffuse radiation (vis=forc_solsd, nir=forc_solld) forc_rain => wateratm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] column level rain rate [mm/s] forc_rain_grc => wateratm2lnd_inst%forc_rain_not_downscaled_grc, & ! Input: [real(r8) (:) ] grid cell-level rain rate [mm/s] forc_snow => wateratm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] column level snow rate [mm/s] forc_snow_grc => wateratm2lnd_inst%forc_snow_not_downscaled_grc, & ! Input: [real(r8) (:) ] grid cell-level snow rate [mm/s] - forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) h2osno_old => waterbalance_inst%h2osno_old_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) at previous time step frac_sno_eff => waterdiagnosticbulk_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] effective snow fraction @@ -567,52 +556,9 @@ subroutine BalanceCheck( bounds, & qflx_sfc_irrig_col => waterflux_inst%qflx_sfc_irrig_col , & ! Input: [real(r8) (:) ] column level irrigation flux (mm H2O /s) qflx_sfc_irrig_grc => waterlnd2atm_inst%qirrig_grc , & ! Input: [real(r8) (:) ] grid cell-level irrigation flux (mm H20 /s) - qflx_glcice_dyn_water_flux_col => waterflux_inst%qflx_glcice_dyn_water_flux_col, & ! Input: [real(r8) (:)] column level water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) - - dhsdt_canopy => energyflux_inst%dhsdt_canopy_patch , & ! Input: [real(r8) (:) ] change in heat content of canopy (W/m**2) [+ to atm] - eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Input: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) - eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Input: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] - eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Input: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] - eflx_lh_tot => energyflux_inst%eflx_lh_tot_patch , & ! Input: [real(r8) (:) ] total latent heat flux (W/m**2) [+ to atm] - eflx_soil_grnd => energyflux_inst%eflx_soil_grnd_patch , & ! Input: [real(r8) (:) ] soil heat flux (W/m**2) [+ = into soil] - eflx_wasteheat_patch => energyflux_inst%eflx_wasteheat_patch , & ! Input: [real(r8) (:) ] sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - eflx_ventilation_patch => energyflux_inst%eflx_ventilation_patch , & ! Input: [real(r8) (:) ] sensible heat flux from building ventilation (W/m**2) - eflx_heat_from_ac_patch => energyflux_inst%eflx_heat_from_ac_patch , & ! Input: [real(r8) (:) ] sensible heat flux put back into canyon due to removal by AC (W/m**2) - eflx_traffic_patch => energyflux_inst%eflx_traffic_patch , & ! Input: [real(r8) (:) ] traffic sensible heat flux (W/m**2) - eflx_dynbal => energyflux_inst%eflx_dynbal_grc , & ! Input: [real(r8) (:) ] energy conversion flux due to dynamic land cover change(W/m**2) [+ to atm] - errsoi_col => energyflux_inst%errsoi_col , & ! Output: [real(r8) (:) ] column-level soil/lake energy conservation error (W/m**2) - errsol => energyflux_inst%errsol_patch , & ! Output: [real(r8) (:) ] solar radiation conservation error (W/m**2) - errseb => energyflux_inst%errseb_patch , & ! Output: [real(r8) (:) ] surface energy conservation error (W/m**2) - errlon => energyflux_inst%errlon_patch , & ! Output: [real(r8) (:) ] longwave radiation conservation error (W/m**2) - - sabg_soil => solarabs_inst%sabg_soil_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by soil (W/m**2) - sabg_snow => solarabs_inst%sabg_snow_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by snow (W/m**2) - sabg_chk => solarabs_inst%sabg_chk_patch , & ! Input: [real(r8) (:) ] sum of soil/snow using current fsno, for balance check - fsa => solarabs_inst%fsa_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed (total) (W/m**2) - fsr => solarabs_inst%fsr_patch , & ! Input: [real(r8) (:) ] solar radiation reflected (W/m**2) - sabv => solarabs_inst%sabv_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by vegetation (W/m**2) - sabg => solarabs_inst%sabg_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by ground (W/m**2) - - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:,:)] - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:,:)] - - fabd => surfalb_inst%fabd_patch , & ! Input: [real(r8) (:,:)] flux absorbed by canopy per unit direct flux - fabi => surfalb_inst%fabi_patch , & ! Input: [real(r8) (:,:)] flux absorbed by canopy per unit indirect flux - albd => surfalb_inst%albd_patch , & ! Input: [real(r8) (:,:)] surface albedo (direct) - albi => surfalb_inst%albi_patch , & ! Input: [real(r8) (:,:)] surface albedo (diffuse) - ftdd => surfalb_inst%ftdd_patch , & ! Input: [real(r8) (:,:)] down direct flux below canopy per unit direct flux - ftid => surfalb_inst%ftid_patch , & ! Input: [real(r8) (:,:)] down diffuse flux below canopy per unit direct flux - ftii => surfalb_inst%ftii_patch , & ! Input: [real(r8) (:,:)] down diffuse flux below canopy per unit diffuse flux - - netrad => energyflux_inst%netrad_patch & ! Output: [real(r8) (:) ] net radiation (positive downward) (W/m**2) + qflx_glcice_dyn_water_flux_col => waterflux_inst%qflx_glcice_dyn_water_flux_col & ! Input: [real(r8) (:)] column level water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) ) - ! Get step size and time step - - nstep = get_nstep() - DAnstep = get_nstep_since_startup_or_lastDA_restart_or_pause() - dtime = get_step_size_real() - ! Determine column level incoming snow and rain ! Assume no incident precipitation on urban wall columns (as in CanopyHydrologyMod.F90). @@ -895,6 +841,110 @@ subroutine BalanceCheck( bounds, & end if ! Energy balance checks + call EnergyBalanceCheck(bounds, atm2lnd_inst, solarabs_inst, & + surfalb_inst, energyflux_inst, canopystate_inst, waterdiagnosticbulk_inst) + + end associate + + end subroutine BalanceCheck + + !----------------------------------------------------------------------- + subroutine EnergyBalanceCheck( bounds, & + atm2lnd_inst, solarabs_inst, & + surfalb_inst, energyflux_inst, canopystate_inst, & + waterdiagnosticbulk_inst) + ! + ! !DESCRIPTION: + ! This subroutine accumulates the numerical truncation errors of the energy + ! balance calculation. It is helpful to see the performance of + ! the process of integration. + ! + ! The error for energy balance: + ! + ! error = abs(Net radiation - change of internal energy - Sensible heat + ! - Latent heat) + ! + ! !USES: + use clm_varcon , only : spval + use clm_time_manager , only : get_nstep + use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause + use CanopyStateType , only : canopystate_type + use SurfaceAlbedoType , only : surfalb_type + ! + ! !ARGUMENTS: + type(bounds_type) , intent(in) :: bounds + type(atm2lnd_type) , intent(in) :: atm2lnd_inst + type(solarabs_type) , intent(in) :: solarabs_inst + type(surfalb_type) , intent(in) :: surfalb_inst + type(energyflux_type) , intent(inout) :: energyflux_inst + type(canopystate_type), intent(inout) :: canopystate_inst + type(waterdiagnosticbulk_type), intent(in) :: waterdiagnosticbulk_inst + ! + ! !LOCAL VARIABLES: + integer :: p,c,l,g ! indices + integer :: nstep ! time step number + integer :: DAnstep ! time step number since last Data Assimilation (DA) + integer :: indexp,indexc,indexg ! index of first found in search loop + + real(r8) :: errsol_max_val ! Maximum value of error in solar radiation conservation error over all columns [W m-2] + real(r8) :: errlon_max_val ! Maximum value of error in longwave radiation conservation error over all columns [W m-2] + real(r8) :: errseb_max_val ! Maximum value of error in surface energy conservation error over all columns [W m-2] + real(r8) :: errsoi_col_max_val ! Maximum value of column-level soil/lake energy conservation error over all columns [W m-2] + + real(r8), parameter :: energy_warning_thresh = 1.e-7_r8 ! Warning threshhold for error in errsol, errsol, errseb, errlonv + real(r8), parameter :: error_thresh = 1.e-5_r8 ! Error threshhold for conservation error + + !----------------------------------------------------------------------- + + associate( & + forc_solad_col => atm2lnd_inst%forc_solad_downscaled_col , & ! Input: [real(r8) (:,:) ] direct beam radiation (vis=forc_sols , nir=forc_soll ) + forc_solad => atm2lnd_inst%forc_solad_not_downscaled_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (vis=forc_sols , nir=forc_soll ) + forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] diffuse radiation (vis=forc_solsd, nir=forc_solld) + forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) + + frac_sno => waterdiagnosticbulk_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) + + dhsdt_canopy => energyflux_inst%dhsdt_canopy_patch , & ! Input: [real(r8) (:) ] change in heat content of canopy (W/m**2) [+ to atm] + eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Input: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) + eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Input: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] + eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Input: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] + eflx_lh_tot => energyflux_inst%eflx_lh_tot_patch , & ! Input: [real(r8) (:) ] total latent heat flux (W/m**2) [+ to atm] + eflx_soil_grnd => energyflux_inst%eflx_soil_grnd_patch , & ! Input: [real(r8) (:) ] soil heat flux (W/m**2) [+ = into soil] + eflx_wasteheat_patch => energyflux_inst%eflx_wasteheat_patch , & ! Input: [real(r8) (:) ] sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) + eflx_ventilation_patch => energyflux_inst%eflx_ventilation_patch , & ! Input: [real(r8) (:) ] sensible heat flux from building ventilation (W/m**2) + eflx_heat_from_ac_patch => energyflux_inst%eflx_heat_from_ac_patch , & ! Input: [real(r8) (:) ] sensible heat flux put back into canyon due to removal by AC (W/m**2) + eflx_traffic_patch => energyflux_inst%eflx_traffic_patch , & ! Input: [real(r8) (:) ] traffic sensible heat flux (W/m**2) + errsoi_col => energyflux_inst%errsoi_col , & ! Output: [real(r8) (:) ] column-level soil/lake energy conservation error (W/m**2) + errsol => energyflux_inst%errsol_patch , & ! Output: [real(r8) (:) ] solar radiation conservation error (W/m**2) + errseb => energyflux_inst%errseb_patch , & ! Output: [real(r8) (:) ] surface energy conservation error (W/m**2) + errlon => energyflux_inst%errlon_patch , & ! Output: [real(r8) (:) ] longwave radiation conservation error (W/m**2) + + sabg_soil => solarabs_inst%sabg_soil_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by soil (W/m**2) + sabg_snow => solarabs_inst%sabg_snow_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by snow (W/m**2) + sabg_chk => solarabs_inst%sabg_chk_patch , & ! Input: [real(r8) (:) ] sum of soil/snow using current fsno, for balance check + fsa => solarabs_inst%fsa_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed (total) (W/m**2) + fsr => solarabs_inst%fsr_patch , & ! Input: [real(r8) (:) ] solar radiation reflected (W/m**2) + sabv => solarabs_inst%sabv_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by vegetation (W/m**2) + sabg => solarabs_inst%sabg_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by ground (W/m**2) + + elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:,:)] + esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:,:)] + + fabd => surfalb_inst%fabd_patch , & ! Input: [real(r8) (:,:)] flux absorbed by canopy per unit direct flux + fabi => surfalb_inst%fabi_patch , & ! Input: [real(r8) (:,:)] flux absorbed by canopy per unit indirect flux + albd => surfalb_inst%albd_patch , & ! Input: [real(r8) (:,:)] surface albedo (direct) + albi => surfalb_inst%albi_patch , & ! Input: [real(r8) (:,:)] surface albedo (diffuse) + ftdd => surfalb_inst%ftdd_patch , & ! Input: [real(r8) (:,:)] down direct flux below canopy per unit direct flux + ftid => surfalb_inst%ftid_patch , & ! Input: [real(r8) (:,:)] down diffuse flux below canopy per unit direct flux + ftii => surfalb_inst%ftii_patch , & ! Input: [real(r8) (:,:)] down diffuse flux below canopy per unit diffuse flux + + netrad => energyflux_inst%netrad_patch & ! Output: [real(r8) (:) ] net radiation (positive downward) (W/m**2) + ) + + ! Get step size and time step + + nstep = get_nstep() + DAnstep = get_nstep_since_startup_or_lastDA_restart_or_pause() do p = bounds%begp, bounds%endp if (patch%active(p)) then @@ -1060,6 +1110,6 @@ subroutine BalanceCheck( bounds, & end associate - end subroutine BalanceCheck + end subroutine EnergyBalanceCheck end module BalanceCheckMod From 822f1b92a37d63b5ed06206943fb2db3a30bae37 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 22 Jan 2026 12:08:43 -0700 Subject: [PATCH 21/57] BalanceCheckMod: error_thresh is now a module-level param. --- src/biogeophys/BalanceCheckMod.F90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index be004283ac..728674f5e7 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -61,6 +61,9 @@ module BalanceCheckMod private :: WaterGridcellBalanceSingle ! Grid cell-level water balance check for bulk or a single tracer private :: BeginWaterColumnBalanceSingle ! Initialize column-level water balance check for bulk or a single tracer + ! !PRIVATE PARAMETERS + real(r8), parameter :: error_thresh = 1.e-5_r8 ! Error threshold for conservation error + character(len=*), parameter, private :: sourcefile = & __FILE__ !----------------------------------------------------------------------- @@ -500,8 +503,7 @@ subroutine BalanceCheck( bounds, & real(r8) :: errh2o_max_val ! Maximum value of error in water conservation error over all columns [mm H2O] real(r8) :: errh2osno_max_val ! Maximum value of error in h2osno conservation error over all columns [kg m-2] - real(r8), parameter :: h2o_warning_thresh = 1.e-9_r8 ! Warning threshhold for error in errh2o and errh2osnow - real(r8), parameter :: error_thresh = 1.e-5_r8 ! Error threshhold for conservation error + real(r8), parameter :: h2o_warning_thresh = 1.e-9_r8 ! Warning threshhold for error in errh2o and errh2osnow !----------------------------------------------------------------------- @@ -892,7 +894,6 @@ subroutine EnergyBalanceCheck( bounds, & real(r8) :: errsoi_col_max_val ! Maximum value of column-level soil/lake energy conservation error over all columns [W m-2] real(r8), parameter :: energy_warning_thresh = 1.e-7_r8 ! Warning threshhold for error in errsol, errsol, errseb, errlonv - real(r8), parameter :: error_thresh = 1.e-5_r8 ! Error threshhold for conservation error !----------------------------------------------------------------------- From 538f11752633e3c4be110b2f7f299c7a16717ec6 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 22 Jan 2026 12:22:24 -0700 Subject: [PATCH 22/57] Call EnergyBalanceCheck at end of SurfaceRadiation. --- src/biogeophys/SurfaceRadiationMod.F90 | 8 +++++++- src/main/clm_driver.F90 | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/biogeophys/SurfaceRadiationMod.F90 b/src/biogeophys/SurfaceRadiationMod.F90 index 5de3ba6e09..6ec4d19ffc 100644 --- a/src/biogeophys/SurfaceRadiationMod.F90 +++ b/src/biogeophys/SurfaceRadiationMod.F90 @@ -457,7 +457,7 @@ end subroutine CanopySunShadeFracs subroutine SurfaceRadiation(bounds, num_nourbanp, filter_nourbanp, & num_urbanp, filter_urbanp, num_urbanc, filter_urbanc, & atm2lnd_inst, waterdiagnosticbulk_inst, canopystate_inst, & - surfalb_inst, solarabs_inst, surfrad_inst) + surfalb_inst, solarabs_inst, surfrad_inst, energyflux_inst) ! ! !DESCRIPTION: ! Solar fluxes absorbed by vegetation and ground surface @@ -482,6 +482,8 @@ subroutine SurfaceRadiation(bounds, num_nourbanp, filter_nourbanp, & use clm_varctl , only : use_subgrid_fluxes, use_snicar_frc, iulog, use_SSRE, do_sno_oc use clm_time_manager , only : get_step_size_real, is_near_local_noon use abortutils , only : endrun + use BalanceCheckMod , only : EnergyBalanceCheck + use EnergyFluxType , only : energyflux_type ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -497,6 +499,7 @@ subroutine SurfaceRadiation(bounds, num_nourbanp, filter_nourbanp, & type(canopystate_type) , intent(inout) :: canopystate_inst type(solarabs_type) , intent(inout) :: solarabs_inst type(surfrad_type) , intent(inout) :: surfrad_inst + type(energyflux_type) , intent(inout) :: energyflux_inst ! ! !LOCAL VARIABLES: integer , parameter :: nband = numrad ! number of solar radiation waveband classes @@ -1020,6 +1023,9 @@ subroutine SurfaceRadiation(bounds, num_nourbanp, filter_nourbanp, & fsr(p) = fsr_vis_d(p) + fsr_nir_d(p) + fsr_vis_i(p) + fsr_nir_i(p) end do + call EnergyBalanceCheck(bounds, atm2lnd_inst, solarabs_inst, surfalb_inst, energyflux_inst, & + canopystate_inst, waterdiagnosticbulk_inst) + end associate end subroutine SurfaceRadiation diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index cf3e13131d..83272f62f1 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -653,7 +653,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro filter(nc)%num_urbanc, filter(nc)%urbanc, & atm2lnd_inst, water_inst%waterdiagnosticbulk_inst, & canopystate_inst, surfalb_inst, & - solarabs_inst, surfrad_inst) + solarabs_inst, surfrad_inst, energyflux_inst) ! Surface Radiation for only urban columns From 43a7a1a0aaed1d24672c5541db9aaf9346accda1 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 22 Jan 2026 13:10:49 -0700 Subject: [PATCH 23/57] Move new EnergyBalanceCheck() call to after UrbanRadiation. --- src/biogeophys/SurfaceRadiationMod.F90 | 8 +------- src/main/clm_driver.F90 | 6 +++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/biogeophys/SurfaceRadiationMod.F90 b/src/biogeophys/SurfaceRadiationMod.F90 index 6ec4d19ffc..5de3ba6e09 100644 --- a/src/biogeophys/SurfaceRadiationMod.F90 +++ b/src/biogeophys/SurfaceRadiationMod.F90 @@ -457,7 +457,7 @@ end subroutine CanopySunShadeFracs subroutine SurfaceRadiation(bounds, num_nourbanp, filter_nourbanp, & num_urbanp, filter_urbanp, num_urbanc, filter_urbanc, & atm2lnd_inst, waterdiagnosticbulk_inst, canopystate_inst, & - surfalb_inst, solarabs_inst, surfrad_inst, energyflux_inst) + surfalb_inst, solarabs_inst, surfrad_inst) ! ! !DESCRIPTION: ! Solar fluxes absorbed by vegetation and ground surface @@ -482,8 +482,6 @@ subroutine SurfaceRadiation(bounds, num_nourbanp, filter_nourbanp, & use clm_varctl , only : use_subgrid_fluxes, use_snicar_frc, iulog, use_SSRE, do_sno_oc use clm_time_manager , only : get_step_size_real, is_near_local_noon use abortutils , only : endrun - use BalanceCheckMod , only : EnergyBalanceCheck - use EnergyFluxType , only : energyflux_type ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -499,7 +497,6 @@ subroutine SurfaceRadiation(bounds, num_nourbanp, filter_nourbanp, & type(canopystate_type) , intent(inout) :: canopystate_inst type(solarabs_type) , intent(inout) :: solarabs_inst type(surfrad_type) , intent(inout) :: surfrad_inst - type(energyflux_type) , intent(inout) :: energyflux_inst ! ! !LOCAL VARIABLES: integer , parameter :: nband = numrad ! number of solar radiation waveband classes @@ -1023,9 +1020,6 @@ subroutine SurfaceRadiation(bounds, num_nourbanp, filter_nourbanp, & fsr(p) = fsr_vis_d(p) + fsr_nir_d(p) + fsr_vis_i(p) + fsr_nir_i(p) end do - call EnergyBalanceCheck(bounds, atm2lnd_inst, solarabs_inst, surfalb_inst, energyflux_inst, & - canopystate_inst, waterdiagnosticbulk_inst) - end associate end subroutine SurfaceRadiation diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 83272f62f1..43ad342559 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -30,6 +30,7 @@ module clm_driver ! use dynSubgridDriverMod , only : dynSubgrid_driver, dynSubgrid_wrapup_weight_changes use BalanceCheckMod , only : WaterGridcellBalance, BeginWaterColumnBalance, BalanceCheck + use BalanceCheckMod , only : EnergyBalanceCheck ! use BiogeophysPreFluxCalcsMod , only : BiogeophysPreFluxCalcs use SurfaceHumidityMod , only : CalculateSurfaceHumidity @@ -653,7 +654,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro filter(nc)%num_urbanc, filter(nc)%urbanc, & atm2lnd_inst, water_inst%waterdiagnosticbulk_inst, & canopystate_inst, surfalb_inst, & - solarabs_inst, surfrad_inst, energyflux_inst) + solarabs_inst, surfrad_inst) ! Surface Radiation for only urban columns @@ -666,6 +667,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro temperature_inst, urbanparams_inst, & solarabs_inst, surfalb_inst, energyflux_inst) + call EnergyBalanceCheck(bounds_clump, atm2lnd_inst, solarabs_inst, surfalb_inst, & + energyflux_inst, canopystate_inst, water_inst%waterdiagnosticbulk_inst) + call t_stopf('surfrad') ! ============================================================================ From 042097b3f02ce91c7337daa35c90f2bb8df64383 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 22 Jan 2026 13:42:20 -0700 Subject: [PATCH 24/57] Move new EnergyBalanceCheck call to right before albedo calculations. --- src/main/clm_driver.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 43ad342559..ad97911736 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -667,9 +667,6 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro temperature_inst, urbanparams_inst, & solarabs_inst, surfalb_inst, energyflux_inst) - call EnergyBalanceCheck(bounds_clump, atm2lnd_inst, solarabs_inst, surfalb_inst, & - energyflux_inst, canopystate_inst, water_inst%waterdiagnosticbulk_inst) - call t_stopf('surfrad') ! ============================================================================ @@ -1274,6 +1271,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call t_stopf('ch4') end if + call EnergyBalanceCheck(bounds_clump, atm2lnd_inst, solarabs_inst, surfalb_inst, & + energyflux_inst, canopystate_inst, water_inst%waterdiagnosticbulk_inst) + ! ============================================================================ ! Determine albedos for next time step ! ============================================================================ From 4478595c705f6652205010fa79bdf58c1653e48b Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 22 Jan 2026 13:57:36 -0700 Subject: [PATCH 25/57] Restore dtime assignment to BalanceCheck. --- src/biogeophys/BalanceCheckMod.F90 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 728674f5e7..39f3eadae3 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -561,6 +561,9 @@ subroutine BalanceCheck( bounds, & qflx_glcice_dyn_water_flux_col => waterflux_inst%qflx_glcice_dyn_water_flux_col & ! Input: [real(r8) (:)] column level water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) ) + ! Get time step + dtime = get_step_size_real() + ! Determine column level incoming snow and rain ! Assume no incident precipitation on urban wall columns (as in CanopyHydrologyMod.F90). From 16b0801a0c46a6f81293db848a2314036ea4a842 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 22 Jan 2026 15:00:00 -0700 Subject: [PATCH 26/57] CropPhase: Factor out new subroutine CropPhase_OnePatch. --- src/biogeochem/CNPhenologyMod.F90 | 63 ++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index fb43c37804..c54766d1c8 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2629,13 +2629,7 @@ subroutine CropPhase(bounds, num_pcropp, filter_pcropp, & ! !DESCRIPTION: ! Get the current phase of each crop patch. ! - ! The returned values (in crop_phase) are from the set of cphase_* values defined in - ! CropType. The returned values in crop_phase are only valid for patches where - ! croplive is true; the values are undefined where croplive is false and should not be - ! used there! - ! - ! This has logic similar to that in CropPhenology. If you make changes here, you - ! should also check if similar changes need to be made in CropPhenology. + ! See CropPhase_OnePatch for more information. ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -2662,20 +2656,7 @@ subroutine CropPhase(bounds, num_pcropp, filter_pcropp, & do fp = 1, num_pcropp p = filter_pcropp(fp) - - if (croplive(p)) then - ! Start with cphase_planted, but this might get changed in the later - ! conditional blocks. - crop_phase(p) = cphase_planted - if (leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p)) then - crop_phase(p) = cphase_leafemerge - else if (hui(p) >= huigrain(p)) then - ! Since we know croplive is true, any hui greater than huigrain implies that - ! we're in the grainfill stage: if we were passt gddmaturity then croplive - ! would be false. - crop_phase(p) = cphase_grainfill - end if - end if + call CropPhase_OnePatch(crop_phase(p), croplive(p), leafout(p), hui(p), huileaf(p), huigrain(p)) end do end associate @@ -2683,6 +2664,46 @@ subroutine CropPhase(bounds, num_pcropp, filter_pcropp, & end subroutine CropPhase + !----------------------------------------------------------------------- + subroutine CropPhase_OnePatch( & + crop_phase, croplive, leafout, hui, huileaf, huigrain & + ) + ! + ! !DESCRIPTION: + ! Get the current phase of a crop patch. + ! + ! The returned values (in crop_phase) are from the set of cphase_* values defined in + ! CropType. The returned values in crop_phase are only valid for patches where + ! croplive is true; the values are undefined where croplive is false and should not be + ! used there! + ! + ! This has logic similar to that in CropPhenology. If you make changes here, you + ! should also check if similar changes need to be made in CropPhenology. + ! + ! !ARGUMENTS: + real(r8), intent(inout) :: crop_phase ! In/out: [real(r8)] crop phase + logical , intent(in) :: croplive ! Input: [logical] Flag, true if planted, not harvested + real(r8), intent(in) :: leafout ! Input: [real(r8)] gdd from top soil layer temperature + real(r8), intent(in) :: hui ! Input: [real(r8)] gdd since planting (gddplant) + real(r8), intent(in) :: huileaf ! Input: [real(r8)] heat unit index needed from planting to leaf emergence + real(r8), intent(in) :: huigrain ! Input: [real(r8)] same to reach vegetative maturity + + if (croplive) then + ! Start with cphase_planted, but this might get changed in the later + ! conditional blocks. + crop_phase = cphase_planted + if (leafout >= huileaf .and. hui < huigrain) then + crop_phase = cphase_leafemerge + else if (hui >= huigrain) then + ! Since we know croplive is true, any hui greater than huigrain implies that + ! we're in the grainfill stage: if we were passt gddmaturity then croplive + ! would be false. + crop_phase = cphase_grainfill + end if + end if + end subroutine CropPhase_OnePatch + + !----------------------------------------------------------------------- subroutine CropPhenologyInit(bounds) ! From b870b8bcd34e010451dbbe51c8185b09e28507f9 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 22 Jan 2026 16:14:52 -0700 Subject: [PATCH 27/57] CropPhase(): Remove associate(). --- src/biogeochem/CNPhenologyMod.F90 | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index c54766d1c8..2151b331e6 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2646,21 +2646,17 @@ subroutine CropPhase(bounds, num_pcropp, filter_pcropp, & !----------------------------------------------------------------------- SHR_ASSERT_ALL_FL((ubound(crop_phase) == [bounds%endp]), sourcefile, __LINE__) - associate( & - croplive => crop_inst%croplive_patch , & ! Input: [logical (:) ] Flag, true if planted, not harvested - hui => crop_inst%hui_patch , & ! Input: [real(r8) (:) ] gdd since planting (gddplant) - leafout => crop_inst%gddtsoi_patch , & ! Input: [real(r8) (:) ] gdd from top soil layer temperature - huileaf => cnveg_state_inst%huileaf_patch , & ! Input: [real(r8) (:) ] heat unit index needed from planting to leaf emergence - huigrain => cnveg_state_inst%huigrain_patch & ! Input: [real(r8) (:) ] same to reach vegetative maturity - ) - do fp = 1, num_pcropp p = filter_pcropp(fp) - call CropPhase_OnePatch(crop_phase(p), croplive(p), leafout(p), hui(p), huileaf(p), huigrain(p)) + call CropPhase_OnePatch( & + crop_phase(p), & + crop_inst%croplive_patch(p), & + crop_inst%gddtsoi_patch(p), & + crop_inst%hui_patch(p), & + cnveg_state_inst%huileaf_patch(p), & + cnveg_state_inst%huigrain_patch(p)) end do - end associate - end subroutine CropPhase From 023631eb4110751afdb1e0fcc02bac3db1ebf81c Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 23 Jan 2026 15:40:46 -0700 Subject: [PATCH 28/57] Fix pre-existing typo. Co-authored-by: Samuel Levis --- src/biogeochem/CNPhenologyMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 2151b331e6..e4b9c01abd 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2692,7 +2692,7 @@ subroutine CropPhase_OnePatch( & crop_phase = cphase_leafemerge else if (hui >= huigrain) then ! Since we know croplive is true, any hui greater than huigrain implies that - ! we're in the grainfill stage: if we were passt gddmaturity then croplive + ! we're in the grainfill stage: if we were past gddmaturity then croplive ! would be false. crop_phase = cphase_grainfill end if From 71123fad032c3e3334cba3935dc973acc5a5680d Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 28 Jan 2026 16:19:50 -0700 Subject: [PATCH 29/57] Move CropPhaseTransitionBiomass from CropType to CNPhenology. --- src/biogeochem/CNPhenologyMod.F90 | 79 ++++++++++++++++++- src/biogeochem/CropType.F90 | 70 ---------------- .../test_CropPhaseTransitionBiomass.pf | 27 ++++--- 3 files changed, 90 insertions(+), 86 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index db0512e030..30e4626ea9 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -69,6 +69,7 @@ module CNPhenologyMod public :: SeasonalCriticalDaylength ! Critical day length needed for Seasonal decidious offset public :: get_swindow public :: was_sown_in_this_window + public :: CropPhaseTransitionBiomass ! !PRIVITE MEMBER FIUNCTIONS: private :: CNPhenologyClimate ! Get climatological everages to figure out triggers for Phenology @@ -2538,7 +2539,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & if ((.not. do_harvest) .and. leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p) .and. idpp < mxmat) then cphase(p) = cphase_leafemerge if (cphase(p) /= cphase_orig) then - call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst) end if if (abs(onset_counter(p)) > 1.e-6_r8) then onset_flag(p) = 1._r8 @@ -2570,7 +2571,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ! Unlike other calls of CropPhaseTransitionBiomass(), we don't need a check for ! cphase(p) /= cphase_orig here. This is because do_harvest already implies we're at ! a phase transition: "cphase(p) isn't cphase_harvest but now it should be." - call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst, is_mature) + call CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst, is_mature) ! Don't update these if you're just harvesting because of incorrect Dec. ! 31 planting @@ -2643,7 +2644,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & else if (hui(p) >= huigrain(p)) then cphase(p) = cphase_grainfill if (cphase(p) /= cphase_orig) then - call crop_inst%CropPhaseTransitionBiomass(p, cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst) end if bglfr(p) = 1._r8/(leaf_long(ivt(p))*avg_dayspyr*secspday) end if @@ -2765,6 +2766,78 @@ subroutine CropPhase_OnePatch( & end subroutine CropPhase_OnePatch + !----------------------------------------------------------------------- + subroutine CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst, is_mature) + ! + ! !DESCRIPTION: + ! Update crop-phase-transition biomass history outputs for a patch. Should only be called AT + ! the phase transition---i.e., immediately after cphase is changed. + ! + ! !USES: + use CNVegCarbonStateType, only : cnveg_carbonstate_type + use CropType, only : cphase_not_planted, cphase_planted, cphase_leafemerge + use CropType, only : cphase_grainfill, cphase_harvest + ! + ! !ARGUMENTS: + class(crop_type) :: crop_inst + integer , intent(in) :: p ! Patch index + type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst + logical , intent(in), optional :: is_mature + ! + ! !LOCALS: + real(r8) :: frootc, livecrootc, livestemc, leafc, reprc + + call shr_assert(crop_inst%cphase_patch(p) >= cphase_not_planted, msg="cphase < cphase_not_planted", & + file=__FILE__, line=__LINE__) + call shr_assert(crop_inst%cphase_patch(p) <= cphase_harvest, msg="cphase > cphase_harvest", & + file=__FILE__, line=__LINE__) + + frootc = cnveg_carbonstate_inst%frootc_patch(p) + livecrootc = cnveg_carbonstate_inst%livecrootc_patch(p) + livestemc = cnveg_carbonstate_inst%livestemc_patch(p) + leafc = cnveg_carbonstate_inst%leafc_patch(p) + ! sum over all grain tisues and destinations + reprc = sum(cnveg_carbonstate_inst%reproductivec_patch(p,:)) + + if (crop_inst%cphase_patch(p) >= cphase_leafemerge .and. crop_inst%frootc_emergence_patch(p) < 0._r8) then + crop_inst%frootc_emergence_patch(p) = frootc + crop_inst%livecrootc_emergence_patch(p) = livecrootc + crop_inst%livestemc_emergence_patch(p) = livestemc + crop_inst%leafc_emergence_patch(p) = leafc + crop_inst%reprc_emergence_patch(p) = reprc + end if + + if (crop_inst%cphase_patch(p) >= cphase_grainfill .and. crop_inst%frootc_anthesis_patch(p) < 0._r8) then + crop_inst%frootc_anthesis_patch(p) = frootc + crop_inst%livecrootc_anthesis_patch(p) = livecrootc + crop_inst%livestemc_anthesis_patch(p) = livestemc + crop_inst%leafc_anthesis_patch(p) = leafc + crop_inst%reprc_anthesis_patch(p) = reprc + end if + + ! Don't need >= etc. here because harvest is the maximum (final) phase (as checked above) + if (crop_inst%cphase_patch(p) == cphase_harvest) then + crop_inst%frootc_harvest_patch(p) = frootc + crop_inst%livecrootc_harvest_patch(p) = livecrootc + crop_inst%livestemc_harvest_patch(p) = livestemc + crop_inst%leafc_harvest_patch(p) = leafc + crop_inst%reprc_harvest_patch(p) = reprc + + if (.not. present(is_mature)) then + call endrun(msg=' ERROR: When called at harvest, CropPhaseTransitionBiomass() needs argument is_mature') + end if + if (is_mature) then + crop_inst%frootc_maturity_patch(p) = frootc + crop_inst%livecrootc_maturity_patch(p) = livecrootc + crop_inst%livestemc_maturity_patch(p) = livestemc + crop_inst%leafc_maturity_patch(p) = leafc + crop_inst%reprc_maturity_patch(p) = reprc + end if + end if + + end subroutine CropPhaseTransitionBiomass + + !----------------------------------------------------------------------- subroutine CropPhenologyInit(bounds) ! diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 index 31621fb0f1..cfd2fe519f 100644 --- a/src/biogeochem/CropType.F90 +++ b/src/biogeochem/CropType.F90 @@ -135,7 +135,6 @@ module CropType procedure, public :: CropUpdateAccVars procedure, public :: CropIncrementYear - procedure, public :: CropPhaseTransitionBiomass ! Private routines procedure, private :: InitAllocate @@ -1340,75 +1339,6 @@ subroutine CropIncrementYear (this, num_pcropp, filter_pcropp) end subroutine CropIncrementYear - !----------------------------------------------------------------------- - subroutine CropPhaseTransitionBiomass (this, p, cnveg_carbonstate_inst, is_mature) - ! - ! !DESCRIPTION: - ! Update crop-phase-transition biomass history outputs for a patch. Should only be called AT - ! the phase transition---i.e., immediately after cphase is changed. - ! - ! !USES: - use CNVegCarbonStateType, only : cnveg_carbonstate_type - ! - ! !ARGUMENTS: - class(crop_type) :: this - integer , intent(in) :: p ! Patch index - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - logical , intent(in), optional :: is_mature - ! - ! !LOCALS: - real(r8) :: frootc, livecrootc, livestemc, leafc, reprc - - call shr_assert(this%cphase_patch(p) >= cphase_not_planted, msg="cphase < cphase_not_planted", & - file=__FILE__, line=__LINE__) - call shr_assert(this%cphase_patch(p) <= cphase_harvest, msg="cphase > cphase_harvest", & - file=__FILE__, line=__LINE__) - - frootc = cnveg_carbonstate_inst%frootc_patch(p) - livecrootc = cnveg_carbonstate_inst%livecrootc_patch(p) - livestemc = cnveg_carbonstate_inst%livestemc_patch(p) - leafc = cnveg_carbonstate_inst%leafc_patch(p) - ! sum over all grain tisues and destinations - reprc = sum(cnveg_carbonstate_inst%reproductivec_patch(p,:)) - - if (this%cphase_patch(p) >= cphase_leafemerge .and. this%frootc_emergence_patch(p) < 0._r8) then - this%frootc_emergence_patch(p) = frootc - this%livecrootc_emergence_patch(p) = livecrootc - this%livestemc_emergence_patch(p) = livestemc - this%leafc_emergence_patch(p) = leafc - this%reprc_emergence_patch(p) = reprc - end if - - if (this%cphase_patch(p) >= cphase_grainfill .and. this%frootc_anthesis_patch(p) < 0._r8) then - this%frootc_anthesis_patch(p) = frootc - this%livecrootc_anthesis_patch(p) = livecrootc - this%livestemc_anthesis_patch(p) = livestemc - this%leafc_anthesis_patch(p) = leafc - this%reprc_anthesis_patch(p) = reprc - end if - - ! Don't need >= etc. here because harvest is the maximum (final) phase (as checked above) - if (this%cphase_patch(p) == cphase_harvest) then - this%frootc_harvest_patch(p) = frootc - this%livecrootc_harvest_patch(p) = livecrootc - this%livestemc_harvest_patch(p) = livestemc - this%leafc_harvest_patch(p) = leafc - this%reprc_harvest_patch(p) = reprc - - if (.not. present(is_mature)) then - call endrun(msg=' ERROR: When called at harvest, CropPhaseTransitionBiomass() needs argument is_mature') - end if - if (is_mature) then - this%frootc_maturity_patch(p) = frootc - this%livecrootc_maturity_patch(p) = livecrootc - this%livestemc_maturity_patch(p) = livestemc - this%leafc_maturity_patch(p) = leafc - this%reprc_maturity_patch(p) = reprc - end if - end if - - end subroutine CropPhaseTransitionBiomass - !----------------------------------------------------------------------- subroutine checkDates( ) ! diff --git a/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf b/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf index d8b4b77bd9..d4963d1a97 100644 --- a/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf +++ b/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf @@ -16,6 +16,7 @@ module test_CropPhaseTransitionBiomass use shr_kind_mod , only : r8 => shr_kind_r8 use CNVegCarbonStateType, only : cnveg_carbonstate_type use CropReprPoolsMod, only : nrepr + use CNPhenologyMod, only : CropPhaseTransitionBiomass implicit none @@ -97,7 +98,7 @@ contains class(TestCropType), intent(inout) :: this this%crop_inst%cphase_patch(pi) = cphase_not_planted - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst) @assertLessThan(this%crop_inst%frootc_emergence_patch(pi), 0._r8) @assertLessThan(this%crop_inst%livecrootc_emergence_patch(pi), 0._r8) @@ -131,7 +132,7 @@ contains class(TestCropType), intent(inout) :: this this%crop_inst%cphase_patch(pi) = cphase_planted - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst) @assertLessThan(this%crop_inst%frootc_emergence_patch(pi), 0._r8) @assertLessThan(this%crop_inst%livecrootc_emergence_patch(pi), 0._r8) @@ -165,7 +166,7 @@ contains class(TestCropType), intent(inout) :: this this%crop_inst%cphase_patch(pi) = cphase_leafemerge - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst) @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) @@ -200,14 +201,14 @@ contains ! Before reaching grainfill, the crop should have gone through leafemerge this%crop_inst%cphase_patch(pi) = cphase_leafemerge - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst) ! Increase biomass pools before moving to next phase call this%increase_biomass_pools(5._r8) ! Now save status at anthesis this%crop_inst%cphase_patch(pi) = cphase_grainfill - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst) @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) @@ -242,21 +243,21 @@ contains ! Before reaching grainfill, the crop should have gone through leafemerge this%crop_inst%cphase_patch(pi) = cphase_leafemerge - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst) ! Increase biomass pools before moving to next phase call this%increase_biomass_pools(5._r8) ! Now save status at anthesis this%crop_inst%cphase_patch(pi) = cphase_grainfill - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst) ! Increase biomass pools before moving to next phase call this%increase_biomass_pools(5._r8) ! Now save status at harvest this%crop_inst%cphase_patch(pi) = cphase_harvest - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst, is_mature=.false.) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, is_mature=.false.) @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) @@ -291,21 +292,21 @@ contains ! Before reaching grainfill, the crop should have gone through leafemerge this%crop_inst%cphase_patch(pi) = cphase_leafemerge - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst) ! Increase biomass pools before moving to next phase call this%increase_biomass_pools(5._r8) ! Now save status at anthesis this%crop_inst%cphase_patch(pi) = cphase_grainfill - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst) ! Increase biomass pools before moving to next phase call this%increase_biomass_pools(5._r8) ! Now save status at harvest this%crop_inst%cphase_patch(pi) = cphase_harvest - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst, is_mature=.true.) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, is_mature=.true.) @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) @@ -341,7 +342,7 @@ contains ! Save status at anthesis this%crop_inst%cphase_patch(pi) = cphase_grainfill - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst) @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) @@ -376,7 +377,7 @@ contains class(TestCropType), intent(inout) :: this this%crop_inst%cphase_patch(pi) = cphase_harvest - call this%crop_inst%CropPhaseTransitionBiomass(pi, this%cnveg_carbonstate_inst, is_mature=.true.) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, is_mature=.true.) @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) From 9af60cb51e06ec6876dcd088ac4a8185f799ee72 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 28 Jan 2026 16:42:15 -0700 Subject: [PATCH 30/57] test_CropPhaseTransitionBiomass: Add two failing tests. --- .../test_CropPhaseTransitionBiomass.pf | 76 ++++++++++++++++++- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf b/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf index d4963d1a97..60eeee1184 100644 --- a/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf +++ b/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf @@ -237,8 +237,8 @@ contains end subroutine test_grainfill @Test - subroutine test_harvest_immature(this) - ! If called at harvest before maturity, only maturity variables should be set + subroutine test_harvest_never_mature(this) + ! If called at harvest before maturity, _maturity_ variables should be unset class(TestCropType), intent(inout) :: this ! Before reaching grainfill, the crop should have gone through leafemerge @@ -283,7 +283,77 @@ contains @assertEqual(14._r8, this%crop_inst%leafc_harvest_patch(pi)) @assertEqual(15._r8 * nrepr, this%crop_inst%reprc_harvest_patch(pi)) - end subroutine test_harvest_immature + end subroutine test_harvest_never_mature + + @Test + subroutine test_direct_to_harvest_never_grainfill(this) + ! If calling during harvest that was reached without entering grain filling period, both + ! _anthesis_ and _maturity_ variables should be unset + class(TestCropType), intent(inout) :: this + + this%crop_inst%cphase_patch(pi) = cphase_harvest + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, is_mature=.false.) + + @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_emergence_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_emergence_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_emergence_patch(pi)) + + @assertLessThan(this%crop_inst%frootc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_anthesis_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_maturity_patch(pi), 0._r8) + + @assertEqual(1._r8, this%crop_inst%frootc_harvest_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_harvest_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_harvest_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_harvest_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_harvest_patch(pi)) + + end subroutine test_direct_to_harvest_never_grainfill + + @Test + subroutine test_direct_to_harvest_never_leafemerge(this) + ! If calling during harvest that was reached before leaf emergence, only _harvest_ variables + ! should be set + class(TestCropType), intent(inout) :: this + + this%crop_inst%cphase_patch(pi) = cphase_harvest + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, is_mature=.false.) + + @assertLessThan(this%crop_inst%frootc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_emergence_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_emergence_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_anthesis_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_anthesis_patch(pi), 0._r8) + + @assertLessThan(this%crop_inst%frootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livecrootc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%livestemc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%leafc_maturity_patch(pi), 0._r8) + @assertLessThan(this%crop_inst%reprc_maturity_patch(pi), 0._r8) + + @assertEqual(1._r8, this%crop_inst%frootc_harvest_patch(pi)) + @assertEqual(2._r8, this%crop_inst%livecrootc_harvest_patch(pi)) + @assertEqual(3._r8, this%crop_inst%livestemc_harvest_patch(pi)) + @assertEqual(4._r8, this%crop_inst%leafc_harvest_patch(pi)) + @assertEqual(5._r8 * nrepr, this%crop_inst%reprc_harvest_patch(pi)) + + end subroutine test_direct_to_harvest_never_leafemerge @Test subroutine test_harvest_mature(this) From d792a2f9682d5c3264e11e1161a53dcdd432651d Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 28 Jan 2026 17:20:20 -0700 Subject: [PATCH 31/57] CropPhaseTransitionBiomass(): Consider whether crop actually reached leafout and grainfill. --- src/biogeochem/CNPhenologyMod.F90 | 48 +++++++++--- .../test_CropPhaseTransitionBiomass.pf | 73 +++++++++++++++++-- 2 files changed, 102 insertions(+), 19 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 30e4626ea9..3b17f5e40c 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -35,6 +35,7 @@ module CNPhenologyMod use CNVegnitrogenstateType , only : cnveg_nitrogenstate_type use CNVegnitrogenfluxType , only : cnveg_nitrogenflux_type use CropType , only : crop_type + use CropType , only : cphase_not_planted use CropType , only : cphase_planted, cphase_leafemerge use CropType , only : cphase_grainfill, cphase_harvest use pftconMod , only : pftcon @@ -70,6 +71,7 @@ module CNPhenologyMod public :: get_swindow public :: was_sown_in_this_window public :: CropPhaseTransitionBiomass + public :: CropPhase_OnePatch ! !PRIVITE MEMBER FIUNCTIONS: private :: CNPhenologyClimate ! Get climatological everages to figure out triggers for Phenology @@ -2571,7 +2573,8 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ! Unlike other calls of CropPhaseTransitionBiomass(), we don't need a check for ! cphase(p) /= cphase_orig here. This is because do_harvest already implies we're at ! a phase transition: "cphase(p) isn't cphase_harvest but now it should be." - call CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst, is_mature) + call CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst, is_mature, & + cnveg_state_inst%huileaf_patch(p), cnveg_state_inst%huigrain_patch(p)) ! Don't update these if you're just harvesting because of incorrect Dec. ! 31 planting @@ -2767,7 +2770,7 @@ end subroutine CropPhase_OnePatch !----------------------------------------------------------------------- - subroutine CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst, is_mature) + subroutine CropPhaseTransitionBiomass (crop_inst, p, cnveg_carbonstate_inst, is_mature, huileaf, huigrain) ! ! !DESCRIPTION: ! Update crop-phase-transition biomass history outputs for a patch. Should only be called AT @@ -2775,21 +2778,45 @@ subroutine CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst, is_m ! ! !USES: use CNVegCarbonStateType, only : cnveg_carbonstate_type - use CropType, only : cphase_not_planted, cphase_planted, cphase_leafemerge - use CropType, only : cphase_grainfill, cphase_harvest ! ! !ARGUMENTS: class(crop_type) :: crop_inst integer , intent(in) :: p ! Patch index type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst logical , intent(in), optional :: is_mature + real(r8), intent(in), optional :: huileaf ! fractional maturity threshold for leaf emergence + real(r8), intent(in), optional :: huigrain ! fractional maturity threshold for grain fill to start ! ! !LOCALS: real(r8) :: frootc, livecrootc, livestemc, leafc, reprc + logical :: called_at_harvest ! whether crop_inst subroutine is being called at time of harvest + real(r8) :: actual_cphase ! the latest crop phase (not including "harvest") the crop has reached + + ! If we're calling at harvest, crop_inst%cphase_patch will not be informative as to which crop + ! development phases the crop actually reached during the growing season. Thus, we call + ! CropPhase_OnePatch() to get "actual" crop phase. + called_at_harvest = crop_inst%cphase_patch(p) == cphase_harvest + if (called_at_harvest) then + if (.not. (present(huileaf) .and. present(huigrain) .and. present(is_mature))) then + call endrun( msg=' ERROR: When called at harvest, CropPhaseTransitionBiomass() needs arguments is_mature, huileaf, and huigrain') + end if + call CropPhase_OnePatch(actual_cphase, crop_inst%croplive_patch(p), & + crop_inst%gddtsoi_patch(p), crop_inst%hui_patch(p), huileaf, huigrain) + + ! Sense checks + if (is_mature) then + call shr_assert(actual_cphase == cphase_grainfill) + end if + if (actual_cphase < cphase_grainfill) then + call shr_assert(.not. is_mature) + end if + else + actual_cphase = crop_inst%cphase_patch(p) + end if - call shr_assert(crop_inst%cphase_patch(p) >= cphase_not_planted, msg="cphase < cphase_not_planted", & + call shr_assert(actual_cphase >= cphase_not_planted, msg="cphase < cphase_not_planted", & file=__FILE__, line=__LINE__) - call shr_assert(crop_inst%cphase_patch(p) <= cphase_harvest, msg="cphase > cphase_harvest", & + call shr_assert(actual_cphase <= cphase_harvest, msg="cphase > cphase_harvest", & file=__FILE__, line=__LINE__) frootc = cnveg_carbonstate_inst%frootc_patch(p) @@ -2799,7 +2826,7 @@ subroutine CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst, is_m ! sum over all grain tisues and destinations reprc = sum(cnveg_carbonstate_inst%reproductivec_patch(p,:)) - if (crop_inst%cphase_patch(p) >= cphase_leafemerge .and. crop_inst%frootc_emergence_patch(p) < 0._r8) then + if (actual_cphase >= cphase_leafemerge .and. crop_inst%frootc_emergence_patch(p) < 0._r8) then crop_inst%frootc_emergence_patch(p) = frootc crop_inst%livecrootc_emergence_patch(p) = livecrootc crop_inst%livestemc_emergence_patch(p) = livestemc @@ -2807,7 +2834,7 @@ subroutine CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst, is_m crop_inst%reprc_emergence_patch(p) = reprc end if - if (crop_inst%cphase_patch(p) >= cphase_grainfill .and. crop_inst%frootc_anthesis_patch(p) < 0._r8) then + if (actual_cphase >= cphase_grainfill .and. crop_inst%frootc_anthesis_patch(p) < 0._r8) then crop_inst%frootc_anthesis_patch(p) = frootc crop_inst%livecrootc_anthesis_patch(p) = livecrootc crop_inst%livestemc_anthesis_patch(p) = livestemc @@ -2816,16 +2843,13 @@ subroutine CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst, is_m end if ! Don't need >= etc. here because harvest is the maximum (final) phase (as checked above) - if (crop_inst%cphase_patch(p) == cphase_harvest) then + if (called_at_harvest) then crop_inst%frootc_harvest_patch(p) = frootc crop_inst%livecrootc_harvest_patch(p) = livecrootc crop_inst%livestemc_harvest_patch(p) = livestemc crop_inst%leafc_harvest_patch(p) = leafc crop_inst%reprc_harvest_patch(p) = reprc - if (.not. present(is_mature)) then - call endrun(msg=' ERROR: When called at harvest, CropPhaseTransitionBiomass() needs argument is_mature') - end if if (is_mature) then crop_inst%frootc_maturity_patch(p) = frootc crop_inst%livecrootc_maturity_patch(p) = livecrootc diff --git a/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf b/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf index 60eeee1184..9075c64489 100644 --- a/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf +++ b/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf @@ -16,7 +16,7 @@ module test_CropPhaseTransitionBiomass use shr_kind_mod , only : r8 => shr_kind_r8 use CNVegCarbonStateType, only : cnveg_carbonstate_type use CropReprPoolsMod, only : nrepr - use CNPhenologyMod, only : CropPhaseTransitionBiomass + use CNPhenologyMod, only : CropPhaseTransitionBiomass, CropPhase_OnePatch implicit none @@ -53,6 +53,7 @@ contains call this%crop_inst%Init(bounds) call this%crop_inst%InitPlantCrop(pi) + this%crop_inst%croplive_patch(pi) = .true. call this%cnveg_carbonstate_inst%InitAllocate(bounds, .true.) this%cnveg_carbonstate_inst%frootc_patch(pi) = 1._r8 @@ -240,6 +241,7 @@ contains subroutine test_harvest_never_mature(this) ! If called at harvest before maturity, _maturity_ variables should be unset class(TestCropType), intent(inout) :: this + real(r8) :: huileaf, huigrain, actual_cphase ! Before reaching grainfill, the crop should have gone through leafemerge this%crop_inst%cphase_patch(pi) = cphase_leafemerge @@ -255,9 +257,19 @@ contains ! Increase biomass pools before moving to next phase call this%increase_biomass_pools(5._r8) + ! We need "actual" crop phase to be cphase_grainfill + this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 ! aka "leafout" + huileaf = 0.2_r8 + this%crop_inst%hui_patch(pi) = 0.8_r8 + huigrain = 0.7_r8 + call CropPhase_OnePatch(actual_cphase, this%crop_inst%croplive_patch(pi), & + this%crop_inst%gddtsoi_patch(pi), this%crop_inst%hui_patch(pi), huileaf, huigrain) + @assertEqual(actual_cphase, cphase_grainfill) + ! Now save status at harvest this%crop_inst%cphase_patch(pi) = cphase_harvest - call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, is_mature=.false.) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, & + is_mature=.false., huileaf=huileaf, huigrain=huigrain) @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) @@ -290,9 +302,21 @@ contains ! If calling during harvest that was reached without entering grain filling period, both ! _anthesis_ and _maturity_ variables should be unset class(TestCropType), intent(inout) :: this + real(r8) :: huileaf, huigrain, actual_cphase + + ! We need "actual" crop phase to be cphase_leafemerge + this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 ! aka "leafout" + huileaf = 0.2_r8 + this%crop_inst%hui_patch(pi) = 0.6_r8 + huigrain = 0.7_r8 + call CropPhase_OnePatch(actual_cphase, this%crop_inst%croplive_patch(pi), & + this%crop_inst%gddtsoi_patch(pi), this%crop_inst%hui_patch(pi), huileaf, huigrain) + @assertEqual(actual_cphase, cphase_leafemerge) + ! Now save status at harvest this%crop_inst%cphase_patch(pi) = cphase_harvest - call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, is_mature=.false.) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, & + is_mature=.false., huileaf=huileaf, huigrain=huigrain) @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) @@ -325,9 +349,21 @@ contains ! If calling during harvest that was reached before leaf emergence, only _harvest_ variables ! should be set class(TestCropType), intent(inout) :: this + real(r8) :: huileaf, huigrain, actual_cphase + ! We need "actual" crop phase to be cphase_planted + this%crop_inst%gddtsoi_patch(pi) = 0.0_r8 ! aka "leafout" + huileaf = 0.2_r8 + this%crop_inst%hui_patch(pi) = 0.0_r8 + huigrain = 0.7_r8 + call CropPhase_OnePatch(actual_cphase, this%crop_inst%croplive_patch(pi), & + this%crop_inst%gddtsoi_patch(pi), this%crop_inst%hui_patch(pi), huileaf, huigrain) + @assertEqual(actual_cphase, cphase_planted) + + ! Now save status at harvest this%crop_inst%cphase_patch(pi) = cphase_harvest - call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, is_mature=.false.) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, & + is_mature=.false., huileaf=huileaf, huigrain=huigrain) @assertLessThan(this%crop_inst%frootc_emergence_patch(pi), 0._r8) @assertLessThan(this%crop_inst%livecrootc_emergence_patch(pi), 0._r8) @@ -359,6 +395,7 @@ contains subroutine test_harvest_mature(this) ! If called at harvest after maturity, all variables should be set class(TestCropType), intent(inout) :: this + real(r8) :: huileaf, huigrain, actual_cphase ! Before reaching grainfill, the crop should have gone through leafemerge this%crop_inst%cphase_patch(pi) = cphase_leafemerge @@ -374,9 +411,19 @@ contains ! Increase biomass pools before moving to next phase call this%increase_biomass_pools(5._r8) - ! Now save status at harvest + ! We need "actual" crop phase to be cphase_grainfill + this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 ! aka "leafout" + huileaf = 0.2_r8 + this%crop_inst%hui_patch(pi) = 0.8_r8 + huigrain = 0.7_r8 + call CropPhase_OnePatch(actual_cphase, this%crop_inst%croplive_patch(pi), & + this%crop_inst%gddtsoi_patch(pi), this%crop_inst%hui_patch(pi), huileaf, huigrain) + @assertEqual(actual_cphase, cphase_grainfill) + + ! Now save status at harvest. this%crop_inst%cphase_patch(pi) = cphase_harvest - call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, is_mature=.true.) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, & + is_mature=.true., huileaf=huileaf, huigrain=huigrain) @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) @@ -445,9 +492,21 @@ contains ! If calling during mature harvest that was reached without a timestep in leafemerge or ! grainfill, all variables should be filled. class(TestCropType), intent(inout) :: this + real(r8) :: huileaf, huigrain, actual_cphase + ! We need "actual" crop phase to be cphase_grainfill + this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 ! aka "leafout" + huileaf = 0.2_r8 + this%crop_inst%hui_patch(pi) = 0.8_r8 + huigrain = 0.7_r8 + call CropPhase_OnePatch(actual_cphase, this%crop_inst%croplive_patch(pi), & + this%crop_inst%gddtsoi_patch(pi), this%crop_inst%hui_patch(pi), huileaf, huigrain) + @assertEqual(actual_cphase, cphase_grainfill) + + ! Now save status at harvest this%crop_inst%cphase_patch(pi) = cphase_harvest - call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, is_mature=.true.) + call CropPhaseTransitionBiomass(this%crop_inst, pi, this%cnveg_carbonstate_inst, & + is_mature=.true., huileaf=huileaf, huigrain=huigrain) @assertEqual(1._r8, this%crop_inst%frootc_emergence_patch(pi)) @assertEqual(2._r8, this%crop_inst%livecrootc_emergence_patch(pi)) From e8c571056699f14bf74dd2cb563a51ebcbd4a3b8 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 28 Jan 2026 17:24:32 -0700 Subject: [PATCH 32/57] Delete an extraneous space. --- src/biogeochem/CNPhenologyMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 3b17f5e40c..a748a6f1ca 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2770,7 +2770,7 @@ end subroutine CropPhase_OnePatch !----------------------------------------------------------------------- - subroutine CropPhaseTransitionBiomass (crop_inst, p, cnveg_carbonstate_inst, is_mature, huileaf, huigrain) + subroutine CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst, is_mature, huileaf, huigrain) ! ! !DESCRIPTION: ! Update crop-phase-transition biomass history outputs for a patch. Should only be called AT From 29bfcf210fe2589b5627d8083e2a590a6e76580c Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 29 Jan 2026 14:32:31 -0700 Subject: [PATCH 33/57] Rename leafout to gddtsoi. --- src/biogeochem/CNPhenologyMod.F90 | 10 +++++----- .../test_CropPhaseTransitionBiomass.pf | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index a748a6f1ca..12695c9aee 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -2100,7 +2100,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & fertnitro => crop_inst%fertnitro_patch , & ! Input: [real(r8) (:) ] fertilizer nitrogen hui => crop_inst%hui_patch , & ! Input: [real(r8) (:) ] crop patch heat unit index (growing degree-days); set to 0 at sowing and accumulated until harvest max_tlai => crop_inst%max_tlai_patch , & ! Input: [real(r8) (:) ] maximum total projected leaf area seen this season (m2/m2); set to 0 at sowing and tracked until harvest - leafout => crop_inst%gddtsoi_patch , & ! Input: [real(r8) (:) ] gdd from top soil layer temperature + gddtsoi => crop_inst%gddtsoi_patch , & ! Input: [real(r8) (:) ] gdd from top soil layer temperature harvdate => crop_inst%harvdate_patch , & ! Output: [integer (:) ] harvest date croplive => crop_inst%croplive_patch , & ! Output: [logical (:) ] Flag, true if planted, not harvested vf => crop_inst%vf_patch , & ! Output: [real(r8) (:) ] vernalization factor @@ -2538,7 +2538,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , & ! phase. However, despite these differences: if you make changes to the ! following conditionals, you should also check to see if you should make ! similar changes in CropPhase. - if ((.not. do_harvest) .and. leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p) .and. idpp < mxmat) then + if ((.not. do_harvest) .and. gddtsoi(p) >= huileaf(p) .and. hui(p) < huigrain(p) .and. idpp < mxmat) then cphase(p) = cphase_leafemerge if (cphase(p) /= cphase_orig) then call CropPhaseTransitionBiomass(crop_inst, p, cnveg_carbonstate_inst) @@ -2731,7 +2731,7 @@ end subroutine CropPhase !----------------------------------------------------------------------- subroutine CropPhase_OnePatch( & - crop_phase, croplive, leafout, hui, huileaf, huigrain & + crop_phase, croplive, gddtsoi, hui, huileaf, huigrain & ) ! ! !DESCRIPTION: @@ -2748,7 +2748,7 @@ subroutine CropPhase_OnePatch( & ! !ARGUMENTS: real(r8), intent(inout) :: crop_phase ! In/out: [real(r8)] crop phase logical , intent(in) :: croplive ! Input: [logical] Flag, true if planted, not harvested - real(r8), intent(in) :: leafout ! Input: [real(r8)] gdd from top soil layer temperature + real(r8), intent(in) :: gddtsoi ! Input: [real(r8)] gdd from top soil layer temperature real(r8), intent(in) :: hui ! Input: [real(r8)] gdd since planting (gddplant) real(r8), intent(in) :: huileaf ! Input: [real(r8)] heat unit index needed from planting to leaf emergence real(r8), intent(in) :: huigrain ! Input: [real(r8)] same to reach vegetative maturity @@ -2757,7 +2757,7 @@ subroutine CropPhase_OnePatch( & ! Start with cphase_planted, but this might get changed in the later ! conditional blocks. crop_phase = cphase_planted - if (leafout >= huileaf .and. hui < huigrain) then + if (gddtsoi >= huileaf .and. hui < huigrain) then crop_phase = cphase_leafemerge else if (hui >= huigrain) then ! Since we know croplive is true, any hui greater than huigrain implies that diff --git a/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf b/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf index 9075c64489..98a6bdc5c7 100644 --- a/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf +++ b/src/biogeochem/test/CropPhaseTransitionBiomass_test/test_CropPhaseTransitionBiomass.pf @@ -258,7 +258,7 @@ contains call this%increase_biomass_pools(5._r8) ! We need "actual" crop phase to be cphase_grainfill - this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 ! aka "leafout" + this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 huileaf = 0.2_r8 this%crop_inst%hui_patch(pi) = 0.8_r8 huigrain = 0.7_r8 @@ -305,7 +305,7 @@ contains real(r8) :: huileaf, huigrain, actual_cphase ! We need "actual" crop phase to be cphase_leafemerge - this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 ! aka "leafout" + this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 huileaf = 0.2_r8 this%crop_inst%hui_patch(pi) = 0.6_r8 huigrain = 0.7_r8 @@ -352,7 +352,7 @@ contains real(r8) :: huileaf, huigrain, actual_cphase ! We need "actual" crop phase to be cphase_planted - this%crop_inst%gddtsoi_patch(pi) = 0.0_r8 ! aka "leafout" + this%crop_inst%gddtsoi_patch(pi) = 0.0_r8 huileaf = 0.2_r8 this%crop_inst%hui_patch(pi) = 0.0_r8 huigrain = 0.7_r8 @@ -412,7 +412,7 @@ contains call this%increase_biomass_pools(5._r8) ! We need "actual" crop phase to be cphase_grainfill - this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 ! aka "leafout" + this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 huileaf = 0.2_r8 this%crop_inst%hui_patch(pi) = 0.8_r8 huigrain = 0.7_r8 @@ -495,7 +495,7 @@ contains real(r8) :: huileaf, huigrain, actual_cphase ! We need "actual" crop phase to be cphase_grainfill - this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 ! aka "leafout" + this%crop_inst%gddtsoi_patch(pi) = 0.5_r8 huileaf = 0.2_r8 this%crop_inst%hui_patch(pi) = 0.8_r8 huigrain = 0.7_r8 From da4797c62ee00505f464e9fd9be05f386e41efd8 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Sat, 1 Nov 2025 13:39:12 -0600 Subject: [PATCH 34/57] Where specifying format for xarray to_netcdf, use NETCDF4_CLASSIC. It's much better at streaming writes, which avoids the "trickling" you see sometimes when writing large files. --- python/ctsm/crop_calendars/generate_gdd20_baseline.py | 2 +- python/ctsm/crop_calendars/generate_gdds.py | 4 ++-- python/ctsm/crop_calendars/interpolate_gdds.py | 2 +- python/ctsm/crop_calendars/process_ggcmi_shdates.py | 2 +- python/ctsm/modify_input_files/modify_fsurdat.py | 2 +- python/ctsm/site_and_regional/base_case.py | 2 +- python/ctsm/site_and_regional/modify_singlept_site_neon.py | 2 +- python/ctsm/utils.py | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/ctsm/crop_calendars/generate_gdd20_baseline.py b/python/ctsm/crop_calendars/generate_gdd20_baseline.py index fa42eb58b4..df9dc3957e 100644 --- a/python/ctsm/crop_calendars/generate_gdd20_baseline.py +++ b/python/ctsm/crop_calendars/generate_gdd20_baseline.py @@ -318,7 +318,7 @@ def generate_gdd20_baseline(input_files, output_file, author, variable, year_arg ds_out[var_out] = grid_one_variable(ds_out, var_out) # Save - ds_out.to_netcdf(output_file, format="NETCDF3_CLASSIC", encoding=encoding_dict) + ds_out.to_netcdf(output_file, format="NETCDF4_CLASSIC", encoding=encoding_dict) print("Done!") diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index 308431d003..0408792beb 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -313,7 +313,7 @@ def save_gdds(sdates_file, hdates_file, outfile, gdd_maps_ds, sdates_rx): for var in template_ds: if "sdate" in var: template_ds = template_ds.drop(var) - template_ds.to_netcdf(path=outfile, format="NETCDF3_CLASSIC") + template_ds.to_netcdf(path=outfile, format="NETCDF4_CLASSIC") template_ds.close() # Add global attributes @@ -332,7 +332,7 @@ def save_gdds(sdates_file, hdates_file, outfile, gdd_maps_ds, sdates_rx): gdd_maps_ds["time_bounds"] = sdates_rx.time_bounds # Save cultivar GDDs - gdd_maps_ds.to_netcdf(outfile, mode="w", format="NETCDF3_CLASSIC") + gdd_maps_ds.to_netcdf(outfile, mode="w", format="NETCDF4_CLASSIC") save_gdds(sdates_file, hdates_file, outfile, gdd_maps_ds, sdates_rx) diff --git a/python/ctsm/crop_calendars/interpolate_gdds.py b/python/ctsm/crop_calendars/interpolate_gdds.py index 123d40af38..cc2db9068c 100755 --- a/python/ctsm/crop_calendars/interpolate_gdds.py +++ b/python/ctsm/crop_calendars/interpolate_gdds.py @@ -20,7 +20,7 @@ logger = logging.getLogger(__name__) -OUTPUT_FORMAT = "NETCDF3_CLASSIC" +OUTPUT_FORMAT = "NETCDF4_CLASSIC" def _file_missing(filepath, descriptor): diff --git a/python/ctsm/crop_calendars/process_ggcmi_shdates.py b/python/ctsm/crop_calendars/process_ggcmi_shdates.py index 7ac4304574..eea6eaf7d5 100644 --- a/python/ctsm/crop_calendars/process_ggcmi_shdates.py +++ b/python/ctsm/crop_calendars/process_ggcmi_shdates.py @@ -529,7 +529,7 @@ def process_ggcmi_shdates( # Save logger.info(" Saving %s...", varname_ggcmi) - thisvar_da.to_netcdf(file_clm, mode="a", format="NETCDF3_CLASSIC") + thisvar_da.to_netcdf(file_clm, mode="a", format="NETCDF4_CLASSIC") cropcal_ds.close() diff --git a/python/ctsm/modify_input_files/modify_fsurdat.py b/python/ctsm/modify_input_files/modify_fsurdat.py index b8f68dbac8..c5ce2fe69a 100644 --- a/python/ctsm/modify_input_files/modify_fsurdat.py +++ b/python/ctsm/modify_input_files/modify_fsurdat.py @@ -199,7 +199,7 @@ def write_output(self, fsurdat_in, fsurdat_out): abort(errmsg) # mode 'w' overwrites file if it exists - self.file.to_netcdf(path=fsurdat_out, mode="w", format="NETCDF3_64BIT") + self.file.to_netcdf(path=fsurdat_out, mode="w", format="NETCDF4_CLASSIC") logger.info("Successfully created fsurdat_out: %s", fsurdat_out) self.file.close() diff --git a/python/ctsm/site_and_regional/base_case.py b/python/ctsm/site_and_regional/base_case.py index d255fb90d9..609c71ac9b 100644 --- a/python/ctsm/site_and_regional/base_case.py +++ b/python/ctsm/site_and_regional/base_case.py @@ -232,7 +232,7 @@ def write_to_netcdf(self, xr_ds, nc_fname): """ if not os.path.exists(nc_fname) or self.overwrite: # mode 'w' overwrites file - xr_ds.to_netcdf(path=nc_fname, mode="w", format="NETCDF3_64BIT") + xr_ds.to_netcdf(path=nc_fname, mode="w", format="NETCDF4_CLASSIC") else: err_msg = ( "File " diff --git a/python/ctsm/site_and_regional/modify_singlept_site_neon.py b/python/ctsm/site_and_regional/modify_singlept_site_neon.py index 13018bcdc5..f7ac7b266c 100755 --- a/python/ctsm/site_and_regional/modify_singlept_site_neon.py +++ b/python/ctsm/site_and_regional/modify_singlept_site_neon.py @@ -707,6 +707,6 @@ def main(): f_2 = update_metadata(f_2, surf_file, neon_file, zb_flag) print(f_2.attrs) - f_2.to_netcdf(path=wfile, mode="w", format="NETCDF3_64BIT") + f_2.to_netcdf(path=wfile, mode="w", format="NETCDF4_CLASSIC") print("Successfully updated surface data file for neon site(" + site_name + "):\n - " + wfile) diff --git a/python/ctsm/utils.py b/python/ctsm/utils.py index df2b78ab7c..52a0c22702 100644 --- a/python/ctsm/utils.py +++ b/python/ctsm/utils.py @@ -206,7 +206,7 @@ def write_output(file, file_in, file_out, file_type): ) # mode 'w' overwrites file if it exists - file.to_netcdf(path=file_out, mode="w", format="NETCDF3_64BIT") + file.to_netcdf(path=file_out, mode="w", format="NETCDF4_CLASSIC") logger.info("Successfully created: %s", file_out) file.close() From 21cad52c04546313a0426ba2efa1d8364353e5a8 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 30 Oct 2025 13:33:37 -0600 Subject: [PATCH 35/57] generate_gdd20_baseline: Make output dir if doesn't exist. --- python/ctsm/crop_calendars/generate_gdd20_baseline.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/ctsm/crop_calendars/generate_gdd20_baseline.py b/python/ctsm/crop_calendars/generate_gdd20_baseline.py index df9dc3957e..0de310ccee 100644 --- a/python/ctsm/crop_calendars/generate_gdd20_baseline.py +++ b/python/ctsm/crop_calendars/generate_gdd20_baseline.py @@ -318,6 +318,8 @@ def generate_gdd20_baseline(input_files, output_file, author, variable, year_arg ds_out[var_out] = grid_one_variable(ds_out, var_out) # Save + output_dir = os.path.dirname(output_file) + os.makedirs(output_dir, exist_ok=True) ds_out.to_netcdf(output_file, format="NETCDF4_CLASSIC", encoding=encoding_dict) print("Done!") From 485e85e515ebda27937c1079e0a609d9da98ac59 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 30 Jan 2026 11:32:37 -0700 Subject: [PATCH 36/57] Docs: Update history_fields_nofates.rst. --- .../history_fields_nofates.rst | 2890 +++++++++-------- 1 file changed, 1514 insertions(+), 1376 deletions(-) diff --git a/doc/source/users_guide/setting-up-and-running-a-case/history_fields_nofates.rst b/doc/source/users_guide/setting-up-and-running-a-case/history_fields_nofates.rst index 5322ae79a2..bb8826c72e 100644 --- a/doc/source/users_guide/setting-up-and-running-a-case/history_fields_nofates.rst +++ b/doc/source/users_guide/setting-up-and-running-a-case/history_fields_nofates.rst @@ -3,1385 +3,1523 @@ CTSM History Fields (nofates) ============================= CAUTION: Not all variables are relevant / present for all CTSM cases. -NOTE: Instantaneous fields will appear in history files labeled with h0i, h1i, ... and non-instantaneous fields will appear in history files labeled with h0a, h1a, ... - Key flags used in this CTSM case: use_cn = T use_crop = T use_fates = F -=================================== ================ ============================================================================================== ================================================================= ======= +=================================== ================ ============================================================================================== ================================================================= ========== ============ CTSM History Fields ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - Variable Name Level Dim. Long Description Units Active? -=================================== ================ ============================================================================================== ================================================================= ======= -A10TMIN - 10-day running mean of min 2-m temperature K F -A5TMIN - 5-day running mean of min 2-m temperature K F -ACTUAL_IMMOB - actual N immobilization gN/m^2/s T -AGLB - Aboveground leaf biomass kg/m^2 F -AGNPP - aboveground NPP gC/m^2/s T -AGSB - Aboveground stem biomass kg/m^2 F -ALPHA - alpha coefficient for VOC calc non F -ALT - current active layer thickness m T -ALTMAX - maximum annual active layer thickness m T -ALTMAX_LASTYEAR - maximum prior year active layer thickness m F -ANNAVG_T2M - annual average 2m air temperature K F -ANNMAX_RETRANSN - annual max of retranslocated N pool gN/m^2 F -ANNSUM_COUNTER - seconds since last annual accumulator turnover s F -ANNSUM_NPP - annual sum of NPP gC/m^2/yr F -ANNSUM_POTENTIAL_GPP - annual sum of potential GPP gN/m^2/yr F -APPAR_TEMP - 2 m apparent temperature C T -APPAR_TEMP_R - Rural 2 m apparent temperature C T -APPAR_TEMP_U - Urban 2 m apparent temperature C T -AR - autotrophic respiration (MR + GR) gC/m^2/s T -ATM_O3 - atmospheric ozone partial pressure mol/mol F -ATM_TOPO - atmospheric surface height m T -AVAILC - C flux available for allocation gC/m^2/s F -AVAIL_RETRANSN - N flux available from retranslocation pool gN/m^2/s F -AZSUN - azimuth angle of the sun radians F -AnnET - Annual ET mm/s F -BAF_CROP - fractional area burned for crop s-1 T -BAF_PEATF - fractional area burned in peatland s-1 T -BCDEP - total BC deposition (dry+wet) from atmosphere kg/m^2/s T -BCPHIDRY - black carbon deposition (phidry) from atmosphere kg/m^2/s F -BCPHIWET - black carbon deposition (phiwet) from atmosphere kg/m^2/s F -BCPHODRY - black carbon deposition (phodry) from atmosphere kg/m^2/s F -BETA - coefficient of convective velocity none F -BGLFR - background litterfall rate 1/s F -BGNPP - belowground NPP gC/m^2/s T -BGTR - background transfer growth rate 1/s F -BTRANMN - daily minimum of transpiration beta factor unitless T -CANNAVG_T2M - annual average of 2m air temperature K F -CANNSUM_NPP - annual sum of column-level NPP gC/m^2/s F -CGRND - deriv. of soil energy flux wrt to soil temp W/m^2/K F -CGRNDL - deriv. of soil latent heat flux wrt soil temp W/m^2/K F -CGRNDS - deriv. of soil sensible heat flux wrt soil temp W/m^2/K F -CH4PROD - Gridcell total production of CH4 gC/m2/s T -CH4_EBUL_TOTAL_SAT - ebullition surface CH4 flux; (+ to atm) mol/m2/s F -CH4_EBUL_TOTAL_UNSAT - ebullition surface CH4 flux; (+ to atm) mol/m2/s F -CH4_SURF_AERE_SAT - aerenchyma surface CH4 flux for inundated area; (+ to atm) mol/m2/s T -CH4_SURF_AERE_UNSAT - aerenchyma surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T -CH4_SURF_DIFF_SAT - diffusive surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s T -CH4_SURF_DIFF_UNSAT - diffusive surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T -CH4_SURF_EBUL_SAT - ebullition surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s T -CH4_SURF_EBUL_UNSAT - ebullition surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T -COL_CTRUNC - column-level sink for C truncation gC/m^2 F -COL_FIRE_CLOSS - total column-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s T -COL_FIRE_NLOSS - total column-level fire N loss gN/m^2/s T -COL_NTRUNC - column-level sink for N truncation gN/m^2 F -COST_NACTIVE - Cost of active uptake gN/gC T -COST_NFIX - Cost of fixation gN/gC T -COST_NRETRANS - Cost of retranslocation gN/gC T -COSZEN - cosine of solar zenith angle (downscaled if downscaling is activated) none F -COSZEN_GRC - cosine of solar zenith angle none F -CPHASE - crop phenology phase 0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest T -CPOOL - temporary photosynthate C pool gC/m^2 T -CPOOL_DEADCROOT_GR - dead coarse root growth respiration gC/m^2/s F -CPOOL_DEADCROOT_STORAGE_GR - dead coarse root growth respiration to storage gC/m^2/s F -CPOOL_DEADSTEM_GR - dead stem growth respiration gC/m^2/s F -CPOOL_DEADSTEM_STORAGE_GR - dead stem growth respiration to storage gC/m^2/s F -CPOOL_FROOT_GR - fine root growth respiration gC/m^2/s F -CPOOL_FROOT_STORAGE_GR - fine root growth respiration to storage gC/m^2/s F -CPOOL_LEAF_GR - leaf growth respiration gC/m^2/s F -CPOOL_LEAF_STORAGE_GR - leaf growth respiration to storage gC/m^2/s F -CPOOL_LIVECROOT_GR - live coarse root growth respiration gC/m^2/s F -CPOOL_LIVECROOT_STORAGE_GR - live coarse root growth respiration to storage gC/m^2/s F -CPOOL_LIVESTEM_GR - live stem growth respiration gC/m^2/s F -CPOOL_LIVESTEM_STORAGE_GR - live stem growth respiration to storage gC/m^2/s F -CPOOL_TO_DEADCROOTC - allocation to dead coarse root C gC/m^2/s F -CPOOL_TO_DEADCROOTC_STORAGE - allocation to dead coarse root C storage gC/m^2/s F -CPOOL_TO_DEADSTEMC - allocation to dead stem C gC/m^2/s F -CPOOL_TO_DEADSTEMC_STORAGE - allocation to dead stem C storage gC/m^2/s F -CPOOL_TO_FROOTC - allocation to fine root C gC/m^2/s F -CPOOL_TO_FROOTC_STORAGE - allocation to fine root C storage gC/m^2/s F -CPOOL_TO_GRESP_STORAGE - allocation to growth respiration storage gC/m^2/s F -CPOOL_TO_LEAFC - allocation to leaf C gC/m^2/s F -CPOOL_TO_LEAFC_STORAGE - allocation to leaf C storage gC/m^2/s F -CPOOL_TO_LIVECROOTC - allocation to live coarse root C gC/m^2/s F -CPOOL_TO_LIVECROOTC_STORAGE - allocation to live coarse root C storage gC/m^2/s F -CPOOL_TO_LIVESTEMC - allocation to live stem C gC/m^2/s F -CPOOL_TO_LIVESTEMC_STORAGE - allocation to live stem C storage gC/m^2/s F -CROPPROD1C - 1-yr crop product (grain+biofuel) C gC/m^2 T -CROPPROD1C_LOSS - loss from 1-yr crop product pool gC/m^2/s T -CROPPROD1N - 1-yr crop product (grain+biofuel) N gN/m^2 T -CROPPROD1N_LOSS - loss from 1-yr crop product pool gN/m^2/s T -CROPSEEDC_DEFICIT - C used for crop seed that needs to be repaid gC/m^2 T -CROPSEEDN_DEFICIT - N used for crop seed that needs to be repaid gN/m^2 F -CROP_SEEDC_TO_LEAF - crop seed source to leaf gC/m^2/s F -CROP_SEEDN_TO_LEAF - crop seed source to leaf gN/m^2/s F -CURRENT_GR - growth resp for new growth displayed in this timestep gC/m^2/s F -CWDC_HR - cwd C heterotrophic respiration gC/m^2/s T -CWDC_LOSS - coarse woody debris C loss gC/m^2/s T -CWD_C - CWD C gC/m^2 T -CWD_C_1m - CWD C to 1 meter gC/m^2 F -CWD_C_TO_LIT_CEL_C - decomp. of coarse woody debris C to cellulosic litter C gC/m^2/s F -CWD_C_TO_LIT_LIG_C - decomp. of coarse woody debris C to lignin litter C gC/m^2/s F -CWD_HR_L2 - Het. Resp. from coarse woody debris gC/m^2/s F -CWD_HR_L3 - Het. Resp. from coarse woody debris gC/m^2/s F -CWD_N - CWD N gN/m^2 T -CWD_N_1m - CWD N to 1 meter gN/m^2 F -CWD_N_TO_LIT_CEL_N - decomp. of coarse woody debris N to cellulosic litter N gN/m^2 F -CWD_N_TO_LIT_LIG_N - decomp. of coarse woody debris N to lignin litter N gN/m^2 F -C_ALLOMETRY - C allocation index none F -DAYL - daylength s F -DAYS_ACTIVE - number of days since last dormancy days F -DEADCROOTC - dead coarse root C gC/m^2 T -DEADCROOTC_STORAGE - dead coarse root C storage gC/m^2 F -DEADCROOTC_STORAGE_TO_XFER - dead coarse root C shift storage to transfer gC/m^2/s F -DEADCROOTC_XFER - dead coarse root C transfer gC/m^2 F -DEADCROOTC_XFER_TO_DEADCROOTC - dead coarse root C growth from storage gC/m^2/s F -DEADCROOTN - dead coarse root N gN/m^2 T -DEADCROOTN_STORAGE - dead coarse root N storage gN/m^2 F -DEADCROOTN_STORAGE_TO_XFER - dead coarse root N shift storage to transfer gN/m^2/s F -DEADCROOTN_XFER - dead coarse root N transfer gN/m^2 F -DEADCROOTN_XFER_TO_DEADCROOTN - dead coarse root N growth from storage gN/m^2/s F -DEADSTEMC - dead stem C gC/m^2 T -DEADSTEMC_STORAGE - dead stem C storage gC/m^2 F -DEADSTEMC_STORAGE_TO_XFER - dead stem C shift storage to transfer gC/m^2/s F -DEADSTEMC_XFER - dead stem C transfer gC/m^2 F -DEADSTEMC_XFER_TO_DEADSTEMC - dead stem C growth from storage gC/m^2/s F -DEADSTEMN - dead stem N gN/m^2 T -DEADSTEMN_STORAGE - dead stem N storage gN/m^2 F -DEADSTEMN_STORAGE_TO_XFER - dead stem N shift storage to transfer gN/m^2/s F -DEADSTEMN_XFER - dead stem N transfer gN/m^2 F -DEADSTEMN_XFER_TO_DEADSTEMN - dead stem N growth from storage gN/m^2/s F -DENIT - total rate of denitrification gN/m^2/s T -DGNETDT - derivative of net ground heat flux wrt soil temp W/m^2/K F -DISCOI - 2 m Discomfort Index C T -DISCOIS - 2 m Stull Discomfort Index C T -DISCOIS_R - Rural 2 m Stull Discomfort Index C T -DISCOIS_U - Urban 2 m Stull Discomfort Index C T -DISCOI_R - Rural 2 m Discomfort Index C T -DISCOI_U - Urban 2 m Discomfort Index C T -DISPLA - displacement height (vegetated landunits only) m F -DISPVEGC - displayed veg carbon, excluding storage and cpool gC/m^2 T -DISPVEGN - displayed vegetation nitrogen gN/m^2 T -DLRAD - downward longwave radiation below the canopy W/m^2 F -DORMANT_FLAG - dormancy flag none F -DOWNREG - fractional reduction in GPP due to N limitation proportion F -DPVLTRB1 - turbulent deposition velocity 1 m/s F -DPVLTRB2 - turbulent deposition velocity 2 m/s F -DPVLTRB3 - turbulent deposition velocity 3 m/s F -DPVLTRB4 - turbulent deposition velocity 4 m/s F -DSL - dry surface layer thickness mm T -DSTDEP - total dust deposition (dry+wet) from atmosphere kg/m^2/s T -DSTDRY1 - dust deposition (dry1) from atmosphere kg/m^2/s F -DSTDRY2 - dust deposition (dry2) from atmosphere kg/m^2/s F -DSTDRY3 - dust deposition (dry3) from atmosphere kg/m^2/s F -DSTDRY4 - dust deposition (dry4) from atmosphere kg/m^2/s F -DSTFLXT - total surface dust emission kg/m2/s T -DSTWET1 - dust deposition (wet1) from atmosphere kg/m^2/s F -DSTWET2 - dust deposition (wet2) from atmosphere kg/m^2/s F -DSTWET3 - dust deposition (wet3) from atmosphere kg/m^2/s F -DSTWET4 - dust deposition (wet4) from atmosphere kg/m^2/s F -DT_VEG - change in t_veg, last iteration K F -DWT_CONV_CFLUX - conversion C flux (immediate loss to atm) (0 at all times except first timestep of year) gC/m^2/s T -DWT_CONV_CFLUX_DRIBBLED - conversion C flux (immediate loss to atm), dribbled throughout the year gC/m^2/s T -DWT_CONV_CFLUX_PATCH - patch-level conversion C flux (immediate loss to atm) (0 at all times except first timestep of gC/m^2/s F -DWT_CONV_NFLUX - conversion N flux (immediate loss to atm) (0 at all times except first timestep of year) gN/m^2/s T -DWT_CONV_NFLUX_PATCH - patch-level conversion N flux (immediate loss to atm) (0 at all times except first timestep of gN/m^2/s F -DWT_CROPPROD1C_GAIN - landcover change-driven addition to 1-year crop product pool gC/m^2/s T -DWT_CROPPROD1N_GAIN - landcover change-driven addition to 1-year crop product pool gN/m^2/s T -DWT_PROD100C_GAIN - landcover change-driven addition to 100-yr wood product pool gC/m^2/s F -DWT_PROD100N_GAIN - landcover change-driven addition to 100-yr wood product pool gN/m^2/s F -DWT_PROD10C_GAIN - landcover change-driven addition to 10-yr wood product pool gC/m^2/s F -DWT_PROD10N_GAIN - landcover change-driven addition to 10-yr wood product pool gN/m^2/s F -DWT_SEEDC_TO_DEADSTEM - seed source to patch-level deadstem gC/m^2/s F -DWT_SEEDC_TO_DEADSTEM_PATCH - patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gC/m^2/s F -DWT_SEEDC_TO_LEAF - seed source to patch-level leaf gC/m^2/s F -DWT_SEEDC_TO_LEAF_PATCH - patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gC/m^2/s F -DWT_SEEDN_TO_DEADSTEM - seed source to patch-level deadstem gN/m^2/s T -DWT_SEEDN_TO_DEADSTEM_PATCH - patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gN/m^2/s F -DWT_SEEDN_TO_LEAF - seed source to patch-level leaf gN/m^2/s T -DWT_SEEDN_TO_LEAF_PATCH - patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gN/m^2/s F -DWT_SLASH_CFLUX - slash C flux (to litter diagnostic only) (0 at all times except first timestep of year) gC/m^2/s T -DWT_SLASH_CFLUX_PATCH - patch-level slash C flux (to litter diagnostic only) (0 at all times except first timestep of gC/m^2/s F -DWT_WOODPRODC_GAIN - landcover change-driven addition to wood product pools gC/m^2/s T -DWT_WOODPRODN_GAIN - landcover change-driven addition to wood product pools gN/m^2/s T -DWT_WOOD_PRODUCTC_GAIN_PATCH - patch-level landcover change-driven addition to wood product pools(0 at all times except first gC/m^2/s F -DYN_COL_ADJUSTMENTS_CH4 - Adjustments in ch4 due to dynamic column areas; only makes sense at the column level: should n gC/m^2 F -DYN_COL_SOIL_ADJUSTMENTS_C - Adjustments in soil carbon due to dynamic column areas; only makes sense at the column level: gC/m^2 F -DYN_COL_SOIL_ADJUSTMENTS_N - Adjustments in soil nitrogen due to dynamic column areas; only makes sense at the column level gN/m^2 F -DYN_COL_SOIL_ADJUSTMENTS_NH4 - Adjustments in soil NH4 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 F -DYN_COL_SOIL_ADJUSTMENTS_NO3 - Adjustments in soil NO3 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 F -EFLXBUILD - building heat flux from change in interior building air temperature W/m^2 T -EFLX_DYNBAL - dynamic land cover change conversion energy flux W/m^2 T -EFLX_GNET - net heat flux into ground W/m^2 F -EFLX_GRND_LAKE - net heat flux into lake/snow surface, excluding light transmission W/m^2 T -EFLX_LH_TOT - total latent heat flux [+ to atm] W/m^2 T -EFLX_LH_TOT_ICE - total latent heat flux [+ to atm] (ice landunits only) W/m^2 F -EFLX_LH_TOT_R - Rural total evaporation W/m^2 T -EFLX_LH_TOT_U - Urban total evaporation W/m^2 F -EFLX_SOIL_GRND - soil heat flux [+ into soil] W/m^2 F -ELAI - exposed one-sided leaf area index m^2/m^2 T -EMG - ground emissivity proportion F -EMV - vegetation emissivity proportion F -EOPT - Eopt coefficient for VOC calc non F -EPT - 2 m Equiv Pot Temp K T -EPT_R - Rural 2 m Equiv Pot Temp K T -EPT_U - Urban 2 m Equiv Pot Temp K T -ER - total ecosystem respiration, autotrophic + heterotrophic gC/m^2/s T -ERRH2O - total water conservation error mm T -ERRH2OSNO - imbalance in snow depth (liquid water) mm T -ERRSEB - surface energy conservation error W/m^2 T -ERRSOI - soil/lake energy conservation error W/m^2 T -ERRSOL - solar radiation conservation error W/m^2 T -ESAI - exposed one-sided stem area index m^2/m^2 T -EXCESSC_MR - excess C maintenance respiration gC/m^2/s F -EXCESS_CFLUX - C flux not allocated due to downregulation gC/m^2/s F -FAREA_BURNED - timestep fractional area burned s-1 T -FCANSNO - fraction of canopy that is wet proportion F -FCEV - canopy evaporation W/m^2 T -FCH4 - Gridcell surface CH4 flux to atmosphere (+ to atm) kgC/m2/s T -FCH4TOCO2 - Gridcell oxidation of CH4 to CO2 gC/m2/s T -FCH4_DFSAT - CH4 additional flux due to changing fsat, natural vegetated and crop landunits only kgC/m2/s T -FCO2 - CO2 flux to atmosphere (+ to atm) kgCO2/m2/s F -FCOV - fractional impermeable area unitless T -FCTR - canopy transpiration W/m^2 T -FDRY - fraction of foliage that is green and dry proportion F -FERTNITRO - Nitrogen fertilizer for each crop gN/m2/yr F -FERT_COUNTER - time left to fertilize seconds F -FERT_TO_SMINN - fertilizer to soil mineral N gN/m^2/s F -FFIX_TO_SMINN - free living N fixation to soil mineral N gN/m^2/s T -FGEV - ground evaporation W/m^2 T -FGR - heat flux into soil/snow including snow melt and lake / snow light transmission W/m^2 T -FGR12 - heat flux between soil layers 1 and 2 W/m^2 T -FGR_ICE - heat flux into soil/snow including snow melt and lake / snow light transmission (ice landunits W/m^2 F -FGR_R - Rural heat flux into soil/snow including snow melt and snow light transmission W/m^2 F -FGR_U - Urban heat flux into soil/snow including snow melt W/m^2 F -FH2OSFC - fraction of ground covered by surface water unitless T -FH2OSFC_NOSNOW - fraction of ground covered by surface water (if no snow present) unitless F -FINUNDATED - fractional inundated area of vegetated columns unitless T -FINUNDATED_LAG - time-lagged inundated fraction of vegetated columns unitless F -FIRA - net infrared (longwave) radiation W/m^2 T -FIRA_ICE - net infrared (longwave) radiation (ice landunits only) W/m^2 F -FIRA_R - Rural net infrared (longwave) radiation W/m^2 T -FIRA_U - Urban net infrared (longwave) radiation W/m^2 F -FIRE - emitted infrared (longwave) radiation W/m^2 T -FIRE_ICE - emitted infrared (longwave) radiation (ice landunits only) W/m^2 F -FIRE_R - Rural emitted infrared (longwave) radiation W/m^2 T -FIRE_U - Urban emitted infrared (longwave) radiation W/m^2 F -FLDS - atmospheric longwave radiation (downscaled for glacier and hillslope columns) W/m^2 T -FLDS_ICE - atmospheric longwave radiation (downscaled for glacier and hillslope columns) (ice landunits o W/m^2 F -FLDS_NOT_DOWNSCALED - atmospheric longwave radiation (pre-downscaling) W/m^2 F -FPI - fraction of potential immobilization proportion T -FPSN - photosynthesis umol m-2 s-1 T -FPSN24 - 24 hour accumulative patch photosynthesis starting from mid-night umol CO2/m^2 ground/day F -FPSN_WC - Rubisco-limited photosynthesis umol m-2 s-1 F -FPSN_WJ - RuBP-limited photosynthesis umol m-2 s-1 F -FPSN_WP - Product-limited photosynthesis umol m-2 s-1 F -FREE_RETRANSN_TO_NPOOL - deployment of retranslocated N gN/m^2/s T -FROOTC - fine root C gC/m^2 T -FROOTC_ALLOC - fine root C allocation gC/m^2/s T -FROOTC_LOSS - fine root C loss gC/m^2/s T -FROOTC_STORAGE - fine root C storage gC/m^2 F -FROOTC_STORAGE_TO_XFER - fine root C shift storage to transfer gC/m^2/s F -FROOTC_TO_LITTER - fine root C litterfall gC/m^2/s F -FROOTC_XFER - fine root C transfer gC/m^2 F -FROOTC_XFER_TO_FROOTC - fine root C growth from storage gC/m^2/s F -FROOTN - fine root N gN/m^2 T -FROOTN_STORAGE - fine root N storage gN/m^2 F -FROOTN_STORAGE_TO_XFER - fine root N shift storage to transfer gN/m^2/s F -FROOTN_TO_LITTER - fine root N litterfall gN/m^2/s F -FROOTN_XFER - fine root N transfer gN/m^2 F -FROOTN_XFER_TO_FROOTN - fine root N growth from storage gN/m^2/s F -FROOT_MR - fine root maintenance respiration gC/m^2/s F -FROST_TABLE - frost table depth (natural vegetated and crop landunits only) m F -FSA - absorbed solar radiation W/m^2 T -FSAT - fractional area with water table at surface unitless T -FSA_ICE - absorbed solar radiation (ice landunits only) W/m^2 F -FSA_R - Rural absorbed solar radiation W/m^2 F -FSA_U - Urban absorbed solar radiation W/m^2 F -FSD24 - direct radiation (last 24hrs) K F -FSD240 - direct radiation (last 240hrs) K F -FSDS - atmospheric incident solar radiation (downscaled for glacier and hillslope columns) W/m^2 T -FSDSND - direct nir incident solar radiation W/m^2 T -FSDSNDLN - direct nir incident solar radiation at local noon W/m^2 T -FSDSNI - diffuse nir incident solar radiation W/m^2 T -FSDSVD - direct vis incident solar radiation W/m^2 T -FSDSVDLN - direct vis incident solar radiation at local noon W/m^2 T -FSDSVI - diffuse vis incident solar radiation W/m^2 T -FSDSVILN - diffuse vis incident solar radiation at local noon W/m^2 T -FSDS_from_atm - atmospheric incident solar radiation received from atmosphere (pre-downscaling) W/m^2 T -FSH - sensible heat not including correction for land use change and rain/snow conversion W/m^2 T -FSH_G - sensible heat from ground W/m^2 T -FSH_ICE - sensible heat not including correction for land use change and rain/snow conversion (ice landu W/m^2 F -FSH_PRECIP_CONVERSION - Sensible heat flux from conversion of rain/snow atm forcing W/m^2 T -FSH_R - Rural sensible heat W/m^2 T -FSH_RUNOFF_ICE_TO_LIQ - sensible heat flux generated from conversion of ice runoff to liquid W/m^2 T -FSH_TO_COUPLER - sensible heat sent to coupler (includes corrections for land use change, rain/snow conversion W/m^2 T -FSH_U - Urban sensible heat W/m^2 F -FSH_V - sensible heat from veg W/m^2 T -FSI24 - indirect radiation (last 24hrs) K F -FSI240 - indirect radiation (last 240hrs) K F -FSM - snow melt heat flux W/m^2 T -FSM_ICE - snow melt heat flux (ice landunits only) W/m^2 F -FSM_R - Rural snow melt heat flux W/m^2 F -FSM_U - Urban snow melt heat flux W/m^2 F -FSNO - fraction of ground covered by snow unitless T -FSNO_EFF - effective fraction of ground covered by snow unitless T -FSNO_ICE - fraction of ground covered by snow (ice landunits only) unitless F -FSR - reflected solar radiation W/m^2 T -FSRND - direct nir reflected solar radiation W/m^2 T -FSRNDLN - direct nir reflected solar radiation at local noon W/m^2 T -FSRNI - diffuse nir reflected solar radiation W/m^2 T -FSRSF - reflected solar radiation W/m^2 T -FSRSFND - direct nir reflected solar radiation W/m^2 T -FSRSFNDLN - direct nir reflected solar radiation at local noon W/m^2 T -FSRSFNI - diffuse nir reflected solar radiation W/m^2 T -FSRSFVD - direct vis reflected solar radiation W/m^2 T -FSRSFVDLN - direct vis reflected solar radiation at local noon W/m^2 T -FSRSFVI - diffuse vis reflected solar radiation W/m^2 T -FSRVD - direct vis reflected solar radiation W/m^2 T -FSRVDLN - direct vis reflected solar radiation at local noon W/m^2 T -FSRVI - diffuse vis reflected solar radiation W/m^2 T -FSR_ICE - reflected solar radiation (ice landunits only) W/m^2 F -FSUN - sunlit fraction of canopy proportion F -FSUN24 - fraction sunlit (last 24hrs) K F -FSUN240 - fraction sunlit (last 240hrs) K F -FUELC - fuel load gC/m^2 T -FV - friction velocity m/s T -FWET - fraction of canopy that is wet proportion F -F_DENIT - denitrification flux gN/m^2/s T -F_N2O_DENIT - denitrification N2O flux gN/m^2/s T -F_N2O_NIT - nitrification N2O flux gN/m^2/s T -F_NIT - nitrification flux gN/m^2/s T -FireComp_BC - fire emissions flux of BC kg/m2/sec F -FireComp_OC - fire emissions flux of OC kg/m2/sec F -FireComp_SO2 - fire emissions flux of SO2 kg/m2/sec F -FireEmis_TOT - Total fire emissions flux gC/m2/sec F -FireEmis_ZTOP - Top of vertical fire emissions distribution m F -FireMech_SO2 - fire emissions flux of SO2 kg/m2/sec F -FireMech_bc_a1 - fire emissions flux of bc_a1 kg/m2/sec F -FireMech_pom_a1 - fire emissions flux of pom_a1 kg/m2/sec F -GAMMA - total gamma for VOC calc non F -GAMMAA - gamma A for VOC calc non F -GAMMAC - gamma C for VOC calc non F -GAMMAL - gamma L for VOC calc non F -GAMMAP - gamma P for VOC calc non F -GAMMAS - gamma S for VOC calc non F -GAMMAT - gamma T for VOC calc non F -GDD0 - Growing degree days base 0C from planting ddays F -GDD020 - Twenty year average of growing degree days base 0C from planting ddays F -GDD10 - Growing degree days base 10C from planting ddays F -GDD1020 - Twenty year average of growing degree days base 10C from planting ddays F -GDD8 - Growing degree days base 8C from planting ddays F -GDD820 - Twenty year average of growing degree days base 8C from planting ddays F -GDDACCUM - Accumulated growing degree days past planting date for crop ddays F -GDDHARV - Growing degree days (gdd) needed to harvest ddays F -GDDTSOI - Growing degree-days from planting (top two soil layers) ddays F -GPP - gross primary production gC/m^2/s T -GR - total growth respiration gC/m^2/s T -GRAINC - grain C (does not equal yield) gC/m^2 T -GRAINC_TO_FOOD - grain C to food gC/m^2/s T -GRAINC_TO_FOOD_ANN - grain C to food harvested per calendar year; should only be output annually gC/m^2 F -GRAINC_TO_SEED - grain C to seed gC/m^2/s T -GRAINC_TO_SEED_ANN - grain C to seed harvested per calendar year; should only be output annually gC/m^2 F -GRAINN - grain N gN/m^2 T -GRAINN_TO_FOOD - grain N to food (not scientifically supported) gN/m^2/s F -GRAINN_TO_FOOD_ANN - grain N to food harvested per calendar year; should only be output annually (not scientificall gN/m^2 F -GRAINN_TO_SEED - grain N to seed (not scientifically supported) gN/m^2/s F -GRAINN_TO_SEED_ANN - grain N to seed harvested per calendar year; should only be output annually (not scientificall gN/m^2 F -GRESP_STORAGE - growth respiration storage gC/m^2 F -GRESP_STORAGE_TO_XFER - growth respiration shift storage to transfer gC/m^2/s F -GRESP_XFER - growth respiration transfer gC/m^2 F -GROSS_NMIN - gross rate of N mineralization gN/m^2/s T -GRU_PROD100C_GAIN - gross unrepresented landcover change addition to 100-yr wood product pool gC/m^2/s F -GRU_PROD100N_GAIN - gross unrepresented landcover change addition to 100-yr wood product pool gN/m^2/s F -GRU_PROD10C_GAIN - gross unrepresented landcover change addition to 10-yr wood product pool gC/m^2/s F -GRU_PROD10N_GAIN - gross unrepresented landcover change addition to 10-yr wood product pool gN/m^2/s F -GSSHA - shaded leaf stomatal conductance umol H20/m2/s T -GSSHALN - shaded leaf stomatal conductance at local noon umol H20/m2/s T -GSSUN - sunlit leaf stomatal conductance umol H20/m2/s T -GSSUNLN - sunlit leaf stomatal conductance at local noon umol H20/m2/s T -H2OCAN - intercepted water mm T -H2OSFC - surface water depth mm T -H2OSNO - snow depth (liquid water) mm T -H2OSNO_ICE - snow depth (liquid water, ice landunits only) mm F -H2OSNO_TOP - mass of snow in top snow layer kg/m2 T -HBOT - canopy bottom m F -HEAT_CONTENT1 - initial gridcell total heat content J/m^2 T -HEAT_CONTENT1_VEG - initial gridcell total heat content - natural vegetated and crop landunits only J/m^2 F -HEAT_CONTENT2 - post land cover change total heat content J/m^2 F -HEAT_FROM_AC - sensible heat flux put into canyon due to heat removed from air conditioning W/m^2 T -HIA - 2 m NWS Heat Index C T -HIA_R - Rural 2 m NWS Heat Index C T -HIA_U - Urban 2 m NWS Heat Index C T -HR - total heterotrophic respiration gC/m^2/s T -HTOP - canopy top m T -HUI - Crop patch heat unit index ddays F -HUMIDEX - 2 m Humidex C T -HUMIDEX_R - Rural 2 m Humidex C T -HUMIDEX_U - Urban 2 m Humidex C T -ICE_CONTENT1 - initial gridcell total ice content mm T -ICE_CONTENT2 - post land cover change total ice content mm F -ICE_MODEL_FRACTION - Ice sheet model fractional coverage unitless F -INIT_GPP - GPP flux before downregulation gC/m^2/s F -INT_SNOW - accumulated swe (natural vegetated and crop landunits only) mm F -INT_SNOW_ICE - accumulated swe (ice landunits only) mm F -IWUELN - local noon intrinsic water use efficiency umolCO2/molH2O T -JMX25T - canopy profile of jmax umol/m2/s T -Jmx25Z - maximum rate of electron transport at 25 Celcius for canopy layers umol electrons/m2/s T -KBM1 - natural logarithm of Z0MG_P/Z0HG_P unitless F -LAI240 - 240hr average of leaf area index m^2/m^2 F -LAISHA - shaded projected leaf area index m^2/m^2 T -LAISUN - sunlit projected leaf area index m^2/m^2 T -LAKEICEFRAC_SURF - surface lake layer ice mass fraction unitless T -LAKEICETHICK - thickness of lake ice (including physical expansion on freezing) m T -LAND_USE_FLUX - total C emitted from land cover conversion (smoothed over the year) and wood and grain product gC/m^2/s T -LATBASET - latitude vary base temperature for hui degree C F -LEAFC - leaf C gC/m^2 T -LEAFCN - Leaf CN ratio used for flexible CN gC/gN T -LEAFCN_OFFSET - Leaf C:N used by FUN unitless F -LEAFCN_STORAGE - Storage Leaf CN ratio used for flexible CN gC/gN F -LEAFC_ALLOC - leaf C allocation gC/m^2/s T -LEAFC_CHANGE - C change in leaf gC/m^2/s T -LEAFC_LOSS - leaf C loss gC/m^2/s T -LEAFC_STORAGE - leaf C storage gC/m^2 F -LEAFC_STORAGE_TO_XFER - leaf C shift storage to transfer gC/m^2/s F -LEAFC_STORAGE_XFER_ACC - Accumulated leaf C transfer gC/m^2 F -LEAFC_TO_BIOFUELC - leaf C to biofuel C gC/m^2/s T -LEAFC_TO_LITTER - leaf C litterfall gC/m^2/s F -LEAFC_TO_LITTER_FUN - leaf C litterfall used by FUN gC/m^2/s T -LEAFC_TO_REMOVEDRESIDUEC - leaf C to removed residue C gC/m^2/s F -LEAFC_XFER - leaf C transfer gC/m^2 F -LEAFC_XFER_TO_LEAFC - leaf C growth from storage gC/m^2/s F -LEAFN - leaf N gN/m^2 T -LEAFN_STORAGE - leaf N storage gN/m^2 F -LEAFN_STORAGE_TO_XFER - leaf N shift storage to transfer gN/m^2/s F -LEAFN_STORAGE_XFER_ACC - Accmulated leaf N transfer gN/m^2 F -LEAFN_TO_LITTER - leaf N litterfall gN/m^2/s T -LEAFN_TO_RETRANSN - leaf N to retranslocated N pool gN/m^2/s F -LEAFN_XFER - leaf N transfer gN/m^2 F -LEAFN_XFER_TO_LEAFN - leaf N growth from storage gN/m^2/s F -LEAF_MR - leaf maintenance respiration gC/m^2/s T -LFC2 - conversion area fraction of BET and BDT that burned per sec T -LGSF - long growing season factor proportion F -LIQCAN - intercepted liquid water mm T -LIQUID_CONTENT1 - initial gridcell total liq content mm T -LIQUID_CONTENT2 - post landuse change gridcell total liq content mm F -LIQUID_WATER_TEMP1 - initial gridcell weighted average liquid water temperature K F -LITFALL - litterfall (leaves and fine roots) gC/m^2/s T -LITFIRE - litter fire losses gC/m^2/s F -LITTERC_HR - litter C heterotrophic respiration gC/m^2/s T -LITTERC_LOSS - litter C loss gC/m^2/s T -LIT_CEL_C - LIT_CEL C gC/m^2 T -LIT_CEL_C_1m - LIT_CEL C to 1 meter gC/m^2 F -LIT_CEL_C_TO_SOM_ACT_C - decomp. of cellulosic litter C to active soil organic C gC/m^2/s F -LIT_CEL_HR - Het. Resp. from cellulosic litter gC/m^2/s F -LIT_CEL_N - LIT_CEL N gN/m^2 T -LIT_CEL_N_1m - LIT_CEL N to 1 meter gN/m^2 F -LIT_CEL_N_TO_SOM_ACT_N - decomp. of cellulosic litter N to active soil organic N gN/m^2 F -LIT_LIG_C - LIT_LIG C gC/m^2 T -LIT_LIG_C_1m - LIT_LIG C to 1 meter gC/m^2 F -LIT_LIG_C_TO_SOM_SLO_C - decomp. of lignin litter C to slow soil organic ma C gC/m^2/s F -LIT_LIG_HR - Het. Resp. from lignin litter gC/m^2/s F -LIT_LIG_N - LIT_LIG N gN/m^2 T -LIT_LIG_N_1m - LIT_LIG N to 1 meter gN/m^2 F -LIT_LIG_N_TO_SOM_SLO_N - decomp. of lignin litter N to slow soil organic ma N gN/m^2 F -LIT_MET_C - LIT_MET C gC/m^2 T -LIT_MET_C_1m - LIT_MET C to 1 meter gC/m^2 F -LIT_MET_C_TO_SOM_ACT_C - decomp. of metabolic litter C to active soil organic C gC/m^2/s F -LIT_MET_HR - Het. Resp. from metabolic litter gC/m^2/s F -LIT_MET_N - LIT_MET N gN/m^2 T -LIT_MET_N_1m - LIT_MET N to 1 meter gN/m^2 F -LIT_MET_N_TO_SOM_ACT_N - decomp. of metabolic litter N to active soil organic N gN/m^2 F -LIVECROOTC - live coarse root C gC/m^2 T -LIVECROOTC_STORAGE - live coarse root C storage gC/m^2 F -LIVECROOTC_STORAGE_TO_XFER - live coarse root C shift storage to transfer gC/m^2/s F -LIVECROOTC_TO_DEADCROOTC - live coarse root C turnover gC/m^2/s F -LIVECROOTC_XFER - live coarse root C transfer gC/m^2 F -LIVECROOTC_XFER_TO_LIVECROOTC - live coarse root C growth from storage gC/m^2/s F -LIVECROOTN - live coarse root N gN/m^2 T -LIVECROOTN_STORAGE - live coarse root N storage gN/m^2 F -LIVECROOTN_STORAGE_TO_XFER - live coarse root N shift storage to transfer gN/m^2/s F -LIVECROOTN_TO_DEADCROOTN - live coarse root N turnover gN/m^2/s F -LIVECROOTN_TO_RETRANSN - live coarse root N to retranslocated N pool gN/m^2/s F -LIVECROOTN_XFER - live coarse root N transfer gN/m^2 F -LIVECROOTN_XFER_TO_LIVECROOTN - live coarse root N growth from storage gN/m^2/s F -LIVECROOT_MR - live coarse root maintenance respiration gC/m^2/s F -LIVESTEMC - live stem C gC/m^2 T -LIVESTEMC_STORAGE - live stem C storage gC/m^2 F -LIVESTEMC_STORAGE_TO_XFER - live stem C shift storage to transfer gC/m^2/s F -LIVESTEMC_TO_BIOFUELC - livestem C to biofuel C gC/m^2/s T -LIVESTEMC_TO_DEADSTEMC - live stem C turnover gC/m^2/s F -LIVESTEMC_TO_REMOVEDRESIDUEC - livestem C to removed residue C gC/m^2/s F -LIVESTEMC_XFER - live stem C transfer gC/m^2 F -LIVESTEMC_XFER_TO_LIVESTEMC - live stem C growth from storage gC/m^2/s F -LIVESTEMN - live stem N gN/m^2 T -LIVESTEMN_STORAGE - live stem N storage gN/m^2 F -LIVESTEMN_STORAGE_TO_XFER - live stem N shift storage to transfer gN/m^2/s F -LIVESTEMN_TO_DEADSTEMN - live stem N turnover gN/m^2/s F -LIVESTEMN_TO_RETRANSN - live stem N to retranslocated N pool gN/m^2/s F -LIVESTEMN_XFER - live stem N transfer gN/m^2 F -LIVESTEMN_XFER_TO_LIVESTEMN - live stem N growth from storage gN/m^2/s F -LIVESTEM_MR - live stem maintenance respiration gC/m^2/s F -LNC - leaf N concentration gN leaf/m^2 T -LWdown - atmospheric longwave radiation (downscaled for glacier and hillslope columns) W/m^2 F -LWup - upwelling longwave radiation W/m^2 F -MEG_acetaldehyde - MEGAN flux kg/m2/sec T -MEG_acetic_acid - MEGAN flux kg/m2/sec T -MEG_acetone - MEGAN flux kg/m2/sec T -MEG_carene_3 - MEGAN flux kg/m2/sec T -MEG_ethanol - MEGAN flux kg/m2/sec T -MEG_formaldehyde - MEGAN flux kg/m2/sec T -MEG_isoprene - MEGAN flux kg/m2/sec T -MEG_methanol - MEGAN flux kg/m2/sec T -MEG_pinene_a - MEGAN flux kg/m2/sec T -MEG_thujene_a - MEGAN flux kg/m2/sec T -MR - maintenance respiration gC/m^2/s T -M_CWD_C_TO_FIRE - coarse woody debris C fire loss gC/m^2/s F -M_CWD_N_TO_FIRE - coarse woody debris N fire loss gN/m^2 F -M_DEADCROOTC_STORAGE_TO_LITTER - dead coarse root C storage mortality gC/m^2/s F -M_DEADCROOTC_STORAGE_TO_LITTER_FIRE - dead coarse root C storage fire mortality to litter gC/m^2/s F -M_DEADCROOTC_TO_LITTER - dead coarse root C mortality gC/m^2/s F -M_DEADCROOTC_XFER_TO_LITTER - dead coarse root C transfer mortality gC/m^2/s F -M_DEADCROOTN_STORAGE_TO_FIRE - dead coarse root N storage fire loss gN/m^2/s F -M_DEADCROOTN_STORAGE_TO_LITTER - dead coarse root N storage mortality gN/m^2/s F -M_DEADCROOTN_TO_FIRE - dead coarse root N fire loss gN/m^2/s F -M_DEADCROOTN_TO_LITTER - dead coarse root N mortality gN/m^2/s F -M_DEADCROOTN_TO_LITTER_FIRE - dead coarse root N fire mortality to litter gN/m^2/s F -M_DEADCROOTN_XFER_TO_FIRE - dead coarse root N transfer fire loss gN/m^2/s F -M_DEADCROOTN_XFER_TO_LITTER - dead coarse root N transfer mortality gN/m^2/s F -M_DEADROOTC_STORAGE_TO_FIRE - dead root C storage fire loss gC/m^2/s F -M_DEADROOTC_STORAGE_TO_LITTER_FIRE - dead root C storage fire mortality to litter gC/m^2/s F -M_DEADROOTC_TO_FIRE - dead root C fire loss gC/m^2/s F -M_DEADROOTC_TO_LITTER_FIRE - dead root C fire mortality to litter gC/m^2/s F -M_DEADROOTC_XFER_TO_FIRE - dead root C transfer fire loss gC/m^2/s F -M_DEADROOTC_XFER_TO_LITTER_FIRE - dead root C transfer fire mortality to litter gC/m^2/s F -M_DEADSTEMC_STORAGE_TO_FIRE - dead stem C storage fire loss gC/m^2/s F -M_DEADSTEMC_STORAGE_TO_LITTER - dead stem C storage mortality gC/m^2/s F -M_DEADSTEMC_STORAGE_TO_LITTER_FIRE - dead stem C storage fire mortality to litter gC/m^2/s F -M_DEADSTEMC_TO_FIRE - dead stem C fire loss gC/m^2/s F -M_DEADSTEMC_TO_LITTER - dead stem C mortality gC/m^2/s F -M_DEADSTEMC_TO_LITTER_FIRE - dead stem C fire mortality to litter gC/m^2/s F -M_DEADSTEMC_XFER_TO_FIRE - dead stem C transfer fire loss gC/m^2/s F -M_DEADSTEMC_XFER_TO_LITTER - dead stem C transfer mortality gC/m^2/s F -M_DEADSTEMC_XFER_TO_LITTER_FIRE - dead stem C transfer fire mortality to litter gC/m^2/s F -M_DEADSTEMN_STORAGE_TO_FIRE - dead stem N storage fire loss gN/m^2/s F -M_DEADSTEMN_STORAGE_TO_LITTER - dead stem N storage mortality gN/m^2/s F -M_DEADSTEMN_TO_FIRE - dead stem N fire loss gN/m^2/s F -M_DEADSTEMN_TO_LITTER - dead stem N mortality gN/m^2/s F -M_DEADSTEMN_TO_LITTER_FIRE - dead stem N fire mortality to litter gN/m^2/s F -M_DEADSTEMN_XFER_TO_FIRE - dead stem N transfer fire loss gN/m^2/s F -M_DEADSTEMN_XFER_TO_LITTER - dead stem N transfer mortality gN/m^2/s F -M_FROOTC_STORAGE_TO_FIRE - fine root C storage fire loss gC/m^2/s F -M_FROOTC_STORAGE_TO_LITTER - fine root C storage mortality gC/m^2/s F -M_FROOTC_STORAGE_TO_LITTER_FIRE - fine root C storage fire mortality to litter gC/m^2/s F -M_FROOTC_TO_FIRE - fine root C fire loss gC/m^2/s F -M_FROOTC_TO_LITTER - fine root C mortality gC/m^2/s F -M_FROOTC_TO_LITTER_FIRE - fine root C fire mortality to litter gC/m^2/s F -M_FROOTC_XFER_TO_FIRE - fine root C transfer fire loss gC/m^2/s F -M_FROOTC_XFER_TO_LITTER - fine root C transfer mortality gC/m^2/s F -M_FROOTC_XFER_TO_LITTER_FIRE - fine root C transfer fire mortality to litter gC/m^2/s F -M_FROOTN_STORAGE_TO_FIRE - fine root N storage fire loss gN/m^2/s F -M_FROOTN_STORAGE_TO_LITTER - fine root N storage mortality gN/m^2/s F -M_FROOTN_TO_FIRE - fine root N fire loss gN/m^2/s F -M_FROOTN_TO_LITTER - fine root N mortality gN/m^2/s F -M_FROOTN_XFER_TO_FIRE - fine root N transfer fire loss gN/m^2/s F -M_FROOTN_XFER_TO_LITTER - fine root N transfer mortality gN/m^2/s F -M_GRESP_STORAGE_TO_FIRE - growth respiration storage fire loss gC/m^2/s F -M_GRESP_STORAGE_TO_LITTER - growth respiration storage mortality gC/m^2/s F -M_GRESP_STORAGE_TO_LITTER_FIRE - growth respiration storage fire mortality to litter gC/m^2/s F -M_GRESP_XFER_TO_FIRE - growth respiration transfer fire loss gC/m^2/s F -M_GRESP_XFER_TO_LITTER - growth respiration transfer mortality gC/m^2/s F -M_GRESP_XFER_TO_LITTER_FIRE - growth respiration transfer fire mortality to litter gC/m^2/s F -M_LEAFC_STORAGE_TO_FIRE - leaf C storage fire loss gC/m^2/s F -M_LEAFC_STORAGE_TO_LITTER - leaf C storage mortality gC/m^2/s F -M_LEAFC_STORAGE_TO_LITTER_FIRE - leaf C fire mortality to litter gC/m^2/s F -M_LEAFC_TO_FIRE - leaf C fire loss gC/m^2/s F -M_LEAFC_TO_LITTER - leaf C mortality gC/m^2/s F -M_LEAFC_TO_LITTER_FIRE - leaf C fire mortality to litter gC/m^2/s F -M_LEAFC_XFER_TO_FIRE - leaf C transfer fire loss gC/m^2/s F -M_LEAFC_XFER_TO_LITTER - leaf C transfer mortality gC/m^2/s F -M_LEAFC_XFER_TO_LITTER_FIRE - leaf C transfer fire mortality to litter gC/m^2/s F -M_LEAFN_STORAGE_TO_FIRE - leaf N storage fire loss gN/m^2/s F -M_LEAFN_STORAGE_TO_LITTER - leaf N storage mortality gN/m^2/s F -M_LEAFN_TO_FIRE - leaf N fire loss gN/m^2/s F -M_LEAFN_TO_LITTER - leaf N mortality gN/m^2/s F -M_LEAFN_XFER_TO_FIRE - leaf N transfer fire loss gN/m^2/s F -M_LEAFN_XFER_TO_LITTER - leaf N transfer mortality gN/m^2/s F -M_LIT_CEL_C_TO_FIRE - cellulosic litter C fire loss gC/m^2/s F -M_LIT_CEL_C_TO_LEACHING - cellulosic litter C leaching loss gC/m^2/s F -M_LIT_CEL_N_TO_FIRE - cellulosic litter N fire loss gN/m^2 F -M_LIT_CEL_N_TO_LEACHING - cellulosic litter N leaching loss gN/m^2/s F -M_LIT_LIG_C_TO_FIRE - lignin litter C fire loss gC/m^2/s F -M_LIT_LIG_C_TO_LEACHING - lignin litter C leaching loss gC/m^2/s F -M_LIT_LIG_N_TO_FIRE - lignin litter N fire loss gN/m^2 F -M_LIT_LIG_N_TO_LEACHING - lignin litter N leaching loss gN/m^2/s F -M_LIT_MET_C_TO_FIRE - metabolic litter C fire loss gC/m^2/s F -M_LIT_MET_C_TO_LEACHING - metabolic litter C leaching loss gC/m^2/s F -M_LIT_MET_N_TO_FIRE - metabolic litter N fire loss gN/m^2 F -M_LIT_MET_N_TO_LEACHING - metabolic litter N leaching loss gN/m^2/s F -M_LIVECROOTC_STORAGE_TO_LITTER - live coarse root C storage mortality gC/m^2/s F -M_LIVECROOTC_STORAGE_TO_LITTER_FIRE - live coarse root C fire mortality to litter gC/m^2/s F -M_LIVECROOTC_TO_LITTER - live coarse root C mortality gC/m^2/s F -M_LIVECROOTC_XFER_TO_LITTER - live coarse root C transfer mortality gC/m^2/s F -M_LIVECROOTN_STORAGE_TO_FIRE - live coarse root N storage fire loss gN/m^2/s F -M_LIVECROOTN_STORAGE_TO_LITTER - live coarse root N storage mortality gN/m^2/s F -M_LIVECROOTN_TO_FIRE - live coarse root N fire loss gN/m^2/s F -M_LIVECROOTN_TO_LITTER - live coarse root N mortality gN/m^2/s F -M_LIVECROOTN_XFER_TO_FIRE - live coarse root N transfer fire loss gN/m^2/s F -M_LIVECROOTN_XFER_TO_LITTER - live coarse root N transfer mortality gN/m^2/s F -M_LIVEROOTC_STORAGE_TO_FIRE - live root C storage fire loss gC/m^2/s F -M_LIVEROOTC_STORAGE_TO_LITTER_FIRE - live root C storage fire mortality to litter gC/m^2/s F -M_LIVEROOTC_TO_DEADROOTC_FIRE - live root C fire mortality to dead root C gC/m^2/s F -M_LIVEROOTC_TO_FIRE - live root C fire loss gC/m^2/s F -M_LIVEROOTC_TO_LITTER_FIRE - live root C fire mortality to litter gC/m^2/s F -M_LIVEROOTC_XFER_TO_FIRE - live root C transfer fire loss gC/m^2/s F -M_LIVEROOTC_XFER_TO_LITTER_FIRE - live root C transfer fire mortality to litter gC/m^2/s F -M_LIVESTEMC_STORAGE_TO_FIRE - live stem C storage fire loss gC/m^2/s F -M_LIVESTEMC_STORAGE_TO_LITTER - live stem C storage mortality gC/m^2/s F -M_LIVESTEMC_STORAGE_TO_LITTER_FIRE - live stem C storage fire mortality to litter gC/m^2/s F -M_LIVESTEMC_TO_DEADSTEMC_FIRE - live stem C fire mortality to dead stem C gC/m^2/s F -M_LIVESTEMC_TO_FIRE - live stem C fire loss gC/m^2/s F -M_LIVESTEMC_TO_LITTER - live stem C mortality gC/m^2/s F -M_LIVESTEMC_TO_LITTER_FIRE - live stem C fire mortality to litter gC/m^2/s F -M_LIVESTEMC_XFER_TO_FIRE - live stem C transfer fire loss gC/m^2/s F -M_LIVESTEMC_XFER_TO_LITTER - live stem C transfer mortality gC/m^2/s F -M_LIVESTEMC_XFER_TO_LITTER_FIRE - live stem C transfer fire mortality to litter gC/m^2/s F -M_LIVESTEMN_STORAGE_TO_FIRE - live stem N storage fire loss gN/m^2/s F -M_LIVESTEMN_STORAGE_TO_LITTER - live stem N storage mortality gN/m^2/s F -M_LIVESTEMN_TO_FIRE - live stem N fire loss gN/m^2/s F -M_LIVESTEMN_TO_LITTER - live stem N mortality gN/m^2/s F -M_LIVESTEMN_XFER_TO_FIRE - live stem N transfer fire loss gN/m^2/s F -M_LIVESTEMN_XFER_TO_LITTER - live stem N transfer mortality gN/m^2/s F -M_RETRANSN_TO_FIRE - retranslocated N pool fire loss gN/m^2/s F -M_RETRANSN_TO_LITTER - retranslocated N pool mortality gN/m^2/s F -M_SOM_ACT_C_TO_LEACHING - active soil organic C leaching loss gC/m^2/s F -M_SOM_ACT_N_TO_LEACHING - active soil organic N leaching loss gN/m^2/s F -M_SOM_PAS_C_TO_LEACHING - passive soil organic C leaching loss gC/m^2/s F -M_SOM_PAS_N_TO_LEACHING - passive soil organic N leaching loss gN/m^2/s F -M_SOM_SLO_C_TO_LEACHING - slow soil organic ma C leaching loss gC/m^2/s F -M_SOM_SLO_N_TO_LEACHING - slow soil organic ma N leaching loss gN/m^2/s F -NACTIVE - Mycorrhizal N uptake flux gN/m^2/s T -NACTIVE_NH4 - Mycorrhizal N uptake flux gN/m^2/s T -NACTIVE_NO3 - Mycorrhizal N uptake flux gN/m^2/s T -NAM - AM-associated N uptake flux gN/m^2/s T -NAM_NH4 - AM-associated N uptake flux gN/m^2/s T -NAM_NO3 - AM-associated N uptake flux gN/m^2/s T -NBP - net biome production, includes fire, landuse, harvest and hrv_xsmrpool flux (latter smoothed o gC/m^2/s T -NDEPLOY - total N deployed in new growth gN/m^2/s T -NDEP_TO_SMINN - atmospheric N deposition to soil mineral N gN/m^2/s T -NECM - ECM-associated N uptake flux gN/m^2/s T -NECM_NH4 - ECM-associated N uptake flux gN/m^2/s T -NECM_NO3 - ECM-associated N uptake flux gN/m^2/s T -NEE - net ecosystem exchange of carbon, includes fire and hrv_xsmrpool (latter smoothed over the yea gC/m^2/s T -NEM - Gridcell net adjustment to net carbon exchange passed to atm. for methane production gC/m2/s T -NEP - net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink gC/m^2/s T -NET_NMIN - net rate of N mineralization gN/m^2/s T -NFERTILIZATION - fertilizer added gN/m^2/s T -NFIRE - fire counts valid only in Reg.C counts/km2/sec T -NFIX - Symbiotic BNF uptake flux gN/m^2/s T -NFIX_TO_SMINN - symbiotic/asymbiotic N fixation to soil mineral N gN/m^2/s F -NNONMYC - Non-mycorrhizal N uptake flux gN/m^2/s T -NNONMYC_NH4 - Non-mycorrhizal N uptake flux gN/m^2/s T -NNONMYC_NO3 - Non-mycorrhizal N uptake flux gN/m^2/s T -NPASSIVE - Passive N uptake flux gN/m^2/s T -NPOOL - temporary plant N pool gN/m^2 T -NPOOL_TO_DEADCROOTN - allocation to dead coarse root N gN/m^2/s F -NPOOL_TO_DEADCROOTN_STORAGE - allocation to dead coarse root N storage gN/m^2/s F -NPOOL_TO_DEADSTEMN - allocation to dead stem N gN/m^2/s F -NPOOL_TO_DEADSTEMN_STORAGE - allocation to dead stem N storage gN/m^2/s F -NPOOL_TO_FROOTN - allocation to fine root N gN/m^2/s F -NPOOL_TO_FROOTN_STORAGE - allocation to fine root N storage gN/m^2/s F -NPOOL_TO_LEAFN - allocation to leaf N gN/m^2/s F -NPOOL_TO_LEAFN_STORAGE - allocation to leaf N storage gN/m^2/s F -NPOOL_TO_LIVECROOTN - allocation to live coarse root N gN/m^2/s F -NPOOL_TO_LIVECROOTN_STORAGE - allocation to live coarse root N storage gN/m^2/s F -NPOOL_TO_LIVESTEMN - allocation to live stem N gN/m^2/s F -NPOOL_TO_LIVESTEMN_STORAGE - allocation to live stem N storage gN/m^2/s F -NPP - net primary production gC/m^2/s T -NPP_BURNEDOFF - C that cannot be used for N uptake gC/m^2/s F -NPP_GROWTH - Total C used for growth in FUN gC/m^2/s T -NPP_NACTIVE - Mycorrhizal N uptake used C gC/m^2/s T -NPP_NACTIVE_NH4 - Mycorrhizal N uptake use C gC/m^2/s T -NPP_NACTIVE_NO3 - Mycorrhizal N uptake used C gC/m^2/s T -NPP_NAM - AM-associated N uptake used C gC/m^2/s T -NPP_NAM_NH4 - AM-associated N uptake use C gC/m^2/s T -NPP_NAM_NO3 - AM-associated N uptake use C gC/m^2/s T -NPP_NECM - ECM-associated N uptake used C gC/m^2/s T -NPP_NECM_NH4 - ECM-associated N uptake use C gC/m^2/s T -NPP_NECM_NO3 - ECM-associated N uptake used C gC/m^2/s T -NPP_NFIX - Symbiotic BNF uptake used C gC/m^2/s T -NPP_NNONMYC - Non-mycorrhizal N uptake used C gC/m^2/s T -NPP_NNONMYC_NH4 - Non-mycorrhizal N uptake use C gC/m^2/s T -NPP_NNONMYC_NO3 - Non-mycorrhizal N uptake use C gC/m^2/s T -NPP_NRETRANS - Retranslocated N uptake flux gC/m^2/s T -NPP_NUPTAKE - Total C used by N uptake in FUN gC/m^2/s T -NRETRANS - Retranslocated N uptake flux gN/m^2/s T -NRETRANS_REG - Retranslocated N uptake flux gN/m^2/s T -NRETRANS_SEASON - Retranslocated N uptake flux gN/m^2/s T -NRETRANS_STRESS - Retranslocated N uptake flux gN/m^2/s T -NSUBSTEPS - number of adaptive timesteps in CLM timestep unitless F -NUPTAKE - Total N uptake of FUN gN/m^2/s T -NUPTAKE_NPP_FRACTION - frac of NPP used in N uptake - T -N_ALLOMETRY - N allocation index none F -OBU - Monin-Obukhov length m F -OCDEP - total OC deposition (dry+wet) from atmosphere kg/m^2/s T -OCPHIDRY - organic carbon deposition (phidry) from atmosphere kg/m^2/s F -OCPHIWET - organic carbon deposition (phiwet) from atmosphere kg/m^2/s F -OCPHODRY - black carbon deposition (phodry) from atmosphere kg/m^2/s F -OFFSET_COUNTER - offset days counter days F -OFFSET_FDD - offset freezing degree days counter C degree-days F -OFFSET_FLAG - offset flag none F -OFFSET_SWI - offset soil water index none F -ONSET_COUNTER - onset days counter days F -ONSET_FDD - onset freezing degree days counter C degree-days F -ONSET_FLAG - onset flag none F -ONSET_GDD - onset growing degree days C degree-days F -ONSET_GDDFLAG - onset flag for growing degree day sum none F -ONSET_SWI - onset soil water index none F -PAR240DZ - 10-day running mean of daytime patch absorbed PAR for leaves for top canopy layer W/m^2 F -PAR240XZ - 10-day running mean of maximum patch absorbed PAR for leaves for top canopy layer W/m^2 F -PAR240_shade - shade PAR (240 hrs) umol/m2/s F -PAR240_sun - sunlit PAR (240 hrs) umol/m2/s F -PAR24_shade - shade PAR (24 hrs) umol/m2/s F -PAR24_sun - sunlit PAR (24 hrs) umol/m2/s F -PARVEGLN - absorbed par by vegetation at local noon W/m^2 T -PAR_shade - shade PAR umol/m2/s F -PAR_sun - sunlit PAR umol/m2/s F -PBOT - atmospheric pressure at surface (downscaled for glacier and hillslope columns) Pa T -PBOT_240 - 10 day running mean of air pressure Pa F -PBOT_NOT_DOWNSCALED - atmospheric pressure at surface (pre-downscaling) Pa F -PCH4 - atmospheric partial pressure of CH4 Pa T -PCO2 - atmospheric partial pressure of CO2 Pa T -PCO2_240 - 10 day running mean of CO2 pressure Pa F -PFT_CTRUNC - patch-level sink for C truncation gC/m^2 F -PFT_FIRE_CLOSS - total patch-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s T -PFT_FIRE_NLOSS - total patch-level fire N loss gN/m^2/s T -PFT_NTRUNC - patch-level sink for N truncation gN/m^2 F -PLANTCN - Plant C:N used by FUN unitless F -PLANT_CALLOC - total allocated C flux gC/m^2/s F -PLANT_NALLOC - total allocated N flux gN/m^2/s F -PLANT_NDEMAND - N flux required to support initial GPP gN/m^2/s T -PNLCZ - Proportion of nitrogen allocated for light capture unitless F -PO2_240 - 10 day running mean of O2 pressure Pa F -POTENTIAL_IMMOB - potential N immobilization gN/m^2/s T -POT_F_DENIT - potential denitrification flux gN/m^2/s T -POT_F_NIT - potential nitrification flux gN/m^2/s T -PREC10 - 10-day running mean of PREC MM H2O/S F -PREC60 - 60-day running mean of PREC MM H2O/S F -PREV_DAYL - daylength from previous timestep s F -PREV_FROOTC_TO_LITTER - previous timestep froot C litterfall flux gC/m^2/s F -PREV_LEAFC_TO_LITTER - previous timestep leaf C litterfall flux gC/m^2/s F -PROD100C - 100-yr wood product C gC/m^2 F -PROD100C_LOSS - loss from 100-yr wood product pool gC/m^2/s F -PROD100N - 100-yr wood product N gN/m^2 F -PROD100N_LOSS - loss from 100-yr wood product pool gN/m^2/s F -PROD10C - 10-yr wood product C gC/m^2 F -PROD10C_LOSS - loss from 10-yr wood product pool gC/m^2/s F -PROD10N - 10-yr wood product N gN/m^2 F -PROD10N_LOSS - loss from 10-yr wood product pool gN/m^2/s F -PSNSHA - shaded leaf photosynthesis umolCO2/m^2/s T -PSNSHADE_TO_CPOOL - C fixation from shaded canopy gC/m^2/s T -PSNSUN - sunlit leaf photosynthesis umolCO2/m^2/s T -PSNSUN_TO_CPOOL - C fixation from sunlit canopy gC/m^2/s T -PSurf - atmospheric pressure at surface (downscaled for glacier and hillslope columns) Pa F -Q2M - 2m specific humidity kg/kg T -QAF - canopy air humidity kg/kg F -QBOT - atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg T -QBOT_NOT_DOWNSCALED - atmospheric specific humidity (pre-downscaling) kg/kg F -QDIRECT_THROUGHFALL - direct throughfall of liquid (rain + above-canopy irrigation) mm/s F -QDIRECT_THROUGHFALL_SNOW - direct throughfall of snow mm/s F -QDRAI - sub-surface drainage mm/s T -QDRAI_PERCH - perched wt drainage mm/s T -QDRAI_XS - saturation excess drainage mm/s T -QDRIP - rate of excess canopy liquid falling off canopy mm/s F -QDRIP_SNOW - rate of excess canopy snow falling off canopy mm/s F -QFLOOD - runoff from river flooding mm/s T -QFLX_EVAP_TOT - qflx_evap_soi + qflx_evap_can + qflx_tran_veg kg m-2 s-1 T -QFLX_EVAP_VEG - vegetation evaporation mm H2O/s F -QFLX_ICE_DYNBAL - ice dynamic land cover change conversion runoff flux mm/s T -QFLX_LIQDEW_TO_TOP_LAYER - rate of liquid water deposited on top soil or snow layer (dew) mm H2O/s T -QFLX_LIQEVAP_FROM_TOP_LAYER - rate of liquid water evaporated from top soil or snow layer mm H2O/s T -QFLX_LIQ_DYNBAL - liq dynamic land cover change conversion runoff flux mm/s T -QFLX_LIQ_GRND - liquid (rain+irrigation) on ground after interception mm H2O/s F -QFLX_SNOW_DRAIN - drainage from snow pack mm/s T -QFLX_SNOW_DRAIN_ICE - drainage from snow pack melt (ice landunits only) mm/s T -QFLX_SNOW_GRND - snow on ground after interception mm H2O/s F -QFLX_SOLIDDEW_TO_TOP_LAYER - rate of solid water deposited on top soil or snow layer (frost) mm H2O/s T -QFLX_SOLIDEVAP_FROM_TOP_LAYER - rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s T -QFLX_SOLIDEVAP_FROM_TOP_LAYER_ICE - rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s F -QH2OSFC - surface water runoff mm/s T -QH2OSFC_TO_ICE - surface water converted to ice mm/s F -QHR - hydraulic redistribution mm/s T -QICE - ice growth/melt mm/s T -QICE_FRZ - ice growth mm/s T -QICE_MELT - ice melt mm/s T -QINFL - infiltration mm/s T -QINTR - interception mm/s T -QIRRIG_DEMAND - irrigation demand mm/s F -QIRRIG_DRIP - water added via drip irrigation mm/s F -QIRRIG_FROM_GW_CONFINED - water added through confined groundwater irrigation mm/s T -QIRRIG_FROM_GW_UNCONFINED - water added through unconfined groundwater irrigation mm/s T -QIRRIG_FROM_SURFACE - water added through surface water irrigation mm/s T -QIRRIG_SPRINKLER - water added via sprinkler irrigation mm/s F -QOVER - total surface runoff (includes QH2OSFC) mm/s T -QOVER_LAG - time-lagged surface runoff for soil columns mm/s F -QPHSNEG - net negative hydraulic redistribution flux mm/s F -QRGWL - surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff fro mm/s T -QRUNOFF - total liquid runoff not including correction for land use change mm/s T -QRUNOFF_ICE - total liquid runoff not incl corret for LULCC (ice landunits only) mm/s T -QRUNOFF_ICE_TO_COUPLER - total ice runoff sent to coupler (includes corrections for land use change) mm/s T -QRUNOFF_ICE_TO_LIQ - liquid runoff from converted ice runoff mm/s F -QRUNOFF_R - Rural total runoff mm/s F -QRUNOFF_TO_COUPLER - total liquid runoff sent to coupler (includes corrections for land use change) mm/s T -QRUNOFF_U - Urban total runoff mm/s F -QSNOCPLIQ - excess liquid h2o due to snow capping not including correction for land use change mm H2O/s T -QSNOEVAP - evaporation from snow (only when snl<0, otherwise it is equal to qflx_ev_soil) mm/s T -QSNOFRZ - column-integrated snow freezing rate kg/m2/s T -QSNOFRZ_ICE - column-integrated snow freezing rate (ice landunits only) mm/s T -QSNOMELT - snow melt rate mm/s T -QSNOMELT_ICE - snow melt (ice landunits only) mm/s T -QSNOUNLOAD - canopy snow unloading mm/s T -QSNO_TEMPUNLOAD - canopy snow temp unloading mm/s T -QSNO_WINDUNLOAD - canopy snow wind unloading mm/s T -QSNWCPICE - excess solid h2o due to snow capping not including correction for land use change mm H2O/s T -QSOIL - Ground evaporation (soil/snow evaporation + soil/snow sublimation - dew) mm/s T -QSOIL_ICE - Ground evaporation (ice landunits only) mm/s T -QTOPSOIL - water input to surface mm/s F -QVEGE - canopy evaporation mm/s T -QVEGT - canopy transpiration mm/s T -Qair - atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg F -Qh - sensible heat W/m^2 F -Qle - total evaporation W/m^2 F -Qstor - storage heat flux (includes snowmelt) W/m^2 F -Qtau - momentum flux kg/m/s^2 F -RAH1 - aerodynamical resistance s/m F -RAH2 - aerodynamical resistance s/m F -RAIN - atmospheric rain, after rain/snow repartitioning based on temperature mm/s T -RAIN_FROM_ATM - atmospheric rain received from atmosphere (pre-repartitioning) mm/s T -RAIN_ICE - atmospheric rain, after rain/snow repartitioning based on temperature (ice landunits only) mm/s F -RAM1 - aerodynamical resistance s/m F -RAM_LAKE - aerodynamic resistance for momentum (lakes only) s/m F -RAW1 - aerodynamical resistance s/m F -RAW2 - aerodynamical resistance s/m F -RB - leaf boundary resistance s/m F -RB10 - 10 day running mean boundary layer resistance s/m F -RETRANSN - plant pool of retranslocated N gN/m^2 T -RETRANSN_TO_NPOOL - deployment of retranslocated N gN/m^2/s T -RH - atmospheric relative humidity % F -RH2M - 2m relative humidity % T -RH2M_R - Rural 2m relative humidity % F -RH2M_U - Urban 2m relative humidity % F -RH30 - 30-day running mean of relative humidity % F -RHAF - fractional humidity of canopy air fraction F -RHAF10 - 10 day running mean of fractional humidity of canopy air fraction F -RH_LEAF - fractional humidity at leaf surface fraction F -RR - root respiration (fine root MR + total root GR) gC/m^2/s T -RSSHA - shaded leaf stomatal resistance s/m T -RSSUN - sunlit leaf stomatal resistance s/m T -Rainf - atmospheric rain, after rain/snow repartitioning based on temperature mm/s F -Rho_from_atm - atmospheric density (pre-downscaling) kg/m^3 F -Rnet - net radiation W/m^2 F -SABG - solar rad absorbed by ground W/m^2 T -SABG_PEN - Rural solar rad penetrating top soil or snow layer watt/m^2 T -SABV - solar rad absorbed by veg W/m^2 T -SEEDC - pool for seeding new PFTs via dynamic landcover gC/m^2 T -SEEDN - pool for seeding new PFTs via dynamic landcover gN/m^2 T -SLASH_HARVESTC - slash harvest carbon (to litter) gC/m^2/s T -SMINN - soil mineral N gN/m^2 T -SMINN_TO_NPOOL - deployment of soil mineral N uptake gN/m^2/s T -SMINN_TO_PLANT - plant uptake of soil mineral N gN/m^2/s T -SMINN_TO_PLANT_FUN - Total soil N uptake of FUN gN/m^2/s T -SMINN_TO_S1N_L1 - mineral N flux for decomp. of LIT_METto SOM_ACT gN/m^2 F -SMINN_TO_S1N_L2 - mineral N flux for decomp. of LIT_CELto SOM_ACT gN/m^2 F -SMINN_TO_S1N_S2 - mineral N flux for decomp. of SOM_SLOto SOM_ACT gN/m^2 F -SMINN_TO_S1N_S3 - mineral N flux for decomp. of SOM_PASto SOM_ACT gN/m^2 F -SMINN_TO_S2N_L3 - mineral N flux for decomp. of LIT_LIGto SOM_SLO gN/m^2 F -SMINN_TO_S2N_S1 - mineral N flux for decomp. of SOM_ACTto SOM_SLO gN/m^2 F -SMINN_TO_S3N_S1 - mineral N flux for decomp. of SOM_ACTto SOM_PAS gN/m^2 F -SMINN_TO_S3N_S2 - mineral N flux for decomp. of SOM_SLOto SOM_PAS gN/m^2 F -SMIN_NH4 - soil mineral NH4 gN/m^2 T -SMIN_NO3 - soil mineral NO3 gN/m^2 T -SMIN_NO3_LEACHED - soil NO3 pool loss to leaching gN/m^2/s T -SMIN_NO3_RUNOFF - soil NO3 pool loss to runoff gN/m^2/s T -SNOBCMCL - mass of BC in snow column kg/m2 T -SNOBCMSL - mass of BC in top snow layer kg/m2 T -SNOCAN - intercepted snow mm T -SNODSTMCL - mass of dust in snow column kg/m2 T -SNODSTMSL - mass of dust in top snow layer kg/m2 T -SNOFSDSND - direct nir incident solar radiation on snow W/m^2 F -SNOFSDSNI - diffuse nir incident solar radiation on snow W/m^2 F -SNOFSDSVD - direct vis incident solar radiation on snow W/m^2 F -SNOFSDSVI - diffuse vis incident solar radiation on snow W/m^2 F -SNOFSRND - direct nir reflected solar radiation from snow W/m^2 T -SNOFSRNI - diffuse nir reflected solar radiation from snow W/m^2 T -SNOFSRVD - direct vis reflected solar radiation from snow W/m^2 T -SNOFSRVI - diffuse vis reflected solar radiation from snow W/m^2 T -SNOINTABS - Fraction of incoming solar absorbed by lower snow layers - T -SNOLIQFL - top snow layer liquid water fraction (land) fraction F -SNOMELT_ACCUM - accumulated snow melt for z0 m T -SNOOCMCL - mass of OC in snow column kg/m2 T -SNOOCMSL - mass of OC in top snow layer kg/m2 T -SNORDSL - top snow layer effective grain radius m^-6 F -SNOTTOPL - snow temperature (top layer) K F -SNOTTOPL_ICE - snow temperature (top layer, ice landunits only) K F -SNOTXMASS - snow temperature times layer mass, layer sum; to get mass-weighted temperature, divide by (SNO K kg/m2 T -SNOTXMASS_ICE - snow temperature times layer mass, layer sum (ice landunits only); to get mass-weighted temper K kg/m2 F -SNOW - atmospheric snow, after rain/snow repartitioning based on temperature mm/s T -SNOWDP - gridcell mean snow height m T -SNOWICE - snow ice kg/m2 T -SNOWICE_ICE - snow ice (ice landunits only) kg/m2 F -SNOWLIQ - snow liquid water kg/m2 T -SNOWLIQ_ICE - snow liquid water (ice landunits only) kg/m2 F -SNOW_5D - 5day snow avg m F -SNOW_DEPTH - snow height of snow covered area m T -SNOW_DEPTH_ICE - snow height of snow covered area (ice landunits only) m F -SNOW_FROM_ATM - atmospheric snow received from atmosphere (pre-repartitioning) mm/s T -SNOW_ICE - atmospheric snow, after rain/snow repartitioning based on temperature (ice landunits only) mm/s F -SNOW_PERSISTENCE - Length of time of continuous snow cover (nat. veg. landunits only) seconds T -SNOW_SINKS - snow sinks (liquid water) mm/s T -SNOW_SOURCES - snow sources (liquid water) mm/s T -SNOdTdzL - top snow layer temperature gradient (land) K/m F -SOIL10 - 10-day running mean of 12cm layer soil K F -SOILC_CHANGE - C change in soil gC/m^2/s T -SOILC_HR - soil C heterotrophic respiration gC/m^2/s T -SOILRESIS - soil resistance to evaporation s/m T -SOILWATER_10CM - soil liquid water + ice in top 10cm of soil (veg landunits only) kg/m2 T -SOMC_FIRE - C loss due to peat burning gC/m^2/s T -SOMFIRE - soil organic matter fire losses gC/m^2/s F -SOM_ACT_C - SOM_ACT C gC/m^2 T -SOM_ACT_C_1m - SOM_ACT C to 1 meter gC/m^2 F -SOM_ACT_C_TO_SOM_PAS_C - decomp. of active soil organic C to passive soil organic C gC/m^2/s F -SOM_ACT_C_TO_SOM_SLO_C - decomp. of active soil organic C to slow soil organic ma C gC/m^2/s F -SOM_ACT_HR_S2 - Het. Resp. from active soil organic gC/m^2/s F -SOM_ACT_HR_S3 - Het. Resp. from active soil organic gC/m^2/s F -SOM_ACT_N - SOM_ACT N gN/m^2 T -SOM_ACT_N_1m - SOM_ACT N to 1 meter gN/m^2 F -SOM_ACT_N_TO_SOM_PAS_N - decomp. of active soil organic N to passive soil organic N gN/m^2 F -SOM_ACT_N_TO_SOM_SLO_N - decomp. of active soil organic N to slow soil organic ma N gN/m^2 F -SOM_C_LEACHED - total flux of C from SOM pools due to leaching gC/m^2/s T -SOM_N_LEACHED - total flux of N from SOM pools due to leaching gN/m^2/s F -SOM_PAS_C - SOM_PAS C gC/m^2 T -SOM_PAS_C_1m - SOM_PAS C to 1 meter gC/m^2 F -SOM_PAS_C_TO_SOM_ACT_C - decomp. of passive soil organic C to active soil organic C gC/m^2/s F -SOM_PAS_HR - Het. Resp. from passive soil organic gC/m^2/s F -SOM_PAS_N - SOM_PAS N gN/m^2 T -SOM_PAS_N_1m - SOM_PAS N to 1 meter gN/m^2 F -SOM_PAS_N_TO_SOM_ACT_N - decomp. of passive soil organic N to active soil organic N gN/m^2 F -SOM_SLO_C - SOM_SLO C gC/m^2 T -SOM_SLO_C_1m - SOM_SLO C to 1 meter gC/m^2 F -SOM_SLO_C_TO_SOM_ACT_C - decomp. of slow soil organic ma C to active soil organic C gC/m^2/s F -SOM_SLO_C_TO_SOM_PAS_C - decomp. of slow soil organic ma C to passive soil organic C gC/m^2/s F -SOM_SLO_HR_S1 - Het. Resp. from slow soil organic ma gC/m^2/s F -SOM_SLO_HR_S3 - Het. Resp. from slow soil organic ma gC/m^2/s F -SOM_SLO_N - SOM_SLO N gN/m^2 T -SOM_SLO_N_1m - SOM_SLO N to 1 meter gN/m^2 F -SOM_SLO_N_TO_SOM_ACT_N - decomp. of slow soil organic ma N to active soil organic N gN/m^2 F -SOM_SLO_N_TO_SOM_PAS_N - decomp. of slow soil organic ma N to passive soil organic N gN/m^2 F -SR - total soil respiration (HR + root resp) gC/m^2/s T -SSRE_FSR - surface snow effect on reflected solar radiation W/m^2 T -SSRE_FSRND - surface snow effect on direct nir reflected solar radiation W/m^2 T -SSRE_FSRNDLN - surface snow effect on direct nir reflected solar radiation at local noon W/m^2 T -SSRE_FSRNI - surface snow effect on diffuse nir reflected solar radiation W/m^2 T -SSRE_FSRVD - surface snow radiatve effect on direct vis reflected solar radiation W/m^2 T -SSRE_FSRVDLN - surface snow radiatve effect on direct vis reflected solar radiation at local noon W/m^2 T -SSRE_FSRVI - surface snow radiatve effect on diffuse vis reflected solar radiation W/m^2 T -STORAGE_CDEMAND - C use from the C storage pool gC/m^2 F -STORAGE_GR - growth resp for growth sent to storage for later display gC/m^2/s F -STORAGE_NDEMAND - N demand during the offset period gN/m^2 F -STORVEGC - stored vegetation carbon, excluding cpool gC/m^2 T -STORVEGN - stored vegetation nitrogen gN/m^2 T -SUPPLEMENT_TO_SMINN - supplemental N supply gN/m^2/s T -SWBGT - 2 m Simplified Wetbulb Globe Temp C T -SWBGT_R - Rural 2 m Simplified Wetbulb Globe Temp C T -SWBGT_U - Urban 2 m Simplified Wetbulb Globe Temp C T -SWMP65 - 2 m Swamp Cooler Temp 65% Eff C T -SWMP65_R - Rural 2 m Swamp Cooler Temp 65% Eff C T -SWMP65_U - Urban 2 m Swamp Cooler Temp 65% Eff C T -SWMP80 - 2 m Swamp Cooler Temp 80% Eff C T -SWMP80_R - Rural 2 m Swamp Cooler Temp 80% Eff C T -SWMP80_U - Urban 2 m Swamp Cooler Temp 80% Eff C T -SWdown - atmospheric incident solar radiation W/m^2 F -SWup - upwelling shortwave radiation W/m^2 F -SoilAlpha - factor limiting ground evap unitless F -SoilAlpha_U - urban factor limiting ground evap unitless F -T10 - 10-day running mean of 2-m temperature K F -TAF - canopy air temperature K F -TAUX - zonal surface stress kg/m/s^2 T -TAUY - meridional surface stress kg/m/s^2 T -TBOT - atmospheric air temperature (downscaled for glacier and hillslope columns) K T -TBUILD - internal urban building air temperature K T -TBUILD_MAX - prescribed maximum interior building temperature K F -TDEPTH - tributary water depth m F -TDEPTHMAX - tributary bankfull water depth m F -TEMPAVG_T2M - temporary average 2m air temperature K F -TEMPMAX_RETRANSN - temporary annual max of retranslocated N pool gN/m^2 F -TEMPSUM_POTENTIAL_GPP - temporary annual sum of potential GPP gC/m^2/yr F -TEQ - 2 m Equiv Temp K T -TEQ_R - Rural 2 m Equiv Temp K T -TEQ_U - Urban 2 m Equiv Temp K T -TFLOOR - floor temperature K F -TG - ground temperature K T -TG_ICE - ground temperature (ice landunits only) K F -TG_R - Rural ground temperature K F -TG_U - Urban ground temperature K F -TH2OSFC - surface water temperature K T -THBOT - atmospheric air potential temperature (downscaled for glacier and hillslope columns) K T -THIC - 2 m Temp Hum Index Comfort C T -THIC_R - Rural 2 m Temp Hum Index Comfort C T -THIC_U - Urban 2 m Temp Hum Index Comfort C T -THIP - 2 m Temp Hum Index Physiology C T -THIP_R - Rural 2 m Temp Hum Index Physiology C T -THIP_U - Urban 2 m Temp Hum Index Physiology C T -TKE1 - top lake level eddy thermal conductivity W/(mK) T -TLAI - total projected leaf area index m^2/m^2 T -TOPO_COL - column-level topographic height m F -TOPO_COL_ICE - column-level topographic height (ice landunits only) m F -TOPT - topt coefficient for VOC calc non F -TOTCOLC - total column carbon, incl veg and cpool but excl product pools gC/m^2 T -TOTCOLCH4 - total belowground CH4 (0 for non-lake special landunits in the absence of dynamic landunits) gC/m2 T -TOTCOLN - total column-level N, excluding product pools gN/m^2 T -TOTECOSYSC - total ecosystem carbon, incl veg but excl cpool and product pools gC/m^2 T -TOTECOSYSN - total ecosystem N, excluding product pools gN/m^2 T -TOTFIRE - total ecosystem fire losses gC/m^2/s F -TOTLITC - total litter carbon gC/m^2 T -TOTLITC_1m - total litter carbon to 1 meter depth gC/m^2 T -TOTLITN - total litter N gN/m^2 T -TOTLITN_1m - total litter N to 1 meter gN/m^2 T -TOTPFTC - total patch-level carbon, including cpool gC/m^2 T -TOTPFTN - total patch-level nitrogen gN/m^2 T -TOTSOILICE - vertically summed soil ice (veg landunits only) kg/m2 T -TOTSOILLIQ - vertically summed soil liquid water (veg landunits only) kg/m2 T -TOTSOMC - total soil organic matter carbon gC/m^2 T -TOTSOMC_1m - total soil organic matter carbon to 1 meter depth gC/m^2 T -TOTSOMN - total soil organic matter N gN/m^2 T -TOTSOMN_1m - total soil organic matter N to 1 meter gN/m^2 T -TOTVEGC - total vegetation carbon, excluding cpool gC/m^2 T -TOTVEGN - total vegetation nitrogen gN/m^2 T -TOT_WOODPRODC - total wood product C gC/m^2 T -TOT_WOODPRODC_LOSS - total loss from wood product pools gC/m^2/s T -TOT_WOODPRODN - total wood product N gN/m^2 T -TOT_WOODPRODN_LOSS - total loss from wood product pools gN/m^2/s T -TPU25T - canopy profile of tpu umol/m2/s T -TRAFFICFLUX - sensible heat flux from urban traffic W/m^2 F -TRANSFER_DEADCROOT_GR - dead coarse root growth respiration from storage gC/m^2/s F -TRANSFER_DEADSTEM_GR - dead stem growth respiration from storage gC/m^2/s F -TRANSFER_FROOT_GR - fine root growth respiration from storage gC/m^2/s F -TRANSFER_GR - growth resp for transfer growth displayed in this timestep gC/m^2/s F -TRANSFER_LEAF_GR - leaf growth respiration from storage gC/m^2/s F -TRANSFER_LIVECROOT_GR - live coarse root growth respiration from storage gC/m^2/s F -TRANSFER_LIVESTEM_GR - live stem growth respiration from storage gC/m^2/s F -TREFMNAV - daily minimum of average 2-m temperature K T -TREFMNAV_R - Rural daily minimum of average 2-m temperature K F -TREFMNAV_U - Urban daily minimum of average 2-m temperature K F -TREFMXAV - daily maximum of average 2-m temperature K T -TREFMXAV_R - Rural daily maximum of average 2-m temperature K F -TREFMXAV_U - Urban daily maximum of average 2-m temperature K F -TROOF_INNER - roof inside surface temperature K F -TSA - 2m air temperature K T -TSAI - total projected stem area index m^2/m^2 T -TSA_ICE - 2m air temperature (ice landunits only) K F -TSA_R - Rural 2m air temperature K F -TSA_U - Urban 2m air temperature K F -TSHDW_INNER - shadewall inside surface temperature K F -TSKIN - skin temperature K T -TSL - temperature of near-surface soil layer (natural vegetated and crop landunits only) K T -TSOI_10CM - soil temperature in top 10cm of soil K T -TSUNW_INNER - sunwall inside surface temperature K F -TV - vegetation temperature K T -TV24 - vegetation temperature (last 24hrs) K F -TV240 - vegetation temperature (last 240hrs) K F -TVEGD10 - 10 day running mean of patch daytime vegetation temperature Kelvin F -TVEGN10 - 10 day running mean of patch night-time vegetation temperature Kelvin F -TWS - total water storage mm T -Tair - atmospheric air temperature (downscaled for glacier and hillslope columns) K F -Tair_from_atm - atmospheric air temperature received from atmosphere (pre-downscaling) K F -Thair_from_atm - atmospheric air potential temperature (pre-downscaling) K F -U10 - 10-m wind m/s T -U10_DUST - 10-m wind for dust model m/s T -U10_ICE - 10-m wind (ice landunits only) m/s F -UAF - canopy air speed m/s F -ULRAD - upward longwave radiation above the canopy W/m^2 F -UM - wind speed plus stability effect m/s F -URBAN_AC - urban air conditioning flux W/m^2 T -URBAN_HEAT - urban heating flux W/m^2 T -USTAR - aerodynamical resistance s/m F -UST_LAKE - friction velocity (lakes only) m/s F -UWIND - atmospheric U wind velocity magnitude m/s F -VA - atmospheric wind speed plus convective velocity m/s F -VCMX25T - canopy profile of vcmax25 umol/m2/s T -VENTILATION - sensible heat flux from building ventilation W/m^2 T -VOCFLXT - total VOC flux into atmosphere moles/m2/sec F -VOLR - river channel total water storage m3 T -VOLRMCH - river channel main channel water storage m3 T -VPD - vpd Pa F -VPD2M - 2m vapor pressure deficit Pa T -VPD_CAN - canopy vapor pressure deficit kPa T -VWIND - atmospheric V wind velocity magnitude m/s F -Vcmx25Z - canopy profile of vcmax25 predicted by LUNA model umol/m2/s T -WASTEHEAT - sensible heat flux from heating/cooling sources of urban waste heat W/m^2 T -WBA - 2 m Wet Bulb C T -WBA_R - Rural 2 m Wet Bulb C T -WBA_U - Urban 2 m Wet Bulb C T -WBT - 2 m Stull Wet Bulb C T -WBT_R - Rural 2 m Stull Wet Bulb C T -WBT_U - Urban 2 m Stull Wet Bulb C T -WF - soil water as frac. of whc for top 0.05 m proportion F -WIND - atmospheric wind velocity magnitude m/s T -WOODC - wood C gC/m^2 T -WOODC_ALLOC - wood C eallocation gC/m^2/s T -WOODC_LOSS - wood C loss gC/m^2/s T -WOOD_HARVESTC - wood harvest carbon (to product pools) gC/m^2/s T -WOOD_HARVESTN - wood harvest N (to product pools) gN/m^2/s T -WTGQ - surface tracer conductance m/s T -Wind - atmospheric wind velocity magnitude m/s F -XSMRPOOL - temporary photosynthate C pool gC/m^2 T -XSMRPOOL_LOSS - temporary photosynthate C pool loss gC/m^2 F -XSMRPOOL_RECOVER - C flux assigned to recovery of negative xsmrpool gC/m^2/s T -Z0HG - roughness length over ground, sensible heat (vegetated landunits only) m F -Z0HG_P - patch roughness length over ground, sensible heat m F -Z0HV - roughness length over vegetation, sensible heat m F -Z0MG - roughness length over ground, momentum (vegetated landunits only) m F -Z0MG_P - patch roughness length over ground, momentum m F -Z0MV - roughness length over vegetation, momentum m F -Z0MV_DENSE - roughness length over vegetation, momentum, for dense canopy m F -Z0M_TO_COUPLER - roughness length, momentum: gridcell average sent to coupler m F -Z0QG - roughness length over ground, latent heat (vegetated landunits only) m F -Z0QG_P - patch roughness length over ground, latent heat m F -Z0QV - roughness length over vegetation, latent heat m F -ZBOT - atmospheric reference height m T -ZETA - dimensionless stability parameter unitless F -ZII - convective boundary height m F -ZWT - water table depth (natural vegetated and crop landunits only) m T -ZWT_CH4_UNSAT - depth of water table for methane production used in non-inundated area m T -ZWT_PERCH - perched water table depth (natural vegetated and crop landunits only) m T -currentPatch - currentPatch coefficient for VOC calc non F -num_iter - number of iterations unitless F -QICE_FORC elevclas qice forcing sent to GLC mm/s F -TOPO_FORC elevclas topograephic height sent to GLC m F -TSRF_FORC elevclas surface temperature sent to GLC K F -ACTUAL_IMMOB_NH4 levdcmp immobilization of NH4 gN/m^3/s F -ACTUAL_IMMOB_NO3 levdcmp immobilization of NO3 gN/m^3/s F -ACTUAL_IMMOB_vr levdcmp actual N immobilization gN/m^3/s F -CROOT_PROF levdcmp profile for litter C and N inputs from coarse roots 1/m F -CWD_C_TO_LIT_CEL_C_vr levdcmp decomp. of coarse woody debris C to cellulosic litter C gC/m^3/s F -CWD_C_TO_LIT_LIG_C_vr levdcmp decomp. of coarse woody debris C to lignin litter C gC/m^3/s F -CWD_HR_L2_vr levdcmp Het. Resp. from coarse woody debris gC/m^3/s F -CWD_HR_L3_vr levdcmp Het. Resp. from coarse woody debris gC/m^3/s F -CWD_N_TO_LIT_CEL_N_vr levdcmp decomp. of coarse woody debris N to cellulosic litter N gN/m^3 F -CWD_N_TO_LIT_LIG_N_vr levdcmp decomp. of coarse woody debris N to lignin litter N gN/m^3 F -CWD_N_vr levdcmp CWD N (vertically resolved) gN/m^3 T -CWD_PATHFRAC_L2_vr levdcmp PATHFRAC from coarse woody debris to cellulosic litter fraction F -CWD_PATHFRAC_L3_vr levdcmp PATHFRAC from coarse woody debris to lignin litter fraction F -CWD_RESP_FRAC_L2_vr levdcmp respired from coarse woody debris to cellulosic litter fraction F -CWD_RESP_FRAC_L3_vr levdcmp respired from coarse woody debris to lignin litter fraction F -DWT_DEADCROOTC_TO_CWDC levdcmp dead coarse root to CWD due to landcover change gC/m^2/s F -DWT_DEADCROOTN_TO_CWDN levdcmp dead coarse root to CWD due to landcover change gN/m^2/s F -DWT_FROOTC_TO_LIT_CEL_C levdcmp fine root to cellulosic litter due to landcover change gC/m^2/s F -DWT_FROOTC_TO_LIT_LIG_C levdcmp fine root to lignin litter due to landcover change gC/m^2/s F -DWT_FROOTC_TO_LIT_MET_C levdcmp fine root to metabolic litter due to landcover change gC/m^2/s F -DWT_FROOTN_TO_LIT_CEL_N levdcmp fine root N to cellulosic litter due to landcover change gN/m^2/s F -DWT_FROOTN_TO_LIT_LIG_N levdcmp fine root N to lignin litter due to landcover change gN/m^2/s F -DWT_FROOTN_TO_LIT_MET_N levdcmp fine root N to metabolic litter due to landcover change gN/m^2/s F -DWT_LIVECROOTC_TO_CWDC levdcmp live coarse root to CWD due to landcover change gC/m^2/s F -DWT_LIVECROOTN_TO_CWDN levdcmp live coarse root to CWD due to landcover change gN/m^2/s F -FMAX_DENIT_CARBONSUBSTRATE levdcmp FMAX_DENIT_CARBONSUBSTRATE gN/m^3/s F -FMAX_DENIT_NITRATE levdcmp FMAX_DENIT_NITRATE gN/m^3/s F -FPI_vr levdcmp fraction of potential immobilization proportion F -FROOT_PROF levdcmp profile for litter C and N inputs from fine roots 1/m F -F_DENIT_BASE levdcmp F_DENIT_BASE gN/m^3/s F -F_DENIT_vr levdcmp denitrification flux gN/m^3/s F -F_NIT_vr levdcmp nitrification flux gN/m^3/s F -GROSS_NMIN_vr levdcmp gross rate of N mineralization gN/m^3/s F -K_CWD levdcmp coarse woody debris potential loss coefficient 1/s F -K_LIT_CEL levdcmp cellulosic litter potential loss coefficient 1/s F -K_LIT_LIG levdcmp lignin litter potential loss coefficient 1/s F -K_LIT_MET levdcmp metabolic litter potential loss coefficient 1/s F -K_NITR levdcmp K_NITR 1/s F -K_NITR_H2O levdcmp K_NITR_H2O unitless F -K_NITR_PH levdcmp K_NITR_PH unitless F -K_NITR_T levdcmp K_NITR_T unitless F -K_SOM_ACT levdcmp active soil organic potential loss coefficient 1/s F -K_SOM_PAS levdcmp passive soil organic potential loss coefficient 1/s F -K_SOM_SLO levdcmp slow soil organic ma potential loss coefficient 1/s F -L1_PATHFRAC_S1_vr levdcmp PATHFRAC from metabolic litter to active soil organic fraction F -L1_RESP_FRAC_S1_vr levdcmp respired from metabolic litter to active soil organic fraction F -L2_PATHFRAC_S1_vr levdcmp PATHFRAC from cellulosic litter to active soil organic fraction F -L2_RESP_FRAC_S1_vr levdcmp respired from cellulosic litter to active soil organic fraction F -L3_PATHFRAC_S2_vr levdcmp PATHFRAC from lignin litter to slow soil organic ma fraction F -L3_RESP_FRAC_S2_vr levdcmp respired from lignin litter to slow soil organic ma fraction F -LEAF_PROF levdcmp profile for litter C and N inputs from leaves 1/m F -LIT_CEL_C_TNDNCY_VERT_TR levdcmp cellulosic litter C tendency due to vertical transport gC/m^3/s F -LIT_CEL_C_TO_SOM_ACT_C_v levdcmp decomp. of cellulosic litter C to active soil organic C gC/m^3/s F -LIT_CEL_HR_vr levdcmp Het. Resp. from cellulosic litter gC/m^3/s F -LIT_CEL_N_TNDNCY_VERT_TR levdcmp cellulosic litter N tendency due to vertical transport gN/m^3/s F -LIT_CEL_N_TO_SOM_ACT_N_v levdcmp decomp. of cellulosic litter N to active soil organic N gN/m^3 F -LIT_CEL_N_vr levdcmp LIT_CEL N (vertically resolved) gN/m^3 T -LIT_LIG_C_TNDNCY_VERT_TR levdcmp lignin litter C tendency due to vertical transport gC/m^3/s F -LIT_LIG_C_TO_SOM_SLO_C_v levdcmp decomp. of lignin litter C to slow soil organic ma C gC/m^3/s F -LIT_LIG_HR_vr levdcmp Het. Resp. from lignin litter gC/m^3/s F -LIT_LIG_N_TNDNCY_VERT_TR levdcmp lignin litter N tendency due to vertical transport gN/m^3/s F -LIT_LIG_N_TO_SOM_SLO_N_v levdcmp decomp. of lignin litter N to slow soil organic ma N gN/m^3 F -LIT_LIG_N_vr levdcmp LIT_LIG N (vertically resolved) gN/m^3 T -LIT_MET_C_TNDNCY_VERT_TR levdcmp metabolic litter C tendency due to vertical transport gC/m^3/s F -LIT_MET_C_TO_SOM_ACT_C_v levdcmp decomp. of metabolic litter C to active soil organic C gC/m^3/s F -LIT_MET_HR_vr levdcmp Het. Resp. from metabolic litter gC/m^3/s F -LIT_MET_N_TNDNCY_VERT_TR levdcmp metabolic litter N tendency due to vertical transport gN/m^3/s F -LIT_MET_N_TO_SOM_ACT_N_v levdcmp decomp. of metabolic litter N to active soil organic N gN/m^3 F -LIT_MET_N_vr levdcmp LIT_MET N (vertically resolved) gN/m^3 T -M_CWD_C_TO_FIRE_vr levdcmp coarse woody debris C fire loss gC/m^3/s F -M_CWD_N_TO_FIRE_vr levdcmp coarse woody debris N fire loss gN/m^3 F -M_LIT_CEL_C_TO_FIRE_vr levdcmp cellulosic litter C fire loss gC/m^3/s F -M_LIT_CEL_N_TO_FIRE_vr levdcmp cellulosic litter N fire loss gN/m^3 F -M_LIT_LIG_C_TO_FIRE_vr levdcmp lignin litter C fire loss gC/m^3/s F -M_LIT_LIG_N_TO_FIRE_vr levdcmp lignin litter N fire loss gN/m^3 F -M_LIT_MET_C_TO_FIRE_vr levdcmp metabolic litter C fire loss gC/m^3/s F -M_LIT_MET_N_TO_FIRE_vr levdcmp metabolic litter N fire loss gN/m^3 F -NDEP_PROF levdcmp profile for atmospheric N deposition 1/m F -NET_NMIN_vr levdcmp net rate of N mineralization gN/m^3/s F -NFIXATION_PROF levdcmp profile for biological N fixation 1/m F -POTENTIAL_IMMOB_vr levdcmp potential N immobilization gN/m^3/s F -POT_F_DENIT_vr levdcmp potential denitrification flux gN/m^3/s F -POT_F_NIT_vr levdcmp potential nitrification flux gN/m^3/s F -S1_PATHFRAC_S2_vr levdcmp PATHFRAC from active soil organic to slow soil organic ma fraction F -S1_PATHFRAC_S3_vr levdcmp PATHFRAC from active soil organic to passive soil organic fraction F -S1_RESP_FRAC_S2_vr levdcmp respired from active soil organic to slow soil organic ma fraction F -S1_RESP_FRAC_S3_vr levdcmp respired from active soil organic to passive soil organic fraction F -S2_PATHFRAC_S1_vr levdcmp PATHFRAC from slow soil organic ma to active soil organic fraction F -S2_PATHFRAC_S3_vr levdcmp PATHFRAC from slow soil organic ma to passive soil organic fraction F -S2_RESP_FRAC_S1_vr levdcmp respired from slow soil organic ma to active soil organic fraction F -S2_RESP_FRAC_S3_vr levdcmp respired from slow soil organic ma to passive soil organic fraction F -S3_PATHFRAC_S1_vr levdcmp PATHFRAC from passive soil organic to active soil organic fraction F -S3_RESP_FRAC_S1_vr levdcmp respired from passive soil organic to active soil organic fraction F -SMINN_TO_PLANT_vr levdcmp plant uptake of soil mineral N gN/m^3/s F -SMINN_TO_S1N_L1_vr levdcmp mineral N flux for decomp. of LIT_METto SOM_ACT gN/m^3 F -SMINN_TO_S1N_L2_vr levdcmp mineral N flux for decomp. of LIT_CELto SOM_ACT gN/m^3 F -SMINN_TO_S1N_S2_vr levdcmp mineral N flux for decomp. of SOM_SLOto SOM_ACT gN/m^3 F -SMINN_TO_S1N_S3_vr levdcmp mineral N flux for decomp. of SOM_PASto SOM_ACT gN/m^3 F -SMINN_TO_S2N_L3_vr levdcmp mineral N flux for decomp. of LIT_LIGto SOM_SLO gN/m^3 F -SMINN_TO_S2N_S1_vr levdcmp mineral N flux for decomp. of SOM_ACTto SOM_SLO gN/m^3 F -SMINN_TO_S3N_S1_vr levdcmp mineral N flux for decomp. of SOM_ACTto SOM_PAS gN/m^3 F -SMINN_TO_S3N_S2_vr levdcmp mineral N flux for decomp. of SOM_SLOto SOM_PAS gN/m^3 F -SMIN_NH4_TO_PLANT levdcmp plant uptake of NH4 gN/m^3/s F -SMIN_NO3_LEACHED_vr levdcmp soil NO3 pool loss to leaching gN/m^3/s F -SMIN_NO3_MASSDENS levdcmp SMIN_NO3_MASSDENS ugN/cm^3 soil F -SMIN_NO3_RUNOFF_vr levdcmp soil NO3 pool loss to runoff gN/m^3/s F -SMIN_NO3_TO_PLANT levdcmp plant uptake of NO3 gN/m^3/s F -SOILN_vr levdcmp SOIL N (vertically resolved) gN/m^3 T -SOM_ACT_C_TNDNCY_VERT_TR levdcmp active soil organic C tendency due to vertical transport gC/m^3/s F -SOM_ACT_C_TO_SOM_PAS_C_v levdcmp decomp. of active soil organic C to passive soil organic C gC/m^3/s F -SOM_ACT_C_TO_SOM_SLO_C_v levdcmp decomp. of active soil organic C to slow soil organic ma C gC/m^3/s F -SOM_ACT_HR_S2_vr levdcmp Het. Resp. from active soil organic gC/m^3/s F -SOM_ACT_HR_S3_vr levdcmp Het. Resp. from active soil organic gC/m^3/s F -SOM_ACT_N_TNDNCY_VERT_TR levdcmp active soil organic N tendency due to vertical transport gN/m^3/s F -SOM_ACT_N_TO_SOM_PAS_N_v levdcmp decomp. of active soil organic N to passive soil organic N gN/m^3 F -SOM_ACT_N_TO_SOM_SLO_N_v levdcmp decomp. of active soil organic N to slow soil organic ma N gN/m^3 F -SOM_ACT_N_vr levdcmp SOM_ACT N (vertically resolved) gN/m^3 T -SOM_ADV_COEF levdcmp advection term for vertical SOM translocation m/s F -SOM_DIFFUS_COEF levdcmp diffusion coefficient for vertical SOM translocation m^2/s F -SOM_PAS_C_TNDNCY_VERT_TR levdcmp passive soil organic C tendency due to vertical transport gC/m^3/s F -SOM_PAS_C_TO_SOM_ACT_C_v levdcmp decomp. of passive soil organic C to active soil organic C gC/m^3/s F -SOM_PAS_HR_vr levdcmp Het. Resp. from passive soil organic gC/m^3/s F -SOM_PAS_N_TNDNCY_VERT_TR levdcmp passive soil organic N tendency due to vertical transport gN/m^3/s F -SOM_PAS_N_TO_SOM_ACT_N_v levdcmp decomp. of passive soil organic N to active soil organic N gN/m^3 F -SOM_PAS_N_vr levdcmp SOM_PAS N (vertically resolved) gN/m^3 T -SOM_SLO_C_TNDNCY_VERT_TR levdcmp slow soil organic ma C tendency due to vertical transport gC/m^3/s F -SOM_SLO_C_TO_SOM_ACT_C_v levdcmp decomp. of slow soil organic ma C to active soil organic C gC/m^3/s F -SOM_SLO_C_TO_SOM_PAS_C_v levdcmp decomp. of slow soil organic ma C to passive soil organic C gC/m^3/s F -SOM_SLO_HR_S1_vr levdcmp Het. Resp. from slow soil organic ma gC/m^3/s F -SOM_SLO_HR_S3_vr levdcmp Het. Resp. from slow soil organic ma gC/m^3/s F -SOM_SLO_N_TNDNCY_VERT_TR levdcmp slow soil organic ma N tendency due to vertical transport gN/m^3/s F -SOM_SLO_N_TO_SOM_ACT_N_v levdcmp decomp. of slow soil organic ma N to active soil organic N gN/m^3 F -SOM_SLO_N_TO_SOM_PAS_N_v levdcmp decomp. of slow soil organic ma N to passive soil organic N gN/m^3 F -SOM_SLO_N_vr levdcmp SOM_SLO N (vertically resolved) gN/m^3 T -STEM_PROF levdcmp profile for litter C and N inputs from stems 1/m F -SUPPLEMENT_TO_SMINN_vr levdcmp supplemental N supply gN/m^3/s F -WFPS levdcmp WFPS percent F -anaerobic_frac levdcmp anaerobic_frac m3/m3 F -diffus levdcmp diffusivity m^2/s F -fr_WFPS levdcmp fr_WFPS fraction F -n2_n2o_ratio_denit levdcmp n2_n2o_ratio_denit gN/gN F -r_psi levdcmp r_psi m F -ratio_k1 levdcmp ratio_k1 none F -ratio_no3_co2 levdcmp ratio_no3_co2 ratio F -soil_bulkdensity levdcmp soil_bulkdensity kg/m3 F -soil_co2_prod levdcmp soil_co2_prod ug C / g soil / day F -CONC_CH4_SAT levgrnd CH4 soil Concentration for inundated / lake area mol/m3 F -CONC_CH4_UNSAT levgrnd CH4 soil Concentration for non-inundated area mol/m3 F -EFF_POROSITY levgrnd effective porosity = porosity - vol_ice proportion F -FGR_SOIL_R levgrnd Rural downward heat flux at interface below each soil layer watt/m^2 F -FRAC_ICEOLD levgrnd fraction of ice relative to the tot water proportion F -HK levgrnd hydraulic conductivity (natural vegetated and crop landunits only) mm/s F -O2_DECOMP_DEPTH_UNSAT levgrnd O2 consumption from HR and AR for non-inundated area mol/m3/s F -ROOTR levgrnd effective fraction of roots in each soil layer (SMS method) proportion F -RRESIS levgrnd root resistance in each soil layer proportion F -SMP levgrnd soil matric potential (natural vegetated and crop landunits only) mm T -SOILPSI levgrnd soil water potential in each soil layer MPa F -TSOI levgrnd soil temperature (natural vegetated and crop landunits only) K T -TSOI_ICE levgrnd soil temperature (ice landunits only) K T -bsw levgrnd clap and hornberger B unitless F -watfc levgrnd water field capacity m^3/m^3 F -watsat levgrnd water saturated m^3/m^3 F -LAKEICEFRAC levlak lake layer ice mass fraction unitless F -TLAKE levlak lake temperature K T -SNO_ABS levsno Absorbed solar radiation in each snow layer W/m^2 F -SNO_ABS_ICE levsno Absorbed solar radiation in each snow layer (ice landunits only) W/m^2 F -SNO_BW levsno Partial density of water in the snow pack (ice + liquid) kg/m3 F -SNO_BW_ICE levsno Partial density of water in the snow pack (ice + liquid, ice landunits only) kg/m3 F -SNO_EXISTENCE levsno Fraction of averaging period for which each snow layer existed unitless F -SNO_FRZ levsno snow freezing rate in each snow layer kg/m2/s F -SNO_FRZ_ICE levsno snow freezing rate in each snow layer (ice landunits only) mm/s F -SNO_GS levsno Mean snow grain size Microns F -SNO_GS_ICE levsno Mean snow grain size (ice landunits only) Microns F -SNO_ICE levsno Snow ice content kg/m2 F -SNO_LIQH2O levsno Snow liquid water content kg/m2 F -SNO_MELT levsno snow melt rate in each snow layer mm/s F -SNO_MELT_ICE levsno snow melt rate in each snow layer (ice landunits only) mm/s F -SNO_T levsno Snow temperatures K F -SNO_TK levsno Thermal conductivity W/m-K F -SNO_TK_ICE levsno Thermal conductivity (ice landunits only) W/m-K F -SNO_T_ICE levsno Snow temperatures (ice landunits only) K F -SNO_Z levsno Snow layer thicknesses m F -SNO_Z_ICE levsno Snow layer thicknesses (ice landunits only) m F -CONC_O2_SAT levsoi O2 soil Concentration for inundated / lake area mol/m3 T -CONC_O2_UNSAT levsoi O2 soil Concentration for non-inundated area mol/m3 T -CWD_C_vr levsoi CWD C (vertically resolved) gC/m^3 T -H2OSOI levsoi volumetric soil water (natural vegetated and crop landunits only) mm3/mm3 T -HR_vr levsoi total vertically resolved heterotrophic respiration gC/m^3/s T -KROOT levsoi root conductance each soil layer 1/s F -KSOIL levsoi soil conductance in each soil layer 1/s F -LIT_CEL_C_vr levsoi LIT_CEL C (vertically resolved) gC/m^3 T -LIT_LIG_C_vr levsoi LIT_LIG C (vertically resolved) gC/m^3 T -LIT_MET_C_vr levsoi LIT_MET C (vertically resolved) gC/m^3 T -O_SCALAR levsoi fraction by which decomposition is reduced due to anoxia unitless T -QROOTSINK levsoi water flux from soil to root in each soil-layer mm/s F -SMINN_vr levsoi soil mineral N gN/m^3 T -SMIN_NH4_vr levsoi soil mineral NH4 (vert. res.) gN/m^3 T -SMIN_NO3_vr levsoi soil mineral NO3 (vert. res.) gN/m^3 T -SOILC_vr levsoi SOIL C (vertically resolved) gC/m^3 T -SOILICE levsoi soil ice (natural vegetated and crop landunits only) kg/m2 T -SOILLIQ levsoi soil liquid water (natural vegetated and crop landunits only) kg/m2 T -SOM_ACT_C_vr levsoi SOM_ACT C (vertically resolved) gC/m^3 T -SOM_PAS_C_vr levsoi SOM_PAS C (vertically resolved) gC/m^3 T -SOM_SLO_C_vr levsoi SOM_SLO C (vertically resolved) gC/m^3 T -T_SCALAR levsoi temperature inhibition of decomposition unitless T -W_SCALAR levsoi Moisture (dryness) inhibition of decomposition unitless T -GDDACCUM_PERHARV mxharvests At-harvest accumulated growing degree days past planting date for crop; should only be output ddays F -GDDHARV_PERHARV mxharvests Growing degree days (gdd) needed to harvest; should only be output annually ddays F -GRAINC_TO_FOOD_PERHARV mxharvests grain C to food per harvest; should only be output annually gC/m^2 F -GRAINC_TO_SEED_PERHARV mxharvests grain C to seed per harvest; should only be output annually gC/m^2 F -GRAINN_TO_FOOD_PERHARV mxharvests grain N to food per harvest; should only be output annually (not scientifically supported) gN/m^2 F -GRAINN_TO_SEED_PERHARV mxharvests grain N to seed per harvest; should only be output annually (not scientifically supported) gN/m^2 F -HARVEST_REASON_PERHARV mxharvests Reason for each crop harvest; should only be output annually 1 = mature; 2 = max season length; 3 = incorrect Dec. 31 sowing; F -HDATES mxharvests actual crop harvest dates; should only be output annually day of year F -HUI_PERHARV mxharvests At-harvest accumulated heat unit index for crop; should only be output annually ddays F -SDATES_PERHARV mxharvests actual sowing dates for crops harvested this year; should only be output annually day of year F -SOWING_REASON_PERHARV mxharvests Reason for sowing of each crop harvested this year; should only be output annually unitless F -SYEARS_PERHARV mxharvests actual sowing years for crops harvested this year; should only be output annually year F -SDATES mxsowings actual crop sowing dates; should only be output annually day of year F -SOWING_REASON mxsowings Reason for each crop sowing; should only be output annually unitless F -SWINDOW_ENDS mxsowings crop sowing window end dates; should only be output annually day of year F -SWINDOW_STARTS mxsowings crop sowing window start dates; should only be output annually day of year F -ALBD numrad surface albedo (direct) proportion T -ALBDSF numrad diagnostic snow-free surface albedo (direct) proportion T -ALBGRD numrad ground albedo (direct) proportion F -ALBGRI numrad ground albedo (indirect) proportion F -ALBI numrad surface albedo (indirect) proportion T -ALBISF numrad diagnostic snow-free surface albedo (indirect) proportion T -VEGWP nvegwcs vegetation water matric potential for sun/sha canopy,xyl,root segments mm T -VEGWPLN nvegwcs vegetation water matric potential for sun/sha canopy,xyl,root at local noon mm T -VEGWPPD nvegwcs predawn vegetation water matric potential for sun/sha canopy,xyl,root mm T -=================================== ================ ============================================================================================== ================================================================= ======= +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Variable Name Level Dim. Long Description Units Active 'I' Act. not 'I' +=================================== ================ ============================================================================================== ================================================================= ========== ============ +A10TMIN - 10-day running mean of min 2-m temperature K F F +A5TMIN - 5-day running mean of min 2-m temperature K F F +ACTUAL_IMMOB - actual N immobilization gN/m^2/s T F +AGLB - Aboveground leaf biomass kg/m^2 F F +AGNPP - aboveground NPP gC/m^2/s T F +AGSB - Aboveground stem biomass kg/m^2 F F +ALPHA - alpha coefficient for VOC calc non F F +ALT - current active layer thickness m T F +ALTMAX - maximum annual active layer thickness m T F +ALTMAX_LASTYEAR - maximum prior year active layer thickness m F F +ANNAVG_FINRW - annual average respiration-weighted FINUNDATED unitless T F +ANNAVG_T2M - annual average 2m air temperature K F F +ANNMAX_RETRANSN - annual max of retranslocated N pool gN/m^2 F F +ANNSUM_COUNTER - seconds since last annual accumulator turnover s F F +ANNSUM_NPP - annual sum of NPP gC/m^2/yr F F +ANNSUM_POTENTIAL_GPP - annual sum of potential GPP gN/m^2/yr F F +APPAR_TEMP - 2 m apparent temperature C T F +APPAR_TEMP_R - Rural 2 m apparent temperature C T F +APPAR_TEMP_U - Urban 2 m apparent temperature C T F +AR - autotrophic respiration (MR + GR) gC/m^2/s T F +ATM_O3 - atmospheric ozone partial pressure mol/mol F F +ATM_TOPO - atmospheric surface height m T F +AVAILC - C flux available for allocation gC/m^2/s F F +AVAIL_RETRANSN - N flux available from retranslocation pool gN/m^2/s F F +AZSUN - azimuth angle of the sun radians F F +AnnET - Annual ET mm/s F F +BAF_CROP - fractional area burned for crop s-1 T F +BAF_PEATF - fractional area burned in peatland s-1 T F +BCDEP - total BC deposition (dry+wet) from atmosphere kg/m^2/s T F +BCPHIDRY - black carbon deposition (phidry) from atmosphere kg/m^2/s F F +BCPHIWET - black carbon deposition (phiwet) from atmosphere kg/m^2/s F F +BCPHODRY - black carbon deposition (phodry) from atmosphere kg/m^2/s F F +BETA - coefficient of convective velocity none F F +BGLFR - background litterfall rate 1/s F F +BGNPP - belowground NPP gC/m^2/s T F +BGTR - background transfer growth rate 1/s F F +BTRAN2 - root zone soil wetness factor unitless T F +BTRANMN - daily minimum of transpiration beta factor unitless T F +CANNAVG_T2M - annual average of 2m air temperature K F F +CANNSUM_NPP - annual sum of column-level NPP gC/m^2/s F F +CGRND - deriv. of soil energy flux wrt to soil temp W/m^2/K F F +CGRNDL - deriv. of soil latent heat flux wrt soil temp W/m^2/K F F +CGRNDS - deriv. of soil sensible heat flux wrt soil temp W/m^2/K F F +CH4PROD - Gridcell total production of CH4 gC/m2/s T F +CH4_EBUL_TOTAL_SAT - ebullition surface CH4 flux; (+ to atm) mol/m2/s F F +CH4_EBUL_TOTAL_UNSAT - ebullition surface CH4 flux; (+ to atm) mol/m2/s F F +CH4_SURF_AERE_SAT - aerenchyma surface CH4 flux for inundated area; (+ to atm) mol/m2/s T F +CH4_SURF_AERE_UNSAT - aerenchyma surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T F +CH4_SURF_DIFF_SAT - diffusive surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s T F +CH4_SURF_DIFF_UNSAT - diffusive surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T F +CH4_SURF_EBUL_SAT - ebullition surface CH4 flux for inundated / lake area; (+ to atm) mol/m2/s T F +CH4_SURF_EBUL_UNSAT - ebullition surface CH4 flux for non-inundated area; (+ to atm) mol/m2/s T F +COL_CTRUNC - column-level sink for C truncation gC/m^2 F F +COL_FIRE_CLOSS - total column-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s T F +COL_FIRE_NLOSS - total column-level fire N loss gN/m^2/s T F +COL_NTRUNC - column-level sink for N truncation gN/m^2 F F +COST_NACTIVE - Cost of active uptake gN/gC T F +COST_NFIX - Cost of fixation gN/gC T F +COST_NRETRANS - Cost of retranslocation gN/gC T F +COSZEN - cosine of solar zenith angle (downscaled if downscaling is activated) none F F +COSZEN_GRC - cosine of solar zenith angle none F F +CPHASE - crop phenology phase 0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest T F +CPOOL - temporary photosynthate C pool gC/m^2 T F +CPOOL_DEADCROOT_GR - dead coarse root growth respiration gC/m^2/s F F +CPOOL_DEADCROOT_STORAGE_GR - dead coarse root growth respiration to storage gC/m^2/s F F +CPOOL_DEADSTEM_GR - dead stem growth respiration gC/m^2/s F F +CPOOL_DEADSTEM_STORAGE_GR - dead stem growth respiration to storage gC/m^2/s F F +CPOOL_FROOT_GR - fine root growth respiration gC/m^2/s F F +CPOOL_FROOT_STORAGE_GR - fine root growth respiration to storage gC/m^2/s F F +CPOOL_LEAF_GR - leaf growth respiration gC/m^2/s F F +CPOOL_LEAF_STORAGE_GR - leaf growth respiration to storage gC/m^2/s F F +CPOOL_LIVECROOT_GR - live coarse root growth respiration gC/m^2/s F F +CPOOL_LIVECROOT_STORAGE_GR - live coarse root growth respiration to storage gC/m^2/s F F +CPOOL_LIVESTEM_GR - live stem growth respiration gC/m^2/s F F +CPOOL_LIVESTEM_STORAGE_GR - live stem growth respiration to storage gC/m^2/s F F +CPOOL_TO_DEADCROOTC - allocation to dead coarse root C gC/m^2/s F F +CPOOL_TO_DEADCROOTC_STORAGE - allocation to dead coarse root C storage gC/m^2/s F F +CPOOL_TO_DEADSTEMC - allocation to dead stem C gC/m^2/s F F +CPOOL_TO_DEADSTEMC_STORAGE - allocation to dead stem C storage gC/m^2/s F F +CPOOL_TO_FROOTC - allocation to fine root C gC/m^2/s F F +CPOOL_TO_FROOTC_STORAGE - allocation to fine root C storage gC/m^2/s F F +CPOOL_TO_GRESP_STORAGE - allocation to growth respiration storage gC/m^2/s F F +CPOOL_TO_LEAFC - allocation to leaf C gC/m^2/s F F +CPOOL_TO_LEAFC_STORAGE - allocation to leaf C storage gC/m^2/s F F +CPOOL_TO_LIVECROOTC - allocation to live coarse root C gC/m^2/s F F +CPOOL_TO_LIVECROOTC_STORAGE - allocation to live coarse root C storage gC/m^2/s F F +CPOOL_TO_LIVESTEMC - allocation to live stem C gC/m^2/s F F +CPOOL_TO_LIVESTEMC_STORAGE - allocation to live stem C storage gC/m^2/s F F +CROPPROD1C - 1-yr crop product (grain+biofuel) C gC/m^2 T F +CROPPROD1C_LOSS - loss from 1-yr crop product pool gC/m^2/s T F +CROPPROD1N - 1-yr crop product (grain+biofuel) N gN/m^2 T F +CROPPROD1N_LOSS - loss from 1-yr crop product pool gN/m^2/s T F +CROPSEEDC_DEFICIT - C used for crop seed that needs to be repaid gC/m^2 T F +CROPSEEDN_DEFICIT - N used for crop seed that needs to be repaid gN/m^2 F F +CROP_SEEDC_TO_LEAF - crop seed source to leaf gC/m^2/s F F +CROP_SEEDN_TO_LEAF - crop seed source to leaf gN/m^2/s F F +CURRENT_GR - growth resp for new growth displayed in this timestep gC/m^2/s F F +CWDC_HR - cwd C heterotrophic respiration gC/m^2/s T F +CWDC_LOSS - coarse woody debris C loss gC/m^2/s T F +CWD_C - CWD C gC/m^2 T F +CWD_C_1m - CWD C to 1 meter gC/m^2 F F +CWD_C_TO_LIT_CEL_C - decomp. of coarse woody debris C to cellulosic litter C gC/m^2/s F F +CWD_C_TO_LIT_LIG_C - decomp. of coarse woody debris C to lignin litter C gC/m^2/s F F +CWD_HR_L2 - Het. Resp. from coarse woody debris gC/m^2/s F F +CWD_HR_L3 - Het. Resp. from coarse woody debris gC/m^2/s F F +CWD_N - CWD N gN/m^2 T F +CWD_N_1m - CWD N to 1 meter gN/m^2 F F +CWD_N_TO_LIT_CEL_N - decomp. of coarse woody debris N to cellulosic litter N gN/m^2 F F +CWD_N_TO_LIT_LIG_N - decomp. of coarse woody debris N to lignin litter N gN/m^2 F F +C_ALLOMETRY - C allocation index none F F +DAYL - daylength s F F +DAYS_ACTIVE - number of days since last dormancy days F F +DEADCROOTC - dead coarse root C gC/m^2 T F +DEADCROOTC_STORAGE - dead coarse root C storage gC/m^2 F F +DEADCROOTC_STORAGE_TO_XFER - dead coarse root C shift storage to transfer gC/m^2/s F F +DEADCROOTC_XFER - dead coarse root C transfer gC/m^2 F F +DEADCROOTC_XFER_TO_DEADCROOTC - dead coarse root C growth from storage gC/m^2/s F F +DEADCROOTN - dead coarse root N gN/m^2 T F +DEADCROOTN_STORAGE - dead coarse root N storage gN/m^2 F F +DEADCROOTN_STORAGE_TO_XFER - dead coarse root N shift storage to transfer gN/m^2/s F F +DEADCROOTN_XFER - dead coarse root N transfer gN/m^2 F F +DEADCROOTN_XFER_TO_DEADCROOTN - dead coarse root N growth from storage gN/m^2/s F F +DEADSTEMC - dead stem C gC/m^2 T F +DEADSTEMC_STORAGE - dead stem C storage gC/m^2 F F +DEADSTEMC_STORAGE_TO_XFER - dead stem C shift storage to transfer gC/m^2/s F F +DEADSTEMC_XFER - dead stem C transfer gC/m^2 F F +DEADSTEMC_XFER_TO_DEADSTEMC - dead stem C growth from storage gC/m^2/s F F +DEADSTEMN - dead stem N gN/m^2 T F +DEADSTEMN_STORAGE - dead stem N storage gN/m^2 F F +DEADSTEMN_STORAGE_TO_XFER - dead stem N shift storage to transfer gN/m^2/s F F +DEADSTEMN_XFER - dead stem N transfer gN/m^2 F F +DEADSTEMN_XFER_TO_DEADSTEMN - dead stem N growth from storage gN/m^2/s F F +DENIT - total rate of denitrification gN/m^2/s T F +DGNETDT - derivative of net ground heat flux wrt soil temp W/m^2/K F F +DISCOI - 2 m Discomfort Index C T F +DISCOIS - 2 m Stull Discomfort Index C T F +DISCOIS_R - Rural 2 m Stull Discomfort Index C T F +DISCOIS_U - Urban 2 m Stull Discomfort Index C T F +DISCOI_R - Rural 2 m Discomfort Index C T F +DISCOI_U - Urban 2 m Discomfort Index C T F +DISPLA - displacement height (vegetated landunits only) m F F +DISPVEGC - displayed veg carbon, excluding storage and cpool gC/m^2 T F +DISPVEGN - displayed vegetation nitrogen gN/m^2 T F +DLRAD - downward longwave radiation below the canopy W/m^2 F F +DORMANT_FLAG - dormancy flag none F F +DOWNREG - fractional reduction in GPP due to N limitation proportion F F +DPVLTRB1 - turbulent deposition velocity 1 m/s F F +DPVLTRB2 - turbulent deposition velocity 2 m/s F F +DPVLTRB3 - turbulent deposition velocity 3 m/s F F +DPVLTRB4 - turbulent deposition velocity 4 m/s F F +DSL - dry surface layer thickness mm T F +DSTDEP - total dust deposition (dry+wet) from atmosphere kg/m^2/s T F +DSTDRY1 - dust deposition (dry1) from atmosphere kg/m^2/s F F +DSTDRY2 - dust deposition (dry2) from atmosphere kg/m^2/s F F +DSTDRY3 - dust deposition (dry3) from atmosphere kg/m^2/s F F +DSTDRY4 - dust deposition (dry4) from atmosphere kg/m^2/s F F +DSTFLXT - total surface dust emission kg/m2/s T F +DSTWET1 - dust deposition (wet1) from atmosphere kg/m^2/s F F +DSTWET2 - dust deposition (wet2) from atmosphere kg/m^2/s F F +DSTWET3 - dust deposition (wet3) from atmosphere kg/m^2/s F F +DSTWET4 - dust deposition (wet4) from atmosphere kg/m^2/s F F +DT_VEG - change in t_veg, last iteration K F F +DWT_CONV_CFLUX - conversion C flux (immediate loss to atm) (0 at all times except first timestep of year) gC/m^2/s T F +DWT_CONV_CFLUX_DRIBBLED - conversion C flux (immediate loss to atm), dribbled throughout the year gC/m^2/s T F +DWT_CONV_CFLUX_PATCH - patch-level conversion C flux (immediate loss to atm) (0 at all times except first timestep of gC/m^2/s F F +DWT_CONV_NFLUX - conversion N flux (immediate loss to atm) (0 at all times except first timestep of year) gN/m^2/s T F +DWT_CONV_NFLUX_PATCH - patch-level conversion N flux (immediate loss to atm) (0 at all times except first timestep of gN/m^2/s F F +DWT_CROPPROD1C_GAIN - landcover change-driven addition to 1-year crop product pool gC/m^2/s T F +DWT_CROPPROD1N_GAIN - landcover change-driven addition to 1-year crop product pool gN/m^2/s T F +DWT_PROD100C_GAIN - landcover change-driven addition to 100-yr wood product pool gC/m^2/s F F +DWT_PROD100N_GAIN - landcover change-driven addition to 100-yr wood product pool gN/m^2/s F F +DWT_PROD10C_GAIN - landcover change-driven addition to 10-yr wood product pool gC/m^2/s F F +DWT_PROD10N_GAIN - landcover change-driven addition to 10-yr wood product pool gN/m^2/s F F +DWT_SEEDC_TO_DEADSTEM - seed source to patch-level deadstem gC/m^2/s F F +DWT_SEEDC_TO_DEADSTEM_PATCH - patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gC/m^2/s F F +DWT_SEEDC_TO_LEAF - seed source to patch-level leaf gC/m^2/s F F +DWT_SEEDC_TO_LEAF_PATCH - patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gC/m^2/s F F +DWT_SEEDN_TO_DEADSTEM - seed source to patch-level deadstem gN/m^2/s T F +DWT_SEEDN_TO_DEADSTEM_PATCH - patch-level seed source to patch-level deadstem (per-area-gridcell; only makes sense with dov2 gN/m^2/s F F +DWT_SEEDN_TO_LEAF - seed source to patch-level leaf gN/m^2/s T F +DWT_SEEDN_TO_LEAF_PATCH - patch-level seed source to patch-level leaf (per-area-gridcell; only makes sense with dov2xy=. gN/m^2/s F F +DWT_SLASH_CFLUX - slash C flux (to litter diagnostic only) (0 at all times except first timestep of year) gC/m^2/s T F +DWT_SLASH_CFLUX_PATCH - patch-level slash C flux (to litter diagnostic only) (0 at all times except first timestep of gC/m^2/s F F +DWT_WOODPRODC_GAIN - landcover change-driven addition to wood product pools gC/m^2/s T F +DWT_WOODPRODN_GAIN - landcover change-driven addition to wood product pools gN/m^2/s T F +DWT_WOOD_PRODUCTC_GAIN_PATCH - patch-level landcover change-driven addition to wood product pools(0 at all times except first gC/m^2/s F F +DYN_COL_ADJUSTMENTS_CH4 - Adjustments in ch4 due to dynamic column areas; only makes sense at the column level: should n gC/m^2 F F +DYN_COL_SOIL_ADJUSTMENTS_C - Adjustments in soil carbon due to dynamic column areas; only makes sense at the column level: gC/m^2 F F +DYN_COL_SOIL_ADJUSTMENTS_N - Adjustments in soil nitrogen due to dynamic column areas; only makes sense at the column level gN/m^2 F F +DYN_COL_SOIL_ADJUSTMENTS_NH4 - Adjustments in soil NH4 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 F F +DYN_COL_SOIL_ADJUSTMENTS_NO3 - Adjustments in soil NO3 due to dynamic column areas; only makes sense at the column level: sho gN/m^2 F F +EFLXBUILD - building heat flux from change in interior building air temperature W/m^2 T F +EFLX_DYNBAL - dynamic land cover change conversion energy flux W/m^2 T F +EFLX_GNET - net heat flux into ground W/m^2 F F +EFLX_GRND_LAKE - net heat flux into lake/snow surface, excluding light transmission W/m^2 T F +EFLX_LH_TOT - total latent heat flux [+ to atm] W/m^2 T F +EFLX_LH_TOT_ICE - total latent heat flux [+ to atm] (ice landunits only) W/m^2 F F +EFLX_LH_TOT_R - Rural total evaporation W/m^2 T F +EFLX_LH_TOT_U - Urban total evaporation W/m^2 T F +EFLX_SOIL_GRND - soil heat flux [+ into soil] W/m^2 F F +ELAI - exposed one-sided leaf area index m^2/m^2 T F +EMG - ground emissivity proportion F F +EMV - vegetation emissivity proportion F F +EOPT - Eopt coefficient for VOC calc non F F +EPT - 2 m Equiv Pot Temp K T F +EPT_R - Rural 2 m Equiv Pot Temp K T F +EPT_U - Urban 2 m Equiv Pot Temp K T F +ER - total ecosystem respiration, autotrophic + heterotrophic gC/m^2/s T F +ERRH2O - total water conservation error mm T F +ERRH2OSNO - imbalance in snow depth (liquid water) mm T F +ERRSEB - surface energy conservation error W/m^2 T F +ERRSOI - soil/lake energy conservation error W/m^2 T F +ERRSOL - solar radiation conservation error W/m^2 T F +ESAI - exposed one-sided stem area index m^2/m^2 T F +EXCESSC_MR - excess C maintenance respiration gC/m^2/s F F +EXCESS_CFLUX - C flux not allocated due to downregulation gC/m^2/s F F +FAREA_BURNED - timestep fractional area burned s-1 T F +FCANSNO - fraction of canopy that is wet proportion F F +FCEV - canopy evaporation W/m^2 T F +FCH4 - Gridcell surface CH4 flux to atmosphere (+ to atm) kgC/m2/s T F +FCH4TOCO2 - Gridcell oxidation of CH4 to CO2 gC/m2/s T F +FCH4_DFSAT - CH4 additional flux due to changing fsat, natural vegetated and crop landunits only kgC/m2/s T F +FCO2 - CO2 flux to atmosphere (+ to atm) kgCO2/m2/s F F +FCOV - fractional impermeable area unitless T F +FCTR - canopy transpiration W/m^2 T F +FDRY - fraction of foliage that is green and dry proportion F F +FERTNITRO - Nitrogen fertilizer for each crop gN/m2/yr F F +FERT_COUNTER - time left to fertilize seconds F F +FERT_TO_SMINN - fertilizer to soil mineral N gN/m^2/s F F +FFIX_TO_SMINN - free living N fixation to soil mineral N gN/m^2/s T F +FGEV - ground evaporation W/m^2 T F +FGR - heat flux into soil/snow including snow melt and lake / snow light transmission W/m^2 T F +FGR12 - heat flux between soil layers 1 and 2 W/m^2 T F +FGR_ICE - heat flux into soil/snow including snow melt and lake / snow light transmission (ice landunits W/m^2 F F +FGR_R - Rural heat flux into soil/snow including snow melt and snow light transmission W/m^2 F F +FGR_U - Urban heat flux into soil/snow including snow melt W/m^2 T F +FH2OSFC - fraction of ground covered by surface water unitless T F +FH2OSFC_NOSNOW - fraction of ground covered by surface water (if no snow present) unitless F F +FINUNDATED - fractional inundated area of vegetated columns unitless T F +FINUNDATED_LAG - time-lagged inundated fraction of vegetated columns unitless F F +FIRA - net infrared (longwave) radiation W/m^2 T F +FIRA_ICE - net infrared (longwave) radiation (ice landunits only) W/m^2 F F +FIRA_R - Rural net infrared (longwave) radiation W/m^2 T F +FIRA_U - Urban net infrared (longwave) radiation W/m^2 T F +FIRE - emitted infrared (longwave) radiation W/m^2 T F +FIRE_ICE - emitted infrared (longwave) radiation (ice landunits only) W/m^2 F F +FIRE_R - Rural emitted infrared (longwave) radiation W/m^2 T F +FIRE_U - Urban emitted infrared (longwave) radiation W/m^2 T F +FLDS - atmospheric longwave radiation (downscaled for glacier and hillslope columns) W/m^2 T F +FLDS_ICE - atmospheric longwave radiation (downscaled for glacier and hillslope columns) (ice landunits o W/m^2 F F +FLDS_NOT_DOWNSCALED - atmospheric longwave radiation (pre-downscaling) W/m^2 F F +FPI - fraction of potential immobilization proportion T F +FPSN - photosynthesis umol m-2 s-1 T F +FPSN24 - 24 hour accumulative patch photosynthesis starting from mid-night umol CO2/m^2 ground/day F F +FPSN_WC - Rubisco-limited photosynthesis umol m-2 s-1 F F +FPSN_WJ - RuBP-limited photosynthesis umol m-2 s-1 F F +FPSN_WP - Product-limited photosynthesis umol m-2 s-1 F F +FREE_RETRANSN_TO_NPOOL - deployment of retranslocated N gN/m^2/s T F +FROOTC - fine root C gC/m^2 T F +FROOTC_ALLOC - fine root C allocation gC/m^2/s T F +FROOTC_LOSS - fine root C loss gC/m^2/s T F +FROOTC_STORAGE - fine root C storage gC/m^2 F F +FROOTC_STORAGE_TO_XFER - fine root C shift storage to transfer gC/m^2/s F F +FROOTC_TO_LITTER - fine root C litterfall gC/m^2/s F F +FROOTC_XFER - fine root C transfer gC/m^2 F F +FROOTC_XFER_TO_FROOTC - fine root C growth from storage gC/m^2/s F F +FROOTN - fine root N gN/m^2 T F +FROOTN_STORAGE - fine root N storage gN/m^2 F F +FROOTN_STORAGE_TO_XFER - fine root N shift storage to transfer gN/m^2/s F F +FROOTN_TO_LITTER - fine root N litterfall gN/m^2/s F F +FROOTN_XFER - fine root N transfer gN/m^2 F F +FROOTN_XFER_TO_FROOTN - fine root N growth from storage gN/m^2/s F F +FROOT_MR - fine root maintenance respiration gC/m^2/s F F +FROST_TABLE - frost table depth (natural vegetated and crop landunits only) m F F +FSA - absorbed solar radiation W/m^2 T F +FSAT - fractional area with water table at surface unitless T F +FSA_ICE - absorbed solar radiation (ice landunits only) W/m^2 F F +FSA_R - Rural absorbed solar radiation W/m^2 F F +FSA_U - Urban absorbed solar radiation W/m^2 T F +FSD24 - direct radiation (last 24hrs) K F F +FSD240 - direct radiation (last 240hrs) K F F +FSDS - atmospheric incident solar radiation (downscaled for glacier and hillslope columns) W/m^2 T F +FSDSND - direct nir incident solar radiation W/m^2 T F +FSDSNDLN - direct nir incident solar radiation at local noon W/m^2 T F +FSDSNI - diffuse nir incident solar radiation W/m^2 T F +FSDSVD - direct vis incident solar radiation W/m^2 T F +FSDSVDLN - direct vis incident solar radiation at local noon W/m^2 T F +FSDSVI - diffuse vis incident solar radiation W/m^2 T F +FSDSVILN - diffuse vis incident solar radiation at local noon W/m^2 T F +FSDS_from_atm - atmospheric incident solar radiation received from atmosphere (pre-downscaling) W/m^2 T F +FSH - sensible heat not including correction for land use change and rain/snow conversion W/m^2 T F +FSH_G - sensible heat from ground W/m^2 T F +FSH_ICE - sensible heat not including correction for land use change and rain/snow conversion (ice landu W/m^2 F F +FSH_PRECIP_CONVERSION - Sensible heat flux from conversion of rain/snow atm forcing W/m^2 T F +FSH_R - Rural sensible heat W/m^2 T F +FSH_RUNOFF_ICE_TO_LIQ - sensible heat flux generated from conversion of ice runoff to liquid W/m^2 T F +FSH_TO_COUPLER - sensible heat sent to coupler (includes corrections for land use change, rain/snow conversion W/m^2 T F +FSH_U - Urban sensible heat W/m^2 T F +FSH_V - sensible heat from veg W/m^2 T F +FSI24 - indirect radiation (last 24hrs) K F F +FSI240 - indirect radiation (last 240hrs) K F F +FSM - snow melt heat flux W/m^2 T F +FSM_ICE - snow melt heat flux (ice landunits only) W/m^2 F F +FSM_R - Rural snow melt heat flux W/m^2 F F +FSM_U - Urban snow melt heat flux W/m^2 T F +FSNO - fraction of ground covered by snow unitless T F +FSNO_EFF - effective fraction of ground covered by snow unitless T F +FSNO_ICE - fraction of ground covered by snow (ice landunits only) unitless F F +FSR - reflected solar radiation W/m^2 T F +FSRND - direct nir reflected solar radiation W/m^2 T F +FSRNDLN - direct nir reflected solar radiation at local noon W/m^2 T F +FSRNI - diffuse nir reflected solar radiation W/m^2 T F +FSRSF - reflected solar radiation W/m^2 T F +FSRSFND - direct nir reflected solar radiation W/m^2 T F +FSRSFNDLN - direct nir reflected solar radiation at local noon W/m^2 T F +FSRSFNI - diffuse nir reflected solar radiation W/m^2 T F +FSRSFVD - direct vis reflected solar radiation W/m^2 T F +FSRSFVDLN - direct vis reflected solar radiation at local noon W/m^2 T F +FSRSFVI - diffuse vis reflected solar radiation W/m^2 T F +FSRVD - direct vis reflected solar radiation W/m^2 T F +FSRVDLN - direct vis reflected solar radiation at local noon W/m^2 T F +FSRVI - diffuse vis reflected solar radiation W/m^2 T F +FSR_ICE - reflected solar radiation (ice landunits only) W/m^2 F F +FSUN - sunlit fraction of canopy proportion F F +FSUN24 - fraction sunlit (last 24hrs) K F F +FSUN240 - fraction sunlit (last 240hrs) K F F +FUELC - fuel load gC/m^2 T F +FV - friction velocity m/s F F +FWET - fraction of canopy that is wet proportion F F +F_DENIT - denitrification flux gN/m^2/s T F +F_N2O_DENIT - denitrification N2O flux gN/m^2/s T F +F_N2O_NIT - nitrification N2O flux gN/m^2/s T F +F_NIT - nitrification flux gN/m^2/s T F +FireComp_BC - fire emissions flux of BC kg/m2/sec F F +FireComp_OC - fire emissions flux of OC kg/m2/sec F F +FireComp_SO2 - fire emissions flux of SO2 kg/m2/sec F F +FireEmis_TOT - Total fire emissions flux gC/m2/sec F F +FireEmis_ZTOP - Top of vertical fire emissions distribution m F F +FireMech_SO2 - fire emissions flux of SO2 kg/m2/sec F F +FireMech_bc_a1 - fire emissions flux of bc_a1 kg/m2/sec F F +FireMech_pom_a1 - fire emissions flux of pom_a1 kg/m2/sec F F +GAMMA - total gamma for VOC calc non F F +GAMMAA - gamma A for VOC calc non F F +GAMMAC - gamma C for VOC calc non F F +GAMMAL - gamma L for VOC calc non F F +GAMMAP - gamma P for VOC calc non F F +GAMMAS - gamma S for VOC calc non F F +GAMMAT - gamma T for VOC calc non F F +GDD0 - Growing degree days base 0C from planting ddays F F +GDD020 - Twenty year average of growing degree days base 0C from planting ddays F F +GDD0X - Growing degree days base 0C from planting, max ddays F F +GDD10 - Growing degree days base 10C from planting ddays F F +GDD1020 - Twenty year average of growing degree days base 10C from planting ddays F F +GDD10X - Growing degree days base 10C from planting, max ddays F F +GDD20_BASELINE - Baseline mean growing-degree days accumulated during accumulation period (from input) ddays F F +GDD20_SEASON_END - End of the GDD20 accumulation season (from input) day of year F F +GDD20_SEASON_START - Start of the GDD20 accumulation season (from input) day of year F F +GDD8 - Growing degree days base 8C from planting ddays F F +GDD820 - Twenty year average of growing degree days base 8C from planting ddays F F +GDD8X - Growing degree days base 8C from planting, max ddays F F +GDDACCUM - Accumulated growing degree days past planting date for crop ddays F F +GDDHARV - Growing degree days (gdd) needed to harvest ddays F F +GDDTSOI - Growing degree-days from planting (top two soil layers) ddays F F +GPP - gross primary production gC/m^2/s T F +GR - total growth respiration gC/m^2/s T F +GRAINC - grain C (does not equal yield) gC/m^2 T F +GRAINC_TO_FOOD - grain C to food gC/m^2/s T F +GRAINC_TO_FOOD_ANN - grain C to food harvested per calendar year; should only be output annually gC/m^2 F F +GRAINC_TO_SEED - grain C to seed gC/m^2/s T F +GRAINC_TO_SEED_ANN - grain C to seed harvested per calendar year; should only be output annually gC/m^2 F F +GRAINN - grain N gN/m^2 T F +GRAINN_TO_FOOD - grain N to food (not scientifically supported) gN/m^2/s F F +GRAINN_TO_FOOD_ANN - grain N to food harvested per calendar year; should only be output annually (not scientificall gN/m^2 F F +GRAINN_TO_SEED - grain N to seed (not scientifically supported) gN/m^2/s F F +GRAINN_TO_SEED_ANN - grain N to seed harvested per calendar year; should only be output annually (not scientificall gN/m^2 F F +GRESP_STORAGE - growth respiration storage gC/m^2 F F +GRESP_STORAGE_TO_XFER - growth respiration shift storage to transfer gC/m^2/s F F +GRESP_XFER - growth respiration transfer gC/m^2 F F +GROSS_NMIN - gross rate of N mineralization gN/m^2/s T F +GRU_PROD100C_GAIN - gross unrepresented landcover change addition to 100-yr wood product pool gC/m^2/s F F +GRU_PROD100N_GAIN - gross unrepresented landcover change addition to 100-yr wood product pool gN/m^2/s F F +GRU_PROD10C_GAIN - gross unrepresented landcover change addition to 10-yr wood product pool gC/m^2/s F F +GRU_PROD10N_GAIN - gross unrepresented landcover change addition to 10-yr wood product pool gN/m^2/s F F +GSSHA - shaded leaf stomatal conductance umol H20/m2/s T F +GSSHALN - shaded leaf stomatal conductance at local noon umol H20/m2/s T F +GSSUN - sunlit leaf stomatal conductance umol H20/m2/s T F +GSSUNLN - sunlit leaf stomatal conductance at local noon umol H20/m2/s T F +H2OCAN - intercepted water mm T F +H2OSFC - surface water depth mm T F +H2OSNO - snow depth (liquid water) mm T F +H2OSNO_ICE - snow depth (liquid water, ice landunits only) mm F F +H2OSNO_TOP - mass of snow in top snow layer kg/m2 T F +HBOT - canopy bottom m F F +HDM - human population density counts/km^2 F F +HEAT_CONTENT1 - initial gridcell total heat content J/m^2 T F +HEAT_CONTENT1_VEG - initial gridcell total heat content - natural vegetated and crop landunits only J/m^2 F F +HEAT_CONTENT2 - post land cover change total heat content J/m^2 F F +HEAT_FROM_AC - sensible heat flux put into canyon due to heat removed from air conditioning W/m^2 T F +HIA - 2 m NWS Heat Index C T F +HIA_R - Rural 2 m NWS Heat Index C T F +HIA_U - Urban 2 m NWS Heat Index C T F +HR - total heterotrophic respiration gC/m^2/s T F +HTOP - canopy top m T F +HUI - Crop patch heat unit index ddays F F +HUMIDEX - 2 m Humidex C T F +HUMIDEX_R - Rural 2 m Humidex C T F +HUMIDEX_U - Urban 2 m Humidex C T F +ICE_CONTENT1 - initial gridcell total ice content mm T F +ICE_CONTENT2 - post land cover change total ice content mm F F +ICE_MODEL_FRACTION - Ice sheet model fractional coverage unitless F F +INIT_GPP - GPP flux before downregulation gC/m^2/s F F +INT_SNOW - accumulated swe (natural vegetated and crop landunits only) mm F F +INT_SNOW_ICE - accumulated swe (ice landunits only) mm F F +IWUELN - local noon intrinsic water use efficiency umolCO2/molH2O T F +JMX25T - canopy profile of jmax umol/m2/s T F +Jmx25Z - maximum rate of electron transport at 25 Celcius for canopy layers umol electrons/m2/s T F +KBM1 - natural logarithm of Z0MG_P/Z0HG_P unitless F F +LAI240 - 240hr average of leaf area index m^2/m^2 F F +LAISHA - shaded projected leaf area index m^2/m^2 T F +LAISUN - sunlit projected leaf area index m^2/m^2 T F +LAKEICEFRAC_SURF - surface lake layer ice mass fraction unitless T F +LAKEICETHICK - thickness of lake ice (including physical expansion on freezing) m T F +LAND_USE_FLUX - total C emitted from land cover conversion (smoothed over the year) and wood and grain product gC/m^2/s T F +LATBASET - latitude vary base temperature for hui degree C F F +LEAFC - leaf C gC/m^2 T F +LEAFCN - Leaf CN ratio used for flexible CN gC/gN T F +LEAFCN_OFFSET - Leaf C:N used by FUN unitless F F +LEAFCN_STORAGE - Storage Leaf CN ratio used for flexible CN gC/gN F F +LEAFCN_TARGET - Target leaf C:N; compare against leafC/leafN gC/gN T F +LEAFC_ALLOC - leaf C allocation gC/m^2/s T F +LEAFC_CHANGE - C change in leaf gC/m^2/s T F +LEAFC_LOSS - leaf C loss gC/m^2/s T F +LEAFC_STORAGE - leaf C storage gC/m^2 F F +LEAFC_STORAGE_TO_XFER - leaf C shift storage to transfer gC/m^2/s F F +LEAFC_STORAGE_XFER_ACC - Accumulated leaf C transfer gC/m^2 F F +LEAFC_TO_BIOFUELC - leaf C to biofuel C gC/m^2/s T F +LEAFC_TO_LITTER - leaf C litterfall gC/m^2/s F F +LEAFC_TO_LITTER_FUN - leaf C litterfall used by FUN gC/m^2/s T F +LEAFC_TO_REMOVEDRESIDUEC - leaf C to removed residue C gC/m^2/s F F +LEAFC_XFER - leaf C transfer gC/m^2 F F +LEAFC_XFER_TO_LEAFC - leaf C growth from storage gC/m^2/s F F +LEAFN - leaf N gN/m^2 T F +LEAFN_STORAGE - leaf N storage gN/m^2 F F +LEAFN_STORAGE_TO_XFER - leaf N shift storage to transfer gN/m^2/s F F +LEAFN_STORAGE_XFER_ACC - Accmulated leaf N transfer gN/m^2 F F +LEAFN_TO_LITTER - leaf N litterfall gN/m^2/s T F +LEAFN_TO_RETRANSN - leaf N to retranslocated N pool gN/m^2/s F F +LEAFN_XFER - leaf N transfer gN/m^2 F F +LEAFN_XFER_TO_LEAFN - leaf N growth from storage gN/m^2/s F F +LEAF_MR - leaf maintenance respiration gC/m^2/s T F +LFC2 - conversion area fraction of BET and BDT that burned per sec T F +LGSF - long growing season factor proportion F F +LIQCAN - intercepted liquid water mm T F +LIQUID_CONTENT1 - initial gridcell total liq content mm T F +LIQUID_CONTENT2 - post landuse change gridcell total liq content mm F F +LIQUID_WATER_TEMP1 - initial gridcell weighted average liquid water temperature K F F +LITFALL - litterfall (leaves and fine roots) gC/m^2/s T F +LITFIRE - litter fire losses gC/m^2/s F F +LITTERC_HR - litter C heterotrophic respiration gC/m^2/s T F +LITTERC_LOSS - litter C loss gC/m^2/s T F +LIT_CEL_C - LIT_CEL C gC/m^2 T F +LIT_CEL_C_1m - LIT_CEL C to 1 meter gC/m^2 F F +LIT_CEL_C_TO_SOM_ACT_C - decomp. of cellulosic litter C to active soil organic C gC/m^2/s F F +LIT_CEL_HR - Het. Resp. from cellulosic litter gC/m^2/s F F +LIT_CEL_N - LIT_CEL N gN/m^2 T F +LIT_CEL_N_1m - LIT_CEL N to 1 meter gN/m^2 F F +LIT_CEL_N_TO_SOM_ACT_N - decomp. of cellulosic litter N to active soil organic N gN/m^2 F F +LIT_LIG_C - LIT_LIG C gC/m^2 T F +LIT_LIG_C_1m - LIT_LIG C to 1 meter gC/m^2 F F +LIT_LIG_C_TO_SOM_SLO_C - decomp. of lignin litter C to slow soil organic ma C gC/m^2/s F F +LIT_LIG_HR - Het. Resp. from lignin litter gC/m^2/s F F +LIT_LIG_N - LIT_LIG N gN/m^2 T F +LIT_LIG_N_1m - LIT_LIG N to 1 meter gN/m^2 F F +LIT_LIG_N_TO_SOM_SLO_N - decomp. of lignin litter N to slow soil organic ma N gN/m^2 F F +LIT_MET_C - LIT_MET C gC/m^2 T F +LIT_MET_C_1m - LIT_MET C to 1 meter gC/m^2 F F +LIT_MET_C_TO_SOM_ACT_C - decomp. of metabolic litter C to active soil organic C gC/m^2/s F F +LIT_MET_HR - Het. Resp. from metabolic litter gC/m^2/s F F +LIT_MET_N - LIT_MET N gN/m^2 T F +LIT_MET_N_1m - LIT_MET N to 1 meter gN/m^2 F F +LIT_MET_N_TO_SOM_ACT_N - decomp. of metabolic litter N to active soil organic N gN/m^2 F F +LIVECROOTC - live coarse root C gC/m^2 T F +LIVECROOTC_STORAGE - live coarse root C storage gC/m^2 F F +LIVECROOTC_STORAGE_TO_XFER - live coarse root C shift storage to transfer gC/m^2/s F F +LIVECROOTC_TO_DEADCROOTC - live coarse root C turnover gC/m^2/s F F +LIVECROOTC_XFER - live coarse root C transfer gC/m^2 F F +LIVECROOTC_XFER_TO_LIVECROOTC - live coarse root C growth from storage gC/m^2/s F F +LIVECROOTN - live coarse root N gN/m^2 T F +LIVECROOTN_STORAGE - live coarse root N storage gN/m^2 F F +LIVECROOTN_STORAGE_TO_XFER - live coarse root N shift storage to transfer gN/m^2/s F F +LIVECROOTN_TO_DEADCROOTN - live coarse root N turnover gN/m^2/s F F +LIVECROOTN_TO_RETRANSN - live coarse root N to retranslocated N pool gN/m^2/s F F +LIVECROOTN_XFER - live coarse root N transfer gN/m^2 F F +LIVECROOTN_XFER_TO_LIVECROOTN - live coarse root N growth from storage gN/m^2/s F F +LIVECROOT_MR - live coarse root maintenance respiration gC/m^2/s F F +LIVESTEMC - live stem C gC/m^2 T F +LIVESTEMC_STORAGE - live stem C storage gC/m^2 F F +LIVESTEMC_STORAGE_TO_XFER - live stem C shift storage to transfer gC/m^2/s F F +LIVESTEMC_TO_BIOFUELC - livestem C to biofuel C gC/m^2/s T F +LIVESTEMC_TO_DEADSTEMC - live stem C turnover gC/m^2/s F F +LIVESTEMC_TO_REMOVEDRESIDUEC - livestem C to removed residue C gC/m^2/s F F +LIVESTEMC_XFER - live stem C transfer gC/m^2 F F +LIVESTEMC_XFER_TO_LIVESTEMC - live stem C growth from storage gC/m^2/s F F +LIVESTEMN - live stem N gN/m^2 T F +LIVESTEMN_STORAGE - live stem N storage gN/m^2 F F +LIVESTEMN_STORAGE_TO_XFER - live stem N shift storage to transfer gN/m^2/s F F +LIVESTEMN_TO_DEADSTEMN - live stem N turnover gN/m^2/s F F +LIVESTEMN_TO_RETRANSN - live stem N to retranslocated N pool gN/m^2/s F F +LIVESTEMN_XFER - live stem N transfer gN/m^2 F F +LIVESTEMN_XFER_TO_LIVESTEMN - live stem N growth from storage gN/m^2/s F F +LIVESTEM_MR - live stem maintenance respiration gC/m^2/s F F +LNC - leaf N concentration gN leaf/m^2 T F +LNFM - Lightning frequency counts/km^2/hr F F +LWdown - atmospheric longwave radiation (downscaled for glacier and hillslope columns) W/m^2 F F +LWup - upwelling longwave radiation W/m^2 F F +MEG_2met_nonatriene - MEGAN flux kg/m2/sec T F +MEG_acetaldehyde - MEGAN flux kg/m2/sec T F +MEG_acetic_acid - MEGAN flux kg/m2/sec T F +MEG_acetone - MEGAN flux kg/m2/sec T F +MEG_acoradiene - MEGAN flux kg/m2/sec T F +MEG_aromadendrene - MEGAN flux kg/m2/sec T F +MEG_bergamotene_a - MEGAN flux kg/m2/sec T F +MEG_bergamotene_b - MEGAN flux kg/m2/sec T F +MEG_bisabolene_a - MEGAN flux kg/m2/sec T F +MEG_bisabolene_b - MEGAN flux kg/m2/sec T F +MEG_bornene - MEGAN flux kg/m2/sec T F +MEG_borneol - MEGAN flux kg/m2/sec T F +MEG_bornyl_ACT - MEGAN flux kg/m2/sec T F +MEG_bourbonene_b - MEGAN flux kg/m2/sec T F +MEG_cadinene_d - MEGAN flux kg/m2/sec T F +MEG_cadinene_g - MEGAN flux kg/m2/sec T F +MEG_camphene - MEGAN flux kg/m2/sec T F +MEG_camphor - MEGAN flux kg/m2/sec T F +MEG_carbon_monoxide - MEGAN flux kg/m2/sec T F +MEG_carene_3 - MEGAN flux kg/m2/sec T F +MEG_caryophyllene_b - MEGAN flux kg/m2/sec T F +MEG_cedrene_a - MEGAN flux kg/m2/sec T F +MEG_cedrol - MEGAN flux kg/m2/sec T F +MEG_cineole_1_8 - MEGAN flux kg/m2/sec T F +MEG_copaene_a - MEGAN flux kg/m2/sec T F +MEG_cubebene_a - MEGAN flux kg/m2/sec T F +MEG_cubebene_b - MEGAN flux kg/m2/sec T F +MEG_decanal - MEGAN flux kg/m2/sec T F +MEG_elemene_b - MEGAN flux kg/m2/sec T F +MEG_ethane - MEGAN flux kg/m2/sec T F +MEG_ethanol - MEGAN flux kg/m2/sec T F +MEG_ethene - MEGAN flux kg/m2/sec T F +MEG_farnescene_a - MEGAN flux kg/m2/sec T F +MEG_farnescene_b - MEGAN flux kg/m2/sec T F +MEG_fenchene_a - MEGAN flux kg/m2/sec T F +MEG_fenchone - MEGAN flux kg/m2/sec T F +MEG_formaldehyde - MEGAN flux kg/m2/sec T F +MEG_geranyl_acetone - MEGAN flux kg/m2/sec T F +MEG_germacrene_B - MEGAN flux kg/m2/sec T F +MEG_germacrene_D - MEGAN flux kg/m2/sec T F +MEG_gurjunene_b - MEGAN flux kg/m2/sec T F +MEG_heptanal - MEGAN flux kg/m2/sec T F +MEG_heptane - MEGAN flux kg/m2/sec T F +MEG_heptanone - MEGAN flux kg/m2/sec T F +MEG_hexanal - MEGAN flux kg/m2/sec T F +MEG_hexane - MEGAN flux kg/m2/sec T F +MEG_hexanol_1 - MEGAN flux kg/m2/sec T F +MEG_humulene_a - MEGAN flux kg/m2/sec T F +MEG_humulene_g - MEGAN flux kg/m2/sec T F +MEG_ionone_b - MEGAN flux kg/m2/sec T F +MEG_ipsenol - MEGAN flux kg/m2/sec T F +MEG_isolongifolene - MEGAN flux kg/m2/sec T F +MEG_isoprene - MEGAN flux kg/m2/sec T F +MEG_jasmone - MEGAN flux kg/m2/sec T F +MEG_limonene - MEGAN flux kg/m2/sec T F +MEG_linalool - MEGAN flux kg/m2/sec T F +MEG_longifolene - MEGAN flux kg/m2/sec T F +MEG_longipinene - MEGAN flux kg/m2/sec T F +MEG_methanol - MEGAN flux kg/m2/sec T F +MEG_muurolene_a - MEGAN flux kg/m2/sec T F +MEG_muurolene_g - MEGAN flux kg/m2/sec T F +MEG_myrcene - MEGAN flux kg/m2/sec T F +MEG_myrtenal - MEGAN flux kg/m2/sec T F +MEG_nerolidol_c - MEGAN flux kg/m2/sec T F +MEG_nerolidol_t - MEGAN flux kg/m2/sec T F +MEG_neryl_acetone - MEGAN flux kg/m2/sec T F +MEG_nonanal - MEGAN flux kg/m2/sec T F +MEG_ocimene_al - MEGAN flux kg/m2/sec T F +MEG_ocimene_c_b - MEGAN flux kg/m2/sec T F +MEG_ocimene_t_b - MEGAN flux kg/m2/sec T F +MEG_octanal - MEGAN flux kg/m2/sec T F +MEG_octanol - MEGAN flux kg/m2/sec T F +MEG_oxopentanal - MEGAN flux kg/m2/sec T F +MEG_pentanal - MEGAN flux kg/m2/sec T F +MEG_pentane - MEGAN flux kg/m2/sec T F +MEG_phellandrene_a - MEGAN flux kg/m2/sec T F +MEG_phellandrene_b - MEGAN flux kg/m2/sec T F +MEG_pinene_a - MEGAN flux kg/m2/sec T F +MEG_pinene_b - MEGAN flux kg/m2/sec T F +MEG_propane - MEGAN flux kg/m2/sec T F +MEG_propene - MEGAN flux kg/m2/sec T F +MEG_sabinene - MEGAN flux kg/m2/sec T F +MEG_selinene_b - MEGAN flux kg/m2/sec T F +MEG_selinene_d - MEGAN flux kg/m2/sec T F +MEG_terpinene_a - MEGAN flux kg/m2/sec T F +MEG_terpinene_g - MEGAN flux kg/m2/sec T F +MEG_terpineol_4 - MEGAN flux kg/m2/sec T F +MEG_terpineol_a - MEGAN flux kg/m2/sec T F +MEG_terpinolene - MEGAN flux kg/m2/sec T F +MEG_terpinyl_ACT_a - MEGAN flux kg/m2/sec T F +MEG_thujene_a - MEGAN flux kg/m2/sec T F +MEG_thujone_a - MEGAN flux kg/m2/sec T F +MEG_thujone_b - MEGAN flux kg/m2/sec T F +MEG_tricyclene - MEGAN flux kg/m2/sec T F +MEG_verbenene - MEGAN flux kg/m2/sec T F +MR - maintenance respiration gC/m^2/s T F +M_CWD_C_TO_FIRE - coarse woody debris C fire loss gC/m^2/s F F +M_CWD_N_TO_FIRE - coarse woody debris N fire loss gN/m^2 F F +M_DEADCROOTC_STORAGE_TO_LITTER - dead coarse root C storage mortality gC/m^2/s F F +M_DEADCROOTC_STORAGE_TO_LITTER_FIRE - dead coarse root C storage fire mortality to litter gC/m^2/s F F +M_DEADCROOTC_TO_LITTER - dead coarse root C mortality gC/m^2/s F F +M_DEADCROOTC_XFER_TO_LITTER - dead coarse root C transfer mortality gC/m^2/s F F +M_DEADCROOTN_STORAGE_TO_FIRE - dead coarse root N storage fire loss gN/m^2/s F F +M_DEADCROOTN_STORAGE_TO_LITTER - dead coarse root N storage mortality gN/m^2/s F F +M_DEADCROOTN_TO_FIRE - dead coarse root N fire loss gN/m^2/s F F +M_DEADCROOTN_TO_LITTER - dead coarse root N mortality gN/m^2/s F F +M_DEADCROOTN_TO_LITTER_FIRE - dead coarse root N fire mortality to litter gN/m^2/s F F +M_DEADCROOTN_XFER_TO_FIRE - dead coarse root N transfer fire loss gN/m^2/s F F +M_DEADCROOTN_XFER_TO_LITTER - dead coarse root N transfer mortality gN/m^2/s F F +M_DEADROOTC_STORAGE_TO_FIRE - dead root C storage fire loss gC/m^2/s F F +M_DEADROOTC_STORAGE_TO_LITTER_FIRE - dead root C storage fire mortality to litter gC/m^2/s F F +M_DEADROOTC_TO_FIRE - dead root C fire loss gC/m^2/s F F +M_DEADROOTC_TO_LITTER_FIRE - dead root C fire mortality to litter gC/m^2/s F F +M_DEADROOTC_XFER_TO_FIRE - dead root C transfer fire loss gC/m^2/s F F +M_DEADROOTC_XFER_TO_LITTER_FIRE - dead root C transfer fire mortality to litter gC/m^2/s F F +M_DEADSTEMC_STORAGE_TO_FIRE - dead stem C storage fire loss gC/m^2/s F F +M_DEADSTEMC_STORAGE_TO_LITTER - dead stem C storage mortality gC/m^2/s F F +M_DEADSTEMC_STORAGE_TO_LITTER_FIRE - dead stem C storage fire mortality to litter gC/m^2/s F F +M_DEADSTEMC_TO_FIRE - dead stem C fire loss gC/m^2/s F F +M_DEADSTEMC_TO_LITTER - dead stem C mortality gC/m^2/s F F +M_DEADSTEMC_TO_LITTER_FIRE - dead stem C fire mortality to litter gC/m^2/s F F +M_DEADSTEMC_XFER_TO_FIRE - dead stem C transfer fire loss gC/m^2/s F F +M_DEADSTEMC_XFER_TO_LITTER - dead stem C transfer mortality gC/m^2/s F F +M_DEADSTEMC_XFER_TO_LITTER_FIRE - dead stem C transfer fire mortality to litter gC/m^2/s F F +M_DEADSTEMN_STORAGE_TO_FIRE - dead stem N storage fire loss gN/m^2/s F F +M_DEADSTEMN_STORAGE_TO_LITTER - dead stem N storage mortality gN/m^2/s F F +M_DEADSTEMN_TO_FIRE - dead stem N fire loss gN/m^2/s F F +M_DEADSTEMN_TO_LITTER - dead stem N mortality gN/m^2/s F F +M_DEADSTEMN_TO_LITTER_FIRE - dead stem N fire mortality to litter gN/m^2/s F F +M_DEADSTEMN_XFER_TO_FIRE - dead stem N transfer fire loss gN/m^2/s F F +M_DEADSTEMN_XFER_TO_LITTER - dead stem N transfer mortality gN/m^2/s F F +M_FROOTC_STORAGE_TO_FIRE - fine root C storage fire loss gC/m^2/s F F +M_FROOTC_STORAGE_TO_LITTER - fine root C storage mortality gC/m^2/s F F +M_FROOTC_STORAGE_TO_LITTER_FIRE - fine root C storage fire mortality to litter gC/m^2/s F F +M_FROOTC_TO_FIRE - fine root C fire loss gC/m^2/s F F +M_FROOTC_TO_LITTER - fine root C mortality gC/m^2/s F F +M_FROOTC_TO_LITTER_FIRE - fine root C fire mortality to litter gC/m^2/s F F +M_FROOTC_XFER_TO_FIRE - fine root C transfer fire loss gC/m^2/s F F +M_FROOTC_XFER_TO_LITTER - fine root C transfer mortality gC/m^2/s F F +M_FROOTC_XFER_TO_LITTER_FIRE - fine root C transfer fire mortality to litter gC/m^2/s F F +M_FROOTN_STORAGE_TO_FIRE - fine root N storage fire loss gN/m^2/s F F +M_FROOTN_STORAGE_TO_LITTER - fine root N storage mortality gN/m^2/s F F +M_FROOTN_TO_FIRE - fine root N fire loss gN/m^2/s F F +M_FROOTN_TO_LITTER - fine root N mortality gN/m^2/s F F +M_FROOTN_XFER_TO_FIRE - fine root N transfer fire loss gN/m^2/s F F +M_FROOTN_XFER_TO_LITTER - fine root N transfer mortality gN/m^2/s F F +M_GRESP_STORAGE_TO_FIRE - growth respiration storage fire loss gC/m^2/s F F +M_GRESP_STORAGE_TO_LITTER - growth respiration storage mortality gC/m^2/s F F +M_GRESP_STORAGE_TO_LITTER_FIRE - growth respiration storage fire mortality to litter gC/m^2/s F F +M_GRESP_XFER_TO_FIRE - growth respiration transfer fire loss gC/m^2/s F F +M_GRESP_XFER_TO_LITTER - growth respiration transfer mortality gC/m^2/s F F +M_GRESP_XFER_TO_LITTER_FIRE - growth respiration transfer fire mortality to litter gC/m^2/s F F +M_LEAFC_STORAGE_TO_FIRE - leaf C storage fire loss gC/m^2/s F F +M_LEAFC_STORAGE_TO_LITTER - leaf C storage mortality gC/m^2/s F F +M_LEAFC_STORAGE_TO_LITTER_FIRE - leaf C fire mortality to litter gC/m^2/s F F +M_LEAFC_TO_FIRE - leaf C fire loss gC/m^2/s F F +M_LEAFC_TO_LITTER - leaf C mortality gC/m^2/s F F +M_LEAFC_TO_LITTER_FIRE - leaf C fire mortality to litter gC/m^2/s F F +M_LEAFC_XFER_TO_FIRE - leaf C transfer fire loss gC/m^2/s F F +M_LEAFC_XFER_TO_LITTER - leaf C transfer mortality gC/m^2/s F F +M_LEAFC_XFER_TO_LITTER_FIRE - leaf C transfer fire mortality to litter gC/m^2/s F F +M_LEAFN_STORAGE_TO_FIRE - leaf N storage fire loss gN/m^2/s F F +M_LEAFN_STORAGE_TO_LITTER - leaf N storage mortality gN/m^2/s F F +M_LEAFN_TO_FIRE - leaf N fire loss gN/m^2/s F F +M_LEAFN_TO_LITTER - leaf N mortality gN/m^2/s F F +M_LEAFN_XFER_TO_FIRE - leaf N transfer fire loss gN/m^2/s F F +M_LEAFN_XFER_TO_LITTER - leaf N transfer mortality gN/m^2/s F F +M_LIT_CEL_C_TO_FIRE - cellulosic litter C fire loss gC/m^2/s F F +M_LIT_CEL_C_TO_LEACHING - cellulosic litter C leaching loss gC/m^2/s F F +M_LIT_CEL_N_TO_FIRE - cellulosic litter N fire loss gN/m^2 F F +M_LIT_CEL_N_TO_LEACHING - cellulosic litter N leaching loss gN/m^2/s F F +M_LIT_LIG_C_TO_FIRE - lignin litter C fire loss gC/m^2/s F F +M_LIT_LIG_C_TO_LEACHING - lignin litter C leaching loss gC/m^2/s F F +M_LIT_LIG_N_TO_FIRE - lignin litter N fire loss gN/m^2 F F +M_LIT_LIG_N_TO_LEACHING - lignin litter N leaching loss gN/m^2/s F F +M_LIT_MET_C_TO_FIRE - metabolic litter C fire loss gC/m^2/s F F +M_LIT_MET_C_TO_LEACHING - metabolic litter C leaching loss gC/m^2/s F F +M_LIT_MET_N_TO_FIRE - metabolic litter N fire loss gN/m^2 F F +M_LIT_MET_N_TO_LEACHING - metabolic litter N leaching loss gN/m^2/s F F +M_LIVECROOTC_STORAGE_TO_LITTER - live coarse root C storage mortality gC/m^2/s F F +M_LIVECROOTC_STORAGE_TO_LITTER_FIRE - live coarse root C fire mortality to litter gC/m^2/s F F +M_LIVECROOTC_TO_LITTER - live coarse root C mortality gC/m^2/s F F +M_LIVECROOTC_XFER_TO_LITTER - live coarse root C transfer mortality gC/m^2/s F F +M_LIVECROOTN_STORAGE_TO_FIRE - live coarse root N storage fire loss gN/m^2/s F F +M_LIVECROOTN_STORAGE_TO_LITTER - live coarse root N storage mortality gN/m^2/s F F +M_LIVECROOTN_TO_FIRE - live coarse root N fire loss gN/m^2/s F F +M_LIVECROOTN_TO_LITTER - live coarse root N mortality gN/m^2/s F F +M_LIVECROOTN_XFER_TO_FIRE - live coarse root N transfer fire loss gN/m^2/s F F +M_LIVECROOTN_XFER_TO_LITTER - live coarse root N transfer mortality gN/m^2/s F F +M_LIVEROOTC_STORAGE_TO_FIRE - live root C storage fire loss gC/m^2/s F F +M_LIVEROOTC_STORAGE_TO_LITTER_FIRE - live root C storage fire mortality to litter gC/m^2/s F F +M_LIVEROOTC_TO_DEADROOTC_FIRE - live root C fire mortality to dead root C gC/m^2/s F F +M_LIVEROOTC_TO_FIRE - live root C fire loss gC/m^2/s F F +M_LIVEROOTC_TO_LITTER_FIRE - live root C fire mortality to litter gC/m^2/s F F +M_LIVEROOTC_XFER_TO_FIRE - live root C transfer fire loss gC/m^2/s F F +M_LIVEROOTC_XFER_TO_LITTER_FIRE - live root C transfer fire mortality to litter gC/m^2/s F F +M_LIVESTEMC_STORAGE_TO_FIRE - live stem C storage fire loss gC/m^2/s F F +M_LIVESTEMC_STORAGE_TO_LITTER - live stem C storage mortality gC/m^2/s F F +M_LIVESTEMC_STORAGE_TO_LITTER_FIRE - live stem C storage fire mortality to litter gC/m^2/s F F +M_LIVESTEMC_TO_DEADSTEMC_FIRE - live stem C fire mortality to dead stem C gC/m^2/s F F +M_LIVESTEMC_TO_FIRE - live stem C fire loss gC/m^2/s F F +M_LIVESTEMC_TO_LITTER - live stem C mortality gC/m^2/s F F +M_LIVESTEMC_TO_LITTER_FIRE - live stem C fire mortality to litter gC/m^2/s F F +M_LIVESTEMC_XFER_TO_FIRE - live stem C transfer fire loss gC/m^2/s F F +M_LIVESTEMC_XFER_TO_LITTER - live stem C transfer mortality gC/m^2/s F F +M_LIVESTEMC_XFER_TO_LITTER_FIRE - live stem C transfer fire mortality to litter gC/m^2/s F F +M_LIVESTEMN_STORAGE_TO_FIRE - live stem N storage fire loss gN/m^2/s F F +M_LIVESTEMN_STORAGE_TO_LITTER - live stem N storage mortality gN/m^2/s F F +M_LIVESTEMN_TO_FIRE - live stem N fire loss gN/m^2/s F F +M_LIVESTEMN_TO_LITTER - live stem N mortality gN/m^2/s F F +M_LIVESTEMN_XFER_TO_FIRE - live stem N transfer fire loss gN/m^2/s F F +M_LIVESTEMN_XFER_TO_LITTER - live stem N transfer mortality gN/m^2/s F F +M_RETRANSN_TO_FIRE - retranslocated N pool fire loss gN/m^2/s F F +M_RETRANSN_TO_LITTER - retranslocated N pool mortality gN/m^2/s F F +M_SOM_ACT_C_TO_LEACHING - active soil organic C leaching loss gC/m^2/s F F +M_SOM_ACT_N_TO_LEACHING - active soil organic N leaching loss gN/m^2/s F F +M_SOM_PAS_C_TO_LEACHING - passive soil organic C leaching loss gC/m^2/s F F +M_SOM_PAS_N_TO_LEACHING - passive soil organic N leaching loss gN/m^2/s F F +M_SOM_SLO_C_TO_LEACHING - slow soil organic ma C leaching loss gC/m^2/s F F +M_SOM_SLO_N_TO_LEACHING - slow soil organic ma N leaching loss gN/m^2/s F F +NACTIVE - Mycorrhizal N uptake flux gN/m^2/s T F +NACTIVE_NH4 - Mycorrhizal N uptake flux gN/m^2/s T F +NACTIVE_NO3 - Mycorrhizal N uptake flux gN/m^2/s T F +NAM - AM-associated N uptake flux gN/m^2/s T F +NAM_NH4 - AM-associated N uptake flux gN/m^2/s T F +NAM_NO3 - AM-associated N uptake flux gN/m^2/s T F +NBP - net biome production, includes fire, landuse, harvest and hrv_xsmrpool flux (latter smoothed o gC/m^2/s T F +NDEPLOY - total N deployed in new growth gN/m^2/s T F +NDEP_TO_SMINN - atmospheric N deposition to soil mineral N gN/m^2/s T F +NECM - ECM-associated N uptake flux gN/m^2/s T F +NECM_NH4 - ECM-associated N uptake flux gN/m^2/s T F +NECM_NO3 - ECM-associated N uptake flux gN/m^2/s T F +NEE - net ecosystem exchange of carbon, includes fire and hrv_xsmrpool (latter smoothed over the yea gC/m^2/s T F +NEM - Gridcell net adjustment to net carbon exchange passed to atm. for methane production gC/m2/s T F +NEP - net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink gC/m^2/s T F +NET_NMIN - net rate of N mineralization gN/m^2/s T F +NFERTILIZATION - fertilizer added gN/m^2/s T F +NFIRE - fire counts valid only in Reg.C counts/km2/sec T F +NFIX - Symbiotic BNF uptake flux gN/m^2/s T F +NFIX_TO_SMINN - symbiotic/asymbiotic N fixation to soil mineral N gN/m^2/s F F +NNONMYC - Non-mycorrhizal N uptake flux gN/m^2/s T F +NNONMYC_NH4 - Non-mycorrhizal N uptake flux gN/m^2/s T F +NNONMYC_NO3 - Non-mycorrhizal N uptake flux gN/m^2/s T F +NPASSIVE - Passive N uptake flux gN/m^2/s T F +NPOOL - temporary plant N pool gN/m^2 T F +NPOOL_TO_DEADCROOTN - allocation to dead coarse root N gN/m^2/s F F +NPOOL_TO_DEADCROOTN_STORAGE - allocation to dead coarse root N storage gN/m^2/s F F +NPOOL_TO_DEADSTEMN - allocation to dead stem N gN/m^2/s F F +NPOOL_TO_DEADSTEMN_STORAGE - allocation to dead stem N storage gN/m^2/s F F +NPOOL_TO_FROOTN - allocation to fine root N gN/m^2/s F F +NPOOL_TO_FROOTN_STORAGE - allocation to fine root N storage gN/m^2/s F F +NPOOL_TO_LEAFN - allocation to leaf N gN/m^2/s F F +NPOOL_TO_LEAFN_STORAGE - allocation to leaf N storage gN/m^2/s F F +NPOOL_TO_LIVECROOTN - allocation to live coarse root N gN/m^2/s F F +NPOOL_TO_LIVECROOTN_STORAGE - allocation to live coarse root N storage gN/m^2/s F F +NPOOL_TO_LIVESTEMN - allocation to live stem N gN/m^2/s F F +NPOOL_TO_LIVESTEMN_STORAGE - allocation to live stem N storage gN/m^2/s F F +NPP - net primary production gC/m^2/s T F +NPP_BURNEDOFF - C that cannot be used for N uptake gC/m^2/s F F +NPP_GROWTH - Total C used for growth in FUN gC/m^2/s T F +NPP_NACTIVE - Mycorrhizal N uptake used C gC/m^2/s T F +NPP_NACTIVE_NH4 - Mycorrhizal N uptake use C gC/m^2/s T F +NPP_NACTIVE_NO3 - Mycorrhizal N uptake used C gC/m^2/s T F +NPP_NAM - AM-associated N uptake used C gC/m^2/s T F +NPP_NAM_NH4 - AM-associated N uptake use C gC/m^2/s T F +NPP_NAM_NO3 - AM-associated N uptake use C gC/m^2/s T F +NPP_NECM - ECM-associated N uptake used C gC/m^2/s T F +NPP_NECM_NH4 - ECM-associated N uptake use C gC/m^2/s T F +NPP_NECM_NO3 - ECM-associated N uptake used C gC/m^2/s T F +NPP_NFIX - Symbiotic BNF uptake used C gC/m^2/s T F +NPP_NNONMYC - Non-mycorrhizal N uptake used C gC/m^2/s T F +NPP_NNONMYC_NH4 - Non-mycorrhizal N uptake use C gC/m^2/s T F +NPP_NNONMYC_NO3 - Non-mycorrhizal N uptake use C gC/m^2/s T F +NPP_NRETRANS - Retranslocated N uptake flux gC/m^2/s T F +NPP_NUPTAKE - Total C used by N uptake in FUN gC/m^2/s T F +NRETRANS - Retranslocated N uptake flux gN/m^2/s T F +NRETRANS_REG - Retranslocated N uptake flux gN/m^2/s T F +NRETRANS_SEASON - Retranslocated N uptake flux gN/m^2/s T F +NRETRANS_STRESS - Retranslocated N uptake flux gN/m^2/s T F +NSUBSTEPS - number of adaptive timesteps in CLM timestep unitless F F +NUPTAKE - Total N uptake of FUN gN/m^2/s T F +NUPTAKE_NPP_FRACTION - frac of NPP used in N uptake - T F +N_ALLOMETRY - N allocation index none F F +OBU - Obukhov length scale m F F +OCDEP - total OC deposition (dry+wet) from atmosphere kg/m^2/s T F +OCPHIDRY - organic carbon deposition (phidry) from atmosphere kg/m^2/s F F +OCPHIWET - organic carbon deposition (phiwet) from atmosphere kg/m^2/s F F +OCPHODRY - black carbon deposition (phodry) from atmosphere kg/m^2/s F F +OFFSET_COUNTER - offset days counter days F F +OFFSET_FDD - offset freezing degree days counter C degree-days F F +OFFSET_FLAG - offset flag none F F +OFFSET_SWI - offset soil water index none F F +ONSET_COUNTER - onset days counter days F F +ONSET_FDD - onset freezing degree days counter C degree-days F F +ONSET_FLAG - onset flag none F F +ONSET_GDD - onset growing degree days C degree-days F F +ONSET_GDDFLAG - onset flag for growing degree day sum none F F +ONSET_SWI - onset soil water index none F F +PAR240DZ - 10-day running mean of daytime patch absorbed PAR for leaves for top canopy layer W/m^2 F F +PAR240XZ - 10-day running mean of maximum patch absorbed PAR for leaves for top canopy layer W/m^2 F F +PAR240_shade - shade PAR (240 hrs) umol/m2/s F F +PAR240_sun - sunlit PAR (240 hrs) umol/m2/s F F +PAR24_shade - shade PAR (24 hrs) umol/m2/s F F +PAR24_sun - sunlit PAR (24 hrs) umol/m2/s F F +PARVEGLN - absorbed par by vegetation at local noon W/m^2 T F +PAR_shade - shade PAR umol/m2/s F F +PAR_sun - sunlit PAR umol/m2/s F F +PBOT - atmospheric pressure at surface (downscaled for glacier and hillslope columns) Pa T F +PBOT_240 - 10 day running mean of air pressure Pa F F +PBOT_NOT_DOWNSCALED - atmospheric pressure at surface (pre-downscaling) Pa F F +PCH4 - atmospheric partial pressure of CH4 Pa T F +PCO2 - atmospheric partial pressure of CO2 Pa T F +PCO2_240 - 10 day running mean of CO2 pressure Pa F F +PFT_CTRUNC - patch-level sink for C truncation gC/m^2 F F +PFT_FIRE_CLOSS - total patch-level fire C loss for non-peat fires outside land-type converted region gC/m^2/s T F +PFT_FIRE_NLOSS - total patch-level fire N loss gN/m^2/s T F +PFT_NTRUNC - patch-level sink for N truncation gN/m^2 F F +PLANTCN - Plant C:N used by FUN unitless F F +PLANT_CALLOC - total allocated C flux gC/m^2/s F F +PLANT_NALLOC - total allocated N flux gN/m^2/s F F +PLANT_NDEMAND - N flux required to support initial GPP gN/m^2/s T F +PNLCZ - Proportion of nitrogen allocated for light capture unitless F F +PO2_240 - 10 day running mean of O2 pressure Pa F F +POTENTIAL_IMMOB - potential N immobilization gN/m^2/s T F +POT_F_DENIT - potential denitrification flux gN/m^2/s T F +POT_F_NIT - potential nitrification flux gN/m^2/s T F +PREC10 - 10-day running mean of PREC MM H2O/S F F +PREC30 - 30-day running mean of PREC MM H2O/S F F +PREC60 - 60-day running mean of PREC MM H2O/S F F +PREV_DAYL - daylength from previous timestep s F F +PREV_FROOTC_TO_LITTER - previous timestep froot C litterfall flux gC/m^2/s F F +PREV_LEAFC_TO_LITTER - previous timestep leaf C litterfall flux gC/m^2/s F F +PROD100C - 100-yr wood product C gC/m^2 F F +PROD100C_LOSS - loss from 100-yr wood product pool gC/m^2/s F F +PROD100N - 100-yr wood product N gN/m^2 F F +PROD100N_LOSS - loss from 100-yr wood product pool gN/m^2/s F F +PROD10C - 10-yr wood product C gC/m^2 F F +PROD10C_LOSS - loss from 10-yr wood product pool gC/m^2/s F F +PROD10N - 10-yr wood product N gN/m^2 F F +PROD10N_LOSS - loss from 10-yr wood product pool gN/m^2/s F F +PSNSHA - shaded leaf photosynthesis umolCO2/m^2/s T F +PSNSHADE_TO_CPOOL - C fixation from shaded canopy gC/m^2/s T F +PSNSUN - sunlit leaf photosynthesis umolCO2/m^2/s T F +PSNSUN_TO_CPOOL - C fixation from sunlit canopy gC/m^2/s T F +PSurf - atmospheric pressure at surface (downscaled for glacier and hillslope columns) Pa F F +Q2M - 2m specific humidity kg/kg T F +QAF - canopy air humidity kg/kg F F +QBOT - atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg T F +QBOT_NOT_DOWNSCALED - atmospheric specific humidity (pre-downscaling) kg/kg F F +QDIRECT_THROUGHFALL - direct throughfall of liquid (rain + above-canopy irrigation) mm/s F F +QDIRECT_THROUGHFALL_SNOW - direct throughfall of snow mm/s F F +QDRAI - sub-surface drainage mm/s T F +QDRAI_PERCH - perched wt drainage mm/s T F +QDRAI_XS - saturation excess drainage mm/s T F +QDRIP - rate of excess canopy liquid falling off canopy mm/s F F +QDRIP_SNOW - rate of excess canopy snow falling off canopy mm/s F F +QFLOOD - runoff from river flooding mm/s T F +QFLX_EVAP_TOT - qflx_evap_soi + qflx_evap_can + qflx_tran_veg kg m-2 s-1 T F +QFLX_EVAP_VEG - vegetation evaporation mm H2O/s F F +QFLX_ICE_DYNBAL - ice dynamic land cover change conversion runoff flux mm/s T F +QFLX_LIQDEW_TO_TOP_LAYER - rate of liquid water deposited on top soil or snow layer (dew) mm H2O/s T F +QFLX_LIQEVAP_FROM_TOP_LAYER - rate of liquid water evaporated from top soil or snow layer mm H2O/s T F +QFLX_LIQ_DYNBAL - liq dynamic land cover change conversion runoff flux mm/s T F +QFLX_LIQ_GRND - liquid (rain+irrigation) on ground after interception mm H2O/s F F +QFLX_SNOW_DRAIN - drainage from snow pack mm/s T F +QFLX_SNOW_DRAIN_ICE - drainage from snow pack melt (ice landunits only) mm/s T F +QFLX_SNOW_GRND - snow on ground after interception mm H2O/s F F +QFLX_SOLIDDEW_TO_TOP_LAYER - rate of solid water deposited on top soil or snow layer (frost) mm H2O/s T F +QFLX_SOLIDEVAP_FROM_TOP_LAYER - rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s T F +QFLX_SOLIDEVAP_FROM_TOP_LAYER_ICE - rate of ice evaporated from top soil or snow layer (sublimation) (also includes bare ice subli mm H2O/s F F +QH2OSFC - surface water runoff mm/s T F +QH2OSFC_TO_ICE - surface water converted to ice mm/s F F +QHR - hydraulic redistribution mm/s T F +QICE - ice growth/melt mm/s T F +QICE_FRZ - ice growth mm/s T F +QICE_MELT - ice melt mm/s T F +QINFL - infiltration mm/s T F +QINTR - interception mm/s T F +QIRRIG_DEMAND - irrigation demand mm/s F F +QIRRIG_DRIP - water added via drip irrigation mm/s F F +QIRRIG_FROM_GW_CONFINED - water added through confined groundwater irrigation mm/s T F +QIRRIG_FROM_GW_UNCONFINED - water added through unconfined groundwater irrigation mm/s T F +QIRRIG_FROM_SURFACE - water added through surface water irrigation mm/s T F +QIRRIG_SPRINKLER - water added via sprinkler irrigation mm/s F F +QOVER - total surface runoff (includes QH2OSFC) mm/s T F +QOVER_LAG - time-lagged surface runoff for soil columns mm/s F F +QPHSNEG - net negative hydraulic redistribution flux mm/s F F +QRGWL - surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff fro mm/s T F +QRUNOFF - total liquid runoff not including correction for land use change mm/s T F +QRUNOFF_ICE - total liquid runoff not incl corret for LULCC (ice landunits only) mm/s T F +QRUNOFF_ICE_TO_COUPLER - total ice runoff sent to coupler (includes corrections for land use change) mm/s T F +QRUNOFF_ICE_TO_LIQ - liquid runoff from converted ice runoff mm/s F F +QRUNOFF_R - Rural total runoff mm/s F F +QRUNOFF_TO_COUPLER - total liquid runoff sent to coupler (includes corrections for land use change) mm/s T F +QRUNOFF_U - Urban total runoff mm/s T F +QSNOCPLIQ - excess liquid h2o due to snow capping not including correction for land use change mm H2O/s T F +QSNOEVAP - evaporation from snow (only when snl<0, otherwise it is equal to qflx_ev_soil) mm/s T F +QSNOFRZ - column-integrated snow freezing rate kg/m2/s T F +QSNOFRZ_ICE - column-integrated snow freezing rate (ice landunits only) mm/s T F +QSNOMELT - snow melt rate mm/s T F +QSNOMELT_ICE - snow melt (ice landunits only) mm/s T F +QSNOUNLOAD - canopy snow unloading mm/s T F +QSNO_TEMPUNLOAD - canopy snow temp unloading mm/s T F +QSNO_WINDUNLOAD - canopy snow wind unloading mm/s T F +QSNWCPICE - excess solid h2o due to snow capping not including correction for land use change mm H2O/s T F +QSOIL - Ground evaporation (soil/snow evaporation + soil/snow sublimation - dew) mm/s T F +QSOIL_ICE - Ground evaporation (ice landunits only) mm/s T F +QTOPSOIL - water input to surface mm/s F F +QVEGE - canopy evaporation mm/s T F +QVEGT - canopy transpiration mm/s T F +Qair - atmospheric specific humidity (downscaled to columns in glacier regions) kg/kg F F +Qh - sensible heat W/m^2 F F +Qle - total evaporation W/m^2 F F +Qstor - storage heat flux (includes snowmelt) W/m^2 F F +Qtau - momentum flux kg/m/s^2 F F +RAH1 - aerodynamical resistance s/m F F +RAH2 - aerodynamical resistance s/m F F +RAIN - atmospheric rain, after rain/snow repartitioning based on temperature mm/s T F +RAIN_FROM_ATM - atmospheric rain received from atmosphere (pre-repartitioning) mm/s T F +RAIN_ICE - atmospheric rain, after rain/snow repartitioning based on temperature (ice landunits only) mm/s F F +RAM1 - aerodynamical resistance s/m F F +RAM_LAKE - aerodynamic resistance for momentum (lakes only) s/m F F +RAW1 - aerodynamical resistance s/m F F +RAW2 - aerodynamical resistance s/m F F +RB - leaf boundary resistance s/m F F +RB10 - 10 day running mean boundary layer resistance s/m F F +RETRANSN - plant pool of retranslocated N gN/m^2 T F +RETRANSN_TO_NPOOL - deployment of retranslocated N gN/m^2/s T F +RH - atmospheric relative humidity % F F +RH2M - 2m relative humidity % T F +RH2M_R - Rural 2m relative humidity % T F +RH2M_U - Urban 2m relative humidity % T F +RH30 - 30-day running mean of relative humidity % F F +RHAF - fractional humidity of canopy air fraction F F +RHAF10 - 10 day running mean of fractional humidity of canopy air fraction F F +RH_LEAF - fractional humidity at leaf surface fraction F F +RR - root respiration (fine root MR + total root GR) gC/m^2/s T F +RSSHA - shaded leaf stomatal resistance s/m T F +RSSUN - sunlit leaf stomatal resistance s/m T F +Rainf - atmospheric rain, after rain/snow repartitioning based on temperature mm/s F F +Rho_from_atm - atmospheric density (pre-downscaling) kg/m^3 F F +Rnet - net radiation W/m^2 F F +SABG - solar rad absorbed by ground W/m^2 T F +SABG_PEN - Rural solar rad penetrating top soil or snow layer watt/m^2 T F +SABV - solar rad absorbed by veg W/m^2 T F +SEEDC - pool for seeding new PFTs via dynamic landcover gC/m^2 T F +SEEDN - pool for seeding new PFTs via dynamic landcover gN/m^2 T F +SIF - seasonal inundation factor calculated for sat. CH4 prod. (non-lake) unitless T F +SLASH_HARVESTC - slash harvest carbon (to litter) gC/m^2/s T F +SMINN - soil mineral N gN/m^2 T F +SMINN_TO_NPOOL - deployment of soil mineral N uptake gN/m^2/s T F +SMINN_TO_PLANT - plant uptake of soil mineral N gN/m^2/s T F +SMINN_TO_PLANT_FUN - Total soil N uptake of FUN gN/m^2/s T F +SMINN_TO_S1N_L1 - mineral N flux for decomp. of LIT_METto SOM_ACT gN/m^2 F F +SMINN_TO_S1N_L2 - mineral N flux for decomp. of LIT_CELto SOM_ACT gN/m^2 F F +SMINN_TO_S1N_S2 - mineral N flux for decomp. of SOM_SLOto SOM_ACT gN/m^2 F F +SMINN_TO_S1N_S3 - mineral N flux for decomp. of SOM_PASto SOM_ACT gN/m^2 F F +SMINN_TO_S2N_L3 - mineral N flux for decomp. of LIT_LIGto SOM_SLO gN/m^2 F F +SMINN_TO_S2N_S1 - mineral N flux for decomp. of SOM_ACTto SOM_SLO gN/m^2 F F +SMINN_TO_S3N_S1 - mineral N flux for decomp. of SOM_ACTto SOM_PAS gN/m^2 F F +SMINN_TO_S3N_S2 - mineral N flux for decomp. of SOM_SLOto SOM_PAS gN/m^2 F F +SMIN_NH4 - soil mineral NH4 gN/m^2 T F +SMIN_NO3 - soil mineral NO3 gN/m^2 T F +SMIN_NO3_LEACHED - soil NO3 pool loss to leaching gN/m^2/s T F +SMIN_NO3_RUNOFF - soil NO3 pool loss to runoff gN/m^2/s T F +SNOBCMCL - mass of BC in snow column kg/m2 T F +SNOBCMSL - mass of BC in top snow layer kg/m2 T F +SNOCAN - intercepted snow mm T F +SNODSTMCL - mass of dust in snow column kg/m2 T F +SNODSTMSL - mass of dust in top snow layer kg/m2 T F +SNOFSDSND - direct nir incident solar radiation on snow W/m^2 F F +SNOFSDSNI - diffuse nir incident solar radiation on snow W/m^2 F F +SNOFSDSVD - direct vis incident solar radiation on snow W/m^2 F F +SNOFSDSVI - diffuse vis incident solar radiation on snow W/m^2 F F +SNOFSRND - direct nir reflected solar radiation from snow W/m^2 T F +SNOFSRNI - diffuse nir reflected solar radiation from snow W/m^2 T F +SNOFSRVD - direct vis reflected solar radiation from snow W/m^2 T F +SNOFSRVI - diffuse vis reflected solar radiation from snow W/m^2 T F +SNOINTABS - Fraction of incoming solar absorbed by lower snow layers - T F +SNOLIQFL - top snow layer liquid water fraction (land) fraction F F +SNOMELT_ACCUM - accumulated snow melt for z0 m T F +SNOOCMCL - mass of OC in snow column kg/m2 T F +SNOOCMSL - mass of OC in top snow layer kg/m2 T F +SNORDSL - top snow layer effective grain radius m^-6 F F +SNOTTOPL - snow temperature (top layer) K F F +SNOTTOPL_ICE - snow temperature (top layer, ice landunits only) K F F +SNOTXMASS - snow temperature times layer mass, layer sum; to get mass-weighted temperature, divide by (SNO K kg/m2 T F +SNOTXMASS_ICE - snow temperature times layer mass, layer sum (ice landunits only); to get mass-weighted temper K kg/m2 F F +SNOW - atmospheric snow, after rain/snow repartitioning based on temperature mm/s T F +SNOWDP - gridcell mean snow height m T F +SNOWICE - snow ice kg/m2 T F +SNOWICE_ICE - snow ice (ice landunits only) kg/m2 F F +SNOWLIQ - snow liquid water kg/m2 T F +SNOWLIQ_ICE - snow liquid water (ice landunits only) kg/m2 F F +SNOW_5D - 5day snow avg m F F +SNOW_DEPTH - snow height of snow covered area m T F +SNOW_DEPTH_ICE - snow height of snow covered area (ice landunits only) m F F +SNOW_FROM_ATM - atmospheric snow received from atmosphere (pre-repartitioning) mm/s T F +SNOW_ICE - atmospheric snow, after rain/snow repartitioning based on temperature (ice landunits only) mm/s F F +SNOW_PERSISTENCE - Length of time of continuous snow cover (nat. veg. landunits only) seconds F T +SNOW_SINKS - snow sinks (liquid water) mm/s T F +SNOW_SOURCES - snow sources (liquid water) mm/s T F +SNOdTdzL - top snow layer temperature gradient (land) K/m F F +SOIL10 - 10-day running mean of 12cm layer soil K F F +SOILC_CHANGE - C change in soil gC/m^2/s T F +SOILC_HR - soil C heterotrophic respiration gC/m^2/s T F +SOILRESIS - soil resistance to evaporation s/m T F +SOILWATER_10CM - soil liquid water + ice in top 10cm of soil (veg landunits only) kg/m2 T F +SOMC_FIRE - C loss due to peat burning gC/m^2/s T F +SOMFIRE - soil organic matter fire losses gC/m^2/s F F +SOM_ACT_C - SOM_ACT C gC/m^2 T F +SOM_ACT_C_1m - SOM_ACT C to 1 meter gC/m^2 F F +SOM_ACT_C_TO_SOM_PAS_C - decomp. of active soil organic C to passive soil organic C gC/m^2/s F F +SOM_ACT_C_TO_SOM_SLO_C - decomp. of active soil organic C to slow soil organic ma C gC/m^2/s F F +SOM_ACT_HR_S2 - Het. Resp. from active soil organic gC/m^2/s F F +SOM_ACT_HR_S3 - Het. Resp. from active soil organic gC/m^2/s F F +SOM_ACT_N - SOM_ACT N gN/m^2 T F +SOM_ACT_N_1m - SOM_ACT N to 1 meter gN/m^2 F F +SOM_ACT_N_TO_SOM_PAS_N - decomp. of active soil organic N to passive soil organic N gN/m^2 F F +SOM_ACT_N_TO_SOM_SLO_N - decomp. of active soil organic N to slow soil organic ma N gN/m^2 F F +SOM_C_LEACHED - total flux of C from SOM pools due to leaching gC/m^2/s T F +SOM_N_LEACHED - total flux of N from SOM pools due to leaching gN/m^2/s F F +SOM_PAS_C - SOM_PAS C gC/m^2 T F +SOM_PAS_C_1m - SOM_PAS C to 1 meter gC/m^2 F F +SOM_PAS_C_TO_SOM_ACT_C - decomp. of passive soil organic C to active soil organic C gC/m^2/s F F +SOM_PAS_HR - Het. Resp. from passive soil organic gC/m^2/s F F +SOM_PAS_N - SOM_PAS N gN/m^2 T F +SOM_PAS_N_1m - SOM_PAS N to 1 meter gN/m^2 F F +SOM_PAS_N_TO_SOM_ACT_N - decomp. of passive soil organic N to active soil organic N gN/m^2 F F +SOM_SLO_C - SOM_SLO C gC/m^2 T F +SOM_SLO_C_1m - SOM_SLO C to 1 meter gC/m^2 F F +SOM_SLO_C_TO_SOM_ACT_C - decomp. of slow soil organic ma C to active soil organic C gC/m^2/s F F +SOM_SLO_C_TO_SOM_PAS_C - decomp. of slow soil organic ma C to passive soil organic C gC/m^2/s F F +SOM_SLO_HR_S1 - Het. Resp. from slow soil organic ma gC/m^2/s F F +SOM_SLO_HR_S3 - Het. Resp. from slow soil organic ma gC/m^2/s F F +SOM_SLO_N - SOM_SLO N gN/m^2 T F +SOM_SLO_N_1m - SOM_SLO N to 1 meter gN/m^2 F F +SOM_SLO_N_TO_SOM_ACT_N - decomp. of slow soil organic ma N to active soil organic N gN/m^2 F F +SOM_SLO_N_TO_SOM_PAS_N - decomp. of slow soil organic ma N to passive soil organic N gN/m^2 F F +SR - total soil respiration (HR + root resp) gC/m^2/s T F +SSRE_FSR - surface snow effect on reflected solar radiation W/m^2 T F +SSRE_FSRND - surface snow effect on direct nir reflected solar radiation W/m^2 T F +SSRE_FSRNDLN - surface snow effect on direct nir reflected solar radiation at local noon W/m^2 T F +SSRE_FSRNI - surface snow effect on diffuse nir reflected solar radiation W/m^2 T F +SSRE_FSRVD - surface snow radiatve effect on direct vis reflected solar radiation W/m^2 T F +SSRE_FSRVDLN - surface snow radiatve effect on direct vis reflected solar radiation at local noon W/m^2 T F +SSRE_FSRVI - surface snow radiatve effect on diffuse vis reflected solar radiation W/m^2 T F +STORAGE_CDEMAND - C use from the C storage pool gC/m^2 F F +STORAGE_GR - growth resp for growth sent to storage for later display gC/m^2/s F F +STORAGE_NDEMAND - N demand during the offset period gN/m^2 F F +STORVEGC - stored vegetation carbon, excluding cpool gC/m^2 T F +STORVEGN - stored vegetation nitrogen gN/m^2 T F +SUPPLEMENT_TO_SMINN - supplemental N supply gN/m^2/s T F +SWBGT - 2 m Simplified Wetbulb Globe Temp C T F +SWBGT_R - Rural 2 m Simplified Wetbulb Globe Temp C T F +SWBGT_U - Urban 2 m Simplified Wetbulb Globe Temp C T F +SWMP65 - 2 m Swamp Cooler Temp 65% Eff C T F +SWMP65_R - Rural 2 m Swamp Cooler Temp 65% Eff C T F +SWMP65_U - Urban 2 m Swamp Cooler Temp 65% Eff C T F +SWMP80 - 2 m Swamp Cooler Temp 80% Eff C T F +SWMP80_R - Rural 2 m Swamp Cooler Temp 80% Eff C T F +SWMP80_U - Urban 2 m Swamp Cooler Temp 80% Eff C T F +SWdown - atmospheric incident solar radiation W/m^2 F F +SWup - upwelling shortwave radiation W/m^2 F F +SoilAlpha - factor limiting ground evap unitless F F +SoilAlpha_U - urban factor limiting ground evap unitless T F +T10 - 10-day running mean of 2-m temperature K F F +TAF - canopy air temperature K F F +TAUX - zonal surface stress kg/m/s^2 T F +TAUY - meridional surface stress kg/m/s^2 T F +TBOT - atmospheric air temperature (downscaled for glacier and hillslope columns) K T F +TBUILD - internal urban building air temperature K T F +TBUILD_MAX - prescribed maximum interior building temperature K F F +TDEPTH - tributary water depth m F F +TDEPTHMAX - tributary bankfull water depth m F F +TEMPAVG_T2M - temporary average 2m air temperature K F F +TEMPMAX_RETRANSN - temporary annual max of retranslocated N pool gN/m^2 F F +TEMPSUM_POTENTIAL_GPP - temporary annual sum of potential GPP gC/m^2/yr F F +TEQ - 2 m Equiv Temp K T F +TEQ_R - Rural 2 m Equiv Temp K T F +TEQ_U - Urban 2 m Equiv Temp K T F +TFLOOR - floor temperature K F F +TG - ground temperature K T F +TG_ICE - ground temperature (ice landunits only) K F F +TG_R - Rural ground temperature K F F +TG_U - Urban ground temperature K T F +TH2OSFC - surface water temperature K T F +THBOT - atmospheric air potential temperature (downscaled for glacier and hillslope columns) K T F +THIC - 2 m Temp Hum Index Comfort C T F +THIC_R - Rural 2 m Temp Hum Index Comfort C T F +THIC_U - Urban 2 m Temp Hum Index Comfort C T F +THIP - 2 m Temp Hum Index Physiology C T F +THIP_R - Rural 2 m Temp Hum Index Physiology C T F +THIP_U - Urban 2 m Temp Hum Index Physiology C T F +TKE1 - top lake level eddy thermal conductivity W/(mK) T F +TLAI - total projected leaf area index m^2/m^2 T F +TOPO_COL - column-level topographic height m F F +TOPO_COL_ICE - column-level topographic height (ice landunits only) m F F +TOPT - topt coefficient for VOC calc non F F +TOTCOLC - total column carbon, incl veg and cpool but excl product pools gC/m^2 T F +TOTCOLCH4 - total belowground CH4 (0 for non-lake special landunits in the absence of dynamic landunits) gC/m2 T F +TOTCOLN - total column-level N, excluding product pools gN/m^2 T F +TOTECOSYSC - total ecosystem carbon, incl veg but excl cpool and product pools gC/m^2 T F +TOTECOSYSN - total ecosystem N, excluding product pools gN/m^2 T F +TOTFIRE - total ecosystem fire losses gC/m^2/s F F +TOTLITC - total litter carbon gC/m^2 T F +TOTLITC_1m - total litter carbon to 1 meter depth gC/m^2 T F +TOTLITN - total litter N gN/m^2 T F +TOTLITN_1m - total litter N to 1 meter gN/m^2 T F +TOTPFTC - total patch-level carbon, including cpool gC/m^2 T F +TOTPFTN - total patch-level nitrogen gN/m^2 T F +TOTSOILICE - vertically summed soil ice (veg landunits only) kg/m2 T F +TOTSOILLIQ - vertically summed soil liquid water (veg landunits only) kg/m2 T F +TOTSOMC - total soil organic matter carbon gC/m^2 T F +TOTSOMC_1m - total soil organic matter carbon to 1 meter depth gC/m^2 T F +TOTSOMN - total soil organic matter N gN/m^2 T F +TOTSOMN_1m - total soil organic matter N to 1 meter gN/m^2 T F +TOTVEGC - total vegetation carbon, excluding cpool gC/m^2 T F +TOTVEGN - total vegetation nitrogen gN/m^2 T F +TOT_WOODPRODC - total wood product C gC/m^2 T F +TOT_WOODPRODC_LOSS - total loss from wood product pools gC/m^2/s T F +TOT_WOODPRODN - total wood product N gN/m^2 T F +TOT_WOODPRODN_LOSS - total loss from wood product pools gN/m^2/s T F +TPU25T - canopy profile of tpu umol/m2/s T F +TRAFFICFLUX - sensible heat flux from urban traffic W/m^2 F F +TRANSFER_DEADCROOT_GR - dead coarse root growth respiration from storage gC/m^2/s F F +TRANSFER_DEADSTEM_GR - dead stem growth respiration from storage gC/m^2/s F F +TRANSFER_FROOT_GR - fine root growth respiration from storage gC/m^2/s F F +TRANSFER_GR - growth resp for transfer growth displayed in this timestep gC/m^2/s F F +TRANSFER_LEAF_GR - leaf growth respiration from storage gC/m^2/s F F +TRANSFER_LIVECROOT_GR - live coarse root growth respiration from storage gC/m^2/s F F +TRANSFER_LIVESTEM_GR - live stem growth respiration from storage gC/m^2/s F F +TREFMNAV - daily minimum of average 2-m temperature K T F +TREFMNAV_R - Rural daily minimum of average 2-m temperature K T F +TREFMNAV_U - Urban daily minimum of average 2-m temperature K T F +TREFMXAV - daily maximum of average 2-m temperature K T F +TREFMXAV_R - Rural daily maximum of average 2-m temperature K T F +TREFMXAV_U - Urban daily maximum of average 2-m temperature K T F +TROOF_INNER - roof inside surface temperature K F F +TSA - 2m air temperature K T F +TSAI - total projected stem area index m^2/m^2 T F +TSA_ICE - 2m air temperature (ice landunits only) K F F +TSA_R - Rural 2m air temperature K T F +TSA_U - Urban 2m air temperature K T F +TSHDW_INNER - shadewall inside surface temperature K F F +TSKIN - skin temperature K T F +TSL - temperature of near-surface soil layer (natural vegetated and crop landunits only) K T F +TSOI_10CM - soil temperature in top 10cm of soil K T F +TSUNW_INNER - sunwall inside surface temperature K F F +TV - vegetation temperature K T F +TV24 - vegetation temperature (last 24hrs) K F F +TV240 - vegetation temperature (last 240hrs) K F F +TVEGD10 - 10 day running mean of patch daytime vegetation temperature Kelvin F F +TVEGN10 - 10 day running mean of patch night-time vegetation temperature Kelvin F F +TWS - total water storage mm T F +Tair - atmospheric air temperature (downscaled for glacier and hillslope columns) K F F +Tair_from_atm - atmospheric air temperature received from atmosphere (pre-downscaling) K F F +Thair_from_atm - atmospheric air potential temperature (pre-downscaling) K F F +U10 - 10-m wind m/s T F +U10_DUST - 10-m wind for dust model m/s T F +U10_ICE - 10-m wind (ice landunits only) m/s F F +UAF - canopy air speed m/s F F +ULRAD - upward longwave radiation above the canopy W/m^2 F F +UM - wind speed plus stability effect m/s F F +URBAN_AC - urban air conditioning flux W/m^2 T F +URBAN_HEAT - urban heating flux W/m^2 T F +USTAR - friction velocity m/s F F +UST_LAKE - friction velocity (lakes only) m/s F F +UWIND - atmospheric U wind velocity magnitude m/s F F +VA - atmospheric wind speed plus convective velocity m/s F F +VCMX25T - canopy profile of vcmax25 umol/m2/s T F +VENTILATION - sensible heat flux from building ventilation W/m^2 T F +VOCFLXT - total VOC flux into atmosphere moles/m2/sec F F +VOLR - river channel total water storage m3 T F +VOLRMCH - river channel main channel water storage m3 T F +VPD - vapor pressure deficit kPa F F +VPD2M - 2m vapor pressure deficit Pa T F +VPD_CAN - canopy vapor pressure deficit kPa T F +VWIND - atmospheric V wind velocity magnitude m/s F F +Vcmx25Z - canopy profile of vcmax25 predicted by LUNA model umol/m2/s T F +WASTEHEAT - sensible heat flux from heating/cooling sources of urban waste heat W/m^2 T F +WBA - 2 m Wet Bulb C T F +WBA_R - Rural 2 m Wet Bulb C T F +WBA_U - Urban 2 m Wet Bulb C T F +WBT - 2 m Stull Wet Bulb C T F +WBT_R - Rural 2 m Stull Wet Bulb C T F +WBT_U - Urban 2 m Stull Wet Bulb C T F +WF - soil water as frac. of whc for top 0.05 m proportion F F +WIND - atmospheric wind velocity magnitude m/s T F +WOODC - wood C gC/m^2 T F +WOODC_ALLOC - wood C eallocation gC/m^2/s T F +WOODC_LOSS - wood C loss gC/m^2/s T F +WOOD_HARVESTC - wood harvest carbon (to product pools) gC/m^2/s T F +WOOD_HARVESTN - wood harvest N (to product pools) gN/m^2/s T F +WTGQ - surface tracer conductance m/s T F +Wind - atmospheric wind velocity magnitude m/s F F +XSMRPOOL - temporary photosynthate C pool gC/m^2 T F +XSMRPOOL_LOSS - temporary photosynthate C pool loss gC/m^2 F F +XSMRPOOL_RECOVER - C flux assigned to recovery of negative xsmrpool gC/m^2/s T F +Z0HG - roughness length over ground, sensible heat (vegetated landunits only) m F F +Z0HG_P - patch roughness length over ground, sensible heat m F F +Z0HV - roughness length over vegetation, sensible heat m F F +Z0MG - roughness length over ground, momentum (vegetated landunits only) m F F +Z0MG_P - patch roughness length over ground, momentum m F F +Z0MV - roughness length over vegetation, momentum m F F +Z0MV_DENSE - roughness length over vegetation, momentum, for dense canopy m F F +Z0M_TO_COUPLER - roughness length, momentum: gridcell average sent to coupler m F F +Z0QG - roughness length over ground, latent heat (vegetated landunits only) m F F +Z0QG_P - patch roughness length over ground, latent heat m F F +Z0QV - roughness length over vegetation, latent heat m F F +ZBOT - atmospheric reference height m T F +ZETA - dimensionless stability parameter unitless F F +ZII - convective boundary height m F F +ZWT - water table depth (natural vegetated and crop landunits only) m T F +ZWT_CH4_UNSAT - depth of water table for methane production used in non-inundated area m T F +ZWT_PERCH - perched water table depth (natural vegetated and crop landunits only) m T F +currentPatch - currentPatch coefficient for VOC calc non F F +num_iter - number of iterations unitless F F +QICE_FORC elevclas qice forcing sent to GLC mm/s F F +TOPO_FORC elevclas topograephic height sent to GLC m F F +TSRF_FORC elevclas surface temperature sent to GLC K F F +ACTUAL_IMMOB_NH4 levdcmp immobilization of NH4 gN/m^3/s F F +ACTUAL_IMMOB_NO3 levdcmp immobilization of NO3 gN/m^3/s F F +ACTUAL_IMMOB_vr levdcmp actual N immobilization gN/m^3/s F F +CROOT_PROF levdcmp profile for litter C and N inputs from coarse roots 1/m F F +CWD_C_TO_LIT_CEL_C_vr levdcmp decomp. of coarse woody debris C to cellulosic litter C gC/m^3/s F F +CWD_C_TO_LIT_LIG_C_vr levdcmp decomp. of coarse woody debris C to lignin litter C gC/m^3/s F F +CWD_HR_L2_vr levdcmp Het. Resp. from coarse woody debris gC/m^3/s F F +CWD_HR_L3_vr levdcmp Het. Resp. from coarse woody debris gC/m^3/s F F +CWD_N_TO_LIT_CEL_N_vr levdcmp decomp. of coarse woody debris N to cellulosic litter N gN/m^3 F F +CWD_N_TO_LIT_LIG_N_vr levdcmp decomp. of coarse woody debris N to lignin litter N gN/m^3 F F +CWD_N_vr levdcmp CWD N (vertically resolved) gN/m^3 T F +CWD_PATHFRAC_L2_vr levdcmp PATHFRAC from coarse woody debris to cellulosic litter fraction F F +CWD_PATHFRAC_L3_vr levdcmp PATHFRAC from coarse woody debris to lignin litter fraction F F +CWD_RESP_FRAC_L2_vr levdcmp respired from coarse woody debris to cellulosic litter fraction F F +CWD_RESP_FRAC_L3_vr levdcmp respired from coarse woody debris to lignin litter fraction F F +DWT_DEADCROOTC_TO_CWDC levdcmp dead coarse root to CWD due to landcover change gC/m^2/s F F +DWT_DEADCROOTN_TO_CWDN levdcmp dead coarse root to CWD due to landcover change gN/m^2/s F F +DWT_FROOTC_TO_LIT_CEL_C levdcmp fine root to cellulosic litter due to landcover change gC/m^2/s F F +DWT_FROOTC_TO_LIT_LIG_C levdcmp fine root to lignin litter due to landcover change gC/m^2/s F F +DWT_FROOTC_TO_LIT_MET_C levdcmp fine root to metabolic litter due to landcover change gC/m^2/s F F +DWT_FROOTN_TO_LIT_CEL_N levdcmp fine root N to cellulosic litter due to landcover change gN/m^2/s F F +DWT_FROOTN_TO_LIT_LIG_N levdcmp fine root N to lignin litter due to landcover change gN/m^2/s F F +DWT_FROOTN_TO_LIT_MET_N levdcmp fine root N to metabolic litter due to landcover change gN/m^2/s F F +DWT_LIVECROOTC_TO_CWDC levdcmp live coarse root to CWD due to landcover change gC/m^2/s F F +DWT_LIVECROOTN_TO_CWDN levdcmp live coarse root to CWD due to landcover change gN/m^2/s F F +FMAX_DENIT_CARBONSUBSTRATE levdcmp FMAX_DENIT_CARBONSUBSTRATE gN/m^3/s F F +FMAX_DENIT_NITRATE levdcmp FMAX_DENIT_NITRATE gN/m^3/s F F +FPHR_vr levdcmp fraction of potential HR due to N limitation unitless T F +FPI_vr levdcmp fraction of potential immobilization proportion F F +FROOT_PROF levdcmp profile for litter C and N inputs from fine roots 1/m F F +F_DENIT_BASE levdcmp F_DENIT_BASE gN/m^3/s F F +F_DENIT_vr levdcmp denitrification flux gN/m^3/s F F +F_NIT_vr levdcmp nitrification flux gN/m^3/s F F +GROSS_NMIN_vr levdcmp gross rate of N mineralization gN/m^3/s F F +K_CWD levdcmp coarse woody debris potential loss coefficient 1/s F F +K_LIT_CEL levdcmp cellulosic litter potential loss coefficient 1/s F F +K_LIT_LIG levdcmp lignin litter potential loss coefficient 1/s F F +K_LIT_MET levdcmp metabolic litter potential loss coefficient 1/s F F +K_NITR levdcmp K_NITR 1/s F F +K_NITR_H2O levdcmp K_NITR_H2O unitless F F +K_NITR_PH levdcmp K_NITR_PH unitless F F +K_NITR_T levdcmp K_NITR_T unitless F F +K_SOM_ACT levdcmp active soil organic potential loss coefficient 1/s F F +K_SOM_PAS levdcmp passive soil organic potential loss coefficient 1/s F F +K_SOM_SLO levdcmp slow soil organic ma potential loss coefficient 1/s F F +L1_PATHFRAC_S1_vr levdcmp PATHFRAC from metabolic litter to active soil organic fraction F F +L1_RESP_FRAC_S1_vr levdcmp respired from metabolic litter to active soil organic fraction F F +L2_PATHFRAC_S1_vr levdcmp PATHFRAC from cellulosic litter to active soil organic fraction F F +L2_RESP_FRAC_S1_vr levdcmp respired from cellulosic litter to active soil organic fraction F F +L3_PATHFRAC_S2_vr levdcmp PATHFRAC from lignin litter to slow soil organic ma fraction F F +L3_RESP_FRAC_S2_vr levdcmp respired from lignin litter to slow soil organic ma fraction F F +LEAF_PROF levdcmp profile for litter C and N inputs from leaves 1/m F F +LIT_CEL_C_TNDNCY_VERT_TR levdcmp cellulosic litter C tendency due to vertical transport gC/m^3/s F F +LIT_CEL_C_TO_SOM_ACT_C_v levdcmp decomp. of cellulosic litter C to active soil organic C gC/m^3/s F F +LIT_CEL_HR_vr levdcmp Het. Resp. from cellulosic litter gC/m^3/s F F +LIT_CEL_N_TNDNCY_VERT_TR levdcmp cellulosic litter N tendency due to vertical transport gN/m^3/s F F +LIT_CEL_N_TO_SOM_ACT_N_v levdcmp decomp. of cellulosic litter N to active soil organic N gN/m^3 F F +LIT_CEL_N_vr levdcmp LIT_CEL N (vertically resolved) gN/m^3 T F +LIT_LIG_C_TNDNCY_VERT_TR levdcmp lignin litter C tendency due to vertical transport gC/m^3/s F F +LIT_LIG_C_TO_SOM_SLO_C_v levdcmp decomp. of lignin litter C to slow soil organic ma C gC/m^3/s F F +LIT_LIG_HR_vr levdcmp Het. Resp. from lignin litter gC/m^3/s F F +LIT_LIG_N_TNDNCY_VERT_TR levdcmp lignin litter N tendency due to vertical transport gN/m^3/s F F +LIT_LIG_N_TO_SOM_SLO_N_v levdcmp decomp. of lignin litter N to slow soil organic ma N gN/m^3 F F +LIT_LIG_N_vr levdcmp LIT_LIG N (vertically resolved) gN/m^3 T F +LIT_MET_C_TNDNCY_VERT_TR levdcmp metabolic litter C tendency due to vertical transport gC/m^3/s F F +LIT_MET_C_TO_SOM_ACT_C_v levdcmp decomp. of metabolic litter C to active soil organic C gC/m^3/s F F +LIT_MET_HR_vr levdcmp Het. Resp. from metabolic litter gC/m^3/s F F +LIT_MET_N_TNDNCY_VERT_TR levdcmp metabolic litter N tendency due to vertical transport gN/m^3/s F F +LIT_MET_N_TO_SOM_ACT_N_v levdcmp decomp. of metabolic litter N to active soil organic N gN/m^3 F F +LIT_MET_N_vr levdcmp LIT_MET N (vertically resolved) gN/m^3 T F +M_CWD_C_TO_FIRE_vr levdcmp coarse woody debris C fire loss gC/m^3/s F F +M_CWD_N_TO_FIRE_vr levdcmp coarse woody debris N fire loss gN/m^3 F F +M_LIT_CEL_C_TO_FIRE_vr levdcmp cellulosic litter C fire loss gC/m^3/s F F +M_LIT_CEL_N_TO_FIRE_vr levdcmp cellulosic litter N fire loss gN/m^3 F F +M_LIT_LIG_C_TO_FIRE_vr levdcmp lignin litter C fire loss gC/m^3/s F F +M_LIT_LIG_N_TO_FIRE_vr levdcmp lignin litter N fire loss gN/m^3 F F +M_LIT_MET_C_TO_FIRE_vr levdcmp metabolic litter C fire loss gC/m^3/s F F +M_LIT_MET_N_TO_FIRE_vr levdcmp metabolic litter N fire loss gN/m^3 F F +NDEP_PROF levdcmp profile for atmospheric N deposition 1/m F F +NET_NMIN_vr levdcmp net rate of N mineralization gN/m^3/s F F +NFIXATION_PROF levdcmp profile for biological N fixation 1/m F F +POTENTIAL_IMMOB_vr levdcmp potential N immobilization gN/m^3/s F F +POT_F_DENIT_vr levdcmp potential denitrification flux gN/m^3/s F F +POT_F_NIT_vr levdcmp potential nitrification flux gN/m^3/s F F +S1_PATHFRAC_S2_vr levdcmp PATHFRAC from active soil organic to slow soil organic ma fraction F F +S1_PATHFRAC_S3_vr levdcmp PATHFRAC from active soil organic to passive soil organic fraction F F +S1_RESP_FRAC_S2_vr levdcmp respired from active soil organic to slow soil organic ma fraction F F +S1_RESP_FRAC_S3_vr levdcmp respired from active soil organic to passive soil organic fraction F F +S2_PATHFRAC_S1_vr levdcmp PATHFRAC from slow soil organic ma to active soil organic fraction F F +S2_PATHFRAC_S3_vr levdcmp PATHFRAC from slow soil organic ma to passive soil organic fraction F F +S2_RESP_FRAC_S1_vr levdcmp respired from slow soil organic ma to active soil organic fraction F F +S2_RESP_FRAC_S3_vr levdcmp respired from slow soil organic ma to passive soil organic fraction F F +S3_PATHFRAC_S1_vr levdcmp PATHFRAC from passive soil organic to active soil organic fraction F F +S3_RESP_FRAC_S1_vr levdcmp respired from passive soil organic to active soil organic fraction F F +SMINN_TO_PLANT_vr levdcmp plant uptake of soil mineral N gN/m^3/s F F +SMINN_TO_S1N_L1_vr levdcmp mineral N flux for decomp. of LIT_METto SOM_ACT gN/m^3 F F +SMINN_TO_S1N_L2_vr levdcmp mineral N flux for decomp. of LIT_CELto SOM_ACT gN/m^3 F F +SMINN_TO_S1N_S2_vr levdcmp mineral N flux for decomp. of SOM_SLOto SOM_ACT gN/m^3 F F +SMINN_TO_S1N_S3_vr levdcmp mineral N flux for decomp. of SOM_PASto SOM_ACT gN/m^3 F F +SMINN_TO_S2N_L3_vr levdcmp mineral N flux for decomp. of LIT_LIGto SOM_SLO gN/m^3 F F +SMINN_TO_S2N_S1_vr levdcmp mineral N flux for decomp. of SOM_ACTto SOM_SLO gN/m^3 F F +SMINN_TO_S3N_S1_vr levdcmp mineral N flux for decomp. of SOM_ACTto SOM_PAS gN/m^3 F F +SMINN_TO_S3N_S2_vr levdcmp mineral N flux for decomp. of SOM_SLOto SOM_PAS gN/m^3 F F +SMIN_NH4_TO_PLANT levdcmp plant uptake of NH4 gN/m^3/s F F +SMIN_NO3_LEACHED_vr levdcmp soil NO3 pool loss to leaching gN/m^3/s F F +SMIN_NO3_MASSDENS levdcmp SMIN_NO3_MASSDENS ugN/cm^3 soil F F +SMIN_NO3_RUNOFF_vr levdcmp soil NO3 pool loss to runoff gN/m^3/s F F +SMIN_NO3_TO_PLANT levdcmp plant uptake of NO3 gN/m^3/s F F +SOILN_vr levdcmp SOIL N (vertically resolved) gN/m^3 T F +SOM_ACT_C_TNDNCY_VERT_TR levdcmp active soil organic C tendency due to vertical transport gC/m^3/s F F +SOM_ACT_C_TO_SOM_PAS_C_v levdcmp decomp. of active soil organic C to passive soil organic C gC/m^3/s F F +SOM_ACT_C_TO_SOM_SLO_C_v levdcmp decomp. of active soil organic C to slow soil organic ma C gC/m^3/s F F +SOM_ACT_HR_S2_vr levdcmp Het. Resp. from active soil organic gC/m^3/s F F +SOM_ACT_HR_S3_vr levdcmp Het. Resp. from active soil organic gC/m^3/s F F +SOM_ACT_N_TNDNCY_VERT_TR levdcmp active soil organic N tendency due to vertical transport gN/m^3/s F F +SOM_ACT_N_TO_SOM_PAS_N_v levdcmp decomp. of active soil organic N to passive soil organic N gN/m^3 F F +SOM_ACT_N_TO_SOM_SLO_N_v levdcmp decomp. of active soil organic N to slow soil organic ma N gN/m^3 F F +SOM_ACT_N_vr levdcmp SOM_ACT N (vertically resolved) gN/m^3 T F +SOM_ADV_COEF levdcmp advection term for vertical SOM translocation m/s F F +SOM_DIFFUS_COEF levdcmp diffusion coefficient for vertical SOM translocation m^2/s F F +SOM_PAS_C_TNDNCY_VERT_TR levdcmp passive soil organic C tendency due to vertical transport gC/m^3/s F F +SOM_PAS_C_TO_SOM_ACT_C_v levdcmp decomp. of passive soil organic C to active soil organic C gC/m^3/s F F +SOM_PAS_HR_vr levdcmp Het. Resp. from passive soil organic gC/m^3/s F F +SOM_PAS_N_TNDNCY_VERT_TR levdcmp passive soil organic N tendency due to vertical transport gN/m^3/s F F +SOM_PAS_N_TO_SOM_ACT_N_v levdcmp decomp. of passive soil organic N to active soil organic N gN/m^3 F F +SOM_PAS_N_vr levdcmp SOM_PAS N (vertically resolved) gN/m^3 T F +SOM_SLO_C_TNDNCY_VERT_TR levdcmp slow soil organic ma C tendency due to vertical transport gC/m^3/s F F +SOM_SLO_C_TO_SOM_ACT_C_v levdcmp decomp. of slow soil organic ma C to active soil organic C gC/m^3/s F F +SOM_SLO_C_TO_SOM_PAS_C_v levdcmp decomp. of slow soil organic ma C to passive soil organic C gC/m^3/s F F +SOM_SLO_HR_S1_vr levdcmp Het. Resp. from slow soil organic ma gC/m^3/s F F +SOM_SLO_HR_S3_vr levdcmp Het. Resp. from slow soil organic ma gC/m^3/s F F +SOM_SLO_N_TNDNCY_VERT_TR levdcmp slow soil organic ma N tendency due to vertical transport gN/m^3/s F F +SOM_SLO_N_TO_SOM_ACT_N_v levdcmp decomp. of slow soil organic ma N to active soil organic N gN/m^3 F F +SOM_SLO_N_TO_SOM_PAS_N_v levdcmp decomp. of slow soil organic ma N to passive soil organic N gN/m^3 F F +SOM_SLO_N_vr levdcmp SOM_SLO N (vertically resolved) gN/m^3 T F +STEM_PROF levdcmp profile for litter C and N inputs from stems 1/m F F +SUPPLEMENT_TO_SMINN_vr levdcmp supplemental N supply gN/m^3/s F F +WFPS levdcmp WFPS percent F F +anaerobic_frac levdcmp anaerobic_frac m3/m3 F F +diffus levdcmp diffusivity m^2/s F F +fr_WFPS levdcmp fr_WFPS fraction F F +n2_n2o_ratio_denit levdcmp n2_n2o_ratio_denit gN/gN F F +r_psi levdcmp r_psi m F F +ratio_k1 levdcmp ratio_k1 none F F +ratio_no3_co2 levdcmp ratio_no3_co2 ratio F F +soil_bulkdensity levdcmp soil_bulkdensity kg/m3 F F +soil_co2_prod levdcmp soil_co2_prod ug C / g soil / day F F +CH4STRESS_SAT levgrnd Ratio of methane available to total potential sink for non-inundated area unitless T F +CH4STRESS_UNSAT levgrnd Ratio of methane available to total potential sink for inundated / lake area unitless T F +CH4_AERE_DEPTH_SAT levgrnd CH4 soil aerenchyma loss for inundated / lake area (including transpiration flux if activated mol/m3/s T F +CH4_AERE_DEPTH_UNSAT levgrnd CH4 soil aerenchyma loss for non-inundated area (including transpiration flux if activated) mol/m3/s T F +CH4_EBUL_DEPTH_SAT levgrnd CH4 soil ebullition for inundated / lake area mol/m3/s T F +CH4_EBUL_DEPTH_UNSAT levgrnd CH4 soil ebullition for non-inundated area mol/m3/s T F +CH4_OXID_DEPTH_SAT levgrnd CH4 soil oxidation for inundated / lake area mol/m3/s T F +CH4_OXID_DEPTH_UNSAT levgrnd CH4 soil oxidation for non-inundated area mol/m3/s T F +CH4_PROD_DEPTH_SAT levgrnd CH4 soil production for inundated / lake area mol/m3/s T F +CH4_PROD_DEPTH_UNSAT levgrnd CH4 soil production for non-inundated area mol/m3/s T F +CH4_TRAN_DEPTH_SAT levgrnd CH4 soil loss from transpiration for inundated / lake area mol/m3/s T F +CH4_TRAN_DEPTH_UNSAT levgrnd CH4 soil loss from transpiration for non-inundated area mol/m3/s T F +CONC_CH4_SAT levgrnd CH4 soil Concentration for inundated / lake area mol/m3 F F +CONC_CH4_UNSAT levgrnd CH4 soil Concentration for non-inundated area mol/m3 F F +EFF_POROSITY levgrnd effective porosity = porosity - vol_ice proportion F F +FGR_SOIL_R levgrnd Rural downward heat flux at interface below each soil layer watt/m^2 F F +FRAC_ICEOLD levgrnd fraction of ice relative to the tot water proportion F F +HK levgrnd hydraulic conductivity (natural vegetated and crop landunits only) mm/s F F +LAYER_SAT_LAG levgrnd lagged saturation status of layer in unsat. zone unitless T F +O2STRESS_SAT levgrnd Ratio of oxygen available to demanded for non-inundated area unitless T F +O2STRESS_UNSAT levgrnd Ratio of oxygen available to demanded for inundated / lake area unitless T F +O2_AERE_DEPTH_SAT levgrnd O2 aerenchyma diffusion into soil for inundated / lake area mol/m3/s T F +O2_AERE_DEPTH_UNSAT levgrnd O2 aerenchyma diffusion into soil for non-inundated area mol/m3/s T F +O2_DECOMP_DEPTH_SAT levgrnd O2 consumption from HR and AR for inundated / lake area mol/m3/s T F +O2_DECOMP_DEPTH_UNSAT levgrnd O2 consumption from HR and AR for non-inundated area mol/m3/s T F +ROOTR levgrnd effective fraction of roots in each soil layer (SMS method) proportion F F +RRESIS levgrnd root resistance in each soil layer proportion F F +SMP levgrnd soil matric potential (natural vegetated and crop landunits only) mm T F +SOILPSI levgrnd soil water potential in each soil layer MPa F F +TSOI levgrnd soil temperature (natural vegetated and crop landunits only) K T F +TSOI_ICE levgrnd soil temperature (ice landunits only) K T F +bsw levgrnd clap and hornberger B unitless F F +watfc levgrnd water field capacity m^3/m^3 F F +watsat levgrnd water saturated m^3/m^3 F F +LAKEICEFRAC levlak lake layer ice mass fraction unitless F F +TLAKE levlak lake temperature K T F +SNO_ABS levsno Absorbed solar radiation in each snow layer W/m^2 F F +SNO_ABS_ICE levsno Absorbed solar radiation in each snow layer (ice landunits only) W/m^2 F F +SNO_BW levsno Partial density of water in the snow pack (ice + liquid) kg/m3 F F +SNO_BW_ICE levsno Partial density of water in the snow pack (ice + liquid, ice landunits only) kg/m3 F F +SNO_EXISTENCE levsno Fraction of averaging period for which each snow layer existed unitless F F +SNO_FRZ levsno snow freezing rate in each snow layer kg/m2/s F F +SNO_FRZ_ICE levsno snow freezing rate in each snow layer (ice landunits only) mm/s F F +SNO_GS levsno Mean snow grain size Microns F F +SNO_GS_ICE levsno Mean snow grain size (ice landunits only) Microns F F +SNO_ICE levsno Snow ice content kg/m2 F F +SNO_LIQH2O levsno Snow liquid water content kg/m2 F F +SNO_MELT levsno snow melt rate in each snow layer mm/s F F +SNO_MELT_ICE levsno snow melt rate in each snow layer (ice landunits only) mm/s F F +SNO_T levsno Snow temperatures K F F +SNO_TK levsno Thermal conductivity W/m-K F F +SNO_TK_ICE levsno Thermal conductivity (ice landunits only) W/m-K F F +SNO_T_ICE levsno Snow temperatures (ice landunits only) K F F +SNO_Z levsno Snow layer thicknesses m F F +SNO_Z_ICE levsno Snow layer thicknesses (ice landunits only) m F F +CONC_O2_SAT levsoi O2 soil Concentration for inundated / lake area mol/m3 T F +CONC_O2_UNSAT levsoi O2 soil Concentration for non-inundated area mol/m3 T F +CWD_C_vr levsoi CWD C (vertically resolved) gC/m^3 T F +H2OSOI levsoi volumetric soil water (natural vegetated and crop landunits only) mm3/mm3 T F +HR_vr levsoi total vertically resolved heterotrophic respiration gC/m^3/s T F +KROOT levsoi root conductance each soil layer 1/s F F +KSOIL levsoi soil conductance in each soil layer 1/s F F +LIT_CEL_C_vr levsoi LIT_CEL C (vertically resolved) gC/m^3 T F +LIT_LIG_C_vr levsoi LIT_LIG C (vertically resolved) gC/m^3 T F +LIT_MET_C_vr levsoi LIT_MET C (vertically resolved) gC/m^3 T F +O_SCALAR levsoi fraction by which decomposition is reduced due to anoxia unitless T F +QIN levsoi flux of water into soil layer mm H2O/s F F +QOUT levsoi flux of water out of soil layer mm H2O/s F F +QROOTSINK levsoi water flux from soil to root in each soil-layer mm/s F F +SMINN_vr levsoi soil mineral N gN/m^3 T F +SMIN_NH4_vr levsoi soil mineral NH4 (vert. res.) gN/m^3 T F +SMIN_NO3_vr levsoi soil mineral NO3 (vert. res.) gN/m^3 T F +SOILC_vr levsoi SOIL C (vertically resolved) gC/m^3 T F +SOILICE levsoi soil ice (natural vegetated and crop landunits only) kg/m2 T F +SOILLIQ levsoi soil liquid water (natural vegetated and crop landunits only) kg/m2 T F +SOM_ACT_C_vr levsoi SOM_ACT C (vertically resolved) gC/m^3 T F +SOM_PAS_C_vr levsoi SOM_PAS C (vertically resolved) gC/m^3 T F +SOM_SLO_C_vr levsoi SOM_SLO C (vertically resolved) gC/m^3 T F +T_SCALAR levsoi temperature inhibition of decomposition unitless T F +W_SCALAR levsoi Moisture (dryness) inhibition of decomposition unitless T F +FROOTC_AT_ANTHESIS_PERHARV mxharvests Fine root C at anthesis for each harvest this year; should only be output annually gC/m^2 F F +FROOTC_AT_EMERGENCE_PERHARV mxharvests Fine root C at emergence for each harvest this year; should only be output annually gC/m^2 F F +FROOTC_AT_HARVEST_PERHARV mxharvests Fine root C at harvest for each harvest this year; should only be output annually gC/m^2 F F +FROOTC_AT_MATURITY_PERHARV mxharvests Fine root C at maturity for each harvest this year; should only be output annually gC/m^2 F F +GDDACCUM_PERHARV mxharvests At-harvest accumulated growing degree days past planting date for crop; should only be output ddays F F +GDDHARV_PERHARV mxharvests Growing degree days (gdd) needed to harvest; should only be output annually ddays F F +GRAINC_TO_FOOD_PERHARV mxharvests grain C to food per harvest; should only be output annually gC/m^2 F F +GRAINC_TO_SEED_PERHARV mxharvests grain C to seed per harvest; should only be output annually gC/m^2 F F +GRAINN_TO_FOOD_PERHARV mxharvests grain N to food per harvest; should only be output annually (not scientifically supported) gN/m^2 F F +GRAINN_TO_SEED_PERHARV mxharvests grain N to seed per harvest; should only be output annually (not scientifically supported) gN/m^2 F F +HARVEST_REASON_PERHARV mxharvests Reason for each crop harvest; should only be output annually 1 = mature; 2 = max season length; 3 = incorrect Dec. 31 sowing; F F +HDATES mxharvests actual crop harvest dates; should only be output annually day of year F F +HUI_PERHARV mxharvests At-harvest accumulated heat unit index for crop; should only be output annually ddays F F +LEAFC_AT_ANTHESIS_PERHARV mxharvests Leaf C at anthesis for each harvest this year; should only be output annually gC/m^2 F F +LEAFC_AT_EMERGENCE_PERHARV mxharvests Leaf C at emergence for each harvest this year; should only be output annually gC/m^2 F F +LEAFC_AT_HARVEST_PERHARV mxharvests Leaf C at harvest for each harvest this year; should only be output annually gC/m^2 F F +LEAFC_AT_MATURITY_PERHARV mxharvests Leaf C at maturity for each harvest this year; should only be output annually gC/m^2 F F +LIVECROOTC_AT_ANTHESIS_PERHARV mxharvests Live coarse root C at anthesis for each harvest this year; should only be output annually gC/m^2 F F +LIVECROOTC_AT_EMERGENCE_PERHARV mxharvests Live coarse root C at emergence for each harvest this year; should only be output annually gC/m^2 F F +LIVECROOTC_AT_HARVEST_PERHARV mxharvests Live coarse root C at harvest for each harvest this year; should only be output annually gC/m^2 F F +LIVECROOTC_AT_MATURITY_PERHARV mxharvests Live coarse root C at maturity for each harvest this year; should only be output annually gC/m^2 F F +LIVESTEMC_AT_ANTHESIS_PERHARV mxharvests Live stem C at anthesis for each harvest this year; should only be output annually gC/m^2 F F +LIVESTEMC_AT_EMERGENCE_PERHARV mxharvests Live stem C at emergence for each harvest this year; should only be output annually gC/m^2 F F +LIVESTEMC_AT_HARVEST_PERHARV mxharvests Live stem C at harvest for each harvest this year; should only be output annually gC/m^2 F F +LIVESTEMC_AT_MATURITY_PERHARV mxharvests Live stem C at maturity for each harvest this year; should only be output annually gC/m^2 F F +MAX_TLAI_PERHARV mxharvests Maximum total projected leaf area index in season of each harvest this year; should only be ou m^2/m^2 F F +REPRC_AT_ANTHESIS_PERHARV mxharvests Reproductive C at anthesis for each harvest this year; should only be output annually gC/m^2 F F +REPRC_AT_EMERGENCE_PERHARV mxharvests Reproductive C at emergence for each harvest this year; should only be output annually gC/m^2 F F +REPRC_AT_HARVEST_PERHARV mxharvests Reproductive C at harvest for each harvest this year; should only be output annually gC/m^2 F F +REPRC_AT_MATURITY_PERHARV mxharvests Reproductive C at maturity for each harvest this year; should only be output annually gC/m^2 F F +SDATES_PERHARV mxharvests actual sowing dates for crops harvested this year; should only be output annually day of year F F +SOWING_REASON_PERHARV mxharvests Reason for sowing of each crop harvested this year; should only be output annually unitless F F +SYEARS_PERHARV mxharvests actual sowing years for crops harvested this year; should only be output annually year F F +SDATES mxsowings actual crop sowing dates; should only be output annually day of year F F +SOWING_REASON mxsowings Reason for each crop sowing; should only be output annually unitless F F +SWINDOW_ENDS mxsowings crop sowing window end dates; should only be output annually day of year F F +SWINDOW_STARTS mxsowings crop sowing window start dates; should only be output annually day of year F F +ALBD numrad surface albedo (direct) proportion T F +ALBDSF numrad diagnostic snow-free surface albedo (direct) proportion T F +ALBGRD numrad ground albedo (direct) proportion T F +ALBGRI numrad ground albedo (indirect) proportion T F +ALBI numrad surface albedo (indirect) proportion T F +ALBISF numrad diagnostic snow-free surface albedo (indirect) proportion T F +VEGWP nvegwcs vegetation water matric potential for sun/sha canopy,xyl,root segments mm T F +VEGWPLN nvegwcs vegetation water matric potential for sun/sha canopy,xyl,root at local noon mm F F +VEGWPPD nvegwcs predawn vegetation water matric potential for sun/sha canopy,xyl,root mm F F +=================================== ================ ============================================================================================== ================================================================= ========== ============ From 5127756aee58278eaba6204140232e91c32a5325 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 29 Oct 2025 11:21:33 -0600 Subject: [PATCH 37/57] Add testing of generate_gdds.py args. --- python/ctsm/crop_calendars/generate_gdds.py | 24 ++++-- python/ctsm/test/test_unit_generate_gdds.py | 81 +++++++++++++++++++++ 2 files changed, 98 insertions(+), 7 deletions(-) create mode 100755 python/ctsm/test/test_unit_generate_gdds.py diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index 0408792beb..08bc90c7db 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -390,11 +390,13 @@ def add_attrs_to_map_ds( ) -if __name__ == "__main__": - ############################### - ### Process input arguments ### - ############################### - parser = argparse.ArgumentParser(description="ADD DESCRIPTION HERE") +def _parse_args(argv): + parser = argparse.ArgumentParser( + description=( + "A script to generate maturity requirements for CLM crops in units of growing degree-" + "days (GDDs)." + ) + ) # Required parser.add_argument( @@ -487,9 +489,17 @@ def add_attrs_to_map_ds( ) # Get arguments - args = parser.parse_args(sys.argv[1:]) - for k, v in sorted(vars(args).items()): + args_parsed = parser.parse_args(argv) + for k, v in sorted(vars(args_parsed).items()): print(f"{k}: {v}") + return args_parsed + + +if __name__ == "__main__": + ############################### + ### Process input arguments ### + ############################### + args = _parse_args(sys.argv[1:]) # Call main() main( diff --git a/python/ctsm/test/test_unit_generate_gdds.py b/python/ctsm/test/test_unit_generate_gdds.py new file mode 100755 index 0000000000..397feb2e00 --- /dev/null +++ b/python/ctsm/test/test_unit_generate_gdds.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 + +""" +Unit tests for generate_gdds.py +""" + +import unittest +import os + +from ctsm import unit_testing +from ctsm.crop_calendars import generate_gdds as gg + +# Allow test names that pylint doesn't like; otherwise hard to make them +# readable +# pylint: disable=invalid-name + +# pylint: disable=protected-access + +## Too many instant variables as part of the class (too many self. in the SetUp) +# pylint: disable=too-many-instance-attributes + + +class TestGenerateGddsArgs(unittest.TestCase): + """Tests the generate_gdds.py argument parsing""" + + def setUp(self): + self._input_dir = os.path.join("dummy", "path", "to", "inputdir") + self._sdates_file = os.path.join("dummy", "path", "to", "sdates") + self._hdates_file = os.path.join("dummy", "path", "to", "hdates") + + def test_generate_gdds_args_reqd_shortnames(self): + """Basic test with all required inputs, short arg names""" + args = [ + "-i", + self._input_dir, + "-1", + "1986", + "-n", + "1987", + "-sd", + self._sdates_file, + "-hd", + self._hdates_file, + ] + gg._parse_args(args) + + # Again, with capital -N option + args = [ + "-i", + self._input_dir, + "-1", + "1986", + "-N", + "1987", + "-sd", + self._sdates_file, + "-hd", + self._hdates_file, + ] + gg._parse_args(args) + + def test_generate_gdds_args_reqd_longnames(self): + """Basic test with all required inputs, long arg names""" + args = [ + "--input-dir", + self._input_dir, + "--first-season", + "1986", + "--last-season", + "1987", + "--sdates-file", + self._sdates_file, + "--hdates-file", + self._hdates_file, + ] + gg._parse_args(args) + + +if __name__ == "__main__": + unit_testing.setup_for_tests() + unittest.main() From b71409124e6dd6a55e7185e795237e8358474aeb Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 29 Oct 2025 11:44:34 -0600 Subject: [PATCH 38/57] generate_gdds: Rename --unlimited-season-length to --max-season-length-from-hdates-file. --- python/ctsm/crop_calendars/generate_gdds.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index 08bc90c7db..8e14b1e03f 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -47,7 +47,7 @@ def main( land_use_file=None, first_land_use_year=None, last_land_use_year=None, - unlimited_season_length=False, + max_season_length_from_hdates_file=False, skip_crops=None, logger=None, no_pickle=None, @@ -58,7 +58,7 @@ def main( output_dir = input_dir else: output_dir = os.path.join(input_dir, "generate_gdds") - if not unlimited_season_length: + if not max_season_length_from_hdates_file: output_dir += ".mxmat" output_dir += "." + dt.datetime.now().strftime("%Y-%m-%d-%H%M%S") if not os.path.exists(output_dir): @@ -146,7 +146,7 @@ def main( sdates_rx = sdates_file hdates_rx = hdates_file - if not unlimited_season_length: + if not max_season_length_from_hdates_file: mxmats = cc.import_max_gs_length(PARAMFILE_DIR, MY_CLM_VER, MY_CLM_SUBVER) else: mxmats = None @@ -470,7 +470,7 @@ def _parse_args(argv): type=int, ) parser.add_argument( - "--unlimited-season-length", + "--max-season-length-from-hdates-file", help="Limit mean growing season length based on CLM CFT parameter mxmat.", action="store_true", default=False, @@ -516,7 +516,7 @@ def _parse_args(argv): land_use_file=args.land_use_file, first_land_use_year=args.first_land_use_year, last_land_use_year=args.last_land_use_year, - unlimited_season_length=args.unlimited_season_length, + max_season_length_from_hdates_file=args.max_season_length_from_hdates_file, skip_crops=args.skip_crops, no_pickle=args.no_pickle, ) From 3c2a8e4a2a8825e4b5f5180b7fd4b2272f07052d Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 29 Oct 2025 12:04:15 -0600 Subject: [PATCH 39/57] import_max_gs_length(): Just take paramfile as arg directly. --- python/ctsm/crop_calendars/cropcal_module.py | 10 +---- python/ctsm/crop_calendars/generate_gdds.py | 8 ++-- python/ctsm/test/test_sys_cropcal_module.py | 45 +++++++++++++++++++ .../test/testinputs/ctsm51_params.c211112.nc | 3 ++ .../ctsm60_params_cal115_c250813.nc | 3 ++ 5 files changed, 57 insertions(+), 12 deletions(-) create mode 100755 python/ctsm/test/test_sys_cropcal_module.py create mode 100644 python/ctsm/test/testinputs/ctsm51_params.c211112.nc create mode 100644 python/ctsm/test/testinputs/ctsm60_params_cal115_c250813.nc diff --git a/python/ctsm/crop_calendars/cropcal_module.py b/python/ctsm/crop_calendars/cropcal_module.py index 393e3a9cd5..d19ffd650f 100644 --- a/python/ctsm/crop_calendars/cropcal_module.py +++ b/python/ctsm/crop_calendars/cropcal_module.py @@ -2,8 +2,6 @@ Helper functions for various crop calendar stuff """ -import os -import glob import numpy as np import xarray as xr @@ -203,16 +201,12 @@ def get_gs_len_da(this_da): return this_da -def import_max_gs_length(paramfile_dir, my_clm_ver, my_clm_subver): +def import_max_gs_length(paramfile): """ Import maximum growing season length """ # Get parameter file - pattern = os.path.join(paramfile_dir, f"*{my_clm_ver}_params.{my_clm_subver}.nc") - paramfile = glob.glob(pattern) - if len(paramfile) != 1: - raise RuntimeError(f"Expected to find 1 match of {pattern}; found {len(paramfile)}") - paramfile_ds = xr.open_dataset(paramfile[0]) + paramfile_ds = xr.open_dataset(paramfile) # Import max growing season length (stored in netCDF as nanoseconds!) paramfile_mxmats = paramfile_ds["mxmat"].values / np.timedelta64(1, "D") diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index 8e14b1e03f..2121dd183e 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -27,9 +27,9 @@ # pylint: disable=too-many-positional-arguments # Global constants -PARAMFILE_DIR = "/glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/paramdata" -MY_CLM_VER = 51 -MY_CLM_SUBVER = "c211112" +PARAMFILE = ( + "/glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/paramdata/ctsm51_params.c211112.nc" +) def main( @@ -147,7 +147,7 @@ def main( hdates_rx = hdates_file if not max_season_length_from_hdates_file: - mxmats = cc.import_max_gs_length(PARAMFILE_DIR, MY_CLM_VER, MY_CLM_SUBVER) + mxmats = cc.import_max_gs_length(PARAMFILE) else: mxmats = None diff --git a/python/ctsm/test/test_sys_cropcal_module.py b/python/ctsm/test/test_sys_cropcal_module.py new file mode 100755 index 0000000000..5614fbc211 --- /dev/null +++ b/python/ctsm/test/test_sys_cropcal_module.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 + +""" +System tests for cropcal_module.py +""" + +import unittest +import os + +from ctsm import unit_testing +from ctsm.crop_calendars.cropcal_module import import_max_gs_length + +# Allow test names that pylint doesn't like; otherwise hard to make them +# readable +# pylint: disable=invalid-name + +# pylint: disable=protected-access + +## Too many instant variables as part of the class (too many self. in the SetUp) +# pylint: disable=too-many-instance-attributes + + +class TestImportMaxGsLength(unittest.TestCase): + """Tests of import_max_gs_length()""" + + def setUp(self): + self._paramfile_51 = os.path.join( + os.path.dirname(__file__), "testinputs", "ctsm51_params.c211112.nc" + ) + self._paramfile_60 = os.path.join( + os.path.dirname(__file__), "testinputs", "ctsm60_params_cal115_c250813.nc" + ) + + def test_import_max_gs_length_ctsm51(self): + """Basic test with ctsm51 paramfile""" + import_max_gs_length(self._paramfile_51) + + def test_import_max_gs_length_ctsm60(self): + """Basic test with ctsm60 paramfile""" + import_max_gs_length(self._paramfile_60) + + +if __name__ == "__main__": + unit_testing.setup_for_tests() + unittest.main() diff --git a/python/ctsm/test/testinputs/ctsm51_params.c211112.nc b/python/ctsm/test/testinputs/ctsm51_params.c211112.nc new file mode 100644 index 0000000000..ce6c2676e2 --- /dev/null +++ b/python/ctsm/test/testinputs/ctsm51_params.c211112.nc @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1cf2f3455e4cee4ea34459ef28e57f546bea595f865300b578d889afdb208cf +size 228464 diff --git a/python/ctsm/test/testinputs/ctsm60_params_cal115_c250813.nc b/python/ctsm/test/testinputs/ctsm60_params_cal115_c250813.nc new file mode 100644 index 0000000000..6fceb6913d --- /dev/null +++ b/python/ctsm/test/testinputs/ctsm60_params_cal115_c250813.nc @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ca369ca10d893f49c4d5223b0cd705dfab699f8e1f6e29d55d878e6dcb8c22d +size 224108 From 87e7a6951e8edf675d437197d2eee67496746890 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 29 Oct 2025 12:07:35 -0600 Subject: [PATCH 40/57] generate_gdds: New --paramfile argument required unless user gives --max-season-length-from-hdates-file. --- python/ctsm/crop_calendars/generate_gdds.py | 36 ++++++++++++++------- python/ctsm/test/test_unit_generate_gdds.py | 24 ++++++++++++++ 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index 2121dd183e..c57464407f 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -26,11 +26,6 @@ # fixed. For now, we'll just disable the warning. # pylint: disable=too-many-positional-arguments -# Global constants -PARAMFILE = ( - "/glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/paramdata/ctsm51_params.c211112.nc" -) - def main( *, @@ -51,6 +46,7 @@ def main( skip_crops=None, logger=None, no_pickle=None, + paramfile=None, ): # pylint: disable=missing-function-docstring,too-many-statements # Directories to save output files and figures if not output_dir: @@ -147,7 +143,7 @@ def main( hdates_rx = hdates_file if not max_season_length_from_hdates_file: - mxmats = cc.import_max_gs_length(PARAMFILE) + mxmats = cc.import_max_gs_length(paramfile) else: mxmats = None @@ -398,6 +394,27 @@ def _parse_args(argv): ) ) + # Required but mutually exclusive + max_growing_season_length_group = parser.add_mutually_exclusive_group(required=True) + max_growing_season_length_group.add_argument( + "--paramfile", + help=( + "Path to parameter file with maximum growing season lengths (mxmat)." + " Mutually exclusive with --max-season-length-from-hdates-file." + ), + ) + max_growing_season_length_group.add_argument( + "--max-season-length-from-hdates-file", + help=( + "Rather than limiting growing season length based on mxmat values from a CLM parameter" + " file, use the season lengths from --hdates-file. Not recommended unless you use the" + "results of this script in a run with sufficiently long mxmat values!" + " Mutually exclusive with --paramfile." + ), + action="store_true", + default=False, + ) + # Required parser.add_argument( "-i", @@ -469,12 +486,6 @@ def _parse_args(argv): default=None, type=int, ) - parser.add_argument( - "--max-season-length-from-hdates-file", - help="Limit mean growing season length based on CLM CFT parameter mxmat.", - action="store_true", - default=False, - ) parser.add_argument( "--skip-crops", help="Skip processing of these crops. Comma- or space-separated list.", @@ -519,4 +530,5 @@ def _parse_args(argv): max_season_length_from_hdates_file=args.max_season_length_from_hdates_file, skip_crops=args.skip_crops, no_pickle=args.no_pickle, + paramfile=args.paramfile, ) diff --git a/python/ctsm/test/test_unit_generate_gdds.py b/python/ctsm/test/test_unit_generate_gdds.py index 397feb2e00..3ed3c4c759 100755 --- a/python/ctsm/test/test_unit_generate_gdds.py +++ b/python/ctsm/test/test_unit_generate_gdds.py @@ -27,6 +27,7 @@ def setUp(self): self._input_dir = os.path.join("dummy", "path", "to", "inputdir") self._sdates_file = os.path.join("dummy", "path", "to", "sdates") self._hdates_file = os.path.join("dummy", "path", "to", "hdates") + self._paramfile = os.path.join("dummy", "path", "to", "paramfile") def test_generate_gdds_args_reqd_shortnames(self): """Basic test with all required inputs, short arg names""" @@ -41,6 +42,8 @@ def test_generate_gdds_args_reqd_shortnames(self): self._sdates_file, "-hd", self._hdates_file, + "--paramfile", + self._paramfile, ] gg._parse_args(args) @@ -56,6 +59,8 @@ def test_generate_gdds_args_reqd_shortnames(self): self._sdates_file, "-hd", self._hdates_file, + "--paramfile", + self._paramfile, ] gg._parse_args(args) @@ -72,6 +77,25 @@ def test_generate_gdds_args_reqd_longnames(self): self._sdates_file, "--hdates-file", self._hdates_file, + "--paramfile", + self._paramfile, + ] + gg._parse_args(args) + + def test_generate_gdds_args_mxmat_from_hdatefile(self): + """Test with option to get max season length from hdates file""" + args = [ + "--input-dir", + self._input_dir, + "--first-season", + "1986", + "--last-season", + "1987", + "--sdates-file", + self._sdates_file, + "--hdates-file", + self._hdates_file, + "--max-season-length-from-hdates-file", ] gg._parse_args(args) From c3052bf257fdeb97640cf4b173e31938e1720d3a Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 30 Oct 2025 11:31:05 -0600 Subject: [PATCH 41/57] generate_gdds: Extract and test _get_max_growing_season_lengths(). --- python/ctsm/crop_calendars/generate_gdds.py | 16 ++++++-- python/ctsm/test/test_unit_generate_gdds.py | 45 +++++++++++++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index c57464407f..a55e48e982 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -27,6 +27,17 @@ # pylint: disable=too-many-positional-arguments +def _get_max_growing_season_lengths(max_season_length_from_hdates_file, paramfile): + """ + Import maximum growing season lengths from paramfile, if doing so. + """ + if not max_season_length_from_hdates_file: + mxmats = cc.import_max_gs_length(paramfile) + else: + mxmats = None + return mxmats + + def main( *, input_dir=None, @@ -142,10 +153,7 @@ def main( sdates_rx = sdates_file hdates_rx = hdates_file - if not max_season_length_from_hdates_file: - mxmats = cc.import_max_gs_length(paramfile) - else: - mxmats = None + mxmats = _get_max_growing_season_lengths(max_season_length_from_hdates_file, paramfile) h1_instantaneous = None for yr_index, this_yr in enumerate(np.arange(first_season + 1, last_season + 3)): diff --git a/python/ctsm/test/test_unit_generate_gdds.py b/python/ctsm/test/test_unit_generate_gdds.py index 3ed3c4c759..73e13639f9 100755 --- a/python/ctsm/test/test_unit_generate_gdds.py +++ b/python/ctsm/test/test_unit_generate_gdds.py @@ -7,6 +7,8 @@ import unittest import os +import numpy as np + from ctsm import unit_testing from ctsm.crop_calendars import generate_gdds as gg @@ -100,6 +102,49 @@ def test_generate_gdds_args_mxmat_from_hdatefile(self): gg._parse_args(args) +class TestGetMaxGsLengths(unittest.TestCase): + """Tests get_max_growing_season_lengths()""" + + def setUp(self): + self._paramfile_51 = os.path.join( + os.path.dirname(__file__), "testinputs", "ctsm51_params.c211112.nc" + ) + self._paramfile_60 = os.path.join( + os.path.dirname(__file__), "testinputs", "ctsm60_params_cal115_c250813.nc" + ) + + # Default arguments + self.no_mxmats = False + self.paramfile = self._paramfile_60 + + def test_generate_gdds_get_mxmats_ctsm51(self): + """Test importing from a ctsm51 paramfile (no fail)""" + paramfile = self._paramfile_51 + gg._get_max_growing_season_lengths(self.no_mxmats, paramfile) + + def test_generate_gdds_get_mxmats_ctsm60(self): + """Test importing from a ctsm60 paramfile (no fail)""" + paramfile = self._paramfile_60 + gg._get_max_growing_season_lengths(self.no_mxmats, paramfile) + + def test_generate_gdds_get_mxmats_none(self): + """Test not importing from a paramfile (should return None)""" + max_season_length_from_hdates_file = True + paramfile = None + result = gg._get_max_growing_season_lengths(max_season_length_from_hdates_file, paramfile) + self.assertIsNone(result) + + def test_generate_gdds_get_mxmats_values(self): + """Check values""" + mxmats = gg._get_max_growing_season_lengths(self.no_mxmats, self.paramfile) + + # Check values + self.assertTrue(np.isinf(mxmats["needleleaf_evergreen_temperate_tree"])) + self.assertEqual(mxmats["temperate_corn"], 165) + self.assertEqual(mxmats["miscanthus"], 210) + + + if __name__ == "__main__": unit_testing.setup_for_tests() unittest.main() From b644a08b5395bb3a94cbebcf936c21de75735e4b Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 29 Oct 2025 17:11:19 -0600 Subject: [PATCH 42/57] generate_gdds: Add --max-season-length-cushion arg. --- python/ctsm/crop_calendars/cropcal_module.py | 52 ++++++++ python/ctsm/crop_calendars/generate_gdds.py | 40 +++++- python/ctsm/test/test_unit_cropcal_module.py | 125 +++++++++++++++++++ python/ctsm/test/test_unit_generate_gdds.py | 95 +++++++++++++- 4 files changed, 300 insertions(+), 12 deletions(-) create mode 100755 python/ctsm/test/test_unit_cropcal_module.py diff --git a/python/ctsm/crop_calendars/cropcal_module.py b/python/ctsm/crop_calendars/cropcal_module.py index d19ffd650f..976d022e85 100644 --- a/python/ctsm/crop_calendars/cropcal_module.py +++ b/python/ctsm/crop_calendars/cropcal_module.py @@ -2,6 +2,8 @@ Helper functions for various crop calendar stuff """ +import warnings + import numpy as np import xarray as xr @@ -228,6 +230,56 @@ def import_max_gs_length(paramfile): return mxmat_dict +def cushion_gs_length(mxmat_dict_in, cushion, *, min_mxmat=1, max_mxmat=365): + """ + Given a dictionary of maximum growing season lengths, apply a "cushion". This is useful for + generating crop maturity requirements: If observed growing season is longer than maximum, + and you're limiting growing seasons based on the maximum, then you'd expect about 50% of + growing seasons to fail to reach maturity (assuming a normal distribution of seasonal + growing degree-days). + """ + + mxmat_dict_out = mxmat_dict_in.copy() + + for pftname, mxmat in mxmat_dict_in.items(): + # Skip PFTs without max growing season length + if np.isinf(mxmat): + continue + + assert mxmat >= min_mxmat, f"{pftname} input mxmat ({mxmat}) is < min_mxmat ({min_mxmat})" + assert mxmat <= max_mxmat, f"{pftname} input mxmat ({mxmat}) is > max_mxmat ({max_mxmat})" + + new_mxmat = mxmat - cushion + + # Apply limits + msg = None + if new_mxmat < min_mxmat: + msg = ( + f"Applying cushion of {cushion} to {pftname}'s mxmat ({mxmat}) resulted in new" + f" mxmat of {new_mxmat}; increasing that to min_mxmat {min_mxmat}" + ) + new_mxmat = min_mxmat + elif new_mxmat > max_mxmat: + msg = ( + f"Applying cushion of {cushion} to {pftname}'s mxmat ({mxmat}) resulted in new" + f" mxmat of {new_mxmat}; decreasing that to max_mxmat {max_mxmat}" + ) + new_mxmat = max_mxmat + if msg: + warnings.warn(msg, RuntimeWarning) + + assert ( + new_mxmat >= min_mxmat + ), f"{pftname} new_mxmat ({new_mxmat}) < min_mxmat ({min_mxmat})" + assert ( + new_mxmat <= max_mxmat + ), f"{pftname} new_mxmat ({new_mxmat}) > max_mxmat ({max_mxmat})" + + mxmat_dict_out[pftname] = new_mxmat + + return mxmat_dict_out + + def unexpected_negative_rx_gdd(data_array): """ Return True if there's a negative value not matching the designated missing value diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index a55e48e982..7af82f9fa1 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -27,14 +27,18 @@ # pylint: disable=too-many-positional-arguments -def _get_max_growing_season_lengths(max_season_length_from_hdates_file, paramfile): +def _get_max_growing_season_lengths(max_season_length_from_hdates_file, paramfile, cushion): """ Import maximum growing season lengths from paramfile, if doing so. """ - if not max_season_length_from_hdates_file: - mxmats = cc.import_max_gs_length(paramfile) - else: - mxmats = None + if max_season_length_from_hdates_file: + return None + + mxmats = cc.import_max_gs_length(paramfile) + + if cushion: + mxmats = cc.cushion_gs_length(mxmats, cushion) + return mxmats @@ -58,6 +62,7 @@ def main( logger=None, no_pickle=None, paramfile=None, + max_season_length_cushion=None, ): # pylint: disable=missing-function-docstring,too-many-statements # Directories to save output files and figures if not output_dir: @@ -153,7 +158,9 @@ def main( sdates_rx = sdates_file hdates_rx = hdates_file - mxmats = _get_max_growing_season_lengths(max_season_length_from_hdates_file, paramfile) + mxmats = _get_max_growing_season_lengths( + max_season_length_from_hdates_file, paramfile, max_season_length_cushion + ) h1_instantaneous = None for yr_index, this_yr in enumerate(np.arange(first_season + 1, last_season + 3)): @@ -506,11 +513,31 @@ def _parse_args(argv): action="store_true", default=False, ) + parser.add_argument( + "--max-season-length-cushion", + help=( + "How much to reduce the maximum growing season length (mxmat) for each crop in the" + " parameter file. This might be useful for helping avoid high rates of immature" + " harvests for gridcells where the observed harvest date is longer than mxmat." + " Incompatible with --max-season-length-from-hdates-file." + ), + default=0, + type=int, + ) # Get arguments args_parsed = parser.parse_args(argv) for k, v in sorted(vars(args_parsed).items()): print(f"{k}: {v}") + + # Check arguments + if args_parsed.max_season_length_from_hdates_file and args_parsed.max_season_length_cushion: + raise argparse.ArgumentError( + None, + "--max-season-length-from-hdates-file is incompatible with --max-season-length-cushion" + " ≠ 0.", + ) + return args_parsed @@ -539,4 +566,5 @@ def _parse_args(argv): skip_crops=args.skip_crops, no_pickle=args.no_pickle, paramfile=args.paramfile, + max_season_length_cushion=args.max_season_length_cushion, ) diff --git a/python/ctsm/test/test_unit_cropcal_module.py b/python/ctsm/test/test_unit_cropcal_module.py new file mode 100755 index 0000000000..cff339fdcb --- /dev/null +++ b/python/ctsm/test/test_unit_cropcal_module.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 + +"""Unit tests for cropcal_module.py""" + +import unittest + +import numpy as np + +from ctsm import unit_testing +from ctsm.crop_calendars import cropcal_module as ccu + +# Allow names that pylint doesn't like, because otherwise it's hard +# to make readable unit test names +# pylint: disable=invalid-name + + +class TestCushionGsLength(unittest.TestCase): + """Tests of cushion_gs_length()""" + + def setUp(self): + self._mxmat_dict = { + "cropA": 55, + "cropB": 57, + "cropC": 87, + "cropD": 86, + } + + def test_cushion_gs_length_1(self): + """ + Test cushion_gs_length() for a cushion of 1. + """ + cushion = 1 + result = ccu.cushion_gs_length(self._mxmat_dict, cushion) + for crop, mxmat_orig in self._mxmat_dict.items(): + self.assertEqual(result[crop], mxmat_orig - cushion) + + def test_cushion_gs_length_neg1(self): + """ + Test cushion_gs_length() for a cushion of -1. + """ + cushion = -1 + result = ccu.cushion_gs_length(self._mxmat_dict, cushion) + for crop, mxmat_orig in self._mxmat_dict.items(): + self.assertEqual(result[crop], mxmat_orig - cushion) + + def test_cushion_gs_length_inf(self): + """ + As test_cushion_gs_length_1 but with an infinite value in original. + """ + self._mxmat_dict["cropB"] = np.inf + cushion = 1 + result = ccu.cushion_gs_length(self._mxmat_dict, cushion) + for crop, mxmat_orig in self._mxmat_dict.items(): + if np.isinf(mxmat_orig): + self.assertTrue(np.isinf(result[crop])) + else: + self.assertEqual(result[crop], mxmat_orig - cushion) + + def test_cushion_gs_length_limit_range_default_min1(self): + """ + Test that cushion_gs_length() limits output range to a minimum of 1 by default + """ + cushion = np.inf + + with self.assertWarnsRegex(RuntimeWarning, "increasing that to"): + result = ccu.cushion_gs_length(self._mxmat_dict, cushion) + + self.assertTrue(all(x == 1 for x in result.values())) + + def test_cushion_gs_length_limit_range_default_max365(self): + """ + Test that cushion_gs_length() limits output range to a maximum of 365 by default + """ + cushion = -np.inf + + with self.assertWarnsRegex(RuntimeWarning, "decreasing that to"): + result = ccu.cushion_gs_length(self._mxmat_dict, cushion) + + print(result) + self.assertTrue(all(x == 365 for x in result.values())) + + def test_cushion_gs_length_limit_range_custom_min(self): + """ + Test cushion_gs_length() with custom min + """ + cushion = np.inf + min_mxmat = -1 + + with self.assertWarnsRegex(RuntimeWarning, "increasing that to"): + result = ccu.cushion_gs_length(self._mxmat_dict, cushion, min_mxmat=min_mxmat) + + self.assertTrue(all(x == min_mxmat for x in result.values())) + + def test_cushion_gs_length_limit_range_custom_max(self): + """ + Test cushion_gs_length() with custom max + """ + cushion = -np.inf + max_mxmat = 400 + + with self.assertWarnsRegex(RuntimeWarning, "decreasing that to"): + result = ccu.cushion_gs_length(self._mxmat_dict, cushion, max_mxmat=max_mxmat) + + self.assertTrue(all(x == max_mxmat for x in result.values())) + + def test_cushion_gs_length_assert_orig_too_low(self): + """ + Test that cushion_gs_length() errors if original value is too low + """ + self._mxmat_dict["cropC"] = -999 + with self.assertRaisesRegex(AssertionError, "is < min_mxmat"): + ccu.cushion_gs_length(self._mxmat_dict, 1) + + def test_cushion_gs_length_assert_orig_too_high(self): + """ + Test that cushion_gs_length() errors if original value is too high + """ + self._mxmat_dict["cropC"] = 999 + with self.assertRaisesRegex(AssertionError, "is > max_mxmat"): + ccu.cushion_gs_length(self._mxmat_dict, 1) + + +if __name__ == "__main__": + unit_testing.setup_for_tests() + unittest.main() diff --git a/python/ctsm/test/test_unit_generate_gdds.py b/python/ctsm/test/test_unit_generate_gdds.py index 73e13639f9..4bfba8e555 100755 --- a/python/ctsm/test/test_unit_generate_gdds.py +++ b/python/ctsm/test/test_unit_generate_gdds.py @@ -6,6 +6,7 @@ import unittest import os +import argparse import numpy as np @@ -101,6 +102,66 @@ def test_generate_gdds_args_mxmat_from_hdatefile(self): ] gg._parse_args(args) + def test_generate_gdds_args_error_with_paramfile_and_nomxmat(self): + """Should error if both --paramfile and --max-season-length-from-hdates-file are given""" + args = [ + "--input-dir", + self._input_dir, + "--first-season", + "1986", + "--last-season", + "1987", + "--sdates-file", + self._sdates_file, + "--hdates-file", + self._hdates_file, + "--max-season-length-from-hdates-file", + "--paramfile", + self._paramfile, + ] + with self.assertRaises(SystemExit): + gg._parse_args(args) + + def test_generate_gdds_args_error_with_nomxmat_and_cushion(self): + """Should error if both --max-season-length-cushion and --max-season-length-from-hdates-file + are given""" + args = [ + "--input-dir", + self._input_dir, + "--first-season", + "1986", + "--last-season", + "1987", + "--sdates-file", + self._sdates_file, + "--hdates-file", + self._hdates_file, + "--max-season-length-from-hdates-file", + "--max-season-length-cushion", + "14", + ] + with self.assertRaises(argparse.ArgumentError): + gg._parse_args(args) + + def test_generate_gdds_args_ok_with_nomxmat_and_cushion0(self): + """As test_generate_gdds_args_error_with_nomxmat_and_cushion, but cushion 0 is ok""" + args = [ + "--input-dir", + self._input_dir, + "--first-season", + "1986", + "--last-season", + "1987", + "--sdates-file", + self._sdates_file, + "--hdates-file", + self._hdates_file, + "--max-season-length-from-hdates-file", + "--max-season-length-cushion", + "0", + ] + gg._parse_args(args) + class TestGetMaxGsLengths(unittest.TestCase): """Tests get_max_growing_season_lengths()""" @@ -116,33 +177,55 @@ def setUp(self): # Default arguments self.no_mxmats = False self.paramfile = self._paramfile_60 + self.cushion = 0 def test_generate_gdds_get_mxmats_ctsm51(self): """Test importing from a ctsm51 paramfile (no fail)""" paramfile = self._paramfile_51 - gg._get_max_growing_season_lengths(self.no_mxmats, paramfile) + gg._get_max_growing_season_lengths(self.no_mxmats, paramfile, self.cushion) def test_generate_gdds_get_mxmats_ctsm60(self): """Test importing from a ctsm60 paramfile (no fail)""" paramfile = self._paramfile_60 - gg._get_max_growing_season_lengths(self.no_mxmats, paramfile) + gg._get_max_growing_season_lengths(self.no_mxmats, paramfile, self.cushion) def test_generate_gdds_get_mxmats_none(self): """Test not importing from a paramfile (should return None)""" max_season_length_from_hdates_file = True paramfile = None - result = gg._get_max_growing_season_lengths(max_season_length_from_hdates_file, paramfile) + result = gg._get_max_growing_season_lengths( + max_season_length_from_hdates_file, paramfile, self.cushion + ) self.assertIsNone(result) def test_generate_gdds_get_mxmats_values(self): - """Check values""" - mxmats = gg._get_max_growing_season_lengths(self.no_mxmats, self.paramfile) + """Check values with no cushion""" + mxmats = gg._get_max_growing_season_lengths(self.no_mxmats, self.paramfile, self.cushion) # Check values self.assertTrue(np.isinf(mxmats["needleleaf_evergreen_temperate_tree"])) self.assertEqual(mxmats["temperate_corn"], 165) self.assertEqual(mxmats["miscanthus"], 210) - + + def test_generate_gdds_get_mxmats_cushion14(self): + """As test_generate_gdds_get_mxmats_values, but cushion 14""" + cushion = 14 + mxmats = gg._get_max_growing_season_lengths(self.no_mxmats, self.paramfile, cushion) + + # Check values + self.assertTrue(np.isinf(mxmats["needleleaf_evergreen_temperate_tree"])) + self.assertEqual(mxmats["temperate_corn"], 165 - cushion) + self.assertEqual(mxmats["miscanthus"], 210 - cushion) + + def test_generate_gdds_get_mxmats_cushionneg14(self): + """As test_generate_gdds_get_mxmats_values, but cushion -14""" + cushion = -14 + mxmats = gg._get_max_growing_season_lengths(self.no_mxmats, self.paramfile, cushion) + + # Check values + self.assertTrue(np.isinf(mxmats["needleleaf_evergreen_temperate_tree"])) + self.assertEqual(mxmats["temperate_corn"], 165 - cushion) + self.assertEqual(mxmats["miscanthus"], 210 - cushion) if __name__ == "__main__": From 7bc30ddf918b510b7e0c9aa812cb2178edc7b402 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 30 Oct 2025 12:59:21 -0600 Subject: [PATCH 43/57] generate_gdds: Fail if rx s/hdates don't match CLM grid. --- .../crop_calendars/generate_gdds_functions.py | 60 ++++++++++- python/ctsm/test/test_unit_generate_gdds.py | 99 ++++++++++++++++++- 2 files changed, 157 insertions(+), 2 deletions(-) diff --git a/python/ctsm/crop_calendars/generate_gdds_functions.py b/python/ctsm/crop_calendars/generate_gdds_functions.py index ec60a85beb..ca70056a75 100644 --- a/python/ctsm/crop_calendars/generate_gdds_functions.py +++ b/python/ctsm/crop_calendars/generate_gdds_functions.py @@ -22,6 +22,9 @@ # fixed. For now, we'll just disable the warning. # pylint: disable=too-many-positional-arguments +# Tolerance (degrees) for checking lat/lon grid matches +GRID_TOL_DEG = 1e-6 + CAN_PLOT = True try: # pylint: disable=wildcard-import,unused-wildcard-import @@ -54,6 +57,31 @@ CAN_PLOT = False +def check_grid_match(grid0, grid1, tol=GRID_TOL_DEG): + """ + Check whether latitude or longitude values match + """ + if grid0.shape != grid1.shape: + return False, None + + if hasattr(grid0, "values"): + grid0 = grid0.values + if hasattr(grid1, "values"): + grid1 = grid1.values + + abs_diff = np.abs(grid1 - grid0) + if np.any(np.isnan(abs_diff)): + if np.any(np.isnan(grid0) != np.isnan(grid1)): + warnings.warn("NaN(s) in grid don't match", RuntimeWarning) + return False, None + warnings.warn("NaN(s) in grid", RuntimeWarning) + + max_abs_diff = np.nanmax(abs_diff) + match = max_abs_diff < tol + + return match, max_abs_diff + + def check_sdates(dates_ds, sdates_rx, outdir_figs, logger, verbose=False): """ Checking that input and output sdates match @@ -62,6 +90,17 @@ def check_sdates(dates_ds, sdates_rx, outdir_figs, logger, verbose=False): sdates_grid = grid_one_variable(dates_ds, "SDATES") + # In this script, we assume that you used prescribed sowing dates on the same grid as the + # CLM run + match, max_abs_diff = check_grid_match(sdates_rx["lat"], sdates_grid["lat"]) + assert bool( + match + ), f"CLM lat grid doesn't match rx sdates's within {GRID_TOL_DEG}; max abs diff {max_abs_diff}" + match, max_abs_diff = check_grid_match(sdates_rx["lon"], sdates_grid["lon"]) + assert bool( + check_grid_match(sdates_rx["lon"], sdates_grid["lon"]) + ), f"CLM lon grid doesn't match rx sdates's within {GRID_TOL_DEG}; max abs diff {max_abs_diff}" + all_ok = True any_found = False vegtypes_skipped = [] @@ -83,8 +122,16 @@ def check_sdates(dates_ds, sdates_rx, outdir_figs, logger, verbose=False): # Output out_map = sdates_grid.sel(ivt_str=vegtype_str).squeeze(drop=True) - # Check for differences + # Calculate differences diff_map = out_map - in_map + assert ( + diff_map.shape == in_map.shape + ), f"Diff map shape {diff_map.shape} doesn't match in_map shape {in_map.shape}" + assert ( + diff_map.shape == out_map.shape + ), f"Diff map shape {diff_map.shape} doesn't match out_map shape {out_map.shape}" + + # Check for differences diff_map_notnan = diff_map.values[np.invert(np.isnan(diff_map.values))] if np.any(diff_map_notnan): log(logger, f"Difference(s) found in {vegtype_str}") @@ -496,6 +543,17 @@ def import_and_process_1yr( "h", hdates_rx, incl_patches1d_itype_veg, mxsowings, logger ) # Yes, mxsowings even when importing harvests + # In this script, we assume that you have prescribed harvest dates on the same grid as the + # CLM run + match, max_abs_diff = check_grid_match(hdates_rx_orig["lat"], dates_incl_ds["lat"]) + assert bool( + match + ), f"CLM lat grid doesn't match rx hdates's within {GRID_TOL_DEG}; max abs diff {max_abs_diff}" + match, max_abs_diff = check_grid_match(hdates_rx_orig["lon"], dates_incl_ds["lon"]) + assert bool( + match + ), f"CLM lon grid doesn't match rx hdates's within {GRID_TOL_DEG}; max abs diff {max_abs_diff}" + # Limit growing season to CLM max growing season length, if needed if mxmats and (imported_sdates or imported_hdates): print(" Limiting growing season length...") diff --git a/python/ctsm/test/test_unit_generate_gdds.py b/python/ctsm/test/test_unit_generate_gdds.py index 4bfba8e555..4976097b7d 100755 --- a/python/ctsm/test/test_unit_generate_gdds.py +++ b/python/ctsm/test/test_unit_generate_gdds.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ -Unit tests for generate_gdds.py +Unit tests for generate_gdds.py and generate_gdds_functions.py """ import unittest @@ -9,9 +9,11 @@ import argparse import numpy as np +import xarray as xr from ctsm import unit_testing from ctsm.crop_calendars import generate_gdds as gg +from ctsm.crop_calendars import generate_gdds_functions as gf # Allow test names that pylint doesn't like; otherwise hard to make them # readable @@ -228,6 +230,101 @@ def test_generate_gdds_get_mxmats_cushionneg14(self): self.assertEqual(mxmats["miscanthus"], 210 - cushion) +class TestCheckGridMatch(unittest.TestCase): + """Tests check_grid_match()""" + + def test_check_grid_match_true_npnp(self): + """Test check_grid_match() with two matching numpy arrays""" + np0 = np.array([0, 1, 2, np.pi]) + match, max_abs_diff = gf.check_grid_match(np0, np0) + self.assertTrue(match) + self.assertEqual(max_abs_diff, 0.0) + + def test_check_grid_match_true_dada(self): + """Test check_grid_match() with two matching DataArrays""" + np0 = np.array([0, 1, 2, np.pi]) + da0 = xr.DataArray(data=np0) + match, max_abs_diff = gf.check_grid_match(da0, da0) + self.assertTrue(match) + self.assertEqual(max_abs_diff, 0.0) + + def test_check_grid_match_false_npnp(self): + """Test check_grid_match() with two non-matching numpy arrays""" + np0 = np.array([0, 1, 2, np.pi]) + np1 = np0.copy() + diff = 2 * gf.GRID_TOL_DEG + np1[0] = np0[0] + diff + match, max_abs_diff = gf.check_grid_match(np0, np1) + self.assertFalse(match) + self.assertEqual(max_abs_diff, diff) + + def test_check_grid_match_false_dada(self): + """Test check_grid_match() with two non-matching DataArrays""" + np0 = np.array([0, 1, 2, np.pi]) + np1 = np0.copy() + diff = 2 * gf.GRID_TOL_DEG + np1[0] = np0[0] + diff + da0 = xr.DataArray(data=np0) + da1 = xr.DataArray(data=np1) + match, max_abs_diff = gf.check_grid_match(da0, da1) + self.assertFalse(match) + self.assertEqual(max_abs_diff, diff) + + def test_check_grid_match_falseneg_npnp(self): + """As test_check_grid_match_false_npnp, but with diff in negative direction""" + np0 = np.array([0, 1, 2, np.pi]) + np1 = np0.copy() + diff = -2 * gf.GRID_TOL_DEG + np1[0] = np0[0] + diff + match, max_abs_diff = gf.check_grid_match(np0, np1) + self.assertFalse(match) + self.assertEqual(max_abs_diff, abs(diff)) + + def test_check_grid_match_matchnans_true_npnp(self): + """Test check_grid_match() with two numpy arrays that have nans and match""" + np0 = np.array([np.nan, 1, 2, np.pi]) + with self.assertWarnsRegex(RuntimeWarning, r"NaN\(s\) in grid"): + match, max_abs_diff = gf.check_grid_match(np0, np0) + self.assertTrue(match) + self.assertEqual(max_abs_diff, 0.0) + + def test_check_grid_match_matchnans_true_dada(self): + """Test check_grid_match() with two DataArrays that have nans and match""" + np0 = np.array([np.nan, 1, 2, np.pi]) + da0 = xr.DataArray(data=np0) + with self.assertWarnsRegex(RuntimeWarning, r"NaN\(s\) in grid"): + match, max_abs_diff = gf.check_grid_match(da0, da0) + self.assertTrue(match) + self.assertEqual(max_abs_diff, 0.0) + + def test_check_grid_match_matchnans_false_npnp(self): + """Test check_grid_match() with two numpy arrays with nans that DON'T match""" + np0 = np.array([np.nan, 1, 2, np.pi]) + np1 = np.array([np.nan, 1, np.nan, np.pi]) + with self.assertWarnsRegex(RuntimeWarning, r"NaN\(s\) in grid don't match"): + match, max_abs_diff = gf.check_grid_match(np0, np1) + self.assertFalse(match) + self.assertIsNone(max_abs_diff) + + def test_check_grid_match_matchnans_falseshape_npnp(self): + """Test check_grid_match() with two numpy arrays that have different shapes""" + np0 = np.array([0, 1, 2, np.pi]) + np1 = np.array([0, 1, 2, np.pi, 4]) + match, max_abs_diff = gf.check_grid_match(np0, np1) + self.assertFalse(match) + self.assertIsNone(max_abs_diff) + + def test_check_grid_match_matchnans_falseshape_dada(self): + """Test check_grid_match() with two DataArrays that have different shapes""" + np0 = np.array([0, 1, 2, np.pi]) + np1 = np.array([0, 1, 2, np.pi, 4]) + da0 = xr.DataArray(data=np0) + da1 = xr.DataArray(data=np1) + match, max_abs_diff = gf.check_grid_match(da0, da1) + self.assertFalse(match) + self.assertIsNone(max_abs_diff) + + if __name__ == "__main__": unit_testing.setup_for_tests() unittest.main() From d51711e92af17df5780a076a322e11cb7119baed Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Sat, 31 Jan 2026 11:43:15 -0700 Subject: [PATCH 44/57] BalanceCheck() bug fix: vars were unset. --- src/biogeophys/BalanceCheckMod.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 39f3eadae3..b79fcee46e 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -561,8 +561,10 @@ subroutine BalanceCheck( bounds, & qflx_glcice_dyn_water_flux_col => waterflux_inst%qflx_glcice_dyn_water_flux_col & ! Input: [real(r8) (:)] column level water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) ) - ! Get time step + ! Get step size and time step dtime = get_step_size_real() + nstep = get_nstep() + DAnstep = get_nstep_since_startup_or_lastDA_restart_or_pause() ! Determine column level incoming snow and rain ! Assume no incident precipitation on urban wall columns (as in CanopyHydrologyMod.F90). From fa82a4b148b99d7685290fc086dd8948e34c8261 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 4 Feb 2026 11:16:15 -0700 Subject: [PATCH 45/57] RXCROPMATURITY test: Add reqd argument. One of the arguments --paramfile --max-season-length-from-hdates-file is required. For simplicity (not having to figure out what the paramfile for the run was) I chose the latter. --- cime_config/SystemTests/rxcropmaturity.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cime_config/SystemTests/rxcropmaturity.py b/cime_config/SystemTests/rxcropmaturity.py index a0eced83c5..589fe38fab 100644 --- a/cime_config/SystemTests/rxcropmaturity.py +++ b/cime_config/SystemTests/rxcropmaturity.py @@ -448,6 +448,7 @@ def _run_generate_gdds(self, case_gddgen): f"--hdates-file {hdates_file}", f"--output-dir generate_gdds_out", f"--skip-crops miscanthus,irrigated_miscanthus,switchgrass,irrigated_switchgrass", + "--max-season-length-from-hdates-file", ] ) stu.run_python_script( From 094f60790246efce85a3911253f8bcbcf5a261f5 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 4 Feb 2026 11:59:04 -0700 Subject: [PATCH 46/57] generate_gdds: Coerce lat/lon matches if needed. --- .../crop_calendars/generate_gdds_functions.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/python/ctsm/crop_calendars/generate_gdds_functions.py b/python/ctsm/crop_calendars/generate_gdds_functions.py index ca70056a75..4f6dd6b966 100644 --- a/python/ctsm/crop_calendars/generate_gdds_functions.py +++ b/python/ctsm/crop_calendars/generate_gdds_functions.py @@ -92,14 +92,26 @@ def check_sdates(dates_ds, sdates_rx, outdir_figs, logger, verbose=False): # In this script, we assume that you used prescribed sowing dates on the same grid as the # CLM run + # Check that latitudes match, coercing a match if difference is acceptable match, max_abs_diff = check_grid_match(sdates_rx["lat"], sdates_grid["lat"]) assert bool( match ), f"CLM lat grid doesn't match rx sdates's within {GRID_TOL_DEG}; max abs diff {max_abs_diff}" + if max_abs_diff > 0: + log(logger, f"Max lat abs diff: {max_abs_diff}. Coercing match.") + # sdates_grid comes from the CLM outputs, so we coerce the prescribed sowing date file + # coordinate to match, because we want the outputs of this script to have CLM's coordinates. + sdates_rx["lat"] = sdates_grid["lat"] + # Check that longitudes match, coercing a match if difference is acceptable match, max_abs_diff = check_grid_match(sdates_rx["lon"], sdates_grid["lon"]) assert bool( check_grid_match(sdates_rx["lon"], sdates_grid["lon"]) ), f"CLM lon grid doesn't match rx sdates's within {GRID_TOL_DEG}; max abs diff {max_abs_diff}" + if max_abs_diff > 0: + log(logger, f"Max lon abs diff: {max_abs_diff}. Coercing match.") + # sdates_grid comes from the CLM outputs, so we coerce the prescribed sowing date file + # coordinate to match, because we want the outputs of this script to have CLM's coordinates. + sdates_rx["lon"] = sdates_grid["lon"] all_ok = True any_found = False @@ -545,14 +557,26 @@ def import_and_process_1yr( # In this script, we assume that you have prescribed harvest dates on the same grid as the # CLM run + # Check that latitudes match, coercing a match if difference is acceptable match, max_abs_diff = check_grid_match(hdates_rx_orig["lat"], dates_incl_ds["lat"]) assert bool( match ), f"CLM lat grid doesn't match rx hdates's within {GRID_TOL_DEG}; max abs diff {max_abs_diff}" + if max_abs_diff > 0: + log(logger, f"Max lat abs diff: {max_abs_diff}. Coercing match.") + # dates_incl_ds comes from the CLM outputs, so we coerce the prescribed harvest date file + # coordinate to match, because we want the outputs of this script to have CLM's coordinates. + hdates_rx_orig["lat"] = dates_incl_ds["lat"] + # Check that longitudes match, coercing a match if difference is acceptable match, max_abs_diff = check_grid_match(hdates_rx_orig["lon"], dates_incl_ds["lon"]) assert bool( match ), f"CLM lon grid doesn't match rx hdates's within {GRID_TOL_DEG}; max abs diff {max_abs_diff}" + if max_abs_diff > 0: + log(logger, f"Max lon abs diff: {max_abs_diff}. Coercing match.") + # dates_incl_ds comes from the CLM outputs, so we coerce the prescribed harvest date file + # coordinate to match, because we want the outputs of this script to have CLM's coordinates. + hdates_rx_orig["lon"] = dates_incl_ds["lon"] # Limit growing season to CLM max growing season length, if needed if mxmats and (imported_sdates or imported_hdates): From 295da0dfafa344caee309a1810c1e4a3659b00a5 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Nov 2025 10:24:29 -0700 Subject: [PATCH 47/57] generate_gdds: Add _get_time_slice_list(); unused. --- python/ctsm/crop_calendars/generate_gdds.py | 37 ++++++++++++++++++ python/ctsm/test/test_unit_generate_gdds.py | 43 +++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index 7af82f9fa1..19c0e17c9e 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -42,6 +42,43 @@ def _get_max_growing_season_lengths(max_season_length_from_hdates_file, paramfil return mxmats +def _get_time_slice_list(first_season, last_season): + """ + Given the requested first and last seasons, get the list of time slices that the script should + look for. The assumptions here, as in import_and_process_1yr and as instructed in the docs, are + that the user (a) is saving instantaneous annual files and (b) started on Jan. 1. + """ + + # Input checks + if not all(isinstance(i, int) for i in [first_season, last_season]): + raise TypeError("_get_time_slice_list() arguments must be integers") + if first_season > last_season: + raise ValueError(f"first_season ({first_season}) > last_season ({last_season})") + + # Saving at the end of a year receive the timestamp of the END of the year's final timestep, + # which means it will actually be 00:00 of Jan. 1 of the next year. + first_history_yr = first_season + 1 + + # Same deal for the last history timestep, but we have to read an extra year in that case, + # because in some places the last growing season won't complete until the year after it was + # planted. + last_history_yr = last_season + 2 + + slice_list = [] + # last_history_yr + 1 because range() will iterate up to but not including the second value. + for history_yr in range(first_history_yr, last_history_yr + 1): + slice_start = f"{history_yr}-01-01" + # Stop could probably be the same as start, since there should just be one value saved per + # year and that should get the Jan. 1 timestamp. + slice_stop = f"{history_yr}-12-31" + slice_list.append(slice(slice_start, slice_stop)) + + # We should be reading one more than the total number of years in [first_season, last_season]. + assert len(slice_list) == last_season - first_season + 2 + + return slice_list + + def main( *, input_dir=None, diff --git a/python/ctsm/test/test_unit_generate_gdds.py b/python/ctsm/test/test_unit_generate_gdds.py index 4976097b7d..13af5e500a 100755 --- a/python/ctsm/test/test_unit_generate_gdds.py +++ b/python/ctsm/test/test_unit_generate_gdds.py @@ -230,6 +230,49 @@ def test_generate_gdds_get_mxmats_cushionneg14(self): self.assertEqual(mxmats["miscanthus"], 210 - cushion) +class TestGetTimeSliceList(unittest.TestCase): + """Tests for _get_time_slice_list()""" + + def test_generate_gdds_get_time_slice_list(self): + """Test that _get_time_slice_list works with two different years""" + season_list = [1986, 1987] + result = gg._get_time_slice_list(season_list[0], season_list[-1]) + expected = [ + slice("1987-01-01", "1987-12-31"), + slice("1988-01-01", "1988-12-31"), + slice("1989-01-01", "1989-12-31"), + ] + assert result == expected + + def test_generate_gdds_get_time_slice_list_1yr(self): + """Test that _get_time_slice_list works with the same year""" + result = gg._get_time_slice_list(1987, 1987) + expected = [ + slice("1988-01-01", "1988-12-31"), + slice("1989-01-01", "1989-12-31"), + ] + assert result == expected + + def test_generate_gdds_get_time_slice_list_valueerror(self): + """Test that _get_time_slice_list raises ValueError if last < first""" + with self.assertRaisesRegex(ValueError, "first_season.* > last_season"): + gg._get_time_slice_list(1987, 1986) + + def test_generate_gdds_get_time_slice_list_typeerror_first(self): + """Test that _get_time_slice_list raises TypeError if not given integer first season""" + with self.assertRaisesRegex( + TypeError, r"_get_time_slice_list\(\) arguments must be integers" + ): + gg._get_time_slice_list(1986.3, 1987) + + def test_generate_gdds_get_time_slice_list_typeerror_last(self): + """Test that _get_time_slice_list raises TypeError if not given integer last season""" + with self.assertRaisesRegex( + TypeError, r"_get_time_slice_list\(\) arguments must be integers" + ): + gg._get_time_slice_list(1986, None) + + class TestCheckGridMatch(unittest.TestCase): """Tests check_grid_match()""" From 14c223c5ac9524b9190ce3b74e107c396c2aad5c Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Nov 2025 11:49:43 -0700 Subject: [PATCH 48/57] import_ds: Factor out new get_files_in_time_slice(). --- python/ctsm/crop_calendars/import_ds.py | 44 +-- python/ctsm/test/test_unit_import_ds.py | 354 ++++++++++++++++++++++++ 2 files changed, 381 insertions(+), 17 deletions(-) create mode 100755 python/ctsm/test/test_unit_import_ds.py diff --git a/python/ctsm/crop_calendars/import_ds.py b/python/ctsm/crop_calendars/import_ds.py index 66a0ec9746..656d10985e 100644 --- a/python/ctsm/crop_calendars/import_ds.py +++ b/python/ctsm/crop_calendars/import_ds.py @@ -247,23 +247,7 @@ def import_ds( # elements through end-1 will be selected, but that seems not to be the case in the xarray # implementation. if time_slice: - new_filelist = [] - for file in sorted(filelist): - log(logger, f"Getting filetime from file: {file}") - filetime = xr.open_dataset(file).time - filetime_sel = utils.safer_timeslice(filetime, time_slice) - include_this_file = filetime_sel.size - if include_this_file: - log(logger, f"Including filetime : {filetime_sel['time'].values}") - new_filelist.append(file) - - # If you found some matching files, but then you find one that doesn't, stop going - # through the list. - elif new_filelist: - break - if not new_filelist: - raise RuntimeError(f"No files found in time_slice {time_slice}") - filelist = new_filelist + filelist = get_files_in_time_slice(filelist, time_slice, logger) # The xarray open_mfdataset() "preprocess" argument requires a function that takes exactly one # variable (an xarray.Dataset object). Wrapping mfdataset_preproc() in this lambda function @@ -324,3 +308,29 @@ def import_ds( log(logger, "End") return this_ds + + +def get_files_in_time_slice(filelist, time_slice, logger=None): + """ + For a given list of files, find the files that need to be read in order to get all history + timesteps in the slice. + """ + new_filelist = [] + for file in sorted(filelist): + if logger: + log(logger, f"Getting filetime from file: {file}") + filetime = xr.open_dataset(file).time + filetime_sel = utils.safer_timeslice(filetime, time_slice) + include_this_file = filetime_sel.size + if include_this_file: + if logger: + log(logger, f"Including filetime : {filetime_sel['time'].values}") + new_filelist.append(file) + + # If you found some matching files, but then you find one that doesn't, stop going + # through the list. + elif new_filelist: + break + if not new_filelist: + raise FileNotFoundError(f"No files found in time_slice {time_slice}") + return new_filelist diff --git a/python/ctsm/test/test_unit_import_ds.py b/python/ctsm/test/test_unit_import_ds.py new file mode 100755 index 0000000000..89349be9d4 --- /dev/null +++ b/python/ctsm/test/test_unit_import_ds.py @@ -0,0 +1,354 @@ +#!/usr/bin/env python3 + +""" +Unit tests for import_ds.py +""" + +import unittest +import os +import tempfile +import shutil + +import xarray as xr +from cftime import DatetimeNoLeap + +from ctsm import unit_testing +from ctsm.crop_calendars import import_ds + +# Allow test names that pylint doesn't like; otherwise hard to make them +# readable +# pylint: disable=invalid-name + +# pylint: disable=protected-access + + +def _make_timestep(str_in): + """ + Because of float imprecision, microseconds should be specified like: + 1,8 instead of 1.000008 + and: + 1,800000 instead of 1.8 + """ + h = minute = s = us = 0 + + str_in_split = str_in.split(" ") + y, month, d = str_in_split[0].split("-") + if len(str_in_split) > 1: + h, minute, s = str_in_split[1].split(":") + if "," in s: + s, us = s.split(",") + inputs = [int(x) for x in [y, month, d, h, minute, s, us]] + return DatetimeNoLeap(*inputs, has_year_zero=True) + + +class TestMakeTimestep(unittest.TestCase): + """Test this test module's _make_timestep() function""" + + def test_make_timestep_ymd(self): + """Test with YYYY-MM-DD""" + self.assertEqual( + _make_timestep("1987-07-24"), + DatetimeNoLeap(1987, 7, 24, 0, 0, 0, 0, has_year_zero=True), + ) + + def test_make_timestep_hms(self): + """Test with YYYY-MM-DD hh:mm:ss""" + self.assertEqual( + _make_timestep("1987-07-24 09:25:07"), + DatetimeNoLeap(1987, 7, 24, 9, 25, 7, 0, has_year_zero=True), + ) + + def test_make_timestep_microsec_leadzeros(self): + """Test with microseconds with leading zeros""" + self.assertEqual( + _make_timestep("1987-07-24 09:25:07,8"), + DatetimeNoLeap(1987, 7, 24, 9, 25, 7, 8, has_year_zero=True), + ) + + def test_make_timestep_microsec_noleadzeros(self): + """Test with microseconds without leading zeros""" + self.assertEqual( + _make_timestep("1987-07-24 09:25:07,800000"), + DatetimeNoLeap(1987, 7, 24, 9, 25, 7, 800000, has_year_zero=True), + ) + + +class TestGetFilesInTimeSlice(unittest.TestCase): + """Tests of get_files_in_time_slice()""" + + def setUp(self): + """ + Set up and change to temporary directory + """ + self.prev_dir = os.getcwd() + self.temp_dir = tempfile.mkdtemp() + os.chdir(self.temp_dir) + + def tearDown(self): + """ + Delete temporary directory and any files within + """ + os.chdir(self.prev_dir) + shutil.rmtree(self.temp_dir, ignore_errors=True) + + def _create_annual_test_files(self, years): + """ + Helper method to create test files with one timestep per file (annual) + + Args: + years: List of years to create files for + + Returns: + List of filenames created + """ + filelist = [] + for year in years: + filename = os.path.join(self.temp_dir, f"test_{year}.nc") + filelist.append(filename) + + # Create a simple dataset with one time step + time = xr.DataArray( + [_make_timestep(f"{year}-01-01")], + dims=["time"], + name="time", + ) + ds = xr.Dataset({"time": time}) + ds.to_netcdf(filename) + + return filelist + + def _create_monthly_test_files(self, year_month_list): + """ + Helper method to create test files with multiple timesteps per file (monthly) + + Args: + year_month_list: List of tuples (year, list_of_months) where each file + contains multiple monthly timesteps + + Returns: + List of filenames created + """ + filelist = [] + for year, months in year_month_list: + filename = os.path.join(self.temp_dir, f"test_{year}.nc") + filelist.append(filename) + + # Create a dataset with multiple monthly time steps + timesteps = [_make_timestep(f"{year}-{month:02d}-15 12:00:00") for month in months] + time = xr.DataArray(timesteps, dims=["time"], name="time") + ds = xr.Dataset({"time": time}) + ds.to_netcdf(filename) + + return filelist + + def _create_daily_test_file(self, year, month, days, *, hour=0, minute=0, second=0): + """ + Helper method to create a test file with daily timesteps + + Args: + year: Year for the file + month: Month for the file + days: List of days to include + hour: Hour of day (default 0) + minute: Minute of hour (default 0) + second: Second of minute (default 0) + + Returns: + Filename created + """ + filename = os.path.join(self.temp_dir, f"test_{year}_{month:02d}.nc") + + # Create a dataset with daily time steps + time_str = f"{hour:02d}:{minute:02d}:{second:02d}" if hour or minute or second else "" + if time_str: + timesteps = [_make_timestep(f"{year}-{month:02d}-{day:02d} {time_str}") for day in days] + else: + timesteps = [_make_timestep(f"{year}-{month:02d}-{day:02d}") for day in days] + time = xr.DataArray(timesteps, dims=["time"], name="time") + ds = xr.Dataset({"time": time}) + ds.to_netcdf(filename) + + return filename + + def test_get_files_in_time_slice_middle(self): + """Test get_files_in_time_slice with a slice in the middle of the range""" + years = [2000, 2001, 2002, 2003, 2004] + filelist = self._create_annual_test_files(years) + + time_slice = slice(_make_timestep("2001-01-01"), _make_timestep("2003-01-01")) + result = import_ds.get_files_in_time_slice(filelist, time_slice) + result_basenames = [os.path.basename(f) for f in result] + expected = ["test_2001.nc", "test_2002.nc", "test_2003.nc"] + self.assertEqual(result_basenames, expected) + + def test_get_files_in_time_slice_middle_slice_just_strings(self): + """ + As test_get_files_in_time_slice_middle, but with the slice containing strings instead of + actual cftime timestamps + """ + years = [2000, 2001, 2002, 2003, 2004] + filelist = self._create_annual_test_files(years) + + time_slice = slice("2001-01-01", "2003-01-01") + result = import_ds.get_files_in_time_slice(filelist, time_slice) + result_basenames = [os.path.basename(f) for f in result] + expected = ["test_2001.nc", "test_2002.nc", "test_2003.nc"] + self.assertEqual(result_basenames, expected) + + def test_get_files_in_time_slice_from_beginning(self): + """Test get_files_in_time_slice with unbounded start (from beginning)""" + years = [2000, 2001, 2002, 2003, 2004] + filelist = self._create_annual_test_files(years) + + time_slice = slice(None, _make_timestep("2001-01-01")) + result = import_ds.get_files_in_time_slice(filelist, time_slice) + result_basenames = [os.path.basename(f) for f in result] + expected = ["test_2000.nc", "test_2001.nc"] + self.assertEqual(result_basenames, expected) + + def test_get_files_in_time_slice_to_end(self): + """Test get_files_in_time_slice with unbounded end (to the end)""" + years = [2000, 2001, 2002, 2003, 2004] + filelist = self._create_annual_test_files(years) + + time_slice = slice(_make_timestep("2003-01-01"), None) + result = import_ds.get_files_in_time_slice(filelist, time_slice) + result_basenames = [os.path.basename(f) for f in result] + expected = ["test_2003.nc", "test_2004.nc"] + self.assertEqual(result_basenames, expected) + + def test_get_files_in_time_slice_all_files(self): + """Test get_files_in_time_slice with unbounded slice (all files)""" + years = [2000, 2001, 2002, 2003, 2004] + filelist = self._create_annual_test_files(years) + + time_slice = slice(None, None) + result = import_ds.get_files_in_time_slice(filelist, time_slice) + # For this test, compare full paths since expected is also full paths + self.assertEqual(result, filelist) + + def test_get_files_in_time_slice_no_match(self): + """Test get_files_in_time_slice with no matching files (should raise FileNotFoundError)""" + years = [2000, 2001, 2002, 2003, 2004] + filelist = self._create_annual_test_files(years) + + time_slice = slice(_make_timestep("2010-01-01"), _make_timestep("2011-01-01")) + with self.assertRaises(FileNotFoundError): + import_ds.get_files_in_time_slice(filelist, time_slice) + + def test_get_files_in_time_slice_monthly_multiple_per_file(self): + """Test get_files_in_time_slice with monthly data, multiple timesteps per file""" + # Create files with monthly data: each file has 12 months + year_month_list = [ + (2000, list(range(1, 13))), # Jan-Dec 2000 + (2001, list(range(1, 13))), # Jan-Dec 2001 + (2002, list(range(1, 13))), # Jan-Dec 2002 + ] + filelist = self._create_monthly_test_files(year_month_list) + + # Select from mid-2000 to mid-2001 + time_slice = slice(_make_timestep("2000-06-01"), _make_timestep("2001-08-01")) + result = import_ds.get_files_in_time_slice(filelist, time_slice) + result_basenames = [os.path.basename(f) for f in result] + expected = ["test_2000.nc", "test_2001.nc"] + self.assertEqual(result_basenames, expected) + + def test_get_files_in_time_slice_monthly_partial_overlap(self): + """Test get_files_in_time_slice with monthly data selecting partial year""" + year_month_list = [ + (2000, list(range(1, 13))), + (2001, list(range(1, 13))), + (2002, list(range(1, 13))), + ] + filelist = self._create_monthly_test_files(year_month_list) + + # Select only within 2001 + time_slice = slice(_make_timestep("2001-03-01"), _make_timestep("2001-09-01")) + result = import_ds.get_files_in_time_slice(filelist, time_slice) + result_basenames = [os.path.basename(f) for f in result] + expected = ["test_2001.nc"] + self.assertEqual(result_basenames, expected) + + def test_get_files_in_time_slice_with_hours_minutes_seconds(self): + """Test get_files_in_time_slice with timesteps including hours, minutes, seconds""" + # Create daily files with specific times + filelist = [] + filelist.append( + self._create_daily_test_file(2000, 6, list(range(1, 31)), hour=6, minute=30, second=15) + ) + filelist.append( + self._create_daily_test_file(2000, 7, list(range(1, 32)), hour=6, minute=30, second=15) + ) + filelist.append( + self._create_daily_test_file(2000, 8, list(range(1, 32)), hour=6, minute=30, second=15) + ) + + # Select from mid-June to mid-July with specific time + time_slice = slice( + _make_timestep("2000-06-15 06:30:15"), + _make_timestep("2000-07-20 06:30:15"), + ) + result = import_ds.get_files_in_time_slice(filelist, time_slice) + result_basenames = [os.path.basename(f) for f in result] + expected = ["test_2000_06.nc", "test_2000_07.nc"] + self.assertEqual(result_basenames, expected) + + def test_get_files_in_time_slice_mixed_frequencies(self): + """Test get_files_in_time_slice with files containing different numbers of timesteps""" + filelist = [] + # File 1: Single timestep (annual) + filename1 = os.path.join(self.temp_dir, "test_1999.nc") + time1 = xr.DataArray([_make_timestep("1999-07-01 00:00:00")], dims=["time"], name="time") + xr.Dataset({"time": time1}).to_netcdf(filename1) + filelist.append(filename1) + + # File 2: Monthly timesteps + filename2 = os.path.join(self.temp_dir, "test_2000.nc") + timesteps2 = [_make_timestep(f"2000-{m:02d}-15 12:00:00") for m in range(1, 13)] + time2 = xr.DataArray(timesteps2, dims=["time"], name="time") + xr.Dataset({"time": time2}).to_netcdf(filename2) + filelist.append(filename2) + + # File 3: Daily timesteps for one month + filelist.append( + self._create_daily_test_file(2001, 1, list(range(1, 32)), hour=3, minute=0, second=0) + ) + + # Select from late 1999 to mid-2000 + time_slice = slice(_make_timestep("1999-06-01"), _make_timestep("2000-08-01")) + result = import_ds.get_files_in_time_slice(filelist, time_slice) + result_basenames = [os.path.basename(f) for f in result] + expected = ["test_1999.nc", "test_2000.nc"] + self.assertEqual(result_basenames, expected) + + def test_get_files_in_time_slice_exact_boundary_match(self): + """Test get_files_in_time_slice with exact timestamp boundary matches at file edges""" + filelist = [] + filelist.append( + self._create_daily_test_file( + 2000, 12, list(range(1, 32)), hour=23, minute=59, second=59 + ) + ) + filelist.append( + self._create_daily_test_file(2001, 1, list(range(1, 32)), hour=23, minute=59, second=59) + ) + filelist.append( + self._create_daily_test_file(2001, 2, list(range(1, 29)), hour=23, minute=59, second=59) + ) + + # Select from last timestep of December file to first timestep of February file + # This tests exact boundary matching at file edges + time_slice = slice( + _make_timestep("2000-12-31 23:59:59"), # Last timestep in first file + _make_timestep("2001-02-01 23:59:59"), # First timestep in third file + ) + result = import_ds.get_files_in_time_slice(filelist, time_slice) + result_basenames = [os.path.basename(f) for f in result] + # Should include all three files since boundaries match exactly + expected = ["test_2000_12.nc", "test_2001_01.nc", "test_2001_02.nc"] + self.assertEqual(result_basenames, expected) + + +if __name__ == "__main__": + unit_testing.setup_for_tests() + unittest.main() From 2822322121b20fa86326895689ed43f9504ac121 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Nov 2025 12:22:46 -0700 Subject: [PATCH 49/57] generate_gdds_functions: Factor out new find_inst_hist_files(). --- .../crop_calendars/generate_gdds_functions.py | 88 ++++++-- python/ctsm/test/test_unit_generate_gdds.py | 193 +++++++++++++++++- 2 files changed, 264 insertions(+), 17 deletions(-) diff --git a/python/ctsm/crop_calendars/generate_gdds_functions.py b/python/ctsm/crop_calendars/generate_gdds_functions.py index 4f6dd6b966..eb4eefdb70 100644 --- a/python/ctsm/crop_calendars/generate_gdds_functions.py +++ b/python/ctsm/crop_calendars/generate_gdds_functions.py @@ -321,13 +321,7 @@ def import_and_process_1yr( chunks = None # Get h1 file (list) - h1_pattern = os.path.join(indir, "*h1i.*.nc") - h1_filelist = glob.glob(h1_pattern) - if not h1_filelist: - h1_pattern = os.path.join(indir, "*h1i.*.nc.base") - h1_filelist = glob.glob(h1_pattern) - if not h1_filelist: - error(logger, "No files found matching pattern '*h1i.*.nc(.base)'") + h1_filelist = find_inst_hist_files(indir, h=1, this_year=None, logger=logger) # Get list of crops to include if skip_crops is not None: @@ -631,14 +625,7 @@ def import_and_process_1yr( log(logger, " Importing accumulated GDDs...") clm_gdd_var = "GDDACCUM" my_vars = [clm_gdd_var, "GDDHARV"] - patterns = [f"*h2i.{this_year-1}-01*.nc", f"*h2i.{this_year-1}-01*.nc.base"] - for pat in patterns: - pattern = os.path.join(indir, pat) - h2_files = glob.glob(pattern) - if h2_files: - break - if not h2_files: - error(logger, f"No files found matching patterns: {patterns}") + h2_files = find_inst_hist_files(indir, h=2, this_year=this_year - 1, logger=logger) h2_ds = import_ds( h2_files, my_vars=my_vars, @@ -896,6 +883,77 @@ def import_and_process_1yr( ) +def find_inst_hist_files(indir, *, h, this_year=None, logger=None): + """ + Find all the instantaneous history files for a given tape number, optionally looking just for + one year in filename. + + Args: + indir: Directory to search for history files + h: History tape number (must be an integer, e.g., 1 for h1, 2 for h2) + this_year: Optional year to filter files by. If provided, only files with dates starting + with "{this_year}-01" will be returned. If None, all files matching the + history tape number will be returned. + logger: Optional logger for error messages. If None, errors are raised without logging. + + Returns: + List of file paths matching the search criteria + + Raises: + TypeError: If h is not an integer + FileNotFoundError: If no files matching the patterns are found + RuntimeError: If files from multiple case names are found (indicates mixed output from + different simulations, which is pathological) + + Notes: + - Searches for files matching patterns: "*h{h}i.*.nc" or "*h{h}i.*.nc.base" + - When this_year is specified, searches for: "*h{h}i.{this_year}-01*.nc" or + "*h{h}i.{this_year}-01*.nc.base" + - Prefers .nc files over .nc.base files (searches .nc pattern first) + - All returned files must be from the same case name (extracted from filename before + ".clm2.h#i.") + """ + if this_year is None: + patterns = [f"*h{h}i.*.nc", f"*h{h}i.*.nc.base"] + else: + if not isinstance(h, int): + err_msg = f"h ({h}) must be an integer, not {type(h)}" + err_type = TypeError + if logger: + error(logger, err_msg, error_type=err_type) + raise err_type(err_msg) + patterns = [f"*h{h}i.{this_year}-01*.nc", f"*h{h}i.{this_year}-01*.nc.base"] + for pat in patterns: + pattern = os.path.join(indir, pat) + file_list = glob.glob(pattern) + if file_list: + break + if not file_list: + err_msg = f"No files found matching patterns: {patterns}" + err_type = FileNotFoundError + if logger: + error(logger, err_msg, error_type=err_type) + raise err_type(err_msg) + + # Error if files found from multiple cases + case_names = set() + for file in file_list: + basename = os.path.basename(file) + # Extract case name (everything before .clm2.h#i.) + parts = basename.split(".clm2.") + if len(parts) > 1: + case_name = parts[0] + case_names.add(case_name) + if len(case_names) > 1: + err_msg = f"Found files from multiple case names: {sorted(case_names)}" + err_type = RuntimeError + if logger: + error(logger, err_msg, error_type=err_type) + raise err_type(err_msg) + + return file_list + + def get_multicrop_maps(this_ds, these_vars, crop_fracs_yx, dummy_fill, gdd_units): # pylint: disable=missing-function-docstring # Get GDDs for these crops diff --git a/python/ctsm/test/test_unit_generate_gdds.py b/python/ctsm/test/test_unit_generate_gdds.py index 13af5e500a..148be0fa3d 100755 --- a/python/ctsm/test/test_unit_generate_gdds.py +++ b/python/ctsm/test/test_unit_generate_gdds.py @@ -7,6 +7,9 @@ import unittest import os import argparse +import tempfile +import shutil +import logging import numpy as np import xarray as xr @@ -125,8 +128,10 @@ def test_generate_gdds_args_error_with_paramfile_and_nomxmat(self): gg._parse_args(args) def test_generate_gdds_args_error_with_nomxmat_and_cushion(self): - """Should error if both --max-season-length-cushion and --max-season-length-from-hdates-file - are given""" + """ + Should error if both --max-season-length-cushion and --max-season-length-from-hdates-file + are given + """ args = [ "--input-dir", self._input_dir, @@ -368,6 +373,190 @@ def test_check_grid_match_matchnans_falseshape_dada(self): self.assertIsNone(max_abs_diff) +class TestFindInstHistFiles(unittest.TestCase): + """Tests of find_inst_hist_files()""" + + def setUp(self): + """ + Set up and change to temporary directory + """ + self.prev_dir = os.getcwd() + self.temp_dir = tempfile.mkdtemp() + os.chdir(self.temp_dir) + + def tearDown(self): + """ + Delete temporary directory + """ + os.chdir(self.prev_dir) + shutil.rmtree(self.temp_dir, ignore_errors=True) + + def _create_test_file(self, filename): + """Helper to create an empty test file""" + filepath = os.path.join(self.temp_dir, filename) + with open(filepath, "a", encoding="utf-8"): + pass + return filepath + + def test_find_inst_hist_files_h1_no_year(self): + """Test finding h1 files without specifying year""" + # Create test files + file1 = self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + file2 = self._create_test_file("test.clm2.h1i.2000-02-01-00000.nc") + file3 = self._create_test_file("test.clm2.h1i.2001-01-01-00000.nc") + + result = gf.find_inst_hist_files(self.temp_dir, h=1, this_year=None) + + # Should find all h1i files + self.assertEqual(len(result), 3) + self.assertIn(file1, result) + self.assertIn(file2, result) + self.assertIn(file3, result) + + def test_find_inst_hist_files_h2_no_year(self): + """Test finding h2 files without specifying year""" + # Create test files + file1 = self._create_test_file("test.clm2.h2i.2000-01-01-00000.nc") + file2 = self._create_test_file("test.clm2.h2i.2001-01-01-00000.nc") + # Create h1 file that should not be found + self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + + result = gf.find_inst_hist_files(self.temp_dir, h=2, this_year=None) + + # Should find only h2i files + self.assertEqual(len(result), 2) + self.assertIn(file1, result) + self.assertIn(file2, result) + + def test_find_inst_hist_files_with_year(self): + """Test finding files for a specific year""" + # Create test files + file_2000 = self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + file_2001 = self._create_test_file("test.clm2.h1i.2001-01-01-00000.nc") + file_2002 = self._create_test_file("test.clm2.h1i.2002-01-01-00000.nc") + + result = gf.find_inst_hist_files(self.temp_dir, h=1, this_year=2001) + + # Should find only 2001 file + self.assertEqual(len(result), 1) + self.assertIn(file_2001, result) + self.assertNotIn(file_2000, result) + self.assertNotIn(file_2002, result) + + def test_find_inst_hist_files_base_extension(self): + """Test finding files with .nc.base extension""" + # Create test files with .nc.base extension + file1 = self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc.base") + file2 = self._create_test_file("test.clm2.h1i.2001-01-01-00000.nc.base") + + result = gf.find_inst_hist_files(self.temp_dir, h=1, this_year=None) + + # Should find .nc.base files + self.assertEqual(len(result), 2) + self.assertIn(file1, result) + self.assertIn(file2, result) + + def test_find_inst_hist_files_prefer_nc_over_base(self): + """Test that .nc files are preferred over .nc.base files""" + # Create both .nc and .nc.base files + file_nc = self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + + result = gf.find_inst_hist_files(self.temp_dir, h=1, this_year=None) + + # Should find .nc files first (pattern order preference) + self.assertIn(file_nc, result) + # .nc.base should only be found if no .nc files exist + + def test_find_inst_hist_files_multiple_months_same_year(self): + """Test finding multiple files from the same year""" + # Create multiple files from 2000 + file1 = self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + file2 = self._create_test_file("test.clm2.h1i.2000-01-15-00000.nc") + file3 = self._create_test_file("test.clm2.h1i.2000-01-31-00000.nc") + # Create file from different year + self._create_test_file("test.clm2.h1i.2001-01-01-00000.nc") + + result = gf.find_inst_hist_files(self.temp_dir, h=1, this_year=2000) + + # Should find all January 2000 files + self.assertEqual(len(result), 3) + self.assertIn(file1, result) + self.assertIn(file2, result) + self.assertIn(file3, result) + + def test_find_inst_hist_files_no_files_found(self): + """Test error when no matching files are found""" + # Create a non-matching file + self._create_test_file("test.clm2.h0.2000-01-01-00000.nc") + + # Should raise a FileNotFoundError error + with self.assertRaises(FileNotFoundError): + gf.find_inst_hist_files(self.temp_dir, h=1, this_year=None) + + def test_find_inst_hist_files_different_case_names(self): + """Test that RuntimeError is raised when files from different case names are found""" + # Create files with different case names + self._create_test_file("case1.clm2.h1i.2000-01-01-00000.nc") + self._create_test_file("case2.clm2.h1i.2000-01-01-00000.nc") + self._create_test_file("longcasename.clm2.h1i.2000-01-01-00000.nc") + + # Should raise RuntimeError due to multiple case names + with self.assertRaises(RuntimeError): + gf.find_inst_hist_files(self.temp_dir, h=1, this_year=2000) + + def test_find_inst_hist_files_different_case_names_with_logger(self): + """ + Test that RuntimeError is raised when files from different case names are found, with logger + """ + # Create a logger + logger = logging.getLogger("test_logger_case_names") + logger.setLevel(logging.DEBUG) + + # Create files with different case names + self._create_test_file("case1.clm2.h1i.2000-01-01-00000.nc") + self._create_test_file("case2.clm2.h1i.2000-01-01-00000.nc") + self._create_test_file("longcasename.clm2.h1i.2000-01-01-00000.nc") + + # Should raise RuntimeError due to multiple case names, even with logger + with self.assertRaises(RuntimeError): + gf.find_inst_hist_files(self.temp_dir, h=1, this_year=2000, logger=logger) + + def test_find_inst_hist_files_no_files_found_with_logger(self): + """Test error when no matching files are found, with logger""" + # Create a logger + logger = logging.getLogger("test_logger_no_files") + logger.setLevel(logging.DEBUG) + + # Create a non-matching file + self._create_test_file("test.clm2.h0.2000-01-01-00000.nc") + + # Should raise a FileNotFoundError even with logger + with self.assertRaises(FileNotFoundError): + gf.find_inst_hist_files(self.temp_dir, h=1, this_year=None, logger=logger) + + def test_find_inst_hist_files_h_str_with_logger(self): + """Test that TypeError is raised when h is a string, with logger""" + # Create a logger + logger = logging.getLogger("test_logger_h_str") + logger.setLevel(logging.DEBUG) + + self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + + with self.assertRaises(TypeError): + gf.find_inst_hist_files(self.temp_dir, h="1", this_year=2000, logger=logger) + + def test_find_inst_hist_files_h_float_with_logger(self): + """Test that TypeError is raised when h is a float, with logger""" + # Create a logger + logger = logging.getLogger("test_logger_h_float") + logger.setLevel(logging.DEBUG) + + self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + + with self.assertRaises(TypeError): + gf.find_inst_hist_files(self.temp_dir, h=1.0, this_year=2000, logger=logger) + + if __name__ == "__main__": unit_testing.setup_for_tests() unittest.main() From ed25bec66db39f73e8a1735775353cc27fc416dc Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Nov 2025 13:10:04 -0700 Subject: [PATCH 50/57] generate_gdds: Get file lists before entering import_and_process_1yr(). --- python/ctsm/crop_calendars/generate_gdds.py | 72 +++++-- .../crop_calendars/generate_gdds_functions.py | 24 +-- python/ctsm/test/test_unit_generate_gdds.py | 184 ++++++++++++++++++ 3 files changed, 243 insertions(+), 37 deletions(-) diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index 19c0e17c9e..094062e17f 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -21,6 +21,9 @@ from ctsm.ctsm_logging import log, error # pylint: disable=wrong-import-position import ctsm.crop_calendars.cropcal_module as cc # pylint: disable=wrong-import-position import ctsm.crop_calendars.generate_gdds_functions as gddfn # pylint: disable=wrong-import-position +from ctsm.crop_calendars.import_ds import ( # pylint: disable=wrong-import-position + get_files_in_time_slice, # pylint: disable=wrong-import-position +) # pylint: disable=wrong-import-position # Functions here were written with too many positional arguments. At some point that should be # fixed. For now, we'll just disable the warning. @@ -42,6 +45,26 @@ def _get_max_growing_season_lengths(max_season_length_from_hdates_file, paramfil return mxmats +def _get_history_yr_range(first_season, last_season): + """ + Get a range object that can be used for looping over all years we need to process timestamps + from. + """ + # Saving at the end of a year receive the timestamp of the END of the year's final timestep, + # which means it will actually be 00:00 of Jan. 1 of the next year. + first_history_yr = first_season + 1 + + # Same deal for the last history timestep, but we have to read an extra year in that case, + # because in some places the last growing season won't complete until the year after it was + # planted. + last_history_yr = last_season + 2 + + # last_history_yr + 1 because range() will iterate up to but not including the second value. + history_yr_range = range(first_history_yr, last_history_yr + 1) + + return history_yr_range + + def _get_time_slice_list(first_season, last_season): """ Given the requested first and last seasons, get the list of time slices that the script should @@ -55,18 +78,8 @@ def _get_time_slice_list(first_season, last_season): if first_season > last_season: raise ValueError(f"first_season ({first_season}) > last_season ({last_season})") - # Saving at the end of a year receive the timestamp of the END of the year's final timestep, - # which means it will actually be 00:00 of Jan. 1 of the next year. - first_history_yr = first_season + 1 - - # Same deal for the last history timestep, but we have to read an extra year in that case, - # because in some places the last growing season won't complete until the year after it was - # planted. - last_history_yr = last_season + 2 - slice_list = [] - # last_history_yr + 1 because range() will iterate up to but not including the second value. - for history_yr in range(first_history_yr, last_history_yr + 1): + for history_yr in _get_history_yr_range(first_season, last_season): slice_start = f"{history_yr}-01-01" # Stop could probably be the same as start, since there should just be one value saved per # year and that should get the Jan. 1 timestamp. @@ -79,6 +92,25 @@ def _get_time_slice_list(first_season, last_season): return slice_list +def _get_file_lists(input_dir, time_slice_list, logger): + """ + For each time slice in a list, find the file(s) that need to be read to get all history + timesteps in the slice. Returns both h1i and h2i file lists. + """ + output_file_lists_list = [None, None] + for i, h in enumerate([1, 2]): + all_h_files = gddfn.find_inst_hist_files(input_dir, h=h, logger=logger) + h_file_lists = [] + for time_slice in time_slice_list: + try: + h_file_lists.append(get_files_in_time_slice(all_h_files, time_slice, logger=logger)) + except FileNotFoundError as e: + raise FileNotFoundError(f"No h{h} timesteps found in {time_slice}") from e + output_file_lists_list[i] = h_file_lists + h1_file_lists, h2_file_lists = tuple(output_file_lists_list) + return h1_file_lists, h2_file_lists + + def main( *, input_dir=None, @@ -199,10 +231,18 @@ def main( max_season_length_from_hdates_file, paramfile, max_season_length_cushion ) - h1_instantaneous = None - for yr_index, this_yr in enumerate(np.arange(first_season + 1, last_season + 3)): + # Get lists of history timesteps and files to read + time_slice_list = _get_time_slice_list(first_season, last_season) + h1_file_lists, h2_file_lists = _get_file_lists(input_dir, time_slice_list, logger) + + for yr_index, this_yr in enumerate(_get_history_yr_range(first_season, last_season)): if this_yr <= pickle_year: continue + log(logger, f"netCDF year {this_yr}...") + + # Get h1 and h2 files to read for this year + h1_file_list = h1_file_lists[yr_index] # pylint: disable=unsubscriptable-object + h2_file_list = h2_file_lists[yr_index] # pylint: disable=unsubscriptable-object ( h2_ds, @@ -216,12 +256,10 @@ def main( incl_vegtypes_str, incl_patches1d_itype_veg, mxsowings, - h1_instantaneous, ) = gddfn.import_and_process_1yr( first_season, last_season, yr_index, - this_yr, sdates_rx, hdates_rx, gddaccum_yp_list, @@ -229,7 +267,6 @@ def main( skip_patches_for_isel_nan_lastyear, lastyear_active_patch_indices_list, incorrectly_daily, - input_dir, incl_vegtypes_str, h2_ds_file, mxmats, @@ -237,7 +274,8 @@ def main( skip_crops, outdir_figs, logger, - h1_instantaneous, + h1_file_list, + h2_file_list, ) log(logger, f" Saving pickle file ({pickle_file})...") diff --git a/python/ctsm/crop_calendars/generate_gdds_functions.py b/python/ctsm/crop_calendars/generate_gdds_functions.py index eb4eefdb70..ed271bdd8d 100644 --- a/python/ctsm/crop_calendars/generate_gdds_functions.py +++ b/python/ctsm/crop_calendars/generate_gdds_functions.py @@ -10,7 +10,6 @@ import numpy as np import xarray as xr -from ctsm.utils import is_instantaneous from ctsm.ctsm_logging import log, error import ctsm.crop_calendars.cropcal_utils as utils import ctsm.crop_calendars.cropcal_module as cc @@ -290,7 +289,6 @@ def import_and_process_1yr( year_1, year_n, year_index, - this_year, sdates_rx, hdates_rx, gddaccum_yp_list, @@ -298,7 +296,6 @@ def import_and_process_1yr( skip_patches_for_isel_nan_last_year, last_year_active_patch_indices_list, incorrectly_daily, - indir, incl_vegtypes_str_in, h2_ds_file, mxmats, @@ -306,13 +303,13 @@ def import_and_process_1yr( skip_crops, outdir_figs, logger, - h1_instantaneous, + h1_filelist, + h2_filelist, ): """ Import one year of CLM output data for GDD generation """ save_figs = True - log(logger, f"netCDF year {this_year}...") # Without dask, this can take a LONG time at resolutions finer than 2-deg if importlib_util.find_spec("dask"): @@ -320,28 +317,17 @@ def import_and_process_1yr( else: chunks = None - # Get h1 file (list) - h1_filelist = find_inst_hist_files(indir, h=1, this_year=None, logger=logger) - # Get list of crops to include if skip_crops is not None: crops_to_read = [c for c in utils.define_mgdcrop_list_withgrasses() if c not in skip_crops] else: crops_to_read = utils.define_mgdcrop_list_withgrasses() - # Are h1 files instantaneous? - if h1_instantaneous is None: - h1_instantaneous = is_instantaneous(xr.open_dataset(h1_filelist[0])["time"]) - - if h1_instantaneous: - slice_year = this_year - else: - slice_year = this_year - 1 + # Read h1 file(s) dates_ds = import_ds( h1_filelist, my_vars=["SDATES", "HDATES"], my_vegtypes=crops_to_read, - time_slice=slice(f"{slice_year}-01-01", f"{slice_year}-12-31"), chunks=chunks, logger=logger, ) @@ -625,9 +611,8 @@ def import_and_process_1yr( log(logger, " Importing accumulated GDDs...") clm_gdd_var = "GDDACCUM" my_vars = [clm_gdd_var, "GDDHARV"] - h2_files = find_inst_hist_files(indir, h=2, this_year=this_year - 1, logger=logger) h2_ds = import_ds( - h2_files, + h2_filelist, my_vars=my_vars, my_vegtypes=crops_to_read, chunks=chunks, @@ -879,7 +864,6 @@ def import_and_process_1yr( incl_vegtypes_str, incl_patches1d_itype_veg, mxsowings, - h1_instantaneous, ) diff --git a/python/ctsm/test/test_unit_generate_gdds.py b/python/ctsm/test/test_unit_generate_gdds.py index 148be0fa3d..06b896d7e4 100755 --- a/python/ctsm/test/test_unit_generate_gdds.py +++ b/python/ctsm/test/test_unit_generate_gdds.py @@ -10,9 +10,11 @@ import tempfile import shutil import logging +import re import numpy as np import xarray as xr +from cftime import DatetimeNoLeap from ctsm import unit_testing from ctsm.crop_calendars import generate_gdds as gg @@ -557,6 +559,188 @@ def test_find_inst_hist_files_h_float_with_logger(self): gf.find_inst_hist_files(self.temp_dir, h=1.0, this_year=2000, logger=logger) +class TestGetFileLists(unittest.TestCase): + """Tests of _get_file_lists()""" + + def setUp(self): + """ + Set up and change to temporary directory + """ + self.prev_dir = os.getcwd() + self.temp_dir = tempfile.mkdtemp() + os.chdir(self.temp_dir) + + def tearDown(self): + """ + Delete temporary directory + """ + os.chdir(self.prev_dir) + shutil.rmtree(self.temp_dir, ignore_errors=True) + + def _create_test_file(self, filename): + """Helper to create an empty test file with time coordinate""" + filepath = os.path.join(self.temp_dir, filename) + + # Extract date from filename using regex (format: *.h#i.YYYY-MM-DD-*.nc) + match = re.search(r"(\d{4})-(\d{2})-(\d{2})", filename) + if match: + year, month, day = match.groups() + time_val = DatetimeNoLeap(int(year), int(month), int(day), has_year_zero=True) + else: + raise ValueError(f"Could not extract date from filename: {filename}") + + # Create a simple dataset with time coordinate + time = xr.DataArray([time_val], dims=["time"], name="time") + ds = xr.Dataset({"time": time}) + ds.to_netcdf(filepath) + + return filepath + + def test_get_file_lists_single_year(self): + """Test _get_file_lists with a single year of data""" + # Create h1 and h2 files for 2000 + h1_file = self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + h2_file = self._create_test_file("test.clm2.h2i.2000-01-01-00000.nc") + + time_slice_list = [slice("2000-01-01", "2000-12-31")] + + h1_file_lists, h2_file_lists = gg._get_file_lists( + self.temp_dir, time_slice_list, logger=None + ) + + # Should have one list for each time slice + self.assertEqual(len(h1_file_lists), 1) + self.assertEqual(len(h2_file_lists), 1) + + # Check contents of file lists + # pylint: disable=unsubscriptable-object + self.assertEqual(len(h1_file_lists[0]), 1) + self.assertEqual(len(h2_file_lists[0]), 1) + self.assertEqual(h1_file_lists[0], [h1_file]) + self.assertEqual(h2_file_lists[0], [h2_file]) + + def test_get_file_lists_multiple_years(self): + """Test _get_file_lists with multiple years of data""" + # Create h1 and h2 files for 2000-2002 + h1_files = [] + h2_files = [] + for year in [2000, 2001, 2002]: + h1_files.append(self._create_test_file(f"test.clm2.h1i.{year}-01-01-00000.nc")) + h2_files.append(self._create_test_file(f"test.clm2.h2i.{year}-01-01-00000.nc")) + + time_slice_list = [ + slice("2000-01-01", "2000-12-31"), + slice("2001-01-01", "2001-12-31"), + slice("2002-01-01", "2002-12-31"), + ] + + h1_file_lists, h2_file_lists = gg._get_file_lists( + self.temp_dir, time_slice_list, logger=None + ) + + # Should have one list for each time slice + self.assertEqual(len(h1_file_lists), 3) + self.assertEqual(len(h2_file_lists), 3) + + # Check contents of file lists + # pylint: disable=unsubscriptable-object + for i in range(3): + self.assertEqual(len(h1_file_lists[i]), 1) + self.assertEqual(len(h2_file_lists[i]), 1) + self.assertEqual(h1_file_lists[i], [h1_files[i]]) + self.assertEqual(h2_file_lists[i], [h2_files[i]]) + + def test_get_file_lists_multiple_files_per_slice(self): + """Test _get_file_lists when multiple files fall within a time slice""" + # Create multiple h1 and h2 files for 2000 + h1_files = [] + h2_files = [] + for month in ["01", "06", "12"]: + h1_files.append(self._create_test_file(f"test.clm2.h1i.2000-{month}-01-00000.nc")) + h2_files.append(self._create_test_file(f"test.clm2.h2i.2000-{month}-01-00000.nc")) + + time_slice_list = [slice("2000-01-01", "2000-12-31")] + + h1_file_lists, h2_file_lists = gg._get_file_lists( + self.temp_dir, time_slice_list, logger=None + ) + + # Should have one list for the time slice + self.assertEqual(len(h1_file_lists), 1) + self.assertEqual(len(h2_file_lists), 1) + + # Check contents of file lists (should be sorted) + # pylint: disable=unsubscriptable-object + self.assertEqual(len(h1_file_lists[0]), 3) + self.assertEqual(len(h2_file_lists[0]), 3) + self.assertEqual(h1_file_lists[0], sorted(h1_files)) + self.assertEqual(h2_file_lists[0], sorted(h2_files)) + + def test_get_file_lists_no_h1_files(self): + """Test _get_file_lists when h1 files are missing""" + # Create only h2 files + self._create_test_file("test.clm2.h2i.2000-01-01-00000.nc") + + time_slice_list = [slice("2000-01-01", "2000-12-31")] + + # Should raise FileNotFoundError when h1 files are not found + with self.assertRaises(FileNotFoundError): + gg._get_file_lists(self.temp_dir, time_slice_list, logger=None) + + def test_get_file_lists_no_h2_files(self): + """Test _get_file_lists when h2 files are missing""" + # Create only h1 files + self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + + time_slice_list = [slice("2000-01-01", "2000-12-31")] + + # Should raise FileNotFoundError when h2 files are not found + with self.assertRaises(FileNotFoundError): + gg._get_file_lists(self.temp_dir, time_slice_list, logger=None) + + def test_get_file_lists_h1_outside_time_slice(self): + """Test _get_file_lists when h1 files exist but have no timesteps in the slice""" + # Create h1 files for 2000 and h2 files for 2001 + self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + self._create_test_file("test.clm2.h2i.2001-01-01-00000.nc") + + # Request time slice for 2001 (h1 files exist but are outside the slice) + time_slice_list = [slice("2001-01-01", "2001-12-31")] + + # Should raise FileNotFoundError when h1 files have no timesteps in slice + with self.assertRaisesRegex(FileNotFoundError, "h1"): + gg._get_file_lists(self.temp_dir, time_slice_list, logger=None) + + def test_get_file_lists_h2_outside_time_slice(self): + """Test _get_file_lists when h2 files exist but have no timesteps in the slice""" + # Create h1 files for 2001 and h2 files for 2000 + self._create_test_file("test.clm2.h1i.2001-01-01-00000.nc") + self._create_test_file("test.clm2.h2i.2000-01-01-00000.nc") + + # Request time slice for 2001 (h2 files exist but are outside the slice) + time_slice_list = [slice("2001-01-01", "2001-12-31")] + + # Should raise FileNotFoundError when h2 files have no timesteps in slice + with self.assertRaisesRegex(FileNotFoundError, "h2"): + gg._get_file_lists(self.temp_dir, time_slice_list, logger=None) + + def test_get_file_lists_partial_overlap(self): + """Test _get_file_lists when some time slices have files and others don't""" + # Create h1 and h2 files for 2000 only + self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + self._create_test_file("test.clm2.h2i.2000-01-01-00000.nc") + + # Request time slices for 2000 and 2001 + time_slice_list = [ + slice("2000-01-01", "2000-12-31"), + slice("2001-01-01", "2001-12-31"), + ] + + # Should raise FileNotFoundError when second time slice has no files + with self.assertRaises(FileNotFoundError): + gg._get_file_lists(self.temp_dir, time_slice_list, logger=None) + + if __name__ == "__main__": unit_testing.setup_for_tests() unittest.main() From 598de2f05638286b3d99ac0ed120977cbc554c3d Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 4 Feb 2026 15:43:21 -0700 Subject: [PATCH 51/57] generate_gdds: Reformat with black. --- python/ctsm/crop_calendars/generate_gdds.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index 094062e17f..b482b5b4fd 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -22,8 +22,8 @@ import ctsm.crop_calendars.cropcal_module as cc # pylint: disable=wrong-import-position import ctsm.crop_calendars.generate_gdds_functions as gddfn # pylint: disable=wrong-import-position from ctsm.crop_calendars.import_ds import ( # pylint: disable=wrong-import-position - get_files_in_time_slice, # pylint: disable=wrong-import-position -) # pylint: disable=wrong-import-position + get_files_in_time_slice, # pylint: disable=wrong-import-position +) # pylint: disable=wrong-import-position # Functions here were written with too many positional arguments. At some point that should be # fixed. For now, we'll just disable the warning. From 879400cd7280b16bced3b8cdcc29a0462375ef0e Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 4 Feb 2026 15:43:47 -0700 Subject: [PATCH 52/57] Add previous commit to .git-blame-ignore-revs. --- .git-blame-ignore-revs | 1 + 1 file changed, 1 insertion(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 0cec06fb3f..bb425bb602 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -76,3 +76,4 @@ cdf40d265cc82775607a1bf25f5f527bacc97405 ac03492012837799b7111607188acff9f739044a d858665d799690d73b56bcb961684382551193f4 c0c6da391ee359f2765439426f3a2a4593a95343 +598de2f05638286b3d99ac0ed120977cbc554c3d From 2f429cd28d90063feb3b25e0325a1f7b33f9e659 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 4 Feb 2026 15:48:07 -0700 Subject: [PATCH 53/57] test_unit_generate_gdds: Fix test_find_inst_hist_files_prefer_nc_over_base. --- python/ctsm/test/test_unit_generate_gdds.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/ctsm/test/test_unit_generate_gdds.py b/python/ctsm/test/test_unit_generate_gdds.py index 06b896d7e4..c14dc0b961 100755 --- a/python/ctsm/test/test_unit_generate_gdds.py +++ b/python/ctsm/test/test_unit_generate_gdds.py @@ -462,12 +462,13 @@ def test_find_inst_hist_files_prefer_nc_over_base(self): """Test that .nc files are preferred over .nc.base files""" # Create both .nc and .nc.base files file_nc = self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") + file_nc_base = self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc.base") result = gf.find_inst_hist_files(self.temp_dir, h=1, this_year=None) # Should find .nc files first (pattern order preference) self.assertIn(file_nc, result) - # .nc.base should only be found if no .nc files exist + self.assertNotIn(file_nc_base, result) def test_find_inst_hist_files_multiple_months_same_year(self): """Test finding multiple files from the same year""" From 16d118284e159e950a5ed005963b3d20d97ea207 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 4 Feb 2026 16:08:51 -0700 Subject: [PATCH 54/57] test_unit_generate_gdds: Check more error messages. --- python/ctsm/test/test_unit_generate_gdds.py | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/python/ctsm/test/test_unit_generate_gdds.py b/python/ctsm/test/test_unit_generate_gdds.py index c14dc0b961..5c0219cd09 100755 --- a/python/ctsm/test/test_unit_generate_gdds.py +++ b/python/ctsm/test/test_unit_generate_gdds.py @@ -493,7 +493,7 @@ def test_find_inst_hist_files_no_files_found(self): self._create_test_file("test.clm2.h0.2000-01-01-00000.nc") # Should raise a FileNotFoundError error - with self.assertRaises(FileNotFoundError): + with self.assertRaisesRegex(FileNotFoundError, "No files found matching patterns"): gf.find_inst_hist_files(self.temp_dir, h=1, this_year=None) def test_find_inst_hist_files_different_case_names(self): @@ -504,7 +504,7 @@ def test_find_inst_hist_files_different_case_names(self): self._create_test_file("longcasename.clm2.h1i.2000-01-01-00000.nc") # Should raise RuntimeError due to multiple case names - with self.assertRaises(RuntimeError): + with self.assertRaisesRegex(RuntimeError, "Found files from multiple case names"): gf.find_inst_hist_files(self.temp_dir, h=1, this_year=2000) def test_find_inst_hist_files_different_case_names_with_logger(self): @@ -521,7 +521,7 @@ def test_find_inst_hist_files_different_case_names_with_logger(self): self._create_test_file("longcasename.clm2.h1i.2000-01-01-00000.nc") # Should raise RuntimeError due to multiple case names, even with logger - with self.assertRaises(RuntimeError): + with self.assertRaisesRegex(RuntimeError, "Found files from multiple case names"): gf.find_inst_hist_files(self.temp_dir, h=1, this_year=2000, logger=logger) def test_find_inst_hist_files_no_files_found_with_logger(self): @@ -534,7 +534,7 @@ def test_find_inst_hist_files_no_files_found_with_logger(self): self._create_test_file("test.clm2.h0.2000-01-01-00000.nc") # Should raise a FileNotFoundError even with logger - with self.assertRaises(FileNotFoundError): + with self.assertRaisesRegex(FileNotFoundError, "No files found matching patterns"): gf.find_inst_hist_files(self.temp_dir, h=1, this_year=None, logger=logger) def test_find_inst_hist_files_h_str_with_logger(self): @@ -545,7 +545,7 @@ def test_find_inst_hist_files_h_str_with_logger(self): self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") - with self.assertRaises(TypeError): + with self.assertRaisesRegex(TypeError, "must be an integer, not"): gf.find_inst_hist_files(self.temp_dir, h="1", this_year=2000, logger=logger) def test_find_inst_hist_files_h_float_with_logger(self): @@ -556,7 +556,7 @@ def test_find_inst_hist_files_h_float_with_logger(self): self._create_test_file("test.clm2.h1i.2000-01-01-00000.nc") - with self.assertRaises(TypeError): + with self.assertRaisesRegex(TypeError, "must be an integer, not"): gf.find_inst_hist_files(self.temp_dir, h=1.0, this_year=2000, logger=logger) @@ -685,7 +685,7 @@ def test_get_file_lists_no_h1_files(self): time_slice_list = [slice("2000-01-01", "2000-12-31")] # Should raise FileNotFoundError when h1 files are not found - with self.assertRaises(FileNotFoundError): + with self.assertRaisesRegex(FileNotFoundError, "No files found matching patterns"): gg._get_file_lists(self.temp_dir, time_slice_list, logger=None) def test_get_file_lists_no_h2_files(self): @@ -696,7 +696,7 @@ def test_get_file_lists_no_h2_files(self): time_slice_list = [slice("2000-01-01", "2000-12-31")] # Should raise FileNotFoundError when h2 files are not found - with self.assertRaises(FileNotFoundError): + with self.assertRaisesRegex(FileNotFoundError, "No files found matching patterns"): gg._get_file_lists(self.temp_dir, time_slice_list, logger=None) def test_get_file_lists_h1_outside_time_slice(self): @@ -709,7 +709,7 @@ def test_get_file_lists_h1_outside_time_slice(self): time_slice_list = [slice("2001-01-01", "2001-12-31")] # Should raise FileNotFoundError when h1 files have no timesteps in slice - with self.assertRaisesRegex(FileNotFoundError, "h1"): + with self.assertRaisesRegex(FileNotFoundError, "No h1 timesteps found in"): gg._get_file_lists(self.temp_dir, time_slice_list, logger=None) def test_get_file_lists_h2_outside_time_slice(self): @@ -722,7 +722,7 @@ def test_get_file_lists_h2_outside_time_slice(self): time_slice_list = [slice("2001-01-01", "2001-12-31")] # Should raise FileNotFoundError when h2 files have no timesteps in slice - with self.assertRaisesRegex(FileNotFoundError, "h2"): + with self.assertRaisesRegex(FileNotFoundError, "No h2 timesteps found in"): gg._get_file_lists(self.temp_dir, time_slice_list, logger=None) def test_get_file_lists_partial_overlap(self): @@ -738,7 +738,7 @@ def test_get_file_lists_partial_overlap(self): ] # Should raise FileNotFoundError when second time slice has no files - with self.assertRaises(FileNotFoundError): + with self.assertRaisesRegex(FileNotFoundError, "No h1 timesteps found in"): gg._get_file_lists(self.temp_dir, time_slice_list, logger=None) From fbf09a038ccc9c7eae367089e89ddbbe7ce38a25 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 4 Feb 2026 17:06:56 -0700 Subject: [PATCH 55/57] generate_gdds: Explain pickle resume. --- python/ctsm/crop_calendars/generate_gdds.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/ctsm/crop_calendars/generate_gdds.py b/python/ctsm/crop_calendars/generate_gdds.py index b482b5b4fd..196d7a96da 100644 --- a/python/ctsm/crop_calendars/generate_gdds.py +++ b/python/ctsm/crop_calendars/generate_gdds.py @@ -195,6 +195,9 @@ def main( + "(years are +1 because of CTSM output naming)", ) + # This script uses pickle to save work in progress. In case of interruption, when the script + # is resumed, it will look for a pickle file. It will resume from the year after + # pickle_year, which is the last processed year in the pickle file. pickle_file = os.path.join(output_dir, f"{first_season}-{last_season}.pickle") h2_ds_file = os.path.join(output_dir, f"{first_season}-{last_season}.h2_ds.nc") if os.path.exists(pickle_file) and not no_pickle: @@ -236,6 +239,8 @@ def main( h1_file_lists, h2_file_lists = _get_file_lists(input_dir, time_slice_list, logger) for yr_index, this_yr in enumerate(_get_history_yr_range(first_season, last_season)): + # If resuming from a pickled file, we continue until we reach a year that hasn't yet + # been processed. if this_yr <= pickle_year: continue log(logger, f"netCDF year {this_yr}...") From 90c4d0e7bf17c1d3ae801ca1b82a961bd2a51e79 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 5 Feb 2026 11:18:18 -0700 Subject: [PATCH 56/57] Add RXCROPMATURITY tests to expected fails. See ESCOMP/CTSM#3740. --- cime_config/testdefs/ExpectedTestFails.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index d19bcf05a6..b00f3e720e 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -36,6 +36,27 @@ + + + FAIL + #3740 + + + + + + FAIL + #3740 + + + + + + FAIL + #3740 + + + FAIL From 7d486e5b51d071a2914e93dfe667f6b40f9b5f91 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 6 Feb 2026 10:51:32 -0700 Subject: [PATCH 57/57] Update ChangeLog and ChangeSum. --- doc/ChangeLog | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 77 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 4499e73421..d249248af9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,80 @@ =============================================================== +Tag name: ctsm5.4.016 +Originator(s): samrabin (Sam Rabin, UCAR/TSS) +Date: Fri Feb 6 09:09:56 MST 2026 +One-line Summary: Merge b4b-dev to master + +Purpose and description of changes +---------------------------------- + +Merge b4b-dev to master + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + +[ ] clm6_0 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed +---------- + +List of CTSM issues fixed (include CTSM Issue # and description): +- [ESCOMP/CTSM Issue #3696: CropPhenology: Rename leafout to gddtsoi](https://github.com/ESCOMP/CTSM/issues/3696) +- [ESCOMP/CTSM Issue #3057: error in errsol computation in BalanceCheckMod reports the wrong albedo values](https://github.com/ESCOMP/CTSM/issues/3057) + + +Notes of particular relevance for users +--------------------------------------- + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): +- New `suppress_gddmaturity_warning` namelist flag, default false. + + +Notes of particular relevance for developers: +--------------------------------------------- + +Changes to tests or testing: +- New Python unit and system tests. +- New Fortran unit tests. +- RXCROPMATURITY_ tests added to expected failure list. Will be resolved soon. + + +Testing summary: +---------------- + + python testing (if python code has changed; see instructions in python/README.md; document testing done): + + derecho - OK + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + derecho ----- OK + izumi ------- OK + + +Other details +------------- + +Pull Requests that document the changes (include PR ids): +- [ESCOMP/CTSM Pull Request #3713: Factor out new subroutine CropPhase_OnePatch](https://github.com/ESCOMP/CTSM/pull/3713) +- [ESCOMP/CTSM Pull Request #3633: Add history outputs: Crop biomass and LAI per harvest](https://github.com/ESCOMP/CTSM/pull/3633) +- [ESCOMP/CTSM Pull Request #3727: Minor improvements to generate_gdd20_baseline.py](https://github.com/ESCOMP/CTSM/pull/3727) +- [ESCOMP/CTSM Pull Request #3710: Improve radiation balance check](https://github.com/ESCOMP/CTSM/pull/3710) +- [ESCOMP/CTSM Pull Request #3729: generate_gdds: Work on arguments](https://github.com/ESCOMP/CTSM/pull/3729) +- [ESCOMP/CTSM Pull Request #3738: generate_gdds: Get file lists earlier](https://github.com/ESCOMP/CTSM/pull/3738) +- [ESCOMP/CTSM Pull Request #3741: ctsm5.4.016: b4b-dev merge 2026-02-05](https://github.com/ESCOMP/CTSM/pull/3741) + +=============================================================== +=============================================================== Tag name: ctsm5.4.015 Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) Date: Tue Feb 3 12:29:48 AM MST 2026 diff --git a/doc/ChangeSum b/doc/ChangeSum index 181087b6cc..a5074a75c6 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.4.016 samrabin 02/06/2026 Merge b4b-dev to master ctsm5.4.015 erik 02/03/2026 Update CISM to latest version with answer changes ctsm5.4.014 mvdebols 01/29/2026 Fix for xm2 and revise logic for excess ice melt ctsm5.4.013 erik 01/28/2026 Patch the Greenland snow hole with initial conditions for ne30 and tweak the C14 isotope latitudes