subroutine addfld(name,long_name,units, | f,dname1,lb1,ub1,dname2,lb2,ub2,idx) ! ! Purpose: ! Save user-provided data f to secondary history field structure. ! ! Basically, the user provides a 2d array in any dimension combination ! (geo or mag) containing all or part of the global domain, along with ! the field name, long_name, and units. This data is saved in either ! 2d (lon,lat), or 3d (lon,lat,lev) data arrays (fsechist(i)%data) for ! the final history variable at the current model time. ! ! If all 3 spatial dimensions are desired on the history, idx is the ! index of the 3rd dimension (i.e., the dimension not specified by ! dname1 and dname2). In this case, addfld is called from inside a ! loop over the 3rd dimension. If only 2 spatial dimensions are desired ! (lon,lat) then idx can be zero. However, only the levs dimension can ! be excluded (i.e., idx can be zero only if saving a horizontal slice, ! see table below) ! ! This routine saves the data and field information in the derived type ! fsechist(n) (see fields.F). The final variable on the history will be ! either (lon,lat,lev,time), or (lon,lat,time), geo or mag (see subs ! def_fsech and wrfsech in nchist.F). ! ! On Input: ! dname1 Name (char string) of 1st dimension of f (see table below) ! lb1,ub1 Lower and upper integer bounds of 1st dimension of f ! (must be within full domain dimension sizes, see table below) ! dname2 Name (char string) of 2nd dimension of f (see table below) ! lb2,ub2 Lower and upper integer bounds of 2nd dimension of f ! (must be within full domain dimension sizes, see table below) ! f(lb1:ub1,lb2:ub2) ! Full or sub domain data to be saved for secondary history ! idx Index of 3rd dimension (or 0 if writing horizontal slice only) ! (idx can be 0 only if providing f(lon,lat) or f(lat,lon)) ! name Name of field (should be in namelist SECFLDS) (<= 16 chars) ! long_name Optional long name of the field (<= 80 chars) ! units Optional units of the field (<= 16 chars) ! ! On Output: ! fsechist(n) is defined (derived type fields_sech, see fields.F). Data ! component has been allocated, and data from f (full or sub-domain) ! has been saved to fsechist(n)%data(lon,lat,lev) !