ESCOMP / CTSM

Community Terrestrial Systems Model (includes the Community Land Model of CESM)
http://www.cesm.ucar.edu/models/cesm2.0/land/
Other
308 stars 312 forks source link

Some lines longer than 132 characters #464

Closed billsacks closed 6 years ago

billsacks commented 6 years ago

Brief summary of bug

By running the code through https://github.com/NCAR/code-format-checker, I found a few dozen lines of code that are longer than 132 lines. I'm not sure why our NAG tests didn't pick this up.

General bug information

CTSM version you are using: ctsm1.0.dev004-24-geb61a048 . Some problems are new to this branch, some look to be pre-existing on master.

Does this bug cause significantly incorrect results in the model's science? No (probably not... though it's possible that runs with NAG are working incorrectly)

Configurations affected: Potentially will cause build failures with NAG compiler

Important output or errors that show the problem

/Users/sacks/ctsm/isotope_prep/src/fates/biogeochem/EDPhysiologyMod.F90 (line 2351, columns 133):
                       currentpatch%root_litter_out(ft) * EDPftvarcon_inst%fr_flab(ft) * currentpatch%area/AREA * froot_prof(s,ft,j)

/Users/sacks/ctsm/isotope_prep/src/fates/biogeochem/EDPhysiologyMod.F90 (line 2353, columns 133):
                       currentpatch%root_litter_out(ft) * EDPftvarcon_inst%fr_fcel(ft) * currentpatch%area/AREA * froot_prof(s,ft,j)

/Users/sacks/ctsm/isotope_prep/src/fates/biogeochem/EDPhysiologyMod.F90 (line 2355, columns 133):
                       currentpatch%root_litter_out(ft) * EDPftvarcon_inst%fr_flig(ft) * currentpatch%area/AREA * froot_prof(s,ft,j)

/Users/sacks/ctsm/isotope_prep/src/fates/biogeochem/EDCohortDynamicsMod.F90 (line 533, columns 133):
                     SF_val_CWD_frac(c) * (1.0_r8 -  EDPftvarcon_inst%allom_agb_frac(currentCohort%pft))  * hlm_days_per_year / AREA

/Users/sacks/ctsm/isotope_prep/src/fates/biogeochem/EDCohortDynamicsMod.F90 (line 800, columns 133):
                                      if (currentCohort%year_net_uptake(i) == 999._r8 .or. nextc%year_net_uptake(i) == 999._r8) then

/Users/sacks/ctsm/isotope_prep/src/fates/biogeophys/EDSurfaceAlbedoMod.F90 (line 770, columns 133):
                                tr_soild = tr_soild + forc_dir(ifp,ib) * weighted_dir_tr(L-1) * (1.0_r8-sum(ftweight(L,1:numpft,1)))

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNFUNMod.F90 (line 1239, columns 155):
                       frac_ideal_C_use = frac_ideal_C_use + (1.0_r8-frac_ideal_C_use)*min(1.0_r8, delta_CN/fun_cn_flex_c(ivt(p)));                       

/Users/sacks/ctsm/isotope_prep/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 (line 957, columns 133):
                  frootcn_actual = cnveg_carbonstate_inst%frootc_storage_patch(p) / cnveg_nitrogenstate_inst%frootn_storage_patch(p)

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNNStateUpdate1Mod.F90 (line 237, columns 133):
            ns_veg%npool_patch(p)              = ns_veg%npool_patch(p)              - nf_veg%npool_to_livecrootn_storage_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNNStateUpdate1Mod.F90 (line 238, columns 133):
            ns_veg%livecrootn_storage_patch(p) = ns_veg%livecrootn_storage_patch(p) + nf_veg%npool_to_livecrootn_storage_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNNStateUpdate1Mod.F90 (line 241, columns 133):
            ns_veg%npool_patch(p)              = ns_veg%npool_patch(p)              - nf_veg%npool_to_deadcrootn_storage_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNNStateUpdate1Mod.F90 (line 242, columns 133):
            ns_veg%deadcrootn_storage_patch(p) = ns_veg%deadcrootn_storage_patch(p) + nf_veg%npool_to_deadcrootn_storage_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNCStateUpdate1Mod.F90 (line 262, columns 133):
                cs_veg%livecrootc_patch(p)      = cs_veg%livecrootc_patch(p)      + cf_veg%livecrootc_xfer_to_livecrootc_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNCStateUpdate1Mod.F90 (line 263, columns 133):
                cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) - cf_veg%livecrootc_xfer_to_livecrootc_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNCStateUpdate1Mod.F90 (line 264, columns 133):
                cs_veg%deadcrootc_patch(p)      = cs_veg%deadcrootc_patch(p)      + cf_veg%deadcrootc_xfer_to_deadcrootc_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNCStateUpdate1Mod.F90 (line 265, columns 133):
                cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) - cf_veg%deadcrootc_xfer_to_deadcrootc_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNCStateUpdate1Mod.F90 (line 367, columns 133):
            cs_veg%cpool_patch(p)              = cs_veg%cpool_patch(p)              - cf_veg%cpool_to_livecrootc_storage_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNCStateUpdate1Mod.F90 (line 368, columns 133):
            cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p) + cf_veg%cpool_to_livecrootc_storage_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNCStateUpdate1Mod.F90 (line 371, columns 133):
            cs_veg%cpool_patch(p)              = cs_veg%cpool_patch(p)              - cf_veg%cpool_to_deadcrootc_storage_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNCStateUpdate1Mod.F90 (line 372, columns 133):
            cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p) + cf_veg%cpool_to_deadcrootc_storage_patch(p)*dt

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 196, columns 138):
           cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p)        = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * 10._r8        

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 243, columns 133):
         cnveg_nitrogenflux_inst%m_leafn_storage_to_litter_patch(p)       = cnveg_nitrogenstate_inst%leafn_storage_patch(p)      * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 244, columns 133):
         cnveg_nitrogenflux_inst%m_frootn_storage_to_litter_patch(p)      = cnveg_nitrogenstate_inst%frootn_storage_patch(p)     * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 245, columns 133):
         cnveg_nitrogenflux_inst%m_livestemn_storage_to_litter_patch(p)   = cnveg_nitrogenstate_inst%livestemn_storage_patch(p)  * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 246, columns 133):
         cnveg_nitrogenflux_inst%m_deadstemn_storage_to_litter_patch(p)   = cnveg_nitrogenstate_inst%deadstemn_storage_patch(p)  * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 247, columns 133):
         cnveg_nitrogenflux_inst%m_livecrootn_storage_to_litter_patch(p)  = cnveg_nitrogenstate_inst%livecrootn_storage_patch(p) * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 248, columns 133):
         cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_litter_patch(p)  = cnveg_nitrogenstate_inst%deadcrootn_storage_patch(p) * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 251, columns 133):
         cnveg_nitrogenflux_inst%m_leafn_xfer_to_litter_patch(p)          = cnveg_nitrogenstate_inst%leafn_xfer_patch(p)         * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 252, columns 133):
         cnveg_nitrogenflux_inst%m_frootn_xfer_to_litter_patch(p)         = cnveg_nitrogenstate_inst%frootn_xfer_patch(p)        * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 253, columns 133):
         cnveg_nitrogenflux_inst%m_livestemn_xfer_to_litter_patch(p)      = cnveg_nitrogenstate_inst%livestemn_xfer_patch(p)     * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 254, columns 133):
         cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_litter_patch(p)      = cnveg_nitrogenstate_inst%deadstemn_xfer_patch(p)     * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 255, columns 133):
         cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_litter_patch(p)     = cnveg_nitrogenstate_inst%livecrootn_xfer_patch(p)    * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNGapMortalityMod.F90 (line 256, columns 133):
         cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_litter_patch(p)     = cnveg_nitrogenstate_inst%deadcrootn_xfer_patch(p)    * m

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNDriverMod.F90 (line 755, columns 133):
    call cnfire_method%CNFireFluxes(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp,                                      &

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNDriverMod.F90 (line 756, columns 133):
         dgvs_inst, cnveg_state_inst,                                                                                              &

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNDriverMod.F90 (line 757, columns 133):
         cnveg_carbonstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst,                         &

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNDriverMod.F90 (line 758, columns 133):
         leaf_prof_patch=soilbiogeochem_state_inst%leaf_prof_patch(begp:endp, 1:nlevdecomp_full),                                  &

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNDriverMod.F90 (line 759, columns 134):
         froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp, 1:nlevdecomp_full),                                & 

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNDriverMod.F90 (line 760, columns 133):
         croot_prof_patch=soilbiogeochem_state_inst%croot_prof_patch(begp:endp, 1:nlevdecomp_full),                                &

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNDriverMod.F90 (line 761, columns 133):
         stem_prof_patch=soilbiogeochem_state_inst%stem_prof_patch(begp:endp, 1:nlevdecomp_full),                                  &

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNDriverMod.F90 (line 762, columns 133):
         totsomc_col=soilbiogeochem_carbonstate_inst%totsomc_col(begc:endc),                                                       &

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNDriverMod.F90 (line 763, columns 133):
         decomp_cpools_vr_col=soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools),   &

/Users/sacks/ctsm/isotope_prep/src/biogeochem/CNDriverMod.F90 (line 764, columns 133):
         decomp_npools_vr_col=soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools), &

/Users/sacks/ctsm/isotope_prep/src/utils/clmfates_interfaceMod.F90 (line 1127, columns 134):
   subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, canopystate_inst, soilstate_inst, frictionvel_inst)

/Users/sacks/ctsm/isotope_prep/src/main/lnd2atmMod.F90 (line 393, columns 133):
       waterdiagnosticbulk_inst%tws_grc(g) = waterdiagnosticbulk_inst%tws_grc(g) + atm2lnd_inst%volr_grc(g) / grc%area(g) * 1.e-3_r8

/Users/sacks/ctsm/isotope_prep/src/main/initVerticalMod.F90 (line 484, columns 133):
             call endrun( 'ERROR:: zbedrock not found on surface data set, and use_bedrock is true.'//errmsg(sourcefile, __LINE__) )

/Users/sacks/ctsm/isotope_prep/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 (line 271, columns 133):
              longname =  'decomp. of '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//&

/Users/sacks/ctsm/isotope_prep/src/biogeophys/WaterFluxType.F90 (line 245, columns 147):
         long_name=this%info%lname('surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff from QSNWCPICE'), &

/Users/sacks/ctsm/isotope_prep/src/biogeophys/HydrologyNoDrainageMod.F90 (line 226, columns 137):
      if ( use_fates ) call clm_fates%ComputeRootSoilFlux(bounds, num_hydrologyc, filter_hydrologyc, soilstate_inst, waterfluxbulk_inst)

/Users/sacks/ctsm/isotope_prep/src/biogeophys/HydrologyNoDrainageMod.F90 (line 240, columns 136):
              soilhydrology_inst, soilstate_inst, temperature_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst) 

/Users/sacks/ctsm/isotope_prep/src/biogeophys/WaterDiagnosticBulkType.F90 (line 712, columns 142):
                                      (waterstatebulk_inst%h2osoi_liq_col(c,col%snl(c)+1)+waterstatebulk_inst%h2osoi_ice_col(c,col%snl(c)+1))

/Users/sacks/ctsm/isotope_prep/src/biogeophys/CanopyFluxesMod.F90 (line 859, columns 136):
                    canopystate_inst, ozone_inst, photosyns_inst, waterfluxbulk_inst, froot_carbon(begp:endp), croot_carbon(begp:endp))

/Users/sacks/ctsm/isotope_prep/src/biogeophys/CanopyTemperatureMod.F90 (line 230, columns 149):
      call calc_soilevap_resis(bounds, num_nolakec, filter_nolakec, soilstate_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, temperature_inst)

Test FAILED!
Found at least one file exceding 132 character limit

Settings:
src_dir:          /Users/sacks/ctsm/isotope_prep/src
test:             regular
description:      regular code lines (w/o comments) exeeding character limit
character limit:  132
extension:        F90
comment:          !
silent:           False
billsacks commented 6 years ago

I realized there's an off-by-one error in that script, so things mentioning 133 characters are actually okay.

billsacks commented 6 years ago

It turns out that the problems on master were not really problems - the only offending lines were due to trailing whitespace. So the only real problems came in in ctsm1.0.dev005.

(I'm running the script with: code-format-checker/CodeFormatChecker.py -t rc -l 133)

rgknox commented 6 years ago

That is a neat format checking tool. That is the kind of thing I would like to add to continuous integration if we ever get it running for fates.

billsacks commented 6 years ago

@rgknox see also https://github.com/marbl-ecosys/MARBL/blob/development/MARBL_tools/code_consistency.py

There are things I like about both of those tools, though neither one works exactly as I'd like right now.