Skip to content

Changing the default contents of output files

Marcos Longo edited this page Feb 11, 2021 · 2 revisions

Caution

Only the default set of variable assigned to each output file type, have been tested. Many variables are only correct, interpretable and properly averaged, because they are preprocessed at the correct time in the code. Including variables that were not intended to be output variables in the output can create confusion. If in doubt, we recommend opening an issue first.

Currently, there is no way of modifying the output without changing the code, specifically (file ed_state_vars.f90). To do this, you must know the hierarchical level, the dimensions (e.g., scalar, by soil layer, by PFT, etc.), and the kind of variable (real or integer). Once you identify, you must look for the proper subroutine and the variable dimension ID (a unique flag used internally by ED2).

List of output dimensions

Dimension Description
npoly Number of polygons
nsite Number of sites (across all polygons)
npatch Number of patches (across all sites and polygons)
ncohort Number of cohorts (across all patches, sites, and polygons)
nzg Number of soil layers
nzs Number of temporary surface water layers
ndcycle Number of hours of the day for mean diurnal cycle
npft Number of plant function type classes
ndbh Number of diameter at breast height classes
ndist Number of disturbance types
nstext Number of soil texture classes
nmort Number of mortality type classes
nmonth Number of months
nmonth+1 Number of months + 1 value for placeholder
nffhgt Number of height classes for patch fusion
nradprof Number of radiation profiles

Existing variable types in ED2

Hierarchical level Kind Dimensions Specific type Subroutine Dimension ID
Global Integer 1 n/a filltab_globtype 90
Global Real 1 n/a filltab_globtype 91
Global Real nzg n/a filltab_globtype 92
Global Real nffhgt n/a filltab_globtype 96
Global Integer nstext n/a filltab_globtype 980
Global Real nstext n/a filltab_globtype 98
Polygon (cgrid) Integer npoly n/a filltab_edtype_p10 10
Polygon (cgrid) Real (ndcycle,npoly) QMEAN filltab_edtype_m11 -11
Polygon (cgrid) Real npoly FMEAN filltab_edtype_p11fmean 11
Polygon (cgrid) Real npoly DMEAN filltab_edtype_p11dmean 11
Polygon (cgrid) Real npoly MMEAN, MMSQU filltab_edtype_p11mmean 11
Polygon (cgrid) Real npoly others filltab_edtype_p11inst 11
Polygon (cgrid) Real (ndcycle,nzg,npoly) QMEAN filltab_edtype_p12 -12
Polygon (cgrid) Real (nzg,npoly) others filltab_edtype_p12 12
Polygon (cgrid) Real (npft,ndbh,npoly) n/a filltab_edtype_p146 146
Polygon (cgrid) Real (nmonth,npoly) n/a filltab_edtype_p19 19
Polygon (cgrid) Real (nmonth+1,npoly) n/a filltab_edtype_p191 191
Site (cpoly) Integer nsite n/a filltab_polygontype_p20 20
Site (cpoly) Real (ndcycle,nsite) QMEAN filltab_polygontype_m21 -21
Site (cpoly) Real nsite FMEAN filltab_polygontype_p21fmean 21
Site (cpoly) Real nsite DMEAN filltab_polygontype_p21dmean 21
Site (cpoly) Real nsite MMEAN, MMSQU filltab_polygontype_p21mmean 21
Site (cpoly) Real nsite n/a filltab_polygontype_p21inst 21
Site (cpoly) Integer (nzg,nsite) n/a filltab_polygontype_p220 220
Site (cpoly) Real (npft,nsite) n/a filltab_polygontype_p24 24
Site (cpoly) Real (npft,ndbh,nsite) n/a filltab_polygontype_p246 246
Site (cpoly) Real (ndist,ndist,nsite) n/a filltab_polygontype_p255 255
Patch (csite) Integer npatch n/a filltab_sitetype_p30 30
Patch (csite) Real (ndcycle,npatch) QMEAN filltab_sitetype_m31 -31
Patch (csite) Real npatch FMEAN filltab_sitetype_p31fmean 31
Patch (csite) Real npatch DMEAN filltab_sitetype_p31dmean 31
Patch (csite) Real npatch MMEAN, MMSQU filltab_sitetype_p31mmean 31
Patch (csite) Real npatch Budget filltab_sitetype_p31budget 31
Patch (csite) Real npatch n/a filltab_sitetype_p31inst 31
Patch (csite) Real (ndcycle,nzg,npatch) QMEAN filltab_sitetype_m32 -32
Patch (csite) Real (nzg,npatch) n/a filltab_sitetype_p32 32
Patch (csite) Real (nzs,npatch) n/a filltab_sitetype_p33 33
Patch (csite) Real (npft,npatch) n/a filltab_sitetype_p34 34
Patch (csite) Real (npft,ndbh,npatch) n/a filltab_sitetype_p346 346
Cohort (cpatch) Integer npatch n/a filltab_patchtype_p40 40
Cohort (cpatch) Real (ndcycle,npatch) QMEAN filltab_patchtype_m41 -41
Cohort (cpatch) Real npatch FMEAN filltab_patchtype_p41fmean 41
Cohort (cpatch) Real npatch DMEAN filltab_patchtype_p41dmean 41
Cohort (cpatch) Real npatch MMEAN, MMSQU filltab_patchtype_p41mmean 41
Cohort (cpatch) Real npatch Daily integration filltab_patchtype_p41today 41
Cohort (cpatch) Real npatch n/a filltab_patchtype_p41inst 41
Cohort (cpatch) Real (nzg,npatch) n/a filltab_patchtype_p42 42
Cohort (cpatch) Real (nmort,npatch) n/a filltab_patchtype_p48 48
Cohort (cpatch) Real (ndcycle,nradprof,npatch) QMEAN filltab_patchtype_m411 -411
Cohort (cpatch) Real (nradprof,npatch) n/a filltab_patchtype_p411 411
Cohort (cpatch) Real (nmonth+1,npatch) n/a filltab_patchtype_p491 491

Editing the output controls

Once you identified the sub-routine, go to the code and search for the variable you would like to modify. You should find a block of code similar to this:

      if (associated(cpoly%some_variable)) then
         nvar=nvar+1
         call vtable_edio_r(npts,cpoly%some_variable                                       &
                           ,nvar,igr,init,cpoly%siglob_id,var_len,var_len_global,max_ptrs  &
                           ,'SOME_VARIABLE_SI :21:hist:anal') 
         call metadata_edio(nvar,igr,'Example variable for Wiki','[X/m2]','(isi)')
      end if

The last argument of subroutine vtable_edio_r (or vtable_edio_i for integer variables) has the instructions on to which output files ED2 should include variable cpoly%some_variable. Items are organised in tokens, separated by ":". The first argument is the variable name in the HDF5 file, the second is the dimension ID from the table above, and the other tokens are the output files. The current token options for outputs are:

Token File type File identifier
(-X- tag)
ED2IN flag
controlling
output
hist State (history) -S- NL%ISOUTPUT
anal Sub-daily -I- NL%IFOUTPUT or NL%IOOUTPUT
dail Daily -D- NL%IDOUTPUT
mont Monthly -E- NL%IMOUTPUT
dcyc Mean diel -Q- NL%IQOUTPUT
year Yearly -Y- NL%IYOUTPUT
opti Tower -T- NL%ITOUTPUT

Adding (removing) one of the tokens above (along with leading or trailing ":") will include (exclude) the variable from the corresponding output file. The changes will be implemented once you recompile the code.