\hypertarget{namespacemom__diag__mediator}{}\doxysection{mom\+\_\+diag\+\_\+mediator Module Reference}
\label{namespacemom__diag__mediator}\index{mom\_diag\_mediator@{mom\_diag\_mediator}}


\doxysubsection{Detailed Description}
The subroutines here provide convenient wrappers to the fms diag\+\_\+manager interfaces with additional diagnostic capabilies. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}
\begin{DoxyCompactList}\small\item\em A group of 1D axes that comprise a 1D/2\+D/3D mesh. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}
\begin{DoxyCompactList}\small\item\em The following data type a list of diagnostic fields an their variants, as well as variables that control the handling of model output. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__diag__mediator_1_1diag__dsamp}{diag\+\_\+dsamp}}
\begin{DoxyCompactList}\small\item\em Contained for down sampled masks. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__diag__mediator_1_1diag__grid__storage}{diag\+\_\+grid\+\_\+storage}}
\begin{DoxyCompactList}\small\item\em Stores all the remapping grids and the model\textquotesingle{}s native space thicknesses. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__diag__mediator_1_1diag__grids__type}{diag\+\_\+grids\+\_\+type}}
\begin{DoxyCompactList}\small\item\em Contains an array to store a diagnostic target grid. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}
\begin{DoxyCompactList}\small\item\em This type is used to represent a diagnostic at the diag\+\_\+mediator level. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__diag__mediator_1_1diagcs__dsamp}{diagcs\+\_\+dsamp}}
\begin{DoxyCompactList}\small\item\em Container for down sampling information. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__diag__mediator_1_1downsample__diag__field}{downsample\+\_\+diag\+\_\+field}}
\begin{DoxyCompactList}\small\item\em Down sample a diagnostic field. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__diag__mediator_1_1downsample__field}{downsample\+\_\+field}}
\begin{DoxyCompactList}\small\item\em Down sample a field. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__diag__mediator_1_1downsample__mask}{downsample\+\_\+mask}}
\begin{DoxyCompactList}\small\item\em Down sample the mask of a field. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__diag__mediator_1_1post__data}{post\+\_\+data}}
\begin{DoxyCompactList}\small\item\em Make a diagnostic available for averaging or output. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a76c9267c7744e3573f78afbaa0b716a5}{set\+\_\+axes\+\_\+info}} (G, GV, US, param\+\_\+file, diag\+\_\+cs, set\+\_\+vertical)
\begin{DoxyCompactList}\small\item\em Sets up diagnostics axes. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a1abcee77dbc8e8a48f4b48144fc0923c}{set\+\_\+axes\+\_\+info\+\_\+dsamp}} (G, GV, param\+\_\+file, diag\+\_\+cs, id\+\_\+zl\+\_\+native, id\+\_\+zi\+\_\+native)
\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a19d8a5e2782eb57ab3d7824028fafd56}{set\+\_\+masks\+\_\+for\+\_\+axes}} (G, diag\+\_\+cs)
\begin{DoxyCompactList}\small\item\em set\+\_\+masks\+\_\+for\+\_\+axes sets up the 2d and 3d masks for diagnostics using the current grid recorded after calling \mbox{\hyperlink{namespacemom__diag__mediator_aa78e69709084d0097b3e01bbd83d3509}{diag\+\_\+update\+\_\+remap\+\_\+grids()}} \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_ade968ef275fa55cf8a2301debdd7e88a}{set\+\_\+masks\+\_\+for\+\_\+axes\+\_\+dsamp}} (G, diag\+\_\+cs)
\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a2795a8a8618f945a9a0830f461d3e42d}{diag\+\_\+register\+\_\+area\+\_\+ids}} (diag\+\_\+cs, id\+\_\+area\+\_\+t, id\+\_\+area\+\_\+q)
\begin{DoxyCompactList}\small\item\em Attaches the id of cell areas to axes groups for use with cell\+\_\+measures. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a820eb49d3acf041c630ce1373bef799e}{register\+\_\+cell\+\_\+measure}} (G, diag, Time)
\begin{DoxyCompactList}\small\item\em Sets a handle inside diagnostics mediator to associate 3d cell measures. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a6affd997646a278d7fca03174a5a06ad}{diag\+\_\+associate\+\_\+volume\+\_\+cell\+\_\+measure}} (diag\+\_\+cs, id\+\_\+h\+\_\+volume)
\begin{DoxyCompactList}\small\item\em Attaches the id of cell volumes to axes groups for use with cell\+\_\+measures. \end{DoxyCompactList}\item 
integer function, public \mbox{\hyperlink{namespacemom__diag__mediator_aba626173ff1459bd423b1902425d1908}{diag\+\_\+get\+\_\+volume\+\_\+cell\+\_\+measure\+\_\+dm\+\_\+id}} (diag\+\_\+cs)
\begin{DoxyCompactList}\small\item\em Returns diag\+\_\+manager id for cell measure of h-\/cells. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_ab9f767ec24a860cb71cae264560272a8}{define\+\_\+axes\+\_\+group}} (diag\+\_\+cs, handles, axes, nz, vertical\+\_\+coordinate\+\_\+number, x\+\_\+cell\+\_\+method, y\+\_\+cell\+\_\+method, v\+\_\+cell\+\_\+method, is\+\_\+h\+\_\+point, is\+\_\+q\+\_\+point, is\+\_\+u\+\_\+point, is\+\_\+v\+\_\+point, is\+\_\+layer, is\+\_\+interface, is\+\_\+native, needs\+\_\+remapping, needs\+\_\+interpolating, xyave\+\_\+axes)
\begin{DoxyCompactList}\small\item\em Defines a group of \char`\"{}axes\char`\"{} from list of handles. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a51129041d5b42f6546c087111465f639}{define\+\_\+axes\+\_\+group\+\_\+dsamp}} (diag\+\_\+cs, handles, axes, dl, nz, vertical\+\_\+coordinate\+\_\+number, x\+\_\+cell\+\_\+method, y\+\_\+cell\+\_\+method, v\+\_\+cell\+\_\+method, is\+\_\+h\+\_\+point, is\+\_\+q\+\_\+point, is\+\_\+u\+\_\+point, is\+\_\+v\+\_\+point, is\+\_\+layer, is\+\_\+interface, is\+\_\+native, needs\+\_\+remapping, needs\+\_\+interpolating, xyave\+\_\+axes)
\begin{DoxyCompactList}\small\item\em Defines a group of downsampled \char`\"{}axes\char`\"{} from list of handles. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a36d062ce991a3bd7250b3224e6508eb5}{set\+\_\+diag\+\_\+mediator\+\_\+grid}} (G, diag\+\_\+cs)
\begin{DoxyCompactList}\small\item\em Set up the array extents for doing diagnostics. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_ab98d892c30de2ee865416e519eacfd79}{post\+\_\+data\+\_\+0d}} (diag\+\_\+field\+\_\+id, field, diag\+\_\+cs, is\+\_\+static)
\begin{DoxyCompactList}\small\item\em Make a real scalar diagnostic available for averaging or output. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_ab5b75b68fa1742ce312c371f4b2c6ac1}{post\+\_\+data\+\_\+1d\+\_\+k}} (diag\+\_\+field\+\_\+id, field, diag\+\_\+cs, is\+\_\+static)
\begin{DoxyCompactList}\small\item\em Make a real 1-\/d array diagnostic available for averaging or output. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a2b87038d2cfd2f6709ecb9f4481e0e75}{post\+\_\+data\+\_\+2d}} (diag\+\_\+field\+\_\+id, field, diag\+\_\+cs, is\+\_\+static, mask)
\begin{DoxyCompactList}\small\item\em Make a real 2-\/d array diagnostic available for averaging or output. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a633c4a461809f5843ac522616db8f382}{post\+\_\+data\+\_\+2d\+\_\+low}} (diag, field, diag\+\_\+cs, is\+\_\+static, mask)
\begin{DoxyCompactList}\small\item\em Make a real 2-\/d array diagnostic available for averaging or output using a \mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}} instead of an integer id. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a70116fa6034dcf977a8bdcb4d81f9207}{post\+\_\+data\+\_\+3d}} (diag\+\_\+field\+\_\+id, field, diag\+\_\+cs, is\+\_\+static, mask, alt\+\_\+h)
\begin{DoxyCompactList}\small\item\em Make a real 3-\/d array diagnostic available for averaging or output. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_ae11cae949c3f8cf68d2c70f656aa9c54}{post\+\_\+data\+\_\+3d\+\_\+low}} (diag, field, diag\+\_\+cs, is\+\_\+static, mask)
\begin{DoxyCompactList}\small\item\em Make a real 3-\/d array diagnostic available for averaging or output using a \mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}} instead of an integer id. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_ab41a1779c5edb50aa7256477cef952ae}{post\+\_\+xy\+\_\+average}} (diag\+\_\+cs, diag, field)
\begin{DoxyCompactList}\small\item\em Post the horizontally area-\/averaged diagnostic. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a91244f765f2964dfb11f8787f65042f1}{enable\+\_\+averaging}} (time\+\_\+int\+\_\+in, time\+\_\+end\+\_\+in, diag\+\_\+cs)
\begin{DoxyCompactList}\small\item\em This subroutine enables the accumulation of time averages over the specified time interval. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_ada4d9d69fb0d79a0fe20a307eaf1ca9c}{enable\+\_\+averages}} (time\+\_\+int, time\+\_\+end, diag\+\_\+\+CS, T\+\_\+to\+\_\+s)
\begin{DoxyCompactList}\small\item\em Enable the accumulation of time averages over the specified time interval in time units. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a1761df399ba39742e34ab989469da0f2}{disable\+\_\+averaging}} (diag\+\_\+cs)
\begin{DoxyCompactList}\small\item\em Call this subroutine to avoid averaging any offered fields. \end{DoxyCompactList}\item 
logical function, public \mbox{\hyperlink{namespacemom__diag__mediator_a0be5d1cbc6c6f8f63950ce7d9bc6455a}{query\+\_\+averaging\+\_\+enabled}} (diag\+\_\+cs, time\+\_\+int, time\+\_\+end)
\begin{DoxyCompactList}\small\item\em Call this subroutine to determine whether the averaging is currently enabled. .true. is returned if it is. \end{DoxyCompactList}\item 
type(time\+\_\+type) function, public \mbox{\hyperlink{namespacemom__diag__mediator_a76e845bc64dfd5116f41fe90922b7937}{get\+\_\+diag\+\_\+time\+\_\+end}} (diag\+\_\+cs)
\begin{DoxyCompactList}\small\item\em This function returns the valid end time for use with diagnostics that are handled outside of the M\+O\+M6 diagnostics infrastructure. \end{DoxyCompactList}\item 
integer function, public \mbox{\hyperlink{namespacemom__diag__mediator_ada491446bf7216fe101e6b0f6ed551e1}{register\+\_\+diag\+\_\+field}} (module\+\_\+name, field\+\_\+name, axes\+\_\+in, init\+\_\+time, long\+\_\+name, units, missing\+\_\+value, range, mask\+\_\+variant, standard\+\_\+name, verbose, do\+\_\+not\+\_\+log, err\+\_\+msg, interp\+\_\+method, tile\+\_\+count, cmor\+\_\+field\+\_\+name, cmor\+\_\+long\+\_\+name, cmor\+\_\+units, cmor\+\_\+standard\+\_\+name, cell\+\_\+methods, x\+\_\+cell\+\_\+method, y\+\_\+cell\+\_\+method, v\+\_\+cell\+\_\+method, conversion, v\+\_\+extensive)
\begin{DoxyCompactList}\small\item\em Returns the \char`\"{}diag\+\_\+mediator\char`\"{} handle for a group (native, C\+M\+OR, z-\/coord, ...) of diagnostics derived from one field. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__diag__mediator_ae50b35cba800ac5fd8975929fd2b9f4a}{register\+\_\+diag\+\_\+field\+\_\+expand\+\_\+cmor}} (dm\+\_\+id, module\+\_\+name, field\+\_\+name, axes, init\+\_\+time, long\+\_\+name, units, missing\+\_\+value, range, mask\+\_\+variant, standard\+\_\+name, verbose, do\+\_\+not\+\_\+log, err\+\_\+msg, interp\+\_\+method, tile\+\_\+count, cmor\+\_\+field\+\_\+name, cmor\+\_\+long\+\_\+name, cmor\+\_\+units, cmor\+\_\+standard\+\_\+name, cell\+\_\+methods, x\+\_\+cell\+\_\+method, y\+\_\+cell\+\_\+method, v\+\_\+cell\+\_\+method, conversion, v\+\_\+extensive)
\begin{DoxyCompactList}\small\item\em Returns True if either the native or C\+M\+Or version of the diagnostic were registered. Updates \textquotesingle{}dm\+\_\+id\textquotesingle{} after calling \mbox{\hyperlink{namespacemom__diag__mediator_aca4a32fea8dade9f51e076a56b9bad2b}{register\+\_\+diag\+\_\+field\+\_\+expand\+\_\+axes()}} for both native and C\+M\+OR variants of the field. \end{DoxyCompactList}\item 
integer function \mbox{\hyperlink{namespacemom__diag__mediator_aca4a32fea8dade9f51e076a56b9bad2b}{register\+\_\+diag\+\_\+field\+\_\+expand\+\_\+axes}} (module\+\_\+name, field\+\_\+name, axes, init\+\_\+time, long\+\_\+name, units, missing\+\_\+value, range, mask\+\_\+variant, standard\+\_\+name, verbose, do\+\_\+not\+\_\+log, err\+\_\+msg, interp\+\_\+method, tile\+\_\+count)
\begin{DoxyCompactList}\small\item\em Returns an F\+MS id from register\+\_\+diag\+\_\+field\+\_\+fms (the diag\+\_\+manager routine) after expanding axes (axes-\/group) into handles and conditionally adding an F\+MS area\+\_\+id for cell\+\_\+measures. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a8415b33a337b1fbc7535688eca85ab37}{add\+\_\+diag\+\_\+to\+\_\+list}} (diag\+\_\+cs, dm\+\_\+id, fms\+\_\+id, this\+\_\+diag, axes, module\+\_\+name, field\+\_\+name, msg)
\begin{DoxyCompactList}\small\item\em Create a diagnostic type and attached to list. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a14d405e0958e6e58797253c52c666cdb}{add\+\_\+xyz\+\_\+method}} (diag, axes, x\+\_\+cell\+\_\+method, y\+\_\+cell\+\_\+method, v\+\_\+cell\+\_\+method, v\+\_\+extensive)
\begin{DoxyCompactList}\small\item\em Adds the encoded \char`\"{}cell\+\_\+methods\char`\"{} for a diagnostics as a diag\% property This allows access to the cell\+\_\+method for a given diagnostics at the time of sending. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_ae0f04c145cb120fc2ab6cbfe9f166392}{attach\+\_\+cell\+\_\+methods}} (id, axes, ostring, cell\+\_\+methods, x\+\_\+cell\+\_\+method, y\+\_\+cell\+\_\+method, v\+\_\+cell\+\_\+method, v\+\_\+extensive)
\begin{DoxyCompactList}\small\item\em Attaches \char`\"{}cell\+\_\+methods\char`\"{} attribute to a variable based on defaults for \mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}} or optional arguments. \end{DoxyCompactList}\item 
integer function, public \mbox{\hyperlink{namespacemom__diag__mediator_afb4254e1cfbbcfc43028f14915173f80}{register\+\_\+scalar\+\_\+field}} (module\+\_\+name, field\+\_\+name, init\+\_\+time, diag\+\_\+cs, long\+\_\+name, units, missing\+\_\+value, range, standard\+\_\+name, do\+\_\+not\+\_\+log, err\+\_\+msg, interp\+\_\+method, cmor\+\_\+field\+\_\+name, cmor\+\_\+long\+\_\+name, cmor\+\_\+units, cmor\+\_\+standard\+\_\+name)
\item 
integer function, public \mbox{\hyperlink{namespacemom__diag__mediator_a87fa69b9e2ba3205756d93e1e13e1dc7}{register\+\_\+static\+\_\+field}} (module\+\_\+name, field\+\_\+name, axes, long\+\_\+name, units, missing\+\_\+value, range, mask\+\_\+variant, standard\+\_\+name, do\+\_\+not\+\_\+log, interp\+\_\+method, tile\+\_\+count, cmor\+\_\+field\+\_\+name, cmor\+\_\+long\+\_\+name, cmor\+\_\+units, cmor\+\_\+standard\+\_\+name, area, x\+\_\+cell\+\_\+method, y\+\_\+cell\+\_\+method, area\+\_\+cell\+\_\+method, conversion)
\begin{DoxyCompactList}\small\item\em Registers a static diagnostic, returning an integer handle. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_ae002ca447acba252bf7bdc042e75a01e}{describe\+\_\+option}} (opt\+\_\+name, value, diag\+\_\+\+CS)
\begin{DoxyCompactList}\small\item\em Describe an option setting in the diagnostic files. \end{DoxyCompactList}\item 
integer function, public \mbox{\hyperlink{namespacemom__diag__mediator_a21267e25d12fa3e5d2540d2a299d2d2c}{ocean\+\_\+register\+\_\+diag}} (var\+\_\+desc, G, diag\+\_\+\+CS, day)
\begin{DoxyCompactList}\small\item\em Registers a diagnostic using the information encapsulated in the vardesc type argument and returns an integer handle to this diagostic. That integer handle is negative if the diagnostic is unused. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_ae8ac8a662308a9e766249fdf29956560}{diag\+\_\+mediator\+\_\+infrastructure\+\_\+init}} (err\+\_\+msg)
\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a3c99ff49de6d5e43f0d1bba79290eb71}{diag\+\_\+mediator\+\_\+init}} (G, GV, US, nz, param\+\_\+file, diag\+\_\+cs, doc\+\_\+file\+\_\+dir)
\begin{DoxyCompactList}\small\item\em diag\+\_\+mediator\+\_\+init initializes the M\+OM diag\+\_\+mediator and opens the available diagnostics file, if appropriate. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_abe52776bc4a161c4912ce1987acaf1c1}{diag\+\_\+set\+\_\+state\+\_\+ptrs}} (h, T, S, eqn\+\_\+of\+\_\+state, diag\+\_\+cs)
\begin{DoxyCompactList}\small\item\em Set pointers to the default state fields used to remap diagnostics. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_aa78e69709084d0097b3e01bbd83d3509}{diag\+\_\+update\+\_\+remap\+\_\+grids}} (diag\+\_\+cs, alt\+\_\+h, alt\+\_\+T, alt\+\_\+S, update\+\_\+intensive, update\+\_\+extensive)
\begin{DoxyCompactList}\small\item\em Build/update vertical grids for diagnostic remapping. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_aebf8dcc4bac8028f24a80fa5f1f1ca5b}{diag\+\_\+masks\+\_\+set}} (G, nz, diag\+\_\+cs)
\begin{DoxyCompactList}\small\item\em Sets up the 2d and 3d masks for native diagnostics. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_ab6b7493efa5caee06547dafdba29361b}{diag\+\_\+mediator\+\_\+close\+\_\+registration}} (diag\+\_\+\+CS)
\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a780f8870b442c730208d66d1ff0b4ac0}{diag\+\_\+mediator\+\_\+end}} (time, diag\+\_\+\+CS, end\+\_\+diag\+\_\+manager)
\item 
character(len=15) function \mbox{\hyperlink{namespacemom__diag__mediator_a82d9bb70db16b1113304936c82d40e82}{i2s}} (a, n\+\_\+in)
\begin{DoxyCompactList}\small\item\em Convert the first n elements (up to 3) of an integer array to an underscore delimited string. \end{DoxyCompactList}\item 
integer function \mbox{\hyperlink{namespacemom__diag__mediator_a3f7442639213320f7429e2288a79fda2}{get\+\_\+new\+\_\+diag\+\_\+id}} (diag\+\_\+cs)
\begin{DoxyCompactList}\small\item\em Returns a new diagnostic id, it may be necessary to expand the diagnostics array. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a883862f004e30bbc5211f38635511ba0}{initialize\+\_\+diag\+\_\+type}} (diag)
\begin{DoxyCompactList}\small\item\em Initializes a \mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}} (used after allocating new memory) \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a1b0bed2113a0c268eafd1bafbb48bd4f}{alloc\+\_\+diag\+\_\+with\+\_\+id}} (diag\+\_\+id, diag\+\_\+cs, diag)
\begin{DoxyCompactList}\small\item\em Make a new diagnostic. Either use memory which is in the array of \textquotesingle{}primary\textquotesingle{} diagnostics, or if that is in use, insert it to the list of secondary diags. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a65fe8d329cf5dbfd08c98874a7a64407}{log\+\_\+available\+\_\+diag}} (used, module\+\_\+name, field\+\_\+name, cell\+\_\+methods\+\_\+string, comment, diag\+\_\+\+CS, long\+\_\+name, units, standard\+\_\+name)
\begin{DoxyCompactList}\small\item\em Log a diagnostic to the available diagnostics file. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_af410974feba66bf49817eccb7d1b6426}{log\+\_\+chksum\+\_\+diag}} (docunit, description, chksum)
\begin{DoxyCompactList}\small\item\em Log the diagnostic chksum to the chksum diag file. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a6f596247402f21fa60bfdf1e73c41044}{diag\+\_\+grid\+\_\+storage\+\_\+init}} (grid\+\_\+storage, G, diag)
\begin{DoxyCompactList}\small\item\em Allocates fields necessary to store diagnostic remapping fields. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a4c15fc11c4d220ebcdd38adb692950db}{diag\+\_\+copy\+\_\+diag\+\_\+to\+\_\+storage}} (grid\+\_\+storage, h\+\_\+state, diag)
\begin{DoxyCompactList}\small\item\em Copy from the main diagnostic arrays to the grid storage as well as the native thicknesses. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_acfce430f0605a56afdb438107afc0d47}{diag\+\_\+copy\+\_\+storage\+\_\+to\+\_\+diag}} (diag, grid\+\_\+storage)
\begin{DoxyCompactList}\small\item\em Copy from the stored diagnostic arrays to the main diagnostic grids. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_aba48dd8ac75fdf10eda85f8183c2b39e}{diag\+\_\+save\+\_\+grids}} (diag)
\begin{DoxyCompactList}\small\item\em Save the current diagnostic grids in the temporary structure within diag. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a7a21b53f286a9a214cc6aac4e34eb78b}{diag\+\_\+restore\+\_\+grids}} (diag)
\begin{DoxyCompactList}\small\item\em Restore the diagnostic grids from the temporary structure within diag. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__diag__mediator_a4f82f684f05d581ea5b62a9c62a54af3}{diag\+\_\+grid\+\_\+storage\+\_\+end}} (grid\+\_\+storage)
\begin{DoxyCompactList}\small\item\em Deallocates the fields in the remapping fields container. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a5f2fcd6b3aa44f8d4f6259d8cf365f04}{downsample\+\_\+diag\+\_\+masks\+\_\+set}} (G, nz, diag\+\_\+cs)
\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a902b3d966dae0a8f0011d98d8697e22d}{downsample\+\_\+diag\+\_\+indices\+\_\+get}} (fo1, fo2, dl, diag\+\_\+cs, isv, iev, jsv, jev)
\begin{DoxyCompactList}\small\item\em Get the diagnostics-\/compute indices (to be passed to send\+\_\+data) based on the shape of the diag field (the same way they are deduced for non-\/downsampled fields) \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a30395d7b955b819afa3942700dedead1}{downsample\+\_\+diag\+\_\+field\+\_\+3d}} (locfield, locfield\+\_\+dsamp, dl, diag\+\_\+cs, diag, isv, iev, jsv, jev, mask)
\begin{DoxyCompactList}\small\item\em This subroutine allocates and computes a downsampled array from an input array It also determines the diagnostics-\/compurte indices for the downsampled array 3d interface. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_ac19dd9879fd5c480c4bd27d6e7b8c0cf}{downsample\+\_\+diag\+\_\+field\+\_\+2d}} (locfield, locfield\+\_\+dsamp, dl, diag\+\_\+cs, diag, isv, iev, jsv, jev, mask)
\begin{DoxyCompactList}\small\item\em This subroutine allocates and computes a downsampled array from an input array It also determines the diagnostics-\/compurte indices for the downsampled array 2d interface. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a640ec8fac9bad1d0af6f737d7e816403}{downsample\+\_\+field\+\_\+3d}} (field\+\_\+in, field\+\_\+out, dl, method, mask, diag\+\_\+cs, diag, isv\+\_\+o, jsv\+\_\+o, isv\+\_\+d, iev\+\_\+d, jsv\+\_\+d, jev\+\_\+d)
\begin{DoxyCompactList}\small\item\em This subroutine allocates and computes a down sampled 3d array given an input array The down sample method is based on the \char`\"{}cell\+\_\+methods\char`\"{} for the diagnostics as explained in the above table. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_aa46e12f1318ed96f60035cdd32e4157a}{downsample\+\_\+field\+\_\+2d}} (field\+\_\+in, field\+\_\+out, dl, method, mask, diag\+\_\+cs, diag, isv\+\_\+o, jsv\+\_\+o, isv\+\_\+d, iev\+\_\+d, jsv\+\_\+d, jev\+\_\+d)
\begin{DoxyCompactList}\small\item\em This subroutine allocates and computes a down sampled 2d array given an input array The down sample method is based on the \char`\"{}cell\+\_\+methods\char`\"{} for the diagnostics as explained in the above table. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a8e211bead8fe3f37da32dfa010b55b90}{downsample\+\_\+mask\+\_\+2d}} (field\+\_\+in, field\+\_\+out, dl, isc\+\_\+o, jsc\+\_\+o, isc\+\_\+d, iec\+\_\+d, jsc\+\_\+d, jec\+\_\+d, isd\+\_\+d, ied\+\_\+d, jsd\+\_\+d, jed\+\_\+d)
\begin{DoxyCompactList}\small\item\em Allocate and compute the 2d down sampled mask The masks are down sampled based on a minority rule, i.\+e., a coarse cell is open (1) if at least one of the sub-\/cells are open, otherwise it\textquotesingle{}s closed (0) \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__diag__mediator_a0b0fe5fefbf6a1e9a5b1642f5852cdb6}{downsample\+\_\+mask\+\_\+3d}} (field\+\_\+in, field\+\_\+out, dl, isc\+\_\+o, jsc\+\_\+o, isc\+\_\+d, iec\+\_\+d, jsc\+\_\+d, jec\+\_\+d, isd\+\_\+d, ied\+\_\+d, jsd\+\_\+d, jed\+\_\+d)
\begin{DoxyCompactList}\small\item\em Allocate and compute the 3d down sampled mask The masks are down sampled based on a minority rule, i.\+e., a coarse cell is open (1) if at least one of the sub-\/cells are open, otherwise it\textquotesingle{}s closed (0) \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_a3247fad19fce000fcb4af1a3cf21a3f2}\label{namespacemom__diag__mediator_a3247fad19fce000fcb4af1a3cf21a3f2}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_a3247fad19fce000fcb4af1a3cf21a3f2}{psp}} =121
\begin{DoxyCompactList}\small\item\em x\+:point,y\+:sum,z\+:point \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_a2f079e2e2550b5ec1887179c37e5cce5}\label{namespacemom__diag__mediator_a2f079e2e2550b5ec1887179c37e5cce5}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_a2f079e2e2550b5ec1887179c37e5cce5}{pss}} =122
\begin{DoxyCompactList}\small\item\em x\+:point,y\+:sum,z\+:point \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_a0614439e5299ca5d575bc820ec697b4a}\label{namespacemom__diag__mediator_a0614439e5299ca5d575bc820ec697b4a}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_a0614439e5299ca5d575bc820ec697b4a}{psm}} =123
\begin{DoxyCompactList}\small\item\em x\+:point,y\+:sum,z\+:mean \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_a17abc676880db0f0ce2764d01161e216}\label{namespacemom__diag__mediator_a17abc676880db0f0ce2764d01161e216}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_a17abc676880db0f0ce2764d01161e216}{pmp}} =131
\begin{DoxyCompactList}\small\item\em x\+:point,y\+:mean,z\+:point \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_a7730b6ffaeb382cbe497cd9772b858fc}\label{namespacemom__diag__mediator_a7730b6ffaeb382cbe497cd9772b858fc}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_a7730b6ffaeb382cbe497cd9772b858fc}{pmm}} =133
\begin{DoxyCompactList}\small\item\em x\+:point,y\+:mean,z\+:mean \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_acaa7d531b586a9217d5a8e6f25023c91}\label{namespacemom__diag__mediator_acaa7d531b586a9217d5a8e6f25023c91}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_acaa7d531b586a9217d5a8e6f25023c91}{spp}} =211
\begin{DoxyCompactList}\small\item\em x\+:sum,y\+:point,z\+:point \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_aae1bf1b1fd0d54e8d0cf13c4aca9f689}\label{namespacemom__diag__mediator_aae1bf1b1fd0d54e8d0cf13c4aca9f689}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_aae1bf1b1fd0d54e8d0cf13c4aca9f689}{sps}} =212
\begin{DoxyCompactList}\small\item\em x\+:sum,y\+:point,z\+:sum \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_ab60866bce3c6b88951f1cedb5a4c319b}\label{namespacemom__diag__mediator_ab60866bce3c6b88951f1cedb5a4c319b}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_ab60866bce3c6b88951f1cedb5a4c319b}{ssp}} =221
\begin{DoxyCompactList}\small\item\em x\+:sum;y\+:sum,z\+:point \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_a374b829068930f39f211bbc74c550d73}\label{namespacemom__diag__mediator_a374b829068930f39f211bbc74c550d73}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_a374b829068930f39f211bbc74c550d73}{mpp}} =311
\begin{DoxyCompactList}\small\item\em x\+:mean,y\+:point,z\+:point \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_af4984649b7e1a295998abb48415fad5c}\label{namespacemom__diag__mediator_af4984649b7e1a295998abb48415fad5c}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_af4984649b7e1a295998abb48415fad5c}{mpm}} =313
\begin{DoxyCompactList}\small\item\em x\+:mean,y\+:point,z\+:mean \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_aaf71efbbdb0b8287772a119750e5127e}\label{namespacemom__diag__mediator_aaf71efbbdb0b8287772a119750e5127e}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_aaf71efbbdb0b8287772a119750e5127e}{mmp}} =331
\begin{DoxyCompactList}\small\item\em x\+:mean,y\+:mean,z\+:point \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_a2f08495ffe07bb4ee3f5f11e4432f7e6}\label{namespacemom__diag__mediator_a2f08495ffe07bb4ee3f5f11e4432f7e6}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_a2f08495ffe07bb4ee3f5f11e4432f7e6}{mms}} =332
\begin{DoxyCompactList}\small\item\em x\+:mean,y\+:mean,z\+:sum \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_ac603c1e0276955bd0dff297f71a63629}\label{namespacemom__diag__mediator_ac603c1e0276955bd0dff297f71a63629}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_ac603c1e0276955bd0dff297f71a63629}{sss}} =222
\begin{DoxyCompactList}\small\item\em x\+:sum,y\+:sum,z\+:sum \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_a54cd7394f3ad400f4a19155e313bcd22}\label{namespacemom__diag__mediator_a54cd7394f3ad400f4a19155e313bcd22}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_a54cd7394f3ad400f4a19155e313bcd22}{mmm}} =333
\begin{DoxyCompactList}\small\item\em x\+:mean,y\+:mean,z\+:mean \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__diag__mediator_aee297aa161d60188320e803751df9ce4}\label{namespacemom__diag__mediator_aee297aa161d60188320e803751df9ce4}} 
integer \mbox{\hyperlink{namespacemom__diag__mediator_aee297aa161d60188320e803751df9ce4}{msk}} =-\/1
\begin{DoxyCompactList}\small\item\em Use the downsample method of a mask. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__diag__mediator_a8415b33a337b1fbc7535688eca85ab37}\label{namespacemom__diag__mediator_a8415b33a337b1fbc7535688eca85ab37}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!add\_diag\_to\_list@{add\_diag\_to\_list}}
\index{add\_diag\_to\_list@{add\_diag\_to\_list}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{add\_diag\_to\_list()}{add\_diag\_to\_list()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::add\+\_\+diag\+\_\+to\+\_\+list (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), pointer}]{diag\+\_\+cs,  }\item[{integer, intent(inout)}]{dm\+\_\+id,  }\item[{integer, intent(in)}]{fms\+\_\+id,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), pointer}]{this\+\_\+diag,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), intent(in), target}]{axes,  }\item[{character(len=$\ast$), intent(in)}]{module\+\_\+name,  }\item[{character(len=$\ast$), intent(in)}]{field\+\_\+name,  }\item[{character(len=$\ast$), intent(in)}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Create a diagnostic type and attached to list. 


\begin{DoxyParams}[1]{Parameters}
 & {\em diag\+\_\+cs} & Diagnostics mediator control structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em dm\+\_\+id} & The diag\+\_\+mediator ID for this diagnostic group \\
\hline
\mbox{\texttt{ in}}  & {\em fms\+\_\+id} & The F\+MS diag\+\_\+manager ID for this diagnostic \\
\hline
 & {\em this\+\_\+diag} & This diagnostic \\
\hline
\mbox{\texttt{ in}}  & {\em axes} & Container w/ up to 3 integer handles that indicates axes for this field \\
\hline
\mbox{\texttt{ in}}  & {\em module\+\_\+name} & Name of this module, usually \char`\"{}ocean\+\_\+model\char`\"{} or \char`\"{}ice\+\_\+shelf\+\_\+model\char`\"{} \\
\hline
\mbox{\texttt{ in}}  & {\em field\+\_\+name} & Name of diagnostic \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & Message for errors \\
\hline
\end{DoxyParams}


Definition at line 2453 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2454   \textcolor{keywordtype}{type}(diag\_ctrl),        \textcolor{keywordtype}{pointer}       :: diag\_cs\textcolor{comment}{ !< Diagnostics mediator control structure}}
\DoxyCodeLine{2455   \textcolor{keywordtype}{integer},                \textcolor{keywordtype}{intent(inout)} :: dm\_id\textcolor{comment}{ !< The diag\_mediator ID for this diagnostic group}}
\DoxyCodeLine{2456   \textcolor{keywordtype}{integer},                \textcolor{keywordtype}{intent(in)}    :: fms\_id\textcolor{comment}{ !< The FMS diag\_manager ID for this diagnostic}}
\DoxyCodeLine{2457   \textcolor{keywordtype}{type}(diag\_type),        \textcolor{keywordtype}{pointer}       :: this\_diag\textcolor{comment}{ !< This diagnostic}}
\DoxyCodeLine{2458   \textcolor{keywordtype}{type}(axes\_grp), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)}    :: axes\textcolor{comment}{ !< Container w/ up to 3 integer handles that}}
\DoxyCodeLine{2459 \textcolor{comment}{                                                !! indicates axes for this field}}
\DoxyCodeLine{2460   \textcolor{keywordtype}{character(len=*)},       \textcolor{keywordtype}{intent(in)}    :: module\_name\textcolor{comment}{ !< Name of this module, usually}}
\DoxyCodeLine{2461 \textcolor{comment}{                                                       !! "ocean\_model" or "ice\_shelf\_model"}}
\DoxyCodeLine{2462   \textcolor{keywordtype}{character(len=*)},       \textcolor{keywordtype}{intent(in)}    :: field\_name\textcolor{comment}{ !< Name of diagnostic}}
\DoxyCodeLine{2463   \textcolor{keywordtype}{character(len=*)},       \textcolor{keywordtype}{intent(in)}    :: msg\textcolor{comment}{ !< Message for errors}}
\DoxyCodeLine{2464 }
\DoxyCodeLine{2465   \textcolor{comment}{! If the diagnostic is needed obtain a diag\_mediator ID (if needed)}}
\DoxyCodeLine{2466   \textcolor{keywordflow}{if} (dm\_id == -\/1) dm\_id = get\_new\_diag\_id(diag\_cs)}
\DoxyCodeLine{2467   \textcolor{comment}{! Create a new diag\_type to store links in}}
\DoxyCodeLine{2468   \textcolor{keyword}{call }alloc\_diag\_with\_id(dm\_id, diag\_cs, this\_diag)}
\DoxyCodeLine{2469   \textcolor{keyword}{call }assert(\textcolor{keyword}{associated}(this\_diag), trim(msg)//\textcolor{stringliteral}{': diag\_type allocation failed'})}
\DoxyCodeLine{2470   \textcolor{comment}{! Record FMS id, masks and conversion factor, in diag\_type}}
\DoxyCodeLine{2471   this\_diag\%fms\_diag\_id = fms\_id}
\DoxyCodeLine{2472   this\_diag\%debug\_str = trim(module\_name)//\textcolor{stringliteral}{"-\/"}//trim(field\_name)}
\DoxyCodeLine{2473   this\_diag\%axes => axes}
\DoxyCodeLine{2474 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a14d405e0958e6e58797253c52c666cdb}\label{namespacemom__diag__mediator_a14d405e0958e6e58797253c52c666cdb}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!add\_xyz\_method@{add\_xyz\_method}}
\index{add\_xyz\_method@{add\_xyz\_method}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{add\_xyz\_method()}{add\_xyz\_method()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::add\+\_\+xyz\+\_\+method (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), pointer}]{diag,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), intent(in)}]{axes,  }\item[{character(len=$\ast$), intent(in), optional}]{x\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{y\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{v\+\_\+cell\+\_\+method,  }\item[{logical, intent(in), optional}]{v\+\_\+extensive }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Adds the encoded \char`\"{}cell\+\_\+methods\char`\"{} for a diagnostics as a diag\% property This allows access to the cell\+\_\+method for a given diagnostics at the time of sending. 


\begin{DoxyParams}[1]{Parameters}
 & {\em diag} & This diagnostic \\
\hline
\mbox{\texttt{ in}}  & {\em axes} & Container w/ up to 3 integer handles that indicates axes for this field \\
\hline
\mbox{\texttt{ in}}  & {\em x\+\_\+cell\+\_\+method} & Specifies the cell method for the x-\/direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em y\+\_\+cell\+\_\+method} & Specifies the cell method for the y-\/direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em v\+\_\+cell\+\_\+method} & Specifies the cell method for the vertical direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em v\+\_\+extensive} & True for vertically extensive fields (vertically integrated). Default/absent for intensive. \\
\hline
\end{DoxyParams}


Definition at line 2479 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2480   \textcolor{keywordtype}{type}(diag\_type),          \textcolor{keywordtype}{pointer}       :: diag\textcolor{comment}{ !< This diagnostic}}
\DoxyCodeLine{2481   \textcolor{keywordtype}{type}(axes\_grp),             \textcolor{keywordtype}{intent(in)}  :: axes\textcolor{comment}{ !< Container w/ up to 3 integer handles that indicates}}
\DoxyCodeLine{2482 \textcolor{comment}{                                                  !! axes for this field}}
\DoxyCodeLine{2483   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: x\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the x-\/direction.}}
\DoxyCodeLine{2484 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{2485   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: y\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the y-\/direction.}}
\DoxyCodeLine{2486 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{2487   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: v\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the vertical direction.}}
\DoxyCodeLine{2488 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{2489   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: v\_extensive\textcolor{comment}{ !< True for vertically extensive fields}}
\DoxyCodeLine{2490 \textcolor{comment}{                                                         !! (vertically integrated). Default/absent for intensive.}}
\DoxyCodeLine{2491   \textcolor{keywordtype}{integer} :: xyz\_method}
\DoxyCodeLine{2492   \textcolor{keywordtype}{character(len=9)} :: mstr}
\DoxyCodeLine{2493 }
\DoxyCodeLine{2494   \textcolor{comment}{!This is a simple way to encode the cell method information made from 3 strings}}
\DoxyCodeLine{2495   \textcolor{comment}{!(x\_cell\_method,y\_cell\_method,v\_cell\_method) in a 3 digit integer xyz}}
\DoxyCodeLine{2496   \textcolor{comment}{!x\_cell\_method,y\_cell\_method,v\_cell\_method can each be 'point' or 'sum' or 'mean'}}
\DoxyCodeLine{2497   \textcolor{comment}{!We can encode these with setting  1 for 'point', 2 for 'sum, 3 for 'mean' in}}
\DoxyCodeLine{2498   \textcolor{comment}{!the 100s position for x, 10s position for y, 1s position for z}}
\DoxyCodeLine{2499   \textcolor{comment}{!E.g., x:sum,y:point,z:mean is 213}}
\DoxyCodeLine{2500 }
\DoxyCodeLine{2501   xyz\_method = 111}
\DoxyCodeLine{2502 }
\DoxyCodeLine{2503   mstr = diag\%axes\%v\_cell\_method}
\DoxyCodeLine{2504   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(v\_extensive)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2505      \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(v\_cell\_method)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"attach\_cell\_methods: "} // \&}
\DoxyCodeLine{2506           \textcolor{stringliteral}{'Vertical cell method was specified along with the vertically extensive flag.'})}
\DoxyCodeLine{2507      \textcolor{keywordflow}{if}(v\_extensive) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2508         mstr=\textcolor{stringliteral}{'sum'}}
\DoxyCodeLine{2509      \textcolor{keywordflow}{else}}
\DoxyCodeLine{2510         mstr=\textcolor{stringliteral}{'mean'}}
\DoxyCodeLine{2511 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{2512   \textcolor{keywordflow}{elseif} (\textcolor{keyword}{present}(v\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2513      mstr = v\_cell\_method}
\DoxyCodeLine{2514 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2515   \textcolor{keywordflow}{if} (trim(mstr)==\textcolor{stringliteral}{'sum'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2516      xyz\_method = xyz\_method + 1}
\DoxyCodeLine{2517   \textcolor{keywordflow}{elseif} (trim(mstr)==\textcolor{stringliteral}{'mean'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2518      xyz\_method = xyz\_method + 2}
\DoxyCodeLine{2519 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2520 }
\DoxyCodeLine{2521   mstr = diag\%axes\%y\_cell\_method}
\DoxyCodeLine{2522   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(y\_cell\_method)) mstr = y\_cell\_method}
\DoxyCodeLine{2523   \textcolor{keywordflow}{if} (trim(mstr)==\textcolor{stringliteral}{'sum'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2524      xyz\_method = xyz\_method + 10}
\DoxyCodeLine{2525   \textcolor{keywordflow}{elseif} (trim(mstr)==\textcolor{stringliteral}{'mean'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2526      xyz\_method = xyz\_method + 20}
\DoxyCodeLine{2527 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2528 }
\DoxyCodeLine{2529   mstr = diag\%axes\%x\_cell\_method}
\DoxyCodeLine{2530   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(x\_cell\_method)) mstr = x\_cell\_method}
\DoxyCodeLine{2531   \textcolor{keywordflow}{if} (trim(mstr)==\textcolor{stringliteral}{'sum'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2532      xyz\_method = xyz\_method + 100}
\DoxyCodeLine{2533   \textcolor{keywordflow}{elseif} (trim(mstr)==\textcolor{stringliteral}{'mean'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2534      xyz\_method = xyz\_method + 200}
\DoxyCodeLine{2535 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2536 }
\DoxyCodeLine{2537   diag\%xyz\_method = xyz\_method}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a1b0bed2113a0c268eafd1bafbb48bd4f}\label{namespacemom__diag__mediator_a1b0bed2113a0c268eafd1bafbb48bd4f}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!alloc\_diag\_with\_id@{alloc\_diag\_with\_id}}
\index{alloc\_diag\_with\_id@{alloc\_diag\_with\_id}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{alloc\_diag\_with\_id()}{alloc\_diag\_with\_id()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::alloc\+\_\+diag\+\_\+with\+\_\+id (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{diag\+\_\+id,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout), target}]{diag\+\_\+cs,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), pointer}]{diag }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Make a new diagnostic. Either use memory which is in the array of \textquotesingle{}primary\textquotesingle{} diagnostics, or if that is in use, insert it to the list of secondary diags. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag\+\_\+id} & id for the diagnostic \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & structure used to regulate diagnostic output \\
\hline
 & {\em diag} & structure representing a diagnostic (inout) \\
\hline
\end{DoxyParams}


Definition at line 3522 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3523   \textcolor{keywordtype}{integer},                 \textcolor{keywordtype}{intent(in   )} :: diag\_id\textcolor{comment}{ !< id for the diagnostic}}
\DoxyCodeLine{3524   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: diag\_cs\textcolor{comment}{ !< structure used to regulate diagnostic output}}
\DoxyCodeLine{3525   \textcolor{keywordtype}{type}(diag\_type),         \textcolor{keywordtype}{pointer}       :: diag\textcolor{comment}{    !< structure representing a diagnostic (inout)}}
\DoxyCodeLine{3526 }
\DoxyCodeLine{3527   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{pointer} :: tmp => null()}
\DoxyCodeLine{3528 }
\DoxyCodeLine{3529   \textcolor{keywordflow}{if} (.not. diag\_cs\%diags(diag\_id)\%in\_use) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3530     diag => diag\_cs\%diags(diag\_id)}
\DoxyCodeLine{3531   \textcolor{keywordflow}{else}}
\DoxyCodeLine{3532     \textcolor{keyword}{allocate}(diag)}
\DoxyCodeLine{3533     tmp => diag\_cs\%diags(diag\_id)\%next}
\DoxyCodeLine{3534     diag\_cs\%diags(diag\_id)\%next => diag}
\DoxyCodeLine{3535     diag\%next => tmp}
\DoxyCodeLine{3536 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3537   diag\%in\_use = .true.}
\DoxyCodeLine{3538 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ae0f04c145cb120fc2ab6cbfe9f166392}\label{namespacemom__diag__mediator_ae0f04c145cb120fc2ab6cbfe9f166392}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!attach\_cell\_methods@{attach\_cell\_methods}}
\index{attach\_cell\_methods@{attach\_cell\_methods}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{attach\_cell\_methods()}{attach\_cell\_methods()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::attach\+\_\+cell\+\_\+methods (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{id,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), intent(in)}]{axes,  }\item[{character(len=$\ast$), intent(out)}]{ostring,  }\item[{character(len=$\ast$), intent(in), optional}]{cell\+\_\+methods,  }\item[{character(len=$\ast$), intent(in), optional}]{x\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{y\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{v\+\_\+cell\+\_\+method,  }\item[{logical, intent(in), optional}]{v\+\_\+extensive }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Attaches \char`\"{}cell\+\_\+methods\char`\"{} attribute to a variable based on defaults for \mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}} or optional arguments. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em id} & Handle to diagnostic \\
\hline
\mbox{\texttt{ in}}  & {\em axes} & Container w/ up to 3 integer handles that indicates axes for this field \\
\hline
\mbox{\texttt{ out}}  & {\em ostring} & The cell\+\_\+methods strings that would appear in the file \\
\hline
\mbox{\texttt{ in}}  & {\em cell\+\_\+methods} & String to append as cell\+\_\+methods attribute. Use \textquotesingle{}\textquotesingle{} to have no attribute. If present, this overrides the default constructed from the default for each individual axis direction. \\
\hline
\mbox{\texttt{ in}}  & {\em x\+\_\+cell\+\_\+method} & Specifies the cell method for the x-\/direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em y\+\_\+cell\+\_\+method} & Specifies the cell method for the y-\/direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em v\+\_\+cell\+\_\+method} & Specifies the cell method for the vertical direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em v\+\_\+extensive} & True for vertically extensive fields (vertically integrated). Default/absent for intensive. \\
\hline
\end{DoxyParams}


Definition at line 2541 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2543   \textcolor{keywordtype}{integer},                    \textcolor{keywordtype}{intent(in)}  :: id\textcolor{comment}{ !< Handle to diagnostic}}
\DoxyCodeLine{2544   \textcolor{keywordtype}{type}(axes\_grp),             \textcolor{keywordtype}{intent(in)}  :: axes\textcolor{comment}{ !< Container w/ up to 3 integer handles that indicates}}
\DoxyCodeLine{2545 \textcolor{comment}{                                                  !! axes for this field}}
\DoxyCodeLine{2546   \textcolor{keywordtype}{character(len=*)},           \textcolor{keywordtype}{intent(out)} :: ostring\textcolor{comment}{ !< The cell\_methods strings that would appear in the file}}
\DoxyCodeLine{2547   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: cell\_methods\textcolor{comment}{ !< String to append as cell\_methods attribute.}}
\DoxyCodeLine{2548 \textcolor{comment}{                                                         !! Use '' to have no attribute. If present, this}}
\DoxyCodeLine{2549 \textcolor{comment}{                                                         !! overrides the default constructed from the default}}
\DoxyCodeLine{2550 \textcolor{comment}{                                                         !! for each individual axis direction.}}
\DoxyCodeLine{2551   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: x\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the x-\/direction.}}
\DoxyCodeLine{2552 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{2553   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: y\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the y-\/direction.}}
\DoxyCodeLine{2554 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{2555   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: v\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the vertical direction.}}
\DoxyCodeLine{2556 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{2557   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: v\_extensive\textcolor{comment}{ !< True for vertically extensive fields}}
\DoxyCodeLine{2558 \textcolor{comment}{                                                         !! (vertically integrated). Default/absent for intensive.}}
\DoxyCodeLine{2559   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{2560   \textcolor{keywordtype}{character(len=9)} :: axis\_name}
\DoxyCodeLine{2561   \textcolor{keywordtype}{logical} :: x\_mean, y\_mean, x\_sum, y\_sum}
\DoxyCodeLine{2562 }
\DoxyCodeLine{2563   x\_mean = .false.}
\DoxyCodeLine{2564   y\_mean = .false.}
\DoxyCodeLine{2565   x\_sum = .false.}
\DoxyCodeLine{2566   y\_sum = .false.}
\DoxyCodeLine{2567 }
\DoxyCodeLine{2568   ostring = \textcolor{stringliteral}{''}}
\DoxyCodeLine{2569   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cell\_methods)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2570     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(x\_cell\_method) .or. \textcolor{keyword}{present}(y\_cell\_method) .or. \textcolor{keyword}{present}(v\_cell\_method) \&}
\DoxyCodeLine{2571         .or. \textcolor{keyword}{present}(v\_extensive)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2572       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"attach\_cell\_methods: "} // \&}
\DoxyCodeLine{2573            \textcolor{stringliteral}{'Individual direction cell method was specified along with a "cell\_methods" string.'})}
\DoxyCodeLine{2574 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2575     \textcolor{keywordflow}{if} (len(trim(cell\_methods))>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2576       \textcolor{keyword}{call }diag\_field\_add\_attribute(id, \textcolor{stringliteral}{'cell\_methods'}, trim(cell\_methods))}
\DoxyCodeLine{2577       ostring = trim(cell\_methods)}
\DoxyCodeLine{2578 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2579   \textcolor{keywordflow}{else}}
\DoxyCodeLine{2580     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(x\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2581       \textcolor{keywordflow}{if} (len(trim(x\_cell\_method))>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2582         \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(1), axis\_name)}
\DoxyCodeLine{2583         \textcolor{keyword}{call }diag\_field\_add\_attribute(id, \textcolor{stringliteral}{'cell\_methods'}, trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(x\_cell\_method))}
\DoxyCodeLine{2584         ostring = trim(adjustl(ostring))//\textcolor{stringliteral}{' '}//trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(x\_cell\_method)}
\DoxyCodeLine{2585         \textcolor{keywordflow}{if} (trim(x\_cell\_method)==\textcolor{stringliteral}{'mean'}) x\_mean=.true.}
\DoxyCodeLine{2586         \textcolor{keywordflow}{if} (trim(x\_cell\_method)==\textcolor{stringliteral}{'sum'}) x\_sum=.true.}
\DoxyCodeLine{2587 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2588     \textcolor{keywordflow}{else}}
\DoxyCodeLine{2589       \textcolor{keywordflow}{if} (len(trim(axes\%x\_cell\_method))>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2590         \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(1), axis\_name)}
\DoxyCodeLine{2591         \textcolor{keyword}{call }diag\_field\_add\_attribute(id, \textcolor{stringliteral}{'cell\_methods'}, trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(axes\%x\_cell\_method))}
\DoxyCodeLine{2592         ostring = trim(adjustl(ostring))//\textcolor{stringliteral}{' '}//trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(axes\%x\_cell\_method)}
\DoxyCodeLine{2593         \textcolor{keywordflow}{if} (trim(axes\%x\_cell\_method)==\textcolor{stringliteral}{'mean'}) x\_mean=.true.}
\DoxyCodeLine{2594         \textcolor{keywordflow}{if} (trim(axes\%x\_cell\_method)==\textcolor{stringliteral}{'sum'}) x\_sum=.true.}
\DoxyCodeLine{2595 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2596 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2597     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(y\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2598       \textcolor{keywordflow}{if} (len(trim(y\_cell\_method))>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2599         \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(2), axis\_name)}
\DoxyCodeLine{2600         \textcolor{keyword}{call }diag\_field\_add\_attribute(id, \textcolor{stringliteral}{'cell\_methods'}, trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(y\_cell\_method))}
\DoxyCodeLine{2601         ostring = trim(adjustl(ostring))//\textcolor{stringliteral}{' '}//trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(y\_cell\_method)}
\DoxyCodeLine{2602         \textcolor{keywordflow}{if} (trim(y\_cell\_method)==\textcolor{stringliteral}{'mean'}) y\_mean=.true.}
\DoxyCodeLine{2603         \textcolor{keywordflow}{if} (trim(y\_cell\_method)==\textcolor{stringliteral}{'sum'}) y\_sum=.true.}
\DoxyCodeLine{2604 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2605     \textcolor{keywordflow}{else}}
\DoxyCodeLine{2606       \textcolor{keywordflow}{if} (len(trim(axes\%y\_cell\_method))>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2607         \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(2), axis\_name)}
\DoxyCodeLine{2608         \textcolor{keyword}{call }diag\_field\_add\_attribute(id, \textcolor{stringliteral}{'cell\_methods'}, trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(axes\%y\_cell\_method))}
\DoxyCodeLine{2609         ostring = trim(adjustl(ostring))//\textcolor{stringliteral}{' '}//trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(axes\%y\_cell\_method)}
\DoxyCodeLine{2610         \textcolor{keywordflow}{if} (trim(axes\%y\_cell\_method)==\textcolor{stringliteral}{'mean'}) y\_mean=.true.}
\DoxyCodeLine{2611         \textcolor{keywordflow}{if} (trim(axes\%y\_cell\_method)==\textcolor{stringliteral}{'sum'}) y\_sum=.true.}
\DoxyCodeLine{2612 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2613 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2614     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(v\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2615       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(v\_extensive)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"attach\_cell\_methods: "} // \&}
\DoxyCodeLine{2616            \textcolor{stringliteral}{'Vertical cell method was specified along with the vertically extensive flag.'})}
\DoxyCodeLine{2617       \textcolor{keywordflow}{if} (len(trim(v\_cell\_method))>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2618         \textcolor{keywordflow}{if} (axes\%rank==1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2619           \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(1), axis\_name)}
\DoxyCodeLine{2620         \textcolor{keywordflow}{elseif} (axes\%rank==3) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2621           \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(3), axis\_name)}
\DoxyCodeLine{2622 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2623         \textcolor{keyword}{call }diag\_field\_add\_attribute(id, \textcolor{stringliteral}{'cell\_methods'}, trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(v\_cell\_method))}
\DoxyCodeLine{2624         ostring = trim(adjustl(ostring))//\textcolor{stringliteral}{' '}//trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(v\_cell\_method)}
\DoxyCodeLine{2625 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2626     \textcolor{keywordflow}{elseif} (\textcolor{keyword}{present}(v\_extensive)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2627      \textcolor{keywordflow}{if}(v\_extensive) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2628       \textcolor{keywordflow}{if} (axes\%rank==1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2629         \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(1), axis\_name)}
\DoxyCodeLine{2630       \textcolor{keywordflow}{elseif} (axes\%rank==3) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2631         \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(3), axis\_name)}
\DoxyCodeLine{2632 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2633       \textcolor{keyword}{call }diag\_field\_add\_attribute(id, \textcolor{stringliteral}{'cell\_methods'}, trim(axis\_name)//\textcolor{stringliteral}{':sum'})}
\DoxyCodeLine{2634       ostring = trim(adjustl(ostring))//\textcolor{stringliteral}{' '}//trim(axis\_name)//\textcolor{stringliteral}{':sum'}}
\DoxyCodeLine{2635 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{2636     \textcolor{keywordflow}{else}}
\DoxyCodeLine{2637       \textcolor{keywordflow}{if} (len(trim(axes\%v\_cell\_method))>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2638         \textcolor{keywordflow}{if} (axes\%rank==1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2639           \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(1), axis\_name)}
\DoxyCodeLine{2640         \textcolor{keywordflow}{elseif} (axes\%rank==3) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2641           \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(3), axis\_name)}
\DoxyCodeLine{2642 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2643         \textcolor{keyword}{call }diag\_field\_add\_attribute(id, \textcolor{stringliteral}{'cell\_methods'}, trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(axes\%v\_cell\_method))}
\DoxyCodeLine{2644         ostring = trim(adjustl(ostring))//\textcolor{stringliteral}{' '}//trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(axes\%v\_cell\_method)}
\DoxyCodeLine{2645 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2646 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2647     \textcolor{keywordflow}{if} (x\_mean .and. y\_mean) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2648       \textcolor{keyword}{call }diag\_field\_add\_attribute(id, \textcolor{stringliteral}{'cell\_methods'}, \textcolor{stringliteral}{'area:mean'})}
\DoxyCodeLine{2649       ostring = trim(adjustl(ostring))//\textcolor{stringliteral}{' area:mean'}}
\DoxyCodeLine{2650     \textcolor{keywordflow}{elseif} (x\_sum .and. y\_sum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2651       \textcolor{keyword}{call }diag\_field\_add\_attribute(id, \textcolor{stringliteral}{'cell\_methods'}, \textcolor{stringliteral}{'area:sum'})}
\DoxyCodeLine{2652       ostring = trim(adjustl(ostring))//\textcolor{stringliteral}{' area:sum'}}
\DoxyCodeLine{2653 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2654 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2655   ostring = adjustl(ostring)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ab9f767ec24a860cb71cae264560272a8}\label{namespacemom__diag__mediator_ab9f767ec24a860cb71cae264560272a8}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!define\_axes\_group@{define\_axes\_group}}
\index{define\_axes\_group@{define\_axes\_group}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{define\_axes\_group()}{define\_axes\_group()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::define\+\_\+axes\+\_\+group (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in), target}]{diag\+\_\+cs,  }\item[{integer, dimension(\+:), intent(in)}]{handles,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), intent(out)}]{axes,  }\item[{integer, intent(in), optional}]{nz,  }\item[{integer, intent(in), optional}]{vertical\+\_\+coordinate\+\_\+number,  }\item[{character(len=$\ast$), intent(in), optional}]{x\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{y\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{v\+\_\+cell\+\_\+method,  }\item[{logical, intent(in), optional}]{is\+\_\+h\+\_\+point,  }\item[{logical, intent(in), optional}]{is\+\_\+q\+\_\+point,  }\item[{logical, intent(in), optional}]{is\+\_\+u\+\_\+point,  }\item[{logical, intent(in), optional}]{is\+\_\+v\+\_\+point,  }\item[{logical, intent(in), optional}]{is\+\_\+layer,  }\item[{logical, intent(in), optional}]{is\+\_\+interface,  }\item[{logical, intent(in), optional}]{is\+\_\+native,  }\item[{logical, intent(in), optional}]{needs\+\_\+remapping,  }\item[{logical, intent(in), optional}]{needs\+\_\+interpolating,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), optional, target}]{xyave\+\_\+axes }\end{DoxyParamCaption})}



Defines a group of \char`\"{}axes\char`\"{} from list of handles. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Diagnostics control structure \\
\hline
\mbox{\texttt{ in}}  & {\em handles} & A list of 1D axis handles \\
\hline
\mbox{\texttt{ out}}  & {\em axes} & The group of 1D axes \\
\hline
\mbox{\texttt{ in}}  & {\em nz} & Number of layers in this diagnostic grid \\
\hline
\mbox{\texttt{ in}}  & {\em vertical\+\_\+coordinate\+\_\+number} & Index number for vertical coordinate \\
\hline
\mbox{\texttt{ in}}  & {\em x\+\_\+cell\+\_\+method} & A x-\/direction cell method used to construct the \char`\"{}cell\+\_\+methods\char`\"{} attribute in CF convention \\
\hline
\mbox{\texttt{ in}}  & {\em y\+\_\+cell\+\_\+method} & A y-\/direction cell method used to construct the \char`\"{}cell\+\_\+methods\char`\"{} attribute in CF convention \\
\hline
\mbox{\texttt{ in}}  & {\em v\+\_\+cell\+\_\+method} & A vertical direction cell method used to construct the \char`\"{}cell\+\_\+methods\char`\"{} attribute in CF convention \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+h\+\_\+point} & If true, indicates this axes group for h-\/point located fields \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+q\+\_\+point} & If true, indicates this axes group for q-\/point located fields \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+u\+\_\+point} & If true, indicates this axes group for u-\/point located fields \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+v\+\_\+point} & If true, indicates this axes group for v-\/point located fields \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+layer} & If true, indicates that this axes group is for a layer vertically-\/located field. \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+interface} & If true, indicates that this axes group is for an interface vertically-\/located field. \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+native} & If true, indicates that this axes group is for a native model grid. False for any other grid. \\
\hline
\mbox{\texttt{ in}}  & {\em needs\+\_\+remapping} & If true, indicates that this axes group is for a intensive layer-\/located field that must be remapped to these axes. Used for rank$>$2. \\
\hline
\mbox{\texttt{ in}}  & {\em needs\+\_\+interpolating} & If true, indicates that this axes group is for a sampled interface-\/located field that must be interpolated to these axes. Used for rank$>$2. \\
\hline
 & {\em xyave\+\_\+axes} & The corresponding axes group for horizontally area-\/average diagnostics \\
\hline
\end{DoxyParams}


Definition at line 995 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1001   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target},    \textcolor{keywordtype}{intent(in)}  :: diag\_cs\textcolor{comment}{ !< Diagnostics control structure}}
\DoxyCodeLine{1002   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(:)},      \textcolor{keywordtype}{intent(in)}  :: handles\textcolor{comment}{ !< A list of 1D axis handles}}
\DoxyCodeLine{1003   \textcolor{keywordtype}{type}(axes\_grp),             \textcolor{keywordtype}{intent(out)} :: axes\textcolor{comment}{    !< The group of 1D axes}}
\DoxyCodeLine{1004   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: nz\textcolor{comment}{      !< Number of layers in this diagnostic grid}}
\DoxyCodeLine{1005   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: vertical\_coordinate\_number\textcolor{comment}{ !< Index number for vertical coordinate}}
\DoxyCodeLine{1006   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: x\_cell\_method\textcolor{comment}{ !< A x-\/direction cell method used to construct the}}
\DoxyCodeLine{1007 \textcolor{comment}{                                                           !! "cell\_methods" attribute in CF convention}}
\DoxyCodeLine{1008   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: y\_cell\_method\textcolor{comment}{ !< A y-\/direction cell method used to construct the}}
\DoxyCodeLine{1009 \textcolor{comment}{                                                           !! "cell\_methods" attribute in CF convention}}
\DoxyCodeLine{1010   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: v\_cell\_method\textcolor{comment}{ !< A vertical direction cell method used to construct}}
\DoxyCodeLine{1011 \textcolor{comment}{                                                        !! the "cell\_methods" attribute in CF convention}}
\DoxyCodeLine{1012   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_h\_point\textcolor{comment}{ !< If true, indicates this axes group for h-\/point}}
\DoxyCodeLine{1013 \textcolor{comment}{                                                        !! located fields}}
\DoxyCodeLine{1014   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_q\_point\textcolor{comment}{ !< If true, indicates this axes group for q-\/point}}
\DoxyCodeLine{1015 \textcolor{comment}{                                                        !! located fields}}
\DoxyCodeLine{1016   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_u\_point\textcolor{comment}{ !< If true, indicates this axes group for}}
\DoxyCodeLine{1017 \textcolor{comment}{                                                        !! u-\/point located fields}}
\DoxyCodeLine{1018   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_v\_point\textcolor{comment}{ !< If true, indicates this axes group for}}
\DoxyCodeLine{1019 \textcolor{comment}{                                                        !! v-\/point located fields}}
\DoxyCodeLine{1020   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_layer\textcolor{comment}{   !< If true, indicates that this axes group is}}
\DoxyCodeLine{1021 \textcolor{comment}{                                                        !! for a layer vertically-\/located field.}}
\DoxyCodeLine{1022   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_interface\textcolor{comment}{ !< If true, indicates that this axes group}}
\DoxyCodeLine{1023 \textcolor{comment}{                                                        !! is for an interface vertically-\/located field.}}
\DoxyCodeLine{1024   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_native\textcolor{comment}{  !< If true, indicates that this axes group is}}
\DoxyCodeLine{1025 \textcolor{comment}{                                                        !! for a native model grid. False for any other grid.}}
\DoxyCodeLine{1026   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: needs\_remapping\textcolor{comment}{ !< If true, indicates that this axes group is}}
\DoxyCodeLine{1027 \textcolor{comment}{                                                        !! for a intensive layer-\/located field that must}}
\DoxyCodeLine{1028 \textcolor{comment}{                                                        !! be remapped to these axes. Used for rank>2.}}
\DoxyCodeLine{1029   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: needs\_interpolating\textcolor{comment}{ !< If true, indicates that this axes group}}
\DoxyCodeLine{1030 \textcolor{comment}{                                                        !! is for a sampled interface-\/located field that must}}
\DoxyCodeLine{1031 \textcolor{comment}{                                                        !! be interpolated to these axes. Used for rank>2.}}
\DoxyCodeLine{1032   \textcolor{keywordtype}{type}(axes\_grp),   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{target}      :: xyave\_axes\textcolor{comment}{ !< The corresponding axes group for horizontally}}
\DoxyCodeLine{1033 \textcolor{comment}{                                                        !! area-\/average diagnostics}}
\DoxyCodeLine{1034   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1035   \textcolor{keywordtype}{integer} :: n}
\DoxyCodeLine{1036 }
\DoxyCodeLine{1037   n = \textcolor{keyword}{size}(handles)}
\DoxyCodeLine{1038   \textcolor{keywordflow}{if} (n<1 .or. n>3) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"define\_axes\_group: wrong size for list of handles!"})}
\DoxyCodeLine{1039   \textcolor{keyword}{allocate}( axes\%handles(n) )}
\DoxyCodeLine{1040   axes\%id = i2s(handles, n) \textcolor{comment}{! Identifying string}}
\DoxyCodeLine{1041   axes\%rank = n}
\DoxyCodeLine{1042   axes\%handles(:) = handles(:)}
\DoxyCodeLine{1043   axes\%diag\_cs => diag\_cs \textcolor{comment}{! A [circular] link back to the diag\_cs structure}}
\DoxyCodeLine{1044   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(x\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1045     \textcolor{keywordflow}{if} (axes\%rank<2) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'define\_axes\_group: '} // \&}
\DoxyCodeLine{1046                                            \textcolor{stringliteral}{'Can not set x\_cell\_method for rank<2.'})}
\DoxyCodeLine{1047     axes\%x\_cell\_method = trim(x\_cell\_method)}
\DoxyCodeLine{1048   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1049     axes\%x\_cell\_method = \textcolor{stringliteral}{''}}
\DoxyCodeLine{1050 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1051   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(y\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1052     \textcolor{keywordflow}{if} (axes\%rank<2) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'define\_axes\_group: '} // \&}
\DoxyCodeLine{1053                                            \textcolor{stringliteral}{'Can not set y\_cell\_method for rank<2.'})}
\DoxyCodeLine{1054     axes\%y\_cell\_method = trim(y\_cell\_method)}
\DoxyCodeLine{1055   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1056     axes\%y\_cell\_method = \textcolor{stringliteral}{''}}
\DoxyCodeLine{1057 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1058   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(v\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1059     \textcolor{keywordflow}{if} (axes\%rank/=1 .and. axes\%rank/=3) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'define\_axes\_group: '} // \&}
\DoxyCodeLine{1060                                            \textcolor{stringliteral}{'Can not set v\_cell\_method for rank<>1 or 3.'})}
\DoxyCodeLine{1061     axes\%v\_cell\_method = trim(v\_cell\_method)}
\DoxyCodeLine{1062   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1063     axes\%v\_cell\_method = \textcolor{stringliteral}{''}}
\DoxyCodeLine{1064 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1065   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(nz)) axes\%nz = nz}
\DoxyCodeLine{1066   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(vertical\_coordinate\_number)) axes\%vertical\_coordinate\_number = vertical\_coordinate\_number}
\DoxyCodeLine{1067   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_h\_point)) axes\%is\_h\_point = is\_h\_point}
\DoxyCodeLine{1068   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_q\_point)) axes\%is\_q\_point = is\_q\_point}
\DoxyCodeLine{1069   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_u\_point)) axes\%is\_u\_point = is\_u\_point}
\DoxyCodeLine{1070   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_v\_point)) axes\%is\_v\_point = is\_v\_point}
\DoxyCodeLine{1071   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_layer)) axes\%is\_layer = is\_layer}
\DoxyCodeLine{1072   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_interface)) axes\%is\_interface = is\_interface}
\DoxyCodeLine{1073   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_native)) axes\%is\_native = is\_native}
\DoxyCodeLine{1074   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(needs\_remapping)) axes\%needs\_remapping = needs\_remapping}
\DoxyCodeLine{1075   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(needs\_interpolating)) axes\%needs\_interpolating = needs\_interpolating}
\DoxyCodeLine{1076   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(xyave\_axes)) axes\%xyave\_axes => xyave\_axes}
\DoxyCodeLine{1077 }
\DoxyCodeLine{1078   \textcolor{comment}{! Setup masks for this axes group}}
\DoxyCodeLine{1079   axes\%mask2d => null()}
\DoxyCodeLine{1080   \textcolor{keywordflow}{if} (axes\%rank==2) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1081     \textcolor{keywordflow}{if} (axes\%is\_h\_point) axes\%mask2d => diag\_cs\%mask2dT}
\DoxyCodeLine{1082     \textcolor{keywordflow}{if} (axes\%is\_u\_point) axes\%mask2d => diag\_cs\%mask2dCu}
\DoxyCodeLine{1083     \textcolor{keywordflow}{if} (axes\%is\_v\_point) axes\%mask2d => diag\_cs\%mask2dCv}
\DoxyCodeLine{1084     \textcolor{keywordflow}{if} (axes\%is\_q\_point) axes\%mask2d => diag\_cs\%mask2dBu}
\DoxyCodeLine{1085 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1086   \textcolor{comment}{! A static 3d mask for non-\/native coordinates can only be setup when a grid is available}}
\DoxyCodeLine{1087   axes\%mask3d => null()}
\DoxyCodeLine{1088   \textcolor{keywordflow}{if} (axes\%rank==3 .and. axes\%is\_native) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1089     \textcolor{comment}{! Native variables can/should use the native masks copied into diag\_cs}}
\DoxyCodeLine{1090     \textcolor{keywordflow}{if} (axes\%is\_layer) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1091       \textcolor{keywordflow}{if} (axes\%is\_h\_point) axes\%mask3d => diag\_cs\%mask3dTL}
\DoxyCodeLine{1092       \textcolor{keywordflow}{if} (axes\%is\_u\_point) axes\%mask3d => diag\_cs\%mask3dCuL}
\DoxyCodeLine{1093       \textcolor{keywordflow}{if} (axes\%is\_v\_point) axes\%mask3d => diag\_cs\%mask3dCvL}
\DoxyCodeLine{1094       \textcolor{keywordflow}{if} (axes\%is\_q\_point) axes\%mask3d => diag\_cs\%mask3dBL}
\DoxyCodeLine{1095     \textcolor{keywordflow}{elseif} (axes\%is\_interface) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1096       \textcolor{keywordflow}{if} (axes\%is\_h\_point) axes\%mask3d => diag\_cs\%mask3dTi}
\DoxyCodeLine{1097       \textcolor{keywordflow}{if} (axes\%is\_u\_point) axes\%mask3d => diag\_cs\%mask3dCui}
\DoxyCodeLine{1098       \textcolor{keywordflow}{if} (axes\%is\_v\_point) axes\%mask3d => diag\_cs\%mask3dCvi}
\DoxyCodeLine{1099       \textcolor{keywordflow}{if} (axes\%is\_q\_point) axes\%mask3d => diag\_cs\%mask3dBi}
\DoxyCodeLine{1100 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1101 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1102 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a51129041d5b42f6546c087111465f639}\label{namespacemom__diag__mediator_a51129041d5b42f6546c087111465f639}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!define\_axes\_group\_dsamp@{define\_axes\_group\_dsamp}}
\index{define\_axes\_group\_dsamp@{define\_axes\_group\_dsamp}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{define\_axes\_group\_dsamp()}{define\_axes\_group\_dsamp()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::define\+\_\+axes\+\_\+group\+\_\+dsamp (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in), target}]{diag\+\_\+cs,  }\item[{integer, dimension(\+:), intent(in)}]{handles,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), intent(out)}]{axes,  }\item[{integer, intent(in)}]{dl,  }\item[{integer, intent(in), optional}]{nz,  }\item[{integer, intent(in), optional}]{vertical\+\_\+coordinate\+\_\+number,  }\item[{character(len=$\ast$), intent(in), optional}]{x\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{y\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{v\+\_\+cell\+\_\+method,  }\item[{logical, intent(in), optional}]{is\+\_\+h\+\_\+point,  }\item[{logical, intent(in), optional}]{is\+\_\+q\+\_\+point,  }\item[{logical, intent(in), optional}]{is\+\_\+u\+\_\+point,  }\item[{logical, intent(in), optional}]{is\+\_\+v\+\_\+point,  }\item[{logical, intent(in), optional}]{is\+\_\+layer,  }\item[{logical, intent(in), optional}]{is\+\_\+interface,  }\item[{logical, intent(in), optional}]{is\+\_\+native,  }\item[{logical, intent(in), optional}]{needs\+\_\+remapping,  }\item[{logical, intent(in), optional}]{needs\+\_\+interpolating,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), optional, target}]{xyave\+\_\+axes }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Defines a group of downsampled \char`\"{}axes\char`\"{} from list of handles. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Diagnostics control structure \\
\hline
\mbox{\texttt{ in}}  & {\em handles} & A list of 1D axis handles \\
\hline
\mbox{\texttt{ out}}  & {\em axes} & The group of 1D axes \\
\hline
\mbox{\texttt{ in}}  & {\em dl} & Downsample level \\
\hline
\mbox{\texttt{ in}}  & {\em nz} & Number of layers in this diagnostic grid \\
\hline
\mbox{\texttt{ in}}  & {\em vertical\+\_\+coordinate\+\_\+number} & Index number for vertical coordinate \\
\hline
\mbox{\texttt{ in}}  & {\em x\+\_\+cell\+\_\+method} & A x-\/direction cell method used to construct the \char`\"{}cell\+\_\+methods\char`\"{} attribute in CF convention \\
\hline
\mbox{\texttt{ in}}  & {\em y\+\_\+cell\+\_\+method} & A y-\/direction cell method used to construct the \char`\"{}cell\+\_\+methods\char`\"{} attribute in CF convention \\
\hline
\mbox{\texttt{ in}}  & {\em v\+\_\+cell\+\_\+method} & A vertical direction cell method used to construct the \char`\"{}cell\+\_\+methods\char`\"{} attribute in CF convention \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+h\+\_\+point} & If true, indicates this axes group for h-\/point located fields \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+q\+\_\+point} & If true, indicates this axes group for q-\/point located fields \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+u\+\_\+point} & If true, indicates this axes group for u-\/point located fields \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+v\+\_\+point} & If true, indicates this axes group for v-\/point located fields \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+layer} & If true, indicates that this axes group is for a layer vertically-\/located field. \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+interface} & If true, indicates that this axes group is for an interface vertically-\/located field. \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+native} & If true, indicates that this axes group is for a native model grid. False for any other grid. \\
\hline
\mbox{\texttt{ in}}  & {\em needs\+\_\+remapping} & If true, indicates that this axes group is for a intensive layer-\/located field that must be remapped to these axes. Used for rank$>$2. \\
\hline
\mbox{\texttt{ in}}  & {\em needs\+\_\+interpolating} & If true, indicates that this axes group is for a sampled interface-\/located field that must be interpolated to these axes. Used for rank$>$2. \\
\hline
 & {\em xyave\+\_\+axes} & The corresponding axes group for horizontally area-\/average diagnostics \\
\hline
\end{DoxyParams}


Definition at line 1106 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1112   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target},    \textcolor{keywordtype}{intent(in)}  :: diag\_cs\textcolor{comment}{ !< Diagnostics control structure}}
\DoxyCodeLine{1113   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(:)},      \textcolor{keywordtype}{intent(in)}  :: handles\textcolor{comment}{ !< A list of 1D axis handles}}
\DoxyCodeLine{1114   \textcolor{keywordtype}{type}(axes\_grp),             \textcolor{keywordtype}{intent(out)} :: axes\textcolor{comment}{    !< The group of 1D axes}}
\DoxyCodeLine{1115   \textcolor{keywordtype}{integer},                    \textcolor{keywordtype}{intent(in)}  :: dl\textcolor{comment}{      !< Downsample level}}
\DoxyCodeLine{1116   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: nz\textcolor{comment}{      !< Number of layers in this diagnostic grid}}
\DoxyCodeLine{1117   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: vertical\_coordinate\_number\textcolor{comment}{ !< Index number for vertical coordinate}}
\DoxyCodeLine{1118   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: x\_cell\_method\textcolor{comment}{ !< A x-\/direction cell method used to construct the}}
\DoxyCodeLine{1119 \textcolor{comment}{                                                           !! "cell\_methods" attribute in CF convention}}
\DoxyCodeLine{1120   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: y\_cell\_method\textcolor{comment}{ !< A y-\/direction cell method used to construct the}}
\DoxyCodeLine{1121 \textcolor{comment}{                                                           !! "cell\_methods" attribute in CF convention}}
\DoxyCodeLine{1122   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: v\_cell\_method\textcolor{comment}{ !< A vertical direction cell method used to construct}}
\DoxyCodeLine{1123 \textcolor{comment}{                                                        !! the "cell\_methods" attribute in CF convention}}
\DoxyCodeLine{1124   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_h\_point\textcolor{comment}{ !< If true, indicates this axes group for h-\/point}}
\DoxyCodeLine{1125 \textcolor{comment}{                                                        !! located fields}}
\DoxyCodeLine{1126   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_q\_point\textcolor{comment}{ !< If true, indicates this axes group for q-\/point}}
\DoxyCodeLine{1127 \textcolor{comment}{                                                        !! located fields}}
\DoxyCodeLine{1128   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_u\_point\textcolor{comment}{ !< If true, indicates this axes group for}}
\DoxyCodeLine{1129 \textcolor{comment}{                                                        !! u-\/point located fields}}
\DoxyCodeLine{1130   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_v\_point\textcolor{comment}{ !< If true, indicates this axes group for}}
\DoxyCodeLine{1131 \textcolor{comment}{                                                        !! v-\/point located fields}}
\DoxyCodeLine{1132   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_layer\textcolor{comment}{   !< If true, indicates that this axes group is}}
\DoxyCodeLine{1133 \textcolor{comment}{                                                        !! for a layer vertically-\/located field.}}
\DoxyCodeLine{1134   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_interface\textcolor{comment}{ !< If true, indicates that this axes group}}
\DoxyCodeLine{1135 \textcolor{comment}{                                                        !! is for an interface vertically-\/located field.}}
\DoxyCodeLine{1136   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: is\_native\textcolor{comment}{  !< If true, indicates that this axes group is}}
\DoxyCodeLine{1137 \textcolor{comment}{                                                        !! for a native model grid. False for any other grid.}}
\DoxyCodeLine{1138   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: needs\_remapping\textcolor{comment}{ !< If true, indicates that this axes group is}}
\DoxyCodeLine{1139 \textcolor{comment}{                                                        !! for a intensive layer-\/located field that must}}
\DoxyCodeLine{1140 \textcolor{comment}{                                                        !! be remapped to these axes. Used for rank>2.}}
\DoxyCodeLine{1141   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: needs\_interpolating\textcolor{comment}{ !< If true, indicates that this axes group}}
\DoxyCodeLine{1142 \textcolor{comment}{                                                        !! is for a sampled interface-\/located field that must}}
\DoxyCodeLine{1143 \textcolor{comment}{                                                        !! be interpolated to these axes. Used for rank>2.}}
\DoxyCodeLine{1144   \textcolor{keywordtype}{type}(axes\_grp),   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{target}      :: xyave\_axes\textcolor{comment}{ !< The corresponding axes group for horizontally}}
\DoxyCodeLine{1145 \textcolor{comment}{                                                        !! area-\/average diagnostics}}
\DoxyCodeLine{1146   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1147   \textcolor{keywordtype}{integer} :: n}
\DoxyCodeLine{1148 }
\DoxyCodeLine{1149   n = \textcolor{keyword}{size}(handles)}
\DoxyCodeLine{1150   \textcolor{keywordflow}{if} (n<1 .or. n>3) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"define\_axes\_group: wrong size for list of handles!"})}
\DoxyCodeLine{1151   \textcolor{keyword}{allocate}( axes\%handles(n) )}
\DoxyCodeLine{1152   axes\%id = i2s(handles, n) \textcolor{comment}{! Identifying string}}
\DoxyCodeLine{1153   axes\%rank = n}
\DoxyCodeLine{1154   axes\%handles(:) = handles(:)}
\DoxyCodeLine{1155   axes\%diag\_cs => diag\_cs \textcolor{comment}{! A [circular] link back to the diag\_cs structure}}
\DoxyCodeLine{1156   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(x\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1157     \textcolor{keywordflow}{if} (axes\%rank<2) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'define\_axes\_group: '} // \&}
\DoxyCodeLine{1158                                            \textcolor{stringliteral}{'Can not set x\_cell\_method for rank<2.'})}
\DoxyCodeLine{1159     axes\%x\_cell\_method = trim(x\_cell\_method)}
\DoxyCodeLine{1160   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1161     axes\%x\_cell\_method = \textcolor{stringliteral}{''}}
\DoxyCodeLine{1162 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1163   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(y\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1164     \textcolor{keywordflow}{if} (axes\%rank<2) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'define\_axes\_group: '} // \&}
\DoxyCodeLine{1165                                            \textcolor{stringliteral}{'Can not set y\_cell\_method for rank<2.'})}
\DoxyCodeLine{1166     axes\%y\_cell\_method = trim(y\_cell\_method)}
\DoxyCodeLine{1167   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1168     axes\%y\_cell\_method = \textcolor{stringliteral}{''}}
\DoxyCodeLine{1169 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1170   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(v\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1171     \textcolor{keywordflow}{if} (axes\%rank/=1 .and. axes\%rank/=3) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{'define\_axes\_group: '} // \&}
\DoxyCodeLine{1172                                            \textcolor{stringliteral}{'Can not set v\_cell\_method for rank<>1 or 3.'})}
\DoxyCodeLine{1173     axes\%v\_cell\_method = trim(v\_cell\_method)}
\DoxyCodeLine{1174   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1175     axes\%v\_cell\_method = \textcolor{stringliteral}{''}}
\DoxyCodeLine{1176 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1177   axes\%downsample\_level = dl}
\DoxyCodeLine{1178   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(nz)) axes\%nz = nz}
\DoxyCodeLine{1179   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(vertical\_coordinate\_number)) axes\%vertical\_coordinate\_number = vertical\_coordinate\_number}
\DoxyCodeLine{1180   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_h\_point)) axes\%is\_h\_point = is\_h\_point}
\DoxyCodeLine{1181   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_q\_point)) axes\%is\_q\_point = is\_q\_point}
\DoxyCodeLine{1182   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_u\_point)) axes\%is\_u\_point = is\_u\_point}
\DoxyCodeLine{1183   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_v\_point)) axes\%is\_v\_point = is\_v\_point}
\DoxyCodeLine{1184   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_layer)) axes\%is\_layer = is\_layer}
\DoxyCodeLine{1185   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_interface)) axes\%is\_interface = is\_interface}
\DoxyCodeLine{1186   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_native)) axes\%is\_native = is\_native}
\DoxyCodeLine{1187   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(needs\_remapping)) axes\%needs\_remapping = needs\_remapping}
\DoxyCodeLine{1188   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(needs\_interpolating)) axes\%needs\_interpolating = needs\_interpolating}
\DoxyCodeLine{1189   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(xyave\_axes)) axes\%xyave\_axes => xyave\_axes}
\DoxyCodeLine{1190 }
\DoxyCodeLine{1191   \textcolor{comment}{! Setup masks for this axes group}}
\DoxyCodeLine{1192 }
\DoxyCodeLine{1193   axes\%mask2d => null()}
\DoxyCodeLine{1194   \textcolor{keywordflow}{if} (axes\%rank==2) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1195     \textcolor{keywordflow}{if} (axes\%is\_h\_point) axes\%mask2d => diag\_cs\%mask2dT}
\DoxyCodeLine{1196     \textcolor{keywordflow}{if} (axes\%is\_u\_point) axes\%mask2d => diag\_cs\%mask2dCu}
\DoxyCodeLine{1197     \textcolor{keywordflow}{if} (axes\%is\_v\_point) axes\%mask2d => diag\_cs\%mask2dCv}
\DoxyCodeLine{1198     \textcolor{keywordflow}{if} (axes\%is\_q\_point) axes\%mask2d => diag\_cs\%mask2dBu}
\DoxyCodeLine{1199 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1200   \textcolor{comment}{! A static 3d mask for non-\/native coordinates can only be setup when a grid is available}}
\DoxyCodeLine{1201   axes\%mask3d => null()}
\DoxyCodeLine{1202   \textcolor{keywordflow}{if} (axes\%rank==3 .and. axes\%is\_native) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1203     \textcolor{comment}{! Native variables can/should use the native masks copied into diag\_cs}}
\DoxyCodeLine{1204     \textcolor{keywordflow}{if} (axes\%is\_layer) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1205       \textcolor{keywordflow}{if} (axes\%is\_h\_point) axes\%mask3d => diag\_cs\%mask3dTL}
\DoxyCodeLine{1206       \textcolor{keywordflow}{if} (axes\%is\_u\_point) axes\%mask3d => diag\_cs\%mask3dCuL}
\DoxyCodeLine{1207       \textcolor{keywordflow}{if} (axes\%is\_v\_point) axes\%mask3d => diag\_cs\%mask3dCvL}
\DoxyCodeLine{1208       \textcolor{keywordflow}{if} (axes\%is\_q\_point) axes\%mask3d => diag\_cs\%mask3dBL}
\DoxyCodeLine{1209     \textcolor{keywordflow}{elseif} (axes\%is\_interface) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1210       \textcolor{keywordflow}{if} (axes\%is\_h\_point) axes\%mask3d => diag\_cs\%mask3dTi}
\DoxyCodeLine{1211       \textcolor{keywordflow}{if} (axes\%is\_u\_point) axes\%mask3d => diag\_cs\%mask3dCui}
\DoxyCodeLine{1212       \textcolor{keywordflow}{if} (axes\%is\_v\_point) axes\%mask3d => diag\_cs\%mask3dCvi}
\DoxyCodeLine{1213       \textcolor{keywordflow}{if} (axes\%is\_q\_point) axes\%mask3d => diag\_cs\%mask3dBi}
\DoxyCodeLine{1214 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1215 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1216 }
\DoxyCodeLine{1217   axes\%dsamp(dl)\%mask2d => null()}
\DoxyCodeLine{1218   \textcolor{keywordflow}{if} (axes\%rank==2) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1219     \textcolor{keywordflow}{if} (axes\%is\_h\_point) axes\%dsamp(dl)\%mask2d => diag\_cs\%dsamp(dl)\%mask2dT}
\DoxyCodeLine{1220     \textcolor{keywordflow}{if} (axes\%is\_u\_point) axes\%dsamp(dl)\%mask2d => diag\_cs\%dsamp(dl)\%mask2dCu}
\DoxyCodeLine{1221     \textcolor{keywordflow}{if} (axes\%is\_v\_point) axes\%dsamp(dl)\%mask2d => diag\_cs\%dsamp(dl)\%mask2dCv}
\DoxyCodeLine{1222     \textcolor{keywordflow}{if} (axes\%is\_q\_point) axes\%dsamp(dl)\%mask2d => diag\_cs\%dsamp(dl)\%mask2dBu}
\DoxyCodeLine{1223 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1224   \textcolor{comment}{! A static 3d mask for non-\/native coordinates can only be setup when a grid is available}}
\DoxyCodeLine{1225   axes\%dsamp(dl)\%mask3d => null()}
\DoxyCodeLine{1226   \textcolor{keywordflow}{if} (axes\%rank==3 .and. axes\%is\_native) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1227     \textcolor{comment}{! Native variables can/should use the native masks copied into diag\_cs}}
\DoxyCodeLine{1228     \textcolor{keywordflow}{if} (axes\%is\_layer) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1229       \textcolor{keywordflow}{if} (axes\%is\_h\_point) axes\%dsamp(dl)\%mask3d => diag\_cs\%dsamp(dl)\%mask3dTL}
\DoxyCodeLine{1230       \textcolor{keywordflow}{if} (axes\%is\_u\_point) axes\%dsamp(dl)\%mask3d => diag\_cs\%dsamp(dl)\%mask3dCuL}
\DoxyCodeLine{1231       \textcolor{keywordflow}{if} (axes\%is\_v\_point) axes\%dsamp(dl)\%mask3d => diag\_cs\%dsamp(dl)\%mask3dCvL}
\DoxyCodeLine{1232       \textcolor{keywordflow}{if} (axes\%is\_q\_point) axes\%dsamp(dl)\%mask3d => diag\_cs\%dsamp(dl)\%mask3dBL}
\DoxyCodeLine{1233     \textcolor{keywordflow}{elseif} (axes\%is\_interface) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1234       \textcolor{keywordflow}{if} (axes\%is\_h\_point) axes\%dsamp(dl)\%mask3d => diag\_cs\%dsamp(dl)\%mask3dTi}
\DoxyCodeLine{1235       \textcolor{keywordflow}{if} (axes\%is\_u\_point) axes\%dsamp(dl)\%mask3d => diag\_cs\%dsamp(dl)\%mask3dCui}
\DoxyCodeLine{1236       \textcolor{keywordflow}{if} (axes\%is\_v\_point) axes\%dsamp(dl)\%mask3d => diag\_cs\%dsamp(dl)\%mask3dCvi}
\DoxyCodeLine{1237       \textcolor{keywordflow}{if} (axes\%is\_q\_point) axes\%dsamp(dl)\%mask3d => diag\_cs\%dsamp(dl)\%mask3dBi}
\DoxyCodeLine{1238 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1239 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1240 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ae002ca447acba252bf7bdc042e75a01e}\label{namespacemom__diag__mediator_ae002ca447acba252bf7bdc042e75a01e}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!describe\_option@{describe\_option}}
\index{describe\_option@{describe\_option}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{describe\_option()}{describe\_option()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::describe\+\_\+option (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{opt\+\_\+name,  }\item[{character(len=$\ast$), intent(in)}]{value,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+\+CS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Describe an option setting in the diagnostic files. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em opt\+\_\+name} & The name of the option \\
\hline
\mbox{\texttt{ in}}  & {\em value} & A character string with the setting of the option. \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\end{DoxyParams}


Definition at line 2908 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2909   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: opt\_name\textcolor{comment}{ !< The name of the option}}
\DoxyCodeLine{2910   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: \textcolor{keywordtype}{value}\textcolor{comment}{   !< A character string with the setting of the option.}}
\DoxyCodeLine{2911   \textcolor{keywordtype}{type}(diag\_ctrl),  \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{2912 }
\DoxyCodeLine{2913   \textcolor{keywordtype}{character(len=240)} :: mesg}
\DoxyCodeLine{2914   \textcolor{keywordtype}{integer} :: len\_ind}
\DoxyCodeLine{2915 }
\DoxyCodeLine{2916   len\_ind = len\_trim(\textcolor{keywordtype}{value})  \textcolor{comment}{! Add error handling for long values?}}
\DoxyCodeLine{2917 }
\DoxyCodeLine{2918   mesg = \textcolor{stringliteral}{"    ! "}//trim(opt\_name)//\textcolor{stringliteral}{": "}//trim(\textcolor{keywordtype}{value})}
\DoxyCodeLine{2919   \textcolor{keyword}{write}(diag\_cs\%available\_diag\_doc\_unit, \textcolor{stringliteral}{'(a)'}) trim(mesg)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a6affd997646a278d7fca03174a5a06ad}\label{namespacemom__diag__mediator_a6affd997646a278d7fca03174a5a06ad}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_associate\_volume\_cell\_measure@{diag\_associate\_volume\_cell\_measure}}
\index{diag\_associate\_volume\_cell\_measure@{diag\_associate\_volume\_cell\_measure}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_associate\_volume\_cell\_measure()}{diag\_associate\_volume\_cell\_measure()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+associate\+\_\+volume\+\_\+cell\+\_\+measure (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs,  }\item[{integer, intent(in)}]{id\+\_\+h\+\_\+volume }\end{DoxyParamCaption})}



Attaches the id of cell volumes to axes groups for use with cell\+\_\+measures. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Diagnostics control structure \\
\hline
\mbox{\texttt{ in}}  & {\em id\+\_\+h\+\_\+volume} & Diag\+\_\+manager id for volume of h-\/cells \\
\hline
\end{DoxyParams}


Definition at line 965 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{966   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{intent(inout)} :: diag\_cs\textcolor{comment}{     !< Diagnostics control structure}}
\DoxyCodeLine{967   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)}    :: id\_h\_volume\textcolor{comment}{ !< Diag\_manager id for volume of h-\/cells}}
\DoxyCodeLine{968   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{969   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{pointer} :: tmp => null()}
\DoxyCodeLine{970 }
\DoxyCodeLine{971   \textcolor{keywordflow}{if} (id\_h\_volume<=0) \textcolor{keywordflow}{return} \textcolor{comment}{! Do nothing}}
\DoxyCodeLine{972   diag\_cs\%volume\_cell\_measure\_dm\_id = id\_h\_volume \textcolor{comment}{! Record for diag\_get\_volume\_cell\_measure\_dm\_id()}}
\DoxyCodeLine{973 }
\DoxyCodeLine{974   \textcolor{comment}{! Set the cell measure for this axes group to the FMS id in this coordinate system}}
\DoxyCodeLine{975   diag\_cs\%diags(id\_h\_volume)\%axes\%id\_volume = diag\_cs\%diags(id\_h\_volume)\%fms\_diag\_id}
\DoxyCodeLine{976 }
\DoxyCodeLine{977   tmp => diag\_cs\%diags(id\_h\_volume)\%next \textcolor{comment}{! First item in the list, if any}}
\DoxyCodeLine{978   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (\textcolor{keyword}{associated}(tmp))}
\DoxyCodeLine{979     \textcolor{comment}{! Set the cell measure for this axes group to the FMS id in this coordinate system}}
\DoxyCodeLine{980     tmp\%axes\%id\_volume = tmp\%fms\_diag\_id}
\DoxyCodeLine{981     tmp => tmp\%next \textcolor{comment}{! Move to next axes group for this field}}
\DoxyCodeLine{982 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{983 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a4c15fc11c4d220ebcdd38adb692950db}\label{namespacemom__diag__mediator_a4c15fc11c4d220ebcdd38adb692950db}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_copy\_diag\_to\_storage@{diag\_copy\_diag\_to\_storage}}
\index{diag\_copy\_diag\_to\_storage@{diag\_copy\_diag\_to\_storage}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_copy\_diag\_to\_storage()}{diag\_copy\_diag\_to\_storage()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+copy\+\_\+diag\+\_\+to\+\_\+storage (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__grid__storage}{diag\+\_\+grid\+\_\+storage}}), intent(inout)}]{grid\+\_\+storage,  }\item[{real, dimension(\+:,\+:,\+:), intent(in)}]{h\+\_\+state,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag }\end{DoxyParamCaption})}



Copy from the main diagnostic arrays to the grid storage as well as the native thicknesses. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em grid\+\_\+storage} & Structure containing a snapshot of the target grids \\
\hline
\mbox{\texttt{ in}}  & {\em h\+\_\+state} & Current model thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em diag} & Diagnostic control structure used as the contructor \\
\hline
\end{DoxyParams}


Definition at line 3612 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3613   \textcolor{keywordtype}{type}(diag\_grid\_storage), \textcolor{keywordtype}{intent(inout)} :: grid\_storage\textcolor{comment}{ !< Structure containing a snapshot of the target grids}}
\DoxyCodeLine{3614 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)},  \textcolor{keywordtype}{intent(in)}    :: h\_state\textcolor{comment}{     !< Current model thicknesses [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{3615   \textcolor{keywordtype}{type}(diag\_ctrl),         \textcolor{keywordtype}{intent(in)}    :: diag\textcolor{comment}{     !< Diagnostic control structure used as the contructor}}
\DoxyCodeLine{3616 }
\DoxyCodeLine{3617   \textcolor{keywordtype}{integer} :: m}
\DoxyCodeLine{3618 }
\DoxyCodeLine{3619   \textcolor{comment}{! Don't do anything else if there are no remapped coordinates}}
\DoxyCodeLine{3620   \textcolor{keywordflow}{if} (grid\_storage\%num\_diag\_coords < 1) \textcolor{keywordflow}{return}}
\DoxyCodeLine{3621 }
\DoxyCodeLine{3622   grid\_storage\%h\_state(:,:,:) = h\_state(:,:,:)}
\DoxyCodeLine{3623   \textcolor{keywordflow}{do} m = 1,grid\_storage\%num\_diag\_coords}
\DoxyCodeLine{3624     \textcolor{keywordflow}{if} (diag\%diag\_remap\_cs(m)\%nz > 0) \&}
\DoxyCodeLine{3625       grid\_storage\%diag\_grids(m)\%h(:,:,:) = diag\%diag\_remap\_cs(m)\%h(:,:,:)}
\DoxyCodeLine{3626 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3627 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_acfce430f0605a56afdb438107afc0d47}\label{namespacemom__diag__mediator_acfce430f0605a56afdb438107afc0d47}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_copy\_storage\_to\_diag@{diag\_copy\_storage\_to\_diag}}
\index{diag\_copy\_storage\_to\_diag@{diag\_copy\_storage\_to\_diag}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_copy\_storage\_to\_diag()}{diag\_copy\_storage\_to\_diag()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+copy\+\_\+storage\+\_\+to\+\_\+diag (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__grid__storage}{diag\+\_\+grid\+\_\+storage}}), intent(in)}]{grid\+\_\+storage }\end{DoxyParamCaption})}



Copy from the stored diagnostic arrays to the main diagnostic grids. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em diag} & Diagnostic control structure used as the contructor \\
\hline
\mbox{\texttt{ in}}  & {\em grid\+\_\+storage} & Structure containing a snapshot of the target grids \\
\hline
\end{DoxyParams}


Definition at line 3631 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3632   \textcolor{keywordtype}{type}(diag\_ctrl),         \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{     !< Diagnostic control structure used as the contructor}}
\DoxyCodeLine{3633   \textcolor{keywordtype}{type}(diag\_grid\_storage), \textcolor{keywordtype}{intent(in)}    :: grid\_storage\textcolor{comment}{ !< Structure containing a snapshot of the target grids}}
\DoxyCodeLine{3634 }
\DoxyCodeLine{3635   \textcolor{keywordtype}{integer} :: m}
\DoxyCodeLine{3636 }
\DoxyCodeLine{3637   \textcolor{comment}{! Don't do anything else if there are no remapped coordinates}}
\DoxyCodeLine{3638   \textcolor{keywordflow}{if} (grid\_storage\%num\_diag\_coords < 1) \textcolor{keywordflow}{return}}
\DoxyCodeLine{3639 }
\DoxyCodeLine{3640   diag\%diag\_grid\_overridden = .true.}
\DoxyCodeLine{3641   \textcolor{keywordflow}{do} m = 1,grid\_storage\%num\_diag\_coords}
\DoxyCodeLine{3642     \textcolor{keywordflow}{if} (diag\%diag\_remap\_cs(m)\%nz > 0) \&}
\DoxyCodeLine{3643       diag\%diag\_remap\_cs(m)\%h(:,:,:) = grid\_storage\%diag\_grids(m)\%h(:,:,:)}
\DoxyCodeLine{3644 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3645 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_aba626173ff1459bd423b1902425d1908}\label{namespacemom__diag__mediator_aba626173ff1459bd423b1902425d1908}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_get\_volume\_cell\_measure\_dm\_id@{diag\_get\_volume\_cell\_measure\_dm\_id}}
\index{diag\_get\_volume\_cell\_measure\_dm\_id@{diag\_get\_volume\_cell\_measure\_dm\_id}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_get\_volume\_cell\_measure\_dm\_id()}{diag\_get\_volume\_cell\_measure\_dm\_id()}}
{\footnotesize\ttfamily integer function, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+get\+\_\+volume\+\_\+cell\+\_\+measure\+\_\+dm\+\_\+id (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs }\end{DoxyParamCaption})}



Returns diag\+\_\+manager id for cell measure of h-\/cells. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Diagnostics control structure \\
\hline
\end{DoxyParams}


Definition at line 987 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{988   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{intent(in)} :: diag\_cs\textcolor{comment}{   !< Diagnostics control structure}}
\DoxyCodeLine{989 }
\DoxyCodeLine{990   diag\_get\_volume\_cell\_measure\_dm\_id = diag\_cs\%volume\_cell\_measure\_dm\_id}
\DoxyCodeLine{991 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a4f82f684f05d581ea5b62a9c62a54af3}\label{namespacemom__diag__mediator_a4f82f684f05d581ea5b62a9c62a54af3}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_grid\_storage\_end@{diag\_grid\_storage\_end}}
\index{diag\_grid\_storage\_end@{diag\_grid\_storage\_end}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_grid\_storage\_end()}{diag\_grid\_storage\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+grid\+\_\+storage\+\_\+end (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__grid__storage}{diag\+\_\+grid\+\_\+storage}}), intent(inout)}]{grid\+\_\+storage }\end{DoxyParamCaption})}



Deallocates the fields in the remapping fields container. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em grid\+\_\+storage} & Structure containing a snapshot of the target grids \\
\hline
\end{DoxyParams}


Definition at line 3682 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3683   \textcolor{keywordtype}{type}(diag\_grid\_storage), \textcolor{keywordtype}{intent(inout)} :: grid\_storage\textcolor{comment}{ !< Structure containing a snapshot of the target grids}}
\DoxyCodeLine{3684   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{3685   \textcolor{keywordtype}{integer} :: m, nz}
\DoxyCodeLine{3686 }
\DoxyCodeLine{3687   \textcolor{comment}{! Don't do anything else if there are no remapped coordinates}}
\DoxyCodeLine{3688   \textcolor{keywordflow}{if} (grid\_storage\%num\_diag\_coords < 1) \textcolor{keywordflow}{return}}
\DoxyCodeLine{3689 }
\DoxyCodeLine{3690   \textcolor{comment}{! Deallocate memory for the native space}}
\DoxyCodeLine{3691   \textcolor{keyword}{deallocate}(grid\_storage\%h\_state)}
\DoxyCodeLine{3692   \textcolor{comment}{! Loop through and deallocate memory for the grid on each target coordinate}}
\DoxyCodeLine{3693   \textcolor{keywordflow}{do} m = 1, grid\_storage\%num\_diag\_coords}
\DoxyCodeLine{3694     \textcolor{keyword}{deallocate}(grid\_storage\%diag\_grids(m)\%h)}
\DoxyCodeLine{3695 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3696   \textcolor{comment}{! Deallocate diagnostic remapping structures}}
\DoxyCodeLine{3697   \textcolor{keyword}{deallocate}(grid\_storage\%diag\_grids)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a6f596247402f21fa60bfdf1e73c41044}\label{namespacemom__diag__mediator_a6f596247402f21fa60bfdf1e73c41044}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_grid\_storage\_init@{diag\_grid\_storage\_init}}
\index{diag\_grid\_storage\_init@{diag\_grid\_storage\_init}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_grid\_storage\_init()}{diag\_grid\_storage\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+grid\+\_\+storage\+\_\+init (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__grid__storage}{diag\+\_\+grid\+\_\+storage}}), intent(inout)}]{grid\+\_\+storage,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag }\end{DoxyParamCaption})}



Allocates fields necessary to store diagnostic remapping fields. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em grid\+\_\+storage} & Structure containing a snapshot of the target grids \\
\hline
\mbox{\texttt{ in}}  & {\em g} & Horizontal grid \\
\hline
\mbox{\texttt{ in}}  & {\em diag} & Diagnostic control structure used as the contructor template for this routine \\
\hline
\end{DoxyParams}


Definition at line 3587 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3588   \textcolor{keywordtype}{type}(diag\_grid\_storage), \textcolor{keywordtype}{intent(inout)} :: grid\_storage\textcolor{comment}{ !< Structure containing a snapshot of the target grids}}
\DoxyCodeLine{3589   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{           !< Horizontal grid}}
\DoxyCodeLine{3590   \textcolor{keywordtype}{type}(diag\_ctrl),         \textcolor{keywordtype}{intent(in)}    :: diag\textcolor{comment}{        !< Diagnostic control structure used as the contructor}}
\DoxyCodeLine{3591 \textcolor{comment}{                                                        !! template for this routine}}
\DoxyCodeLine{3592 }
\DoxyCodeLine{3593   \textcolor{keywordtype}{integer} :: m, nz}
\DoxyCodeLine{3594   grid\_storage\%num\_diag\_coords = diag\%num\_diag\_coords}
\DoxyCodeLine{3595 }
\DoxyCodeLine{3596   \textcolor{comment}{! Don't do anything else if there are no remapped coordinates}}
\DoxyCodeLine{3597   \textcolor{keywordflow}{if} (grid\_storage\%num\_diag\_coords < 1) \textcolor{keywordflow}{return}}
\DoxyCodeLine{3598 }
\DoxyCodeLine{3599   \textcolor{comment}{! Allocate memory for the native space}}
\DoxyCodeLine{3600   \textcolor{keyword}{allocate}(grid\_storage\%h\_state(g\%isd:g\%ied,g\%jsd:g\%jed, g\%ke))}
\DoxyCodeLine{3601   \textcolor{comment}{! Allocate diagnostic remapping structures}}
\DoxyCodeLine{3602   \textcolor{keyword}{allocate}(grid\_storage\%diag\_grids(diag\%num\_diag\_coords))}
\DoxyCodeLine{3603   \textcolor{comment}{! Loop through and allocate memory for the grid on each target coordinate}}
\DoxyCodeLine{3604   \textcolor{keywordflow}{do} m = 1, diag\%num\_diag\_coords}
\DoxyCodeLine{3605     nz = diag\%diag\_remap\_cs(m)\%nz}
\DoxyCodeLine{3606     \textcolor{keyword}{allocate}(grid\_storage\%diag\_grids(m)\%h(g\%isd:g\%ied,g\%jsd:g\%jed, nz))}
\DoxyCodeLine{3607 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3608 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_aebf8dcc4bac8028f24a80fa5f1f1ca5b}\label{namespacemom__diag__mediator_aebf8dcc4bac8028f24a80fa5f1f1ca5b}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_masks\_set@{diag\_masks\_set}}
\index{diag\_masks\_set@{diag\_masks\_set}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_masks\_set()}{diag\_masks\_set()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+masks\+\_\+set (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in), target}]{G,  }\item[{integer, intent(in)}]{nz,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), pointer}]{diag\+\_\+cs }\end{DoxyParamCaption})}



Sets up the 2d and 3d masks for native diagnostics. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The ocean grid type. \\
\hline
\mbox{\texttt{ in}}  & {\em nz} & The number of layers in the model\textquotesingle{}s native grid. \\
\hline
 & {\em diag\+\_\+cs} & A pointer to a type with many variables used for diagnostics \\
\hline
\end{DoxyParams}


Definition at line 3343 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3344   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{  !< The ocean grid type.}}
\DoxyCodeLine{3345   \textcolor{keywordtype}{integer},                       \textcolor{keywordtype}{intent(in)} :: nz\textcolor{comment}{ !< The number of layers in the model's native grid.}}
\DoxyCodeLine{3346   \textcolor{keywordtype}{type}(diag\_ctrl),               \textcolor{keywordtype}{pointer}    :: diag\_cs\textcolor{comment}{ !< A pointer to a type with many variables}}
\DoxyCodeLine{3347 \textcolor{comment}{                                                       !! used for diagnostics}}
\DoxyCodeLine{3348   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{3349   \textcolor{keywordtype}{integer} :: k}
\DoxyCodeLine{3350 }
\DoxyCodeLine{3351   \textcolor{comment}{! 2d masks point to the model masks since they are identical}}
\DoxyCodeLine{3352   diag\_cs\%mask2dT  => g\%mask2dT}
\DoxyCodeLine{3353   diag\_cs\%mask2dBu => g\%mask2dBu}
\DoxyCodeLine{3354   diag\_cs\%mask2dCu => g\%mask2dCu}
\DoxyCodeLine{3355   diag\_cs\%mask2dCv => g\%mask2dCv}
\DoxyCodeLine{3356 }
\DoxyCodeLine{3357   \textcolor{comment}{! 3d native masks are needed by diag\_manager but the native variables}}
\DoxyCodeLine{3358   \textcolor{comment}{! can only be masked 2d -\/ for ocean points, all layers exists.}}
\DoxyCodeLine{3359   \textcolor{keyword}{allocate}(diag\_cs\%mask3dTL(g\%isd:g\%ied,g\%jsd:g\%jed,1:nz))}
\DoxyCodeLine{3360   \textcolor{keyword}{allocate}(diag\_cs\%mask3dBL(g\%IsdB:g\%IedB,g\%JsdB:g\%JedB,1:nz))}
\DoxyCodeLine{3361   \textcolor{keyword}{allocate}(diag\_cs\%mask3dCuL(g\%IsdB:g\%IedB,g\%jsd:g\%jed,1:nz))}
\DoxyCodeLine{3362   \textcolor{keyword}{allocate}(diag\_cs\%mask3dCvL(g\%isd:g\%ied,g\%JsdB:g\%JedB,1:nz))}
\DoxyCodeLine{3363   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{3364     diag\_cs\%mask3dTL(:,:,k) = diag\_cs\%mask2dT(:,:)}
\DoxyCodeLine{3365     diag\_cs\%mask3dBL(:,:,k) = diag\_cs\%mask2dBu(:,:)}
\DoxyCodeLine{3366     diag\_cs\%mask3dCuL(:,:,k) = diag\_cs\%mask2dCu(:,:)}
\DoxyCodeLine{3367     diag\_cs\%mask3dCvL(:,:,k) = diag\_cs\%mask2dCv(:,:)}
\DoxyCodeLine{3368 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3369   \textcolor{keyword}{allocate}(diag\_cs\%mask3dTi(g\%isd:g\%ied,g\%jsd:g\%jed,1:nz+1))}
\DoxyCodeLine{3370   \textcolor{keyword}{allocate}(diag\_cs\%mask3dBi(g\%IsdB:g\%IedB,g\%JsdB:g\%JedB,1:nz+1))}
\DoxyCodeLine{3371   \textcolor{keyword}{allocate}(diag\_cs\%mask3dCui(g\%IsdB:g\%IedB,g\%jsd:g\%jed,1:nz+1))}
\DoxyCodeLine{3372   \textcolor{keyword}{allocate}(diag\_cs\%mask3dCvi(g\%isd:g\%ied,g\%JsdB:g\%JedB,1:nz+1))}
\DoxyCodeLine{3373   \textcolor{keywordflow}{do} k=1,nz+1}
\DoxyCodeLine{3374     diag\_cs\%mask3dTi(:,:,k) = diag\_cs\%mask2dT(:,:)}
\DoxyCodeLine{3375     diag\_cs\%mask3dBi(:,:,k) = diag\_cs\%mask2dBu(:,:)}
\DoxyCodeLine{3376     diag\_cs\%mask3dCui(:,:,k) = diag\_cs\%mask2dCu(:,:)}
\DoxyCodeLine{3377     diag\_cs\%mask3dCvi(:,:,k) = diag\_cs\%mask2dCv(:,:)}
\DoxyCodeLine{3378 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3379 }
\DoxyCodeLine{3380   \textcolor{comment}{!Allocate and initialize the downsampled masks}}
\DoxyCodeLine{3381   \textcolor{keyword}{call }downsample\_diag\_masks\_set(g, nz, diag\_cs)}
\DoxyCodeLine{3382 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ab6b7493efa5caee06547dafdba29361b}\label{namespacemom__diag__mediator_ab6b7493efa5caee06547dafdba29361b}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_mediator\_close\_registration@{diag\_mediator\_close\_registration}}
\index{diag\_mediator\_close\_registration@{diag\_mediator\_close\_registration}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_mediator\_close\_registration()}{diag\_mediator\_close\_registration()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+mediator\+\_\+close\+\_\+registration (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+\+CS }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\end{DoxyParams}


Definition at line 3385 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3386   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{intent(inout)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{3387 }
\DoxyCodeLine{3388   \textcolor{keywordtype}{integer} :: i}
\DoxyCodeLine{3389 }
\DoxyCodeLine{3390   \textcolor{keywordflow}{if} (diag\_cs\%available\_diag\_doc\_unit > -\/1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3391     \textcolor{keyword}{close}(diag\_cs\%available\_diag\_doc\_unit) ; diag\_cs\%available\_diag\_doc\_unit = -\/2}
\DoxyCodeLine{3392 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3393 }
\DoxyCodeLine{3394   \textcolor{keywordflow}{do} i=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{3395     \textcolor{keyword}{call }diag\_remap\_diag\_registration\_closed(diag\_cs\%diag\_remap\_cs(i))}
\DoxyCodeLine{3396 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3397 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a780f8870b442c730208d66d1ff0b4ac0}\label{namespacemom__diag__mediator_a780f8870b442c730208d66d1ff0b4ac0}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_mediator\_end@{diag\_mediator\_end}}
\index{diag\_mediator\_end@{diag\_mediator\_end}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_mediator\_end()}{diag\_mediator\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+mediator\+\_\+end (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{time,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+\+CS,  }\item[{logical, intent(in), optional}]{end\+\_\+diag\+\_\+manager }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em time} & The current model time\\
\hline
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output\\
\hline
\mbox{\texttt{ in}}  & {\em end\+\_\+diag\+\_\+manager} & If true, call diag\+\_\+manager\+\_\+end() \\
\hline
\end{DoxyParams}


Definition at line 3400 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3401   \textcolor{keywordtype}{type}(time\_type),   \textcolor{keywordtype}{intent(in)}  :: time\textcolor{comment}{ !< The current model time}}
\DoxyCodeLine{3402   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{intent(inout)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{3403   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: end\_diag\_manager\textcolor{comment}{ !< If true, call diag\_manager\_end()}}
\DoxyCodeLine{3404 }
\DoxyCodeLine{3405   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{3406   \textcolor{keywordtype}{integer} :: i}
\DoxyCodeLine{3407 }
\DoxyCodeLine{3408   \textcolor{keywordflow}{if} (diag\_cs\%available\_diag\_doc\_unit > -\/1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3409     \textcolor{keyword}{close}(diag\_cs\%available\_diag\_doc\_unit) ; diag\_cs\%available\_diag\_doc\_unit = -\/3}
\DoxyCodeLine{3410 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3411   \textcolor{keywordflow}{if} (diag\_cs\%chksum\_iounit > -\/1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3412     \textcolor{keyword}{close}(diag\_cs\%chksum\_iounit) ; diag\_cs\%chksum\_iounit = -\/3}
\DoxyCodeLine{3413 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3414 }
\DoxyCodeLine{3415   \textcolor{keyword}{deallocate}(diag\_cs\%diags)}
\DoxyCodeLine{3416 }
\DoxyCodeLine{3417   \textcolor{keywordflow}{do} i=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{3418     \textcolor{keyword}{call }diag\_remap\_end(diag\_cs\%diag\_remap\_cs(i))}
\DoxyCodeLine{3419 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3420 }
\DoxyCodeLine{3421   \textcolor{keyword}{call }diag\_grid\_storage\_end(diag\_cs\%diag\_grid\_temp)}
\DoxyCodeLine{3422   \textcolor{keyword}{deallocate}(diag\_cs\%mask3dTL)}
\DoxyCodeLine{3423   \textcolor{keyword}{deallocate}(diag\_cs\%mask3dBL)}
\DoxyCodeLine{3424   \textcolor{keyword}{deallocate}(diag\_cs\%mask3dCuL)}
\DoxyCodeLine{3425   \textcolor{keyword}{deallocate}(diag\_cs\%mask3dCvL)}
\DoxyCodeLine{3426   \textcolor{keyword}{deallocate}(diag\_cs\%mask3dTi)}
\DoxyCodeLine{3427   \textcolor{keyword}{deallocate}(diag\_cs\%mask3dBi)}
\DoxyCodeLine{3428   \textcolor{keyword}{deallocate}(diag\_cs\%mask3dCui)}
\DoxyCodeLine{3429   \textcolor{keyword}{deallocate}(diag\_cs\%mask3dCvi)}
\DoxyCodeLine{3430   \textcolor{keywordflow}{do} i=2,max\_dsamp\_lev}
\DoxyCodeLine{3431      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask2dT)}
\DoxyCodeLine{3432      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask2dBu)}
\DoxyCodeLine{3433      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask2dCu)}
\DoxyCodeLine{3434      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask2dCv)}
\DoxyCodeLine{3435      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask3dTL)}
\DoxyCodeLine{3436      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask3dBL)}
\DoxyCodeLine{3437      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask3dCuL)}
\DoxyCodeLine{3438      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask3dCvL)}
\DoxyCodeLine{3439      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask3dTi)}
\DoxyCodeLine{3440      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask3dBi)}
\DoxyCodeLine{3441      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask3dCui)}
\DoxyCodeLine{3442      \textcolor{keyword}{deallocate}(diag\_cs\%dsamp(i)\%mask3dCvi)}
\DoxyCodeLine{3443 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3444 }
\DoxyCodeLine{3445 \textcolor{preprocessor}{\#if defined(DEBUG) || defined(\_\_DO\_SAFETY\_CHECKS\_\_)}}
\DoxyCodeLine{3446 \textcolor{preprocessor}{}  \textcolor{keyword}{deallocate}(diag\_cs\%h\_old)}
\DoxyCodeLine{3447 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{3448 \textcolor{preprocessor}{}}
\DoxyCodeLine{3449   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(end\_diag\_manager)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3450     \textcolor{keywordflow}{if} (end\_diag\_manager) \textcolor{keyword}{call }diag\_manager\_end(time)}
\DoxyCodeLine{3451 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3452 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ae8ac8a662308a9e766249fdf29956560}\label{namespacemom__diag__mediator_ae8ac8a662308a9e766249fdf29956560}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_mediator\_infrastructure\_init@{diag\_mediator\_infrastructure\_init}}
\index{diag\_mediator\_infrastructure\_init@{diag\_mediator\_infrastructure\_init}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_mediator\_infrastructure\_init()}{diag\_mediator\_infrastructure\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+mediator\+\_\+infrastructure\+\_\+init (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(out), optional}]{err\+\_\+msg }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em err\+\_\+msg} & An error message \\
\hline
\end{DoxyParams}


Definition at line 3028 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3029   \textcolor{comment}{! This subroutine initializes the FMS diag\_manager.}}
\DoxyCodeLine{3030   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}   :: err\_msg\textcolor{comment}{ !< An error message}}
\DoxyCodeLine{3031 }
\DoxyCodeLine{3032   \textcolor{keyword}{call }diag\_manager\_init(err\_msg=err\_msg)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a3c99ff49de6d5e43f0d1bba79290eb71}\label{namespacemom__diag__mediator_a3c99ff49de6d5e43f0d1bba79290eb71}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_mediator\_init@{diag\_mediator\_init}}
\index{diag\_mediator\_init@{diag\_mediator\_init}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_mediator\_init()}{diag\_mediator\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+mediator\+\_\+init (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout), target}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in), target}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), target}]{US,  }\item[{integer, intent(in)}]{nz,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs,  }\item[{character(len=$\ast$), intent(in), optional}]{doc\+\_\+file\+\_\+dir }\end{DoxyParamCaption})}



diag\+\_\+mediator\+\_\+init initializes the M\+OM diag\+\_\+mediator and opens the available diagnostics file, if appropriate. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The ocean grid type. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em nz} & The number of layers in the model\textquotesingle{}s native grid. \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & A pointer to a type with many variables used for diagnostics \\
\hline
\mbox{\texttt{ in}}  & {\em doc\+\_\+file\+\_\+dir} & A directory in which to create the file \\
\hline
\end{DoxyParams}


Definition at line 3037 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3038   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{  !< The ocean grid type.}}
\DoxyCodeLine{3039   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{ !< The ocean vertical grid structure}}
\DoxyCodeLine{3040   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{3041   \textcolor{keywordtype}{integer},                    \textcolor{keywordtype}{intent(in)}    :: nz\textcolor{comment}{    !< The number of layers in the model's native grid.}}
\DoxyCodeLine{3042   \textcolor{keywordtype}{type}(param\_file\_type),      \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{3043   \textcolor{keywordtype}{type}(diag\_ctrl),            \textcolor{keywordtype}{intent(inout)} :: diag\_cs\textcolor{comment}{ !< A pointer to a type with many variables}}
\DoxyCodeLine{3044 \textcolor{comment}{                                                     !! used for diagnostics}}
\DoxyCodeLine{3045   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: doc\_file\_dir\textcolor{comment}{ !< A directory in which to create the}}
\DoxyCodeLine{3046 \textcolor{comment}{                                                     !! file}}
\DoxyCodeLine{3047 }
\DoxyCodeLine{3048   \textcolor{comment}{! This subroutine initializes the diag\_mediator and the diag\_manager.}}
\DoxyCodeLine{3049   \textcolor{comment}{! The grid type should have its dimensions set by this point, but it}}
\DoxyCodeLine{3050   \textcolor{comment}{! is not necessary that the metrics and axis labels be set up yet.}}
\DoxyCodeLine{3051 }
\DoxyCodeLine{3052   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{3053   \textcolor{keywordtype}{integer} :: ios, i, new\_unit}
\DoxyCodeLine{3054   \textcolor{keywordtype}{logical} :: opened, new\_file}
\DoxyCodeLine{3055   \textcolor{keywordtype}{logical} :: answers\_2018, default\_2018\_answers}
\DoxyCodeLine{3056   \textcolor{keywordtype}{character(len=8)}   :: this\_pe}
\DoxyCodeLine{3057   \textcolor{keywordtype}{character(len=240)} :: doc\_file, doc\_file\_dflt, doc\_path}
\DoxyCodeLine{3058   \textcolor{keywordtype}{character(len=240)}, \textcolor{keywordtype}{allocatable} :: diag\_coords(:)}
\DoxyCodeLine{3059   \textcolor{comment}{! This include declares and sets the variable "version".}}
\DoxyCodeLine{3060 \textcolor{preprocessor}{\# include "version\_variable.h"}}
\DoxyCodeLine{3061 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)} :: mdl = \textcolor{stringliteral}{"MOM\_diag\_mediator"} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{3062   \textcolor{keywordtype}{character(len=32)} :: filename\_appendix = \textcolor{stringliteral}{''} \textcolor{comment}{!fms appendix to filename for ensemble runs}}
\DoxyCodeLine{3063 }
\DoxyCodeLine{3064   id\_clock\_diag\_mediator = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean diagnostics framework)'}, grain=clock\_module)}
\DoxyCodeLine{3065   id\_clock\_diag\_remap = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean diagnostics remapping)'}, grain=clock\_routine)}
\DoxyCodeLine{3066   id\_clock\_diag\_grid\_updates = cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean diagnostics grid updates)'}, grain=clock\_routine)}
\DoxyCodeLine{3067 }
\DoxyCodeLine{3068   \textcolor{comment}{! Allocate and initialize list of all diagnostics (and variants)}}
\DoxyCodeLine{3069   \textcolor{keyword}{allocate}(diag\_cs\%diags(diag\_alloc\_chunk\_size))}
\DoxyCodeLine{3070   diag\_cs\%next\_free\_diag\_id = 1}
\DoxyCodeLine{3071   \textcolor{keywordflow}{do} i=1, diag\_alloc\_chunk\_size}
\DoxyCodeLine{3072     \textcolor{keyword}{call }initialize\_diag\_type(diag\_cs\%diags(i))}
\DoxyCodeLine{3073 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3074 }
\DoxyCodeLine{3075   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}}
\DoxyCodeLine{3076   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})}
\DoxyCodeLine{3077 }
\DoxyCodeLine{3078   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{'NUM\_DIAG\_COORDS'}, diag\_cs\%num\_diag\_coords, \&}
\DoxyCodeLine{3079                  \textcolor{stringliteral}{'The number of diagnostic vertical coordinates to use. '}//\&}
\DoxyCodeLine{3080                  \textcolor{stringliteral}{'For each coordinate, an entry in DIAG\_COORDS must be provided.'}, \&}
\DoxyCodeLine{3081                  default=1)}
\DoxyCodeLine{3082   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DEFAULT\_2018\_ANSWERS"}, default\_2018\_answers, \&}
\DoxyCodeLine{3083                  \textcolor{stringliteral}{"This sets the default value for the various \_2018\_ANSWERS parameters."}, \&}
\DoxyCodeLine{3084                  default=.false.)}
\DoxyCodeLine{3085   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"REMAPPING\_2018\_ANSWERS"}, answers\_2018, \&}
\DoxyCodeLine{3086                  \textcolor{stringliteral}{"If true, use the order of arithmetic and expressions that recover the "}//\&}
\DoxyCodeLine{3087                  \textcolor{stringliteral}{"answers from the end of 2018.  Otherwise, use updated and more robust "}//\&}
\DoxyCodeLine{3088                  \textcolor{stringliteral}{"forms of the same expressions."}, default=default\_2018\_answers)}
\DoxyCodeLine{3089   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{'USE\_GRID\_SPACE\_DIAGNOSTIC\_AXES'}, diag\_cs\%grid\_space\_axes, \&}
\DoxyCodeLine{3090                  \textcolor{stringliteral}{'If true, use a grid index coordinate convention for diagnostic axes. '},\&}
\DoxyCodeLine{3091                  default=.false.)}
\DoxyCodeLine{3092 }
\DoxyCodeLine{3093   \textcolor{keywordflow}{if} (diag\_cs\%num\_diag\_coords>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3094     \textcolor{keyword}{allocate}(diag\_coords(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{3095     \textcolor{keywordflow}{if} (diag\_cs\%num\_diag\_coords==1) \textcolor{keywordflow}{then} \textcolor{comment}{! The default is to provide just one instance of Z*}}
\DoxyCodeLine{3096       \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{'DIAG\_COORDS'}, diag\_coords, \&}
\DoxyCodeLine{3097                  \textcolor{stringliteral}{'A list of string tuples associating diag\_table modules to '}//\&}
\DoxyCodeLine{3098                  \textcolor{stringliteral}{'a coordinate definition used for diagnostics. Each string '}//\&}
\DoxyCodeLine{3099                  \textcolor{stringliteral}{'is of the form "MODULE\_SUFFIX PARAMETER\_SUFFIX COORDINATE\_NAME".'}, \&}
\DoxyCodeLine{3100                  default=\textcolor{stringliteral}{'z Z ZSTAR'})}
\DoxyCodeLine{3101     \textcolor{keywordflow}{else} \textcolor{comment}{! If using more than 1 diagnostic coordinate, all must be explicitly defined}}
\DoxyCodeLine{3102       \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{'DIAG\_COORDS'}, diag\_coords, \&}
\DoxyCodeLine{3103                  \textcolor{stringliteral}{'A list of string tuples associating diag\_table modules to '}//\&}
\DoxyCodeLine{3104                  \textcolor{stringliteral}{'a coordinate definition used for diagnostics. Each string '}//\&}
\DoxyCodeLine{3105                  \textcolor{stringliteral}{'is of the form "MODULE\_SUFFIX,PARAMETER\_SUFFIX,COORDINATE\_NAME".'}, \&}
\DoxyCodeLine{3106                  fail\_if\_missing=.true.)}
\DoxyCodeLine{3107 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{3108     \textcolor{keyword}{allocate}(diag\_cs\%diag\_remap\_cs(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{3109     \textcolor{comment}{! Initialize each diagnostic vertical coordinate}}
\DoxyCodeLine{3110     \textcolor{keywordflow}{do} i=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{3111       \textcolor{keyword}{call }diag\_remap\_init(diag\_cs\%diag\_remap\_cs(i), diag\_coords(i), answers\_2018=answers\_2018)}
\DoxyCodeLine{3112 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{3113     \textcolor{keyword}{deallocate}(diag\_coords)}
\DoxyCodeLine{3114 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3115 }
\DoxyCodeLine{3116   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{'DIAG\_MISVAL'}, diag\_cs\%missing\_value, \&}
\DoxyCodeLine{3117                  \textcolor{stringliteral}{'Set the default missing value to use for diagnostics.'}, \&}
\DoxyCodeLine{3118                  default=1.e20)}
\DoxyCodeLine{3119   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{'DIAG\_AS\_CHKSUM'}, diag\_cs\%diag\_as\_chksum, \&}
\DoxyCodeLine{3120                  \textcolor{stringliteral}{'Instead of writing diagnostics to the diag manager, write '}//\&}
\DoxyCodeLine{3121                  \textcolor{stringliteral}{'a text file containing the checksum (bitcount) of the array.'},  \&}
\DoxyCodeLine{3122                  default=.false.)}
\DoxyCodeLine{3123 }
\DoxyCodeLine{3124   \textcolor{keywordflow}{if} (diag\_cs\%diag\_as\_chksum) \&}
\DoxyCodeLine{3125     diag\_cs\%num\_chksum\_diags = 0}
\DoxyCodeLine{3126 }
\DoxyCodeLine{3127   \textcolor{comment}{! Keep pointers grid, h, T, S needed diagnostic remapping}}
\DoxyCodeLine{3128   diag\_cs\%G => g}
\DoxyCodeLine{3129   diag\_cs\%GV => gv}
\DoxyCodeLine{3130   diag\_cs\%US => us}
\DoxyCodeLine{3131   diag\_cs\%h => null()}
\DoxyCodeLine{3132   diag\_cs\%T => null()}
\DoxyCodeLine{3133   diag\_cs\%S => null()}
\DoxyCodeLine{3134   diag\_cs\%eqn\_of\_state => null()}
\DoxyCodeLine{3135 }
\DoxyCodeLine{3136   \textcolor{keyword}{allocate}(diag\_cs\%h\_begin(g\%isd:g\%ied,g\%jsd:g\%jed,nz))}
\DoxyCodeLine{3137 \textcolor{preprocessor}{\#if defined(DEBUG) || defined(\_\_DO\_SAFETY\_CHECKS\_\_)}}
\DoxyCodeLine{3138 \textcolor{preprocessor}{}  \textcolor{keyword}{allocate}(diag\_cs\%h\_old(g\%isd:g\%ied,g\%jsd:g\%jed,nz))}
\DoxyCodeLine{3139   diag\_cs\%h\_old(:,:,:) = 0.0}
\DoxyCodeLine{3140 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{3141 \textcolor{preprocessor}{}}
\DoxyCodeLine{3142   diag\_cs\%is = g\%isc -\/ (g\%isd-\/1) ; diag\_cs\%ie = g\%iec -\/ (g\%isd-\/1)}
\DoxyCodeLine{3143   diag\_cs\%js = g\%jsc -\/ (g\%jsd-\/1) ; diag\_cs\%je = g\%jec -\/ (g\%jsd-\/1)}
\DoxyCodeLine{3144   diag\_cs\%isd = g\%isd ; diag\_cs\%ied = g\%ied}
\DoxyCodeLine{3145   diag\_cs\%jsd = g\%jsd ; diag\_cs\%jed = g\%jed}
\DoxyCodeLine{3146 }
\DoxyCodeLine{3147   \textcolor{comment}{!Downsample indices for dl=2 (should be generalized to arbitrary dl, perhaps via a G array)}}
\DoxyCodeLine{3148   diag\_cs\%dsamp(2)\%isc = g\%HId2\%isc -\/ (g\%HId2\%isd-\/1) ; diag\_cs\%dsamp(2)\%iec = g\%HId2\%iec -\/ (g\%HId2\%isd-\/1)}
\DoxyCodeLine{3149   diag\_cs\%dsamp(2)\%jsc = g\%HId2\%jsc -\/ (g\%HId2\%jsd-\/1) ; diag\_cs\%dsamp(2)\%jec = g\%HId2\%jec -\/ (g\%HId2\%jsd-\/1)}
\DoxyCodeLine{3150   diag\_cs\%dsamp(2)\%isd = g\%HId2\%isd ; diag\_cs\%dsamp(2)\%ied = g\%HId2\%ied}
\DoxyCodeLine{3151   diag\_cs\%dsamp(2)\%jsd = g\%HId2\%jsd ; diag\_cs\%dsamp(2)\%jed = g\%HId2\%jed}
\DoxyCodeLine{3152   diag\_cs\%dsamp(2)\%isg = g\%HId2\%isg ; diag\_cs\%dsamp(2)\%ieg = g\%HId2\%ieg}
\DoxyCodeLine{3153   diag\_cs\%dsamp(2)\%jsg = g\%HId2\%jsg ; diag\_cs\%dsamp(2)\%jeg = g\%HId2\%jeg}
\DoxyCodeLine{3154   diag\_cs\%dsamp(2)\%isgB = g\%HId2\%isgB ; diag\_cs\%dsamp(2)\%iegB = g\%HId2\%iegB}
\DoxyCodeLine{3155   diag\_cs\%dsamp(2)\%jsgB = g\%HId2\%jsgB ; diag\_cs\%dsamp(2)\%jegB = g\%HId2\%jegB}
\DoxyCodeLine{3156 }
\DoxyCodeLine{3157   \textcolor{comment}{! Initialze available diagnostic log file}}
\DoxyCodeLine{3158   \textcolor{keywordflow}{if} (is\_root\_pe() .and. (diag\_cs\%available\_diag\_doc\_unit < 0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3159     \textcolor{keyword}{write}(this\_pe,\textcolor{stringliteral}{'(i6.6)'}) pe\_here()}
\DoxyCodeLine{3160     doc\_file\_dflt = \textcolor{stringliteral}{"available\_diags."}//this\_pe}
\DoxyCodeLine{3161     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"AVAILABLE\_DIAGS\_FILE"}, doc\_file, \&}
\DoxyCodeLine{3162                  \textcolor{stringliteral}{"A file into which to write a list of all available "}//\&}
\DoxyCodeLine{3163                  \textcolor{stringliteral}{"ocean diagnostics that can be included in a diag\_table."}, \&}
\DoxyCodeLine{3164                  default=doc\_file\_dflt, do\_not\_log=(diag\_cs\%available\_diag\_doc\_unit/=-\/1))}
\DoxyCodeLine{3165     \textcolor{keywordflow}{if} (len\_trim(doc\_file) > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3166       new\_file = .true. ; \textcolor{keywordflow}{if} (diag\_cs\%available\_diag\_doc\_unit /= -\/1) new\_file = .false.}
\DoxyCodeLine{3167     \textcolor{comment}{! Find an unused unit number.}}
\DoxyCodeLine{3168       \textcolor{keywordflow}{do} new\_unit=512,42,-\/1}
\DoxyCodeLine{3169         \textcolor{keyword}{inquire}( new\_unit, opened=opened)}
\DoxyCodeLine{3170         \textcolor{keywordflow}{if} (.not.opened) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{3171 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{3172       \textcolor{keywordflow}{if} (opened) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{3173           \textcolor{stringliteral}{"diag\_mediator\_init failed to find an unused unit number."})}
\DoxyCodeLine{3174 }
\DoxyCodeLine{3175       doc\_path = doc\_file}
\DoxyCodeLine{3176       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(doc\_file\_dir)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (len\_trim(doc\_file\_dir) > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3177         doc\_path = trim(slasher(doc\_file\_dir))//trim(doc\_file)}
\DoxyCodeLine{3178 \textcolor{keywordflow}{      endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{3179 }
\DoxyCodeLine{3180       diag\_cs\%available\_diag\_doc\_unit = new\_unit}
\DoxyCodeLine{3181 }
\DoxyCodeLine{3182       \textcolor{keywordflow}{if} (new\_file) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3183         \textcolor{keyword}{open}(diag\_cs\%available\_diag\_doc\_unit, file=trim(doc\_path), access=\textcolor{stringliteral}{'SEQUENTIAL'}, form=\textcolor{stringliteral}{'FORMATTED'}, \&}
\DoxyCodeLine{3184              action=\textcolor{stringliteral}{'WRITE'}, status=\textcolor{stringliteral}{'REPLACE'}, iostat=ios)}
\DoxyCodeLine{3185       \textcolor{keywordflow}{else} \textcolor{comment}{! This file is being reopened, and should be appended.}}
\DoxyCodeLine{3186         \textcolor{keyword}{open}(diag\_cs\%available\_diag\_doc\_unit, file=trim(doc\_path), access=\textcolor{stringliteral}{'SEQUENTIAL'}, form=\textcolor{stringliteral}{'FORMATTED'}, \&}
\DoxyCodeLine{3187              action=\textcolor{stringliteral}{'WRITE'}, status=\textcolor{stringliteral}{'OLD'}, position=\textcolor{stringliteral}{'APPEND'}, iostat=ios)}
\DoxyCodeLine{3188 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{3189       \textcolor{keyword}{inquire}(diag\_cs\%available\_diag\_doc\_unit, opened=opened)}
\DoxyCodeLine{3190       \textcolor{keywordflow}{if} ((.not.opened) .or. (ios /= 0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3191         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"Failed to open available diags file "}//trim(doc\_path)//\textcolor{stringliteral}{"."})}
\DoxyCodeLine{3192 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{3193 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{3194 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3195 }
\DoxyCodeLine{3196   \textcolor{keywordflow}{if} (is\_root\_pe() .and. (diag\_cs\%chksum\_iounit < 0) .and. diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3197     \textcolor{comment}{!write(this\_pe,'(i6.6)') PE\_here()}}
\DoxyCodeLine{3198     \textcolor{comment}{!doc\_file\_dflt = "chksum\_diag."//this\_pe}}
\DoxyCodeLine{3199     doc\_file\_dflt = \textcolor{stringliteral}{"chksum\_diag"}}
\DoxyCodeLine{3200     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"CHKSUM\_DIAG\_FILE"}, doc\_file, \&}
\DoxyCodeLine{3201                  \textcolor{stringliteral}{"A file into which to write all checksums of the "}//\&}
\DoxyCodeLine{3202                  \textcolor{stringliteral}{"diagnostics listed in the diag\_table."}, \&}
\DoxyCodeLine{3203                  default=doc\_file\_dflt, do\_not\_log=(diag\_cs\%chksum\_iounit/=-\/1))}
\DoxyCodeLine{3204 }
\DoxyCodeLine{3205     \textcolor{keyword}{call }get\_filename\_appendix(filename\_appendix)}
\DoxyCodeLine{3206     \textcolor{keywordflow}{if} (len\_trim(filename\_appendix) > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3207       doc\_file = trim(doc\_file) //\textcolor{stringliteral}{'.'}//trim(filename\_appendix)}
\DoxyCodeLine{3208 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{3209 \textcolor{preprocessor}{\#ifdef STATSLABEL}}
\DoxyCodeLine{3210 \textcolor{preprocessor}{}    doc\_file = trim(doc\_file)//\textcolor{stringliteral}{"."}//trim(adjustl(statslabel))}
\DoxyCodeLine{3211 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{3212 \textcolor{preprocessor}{}}
\DoxyCodeLine{3213     \textcolor{keywordflow}{if} (len\_trim(doc\_file) > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3214       new\_file = .true. ; \textcolor{keywordflow}{if} (diag\_cs\%chksum\_iounit /= -\/1) new\_file = .false.}
\DoxyCodeLine{3215     \textcolor{comment}{! Find an unused unit number.}}
\DoxyCodeLine{3216       \textcolor{keywordflow}{do} new\_unit=512,42,-\/1}
\DoxyCodeLine{3217         \textcolor{keyword}{inquire}( new\_unit, opened=opened)}
\DoxyCodeLine{3218         \textcolor{keywordflow}{if} (.not.opened) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{3219 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{3220       \textcolor{keywordflow}{if} (opened) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{3221           \textcolor{stringliteral}{"diag\_mediator\_init failed to find an unused unit number."})}
\DoxyCodeLine{3222 }
\DoxyCodeLine{3223       doc\_path = doc\_file}
\DoxyCodeLine{3224       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(doc\_file\_dir)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (len\_trim(doc\_file\_dir) > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3225         doc\_path = trim(slasher(doc\_file\_dir))//trim(doc\_file)}
\DoxyCodeLine{3226 \textcolor{keywordflow}{      endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{3227 }
\DoxyCodeLine{3228       diag\_cs\%chksum\_iounit = new\_unit}
\DoxyCodeLine{3229 }
\DoxyCodeLine{3230       \textcolor{keywordflow}{if} (new\_file) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3231         \textcolor{keyword}{open}(diag\_cs\%chksum\_iounit, file=trim(doc\_path), access=\textcolor{stringliteral}{'SEQUENTIAL'}, form=\textcolor{stringliteral}{'FORMATTED'}, \&}
\DoxyCodeLine{3232              action=\textcolor{stringliteral}{'WRITE'}, status=\textcolor{stringliteral}{'REPLACE'}, iostat=ios)}
\DoxyCodeLine{3233       \textcolor{keywordflow}{else} \textcolor{comment}{! This file is being reopened, and should be appended.}}
\DoxyCodeLine{3234         \textcolor{keyword}{open}(diag\_cs\%chksum\_iounit, file=trim(doc\_path), access=\textcolor{stringliteral}{'SEQUENTIAL'}, form=\textcolor{stringliteral}{'FORMATTED'}, \&}
\DoxyCodeLine{3235              action=\textcolor{stringliteral}{'WRITE'}, status=\textcolor{stringliteral}{'OLD'}, position=\textcolor{stringliteral}{'APPEND'}, iostat=ios)}
\DoxyCodeLine{3236 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{3237       \textcolor{keyword}{inquire}(diag\_cs\%chksum\_iounit, opened=opened)}
\DoxyCodeLine{3238       \textcolor{keywordflow}{if} ((.not.opened) .or. (ios /= 0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3239         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"Failed to open checksum diags file "}//trim(doc\_path)//\textcolor{stringliteral}{"."})}
\DoxyCodeLine{3240 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{3241 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{3242 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3243 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a2795a8a8618f945a9a0830f461d3e42d}\label{namespacemom__diag__mediator_a2795a8a8618f945a9a0830f461d3e42d}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_register\_area\_ids@{diag\_register\_area\_ids}}
\index{diag\_register\_area\_ids@{diag\_register\_area\_ids}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_register\_area\_ids()}{diag\_register\_area\_ids()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+register\+\_\+area\+\_\+ids (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs,  }\item[{integer, intent(in), optional}]{id\+\_\+area\+\_\+t,  }\item[{integer, intent(in), optional}]{id\+\_\+area\+\_\+q }\end{DoxyParamCaption})}



Attaches the id of cell areas to axes groups for use with cell\+\_\+measures. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Diagnostics control structure \\
\hline
\mbox{\texttt{ in}}  & {\em id\+\_\+area\+\_\+t} & Diag\+\_\+mediator id for area of h-\/cells \\
\hline
\mbox{\texttt{ in}}  & {\em id\+\_\+area\+\_\+q} & Diag\+\_\+mediator id for area of q-\/cells \\
\hline
\end{DoxyParams}


Definition at line 921 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{922   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{intent(inout)} :: diag\_cs\textcolor{comment}{   !< Diagnostics control structure}}
\DoxyCodeLine{923   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: id\_area\_t\textcolor{comment}{ !< Diag\_mediator id for area of h-\/cells}}
\DoxyCodeLine{924   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: id\_area\_q\textcolor{comment}{ !< Diag\_mediator id for area of q-\/cells}}
\DoxyCodeLine{925   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{926   \textcolor{keywordtype}{integer} :: fms\_id, i}
\DoxyCodeLine{927   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(id\_area\_t)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{928     fms\_id = diag\_cs\%diags(id\_area\_t)\%fms\_diag\_id}
\DoxyCodeLine{929     diag\_cs\%axesT1\%id\_area = fms\_id}
\DoxyCodeLine{930     diag\_cs\%axesTi\%id\_area = fms\_id}
\DoxyCodeLine{931     diag\_cs\%axesTL\%id\_area = fms\_id}
\DoxyCodeLine{932     \textcolor{keywordflow}{do} i=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{933       diag\_cs\%remap\_axesTL(i)\%id\_area = fms\_id}
\DoxyCodeLine{934       diag\_cs\%remap\_axesTi(i)\%id\_area = fms\_id}
\DoxyCodeLine{935 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{936 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{937   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(id\_area\_q)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{938     fms\_id = diag\_cs\%diags(id\_area\_q)\%fms\_diag\_id}
\DoxyCodeLine{939     diag\_cs\%axesB1\%id\_area = fms\_id}
\DoxyCodeLine{940     diag\_cs\%axesBi\%id\_area = fms\_id}
\DoxyCodeLine{941     diag\_cs\%axesBL\%id\_area = fms\_id}
\DoxyCodeLine{942     \textcolor{keywordflow}{do} i=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{943       diag\_cs\%remap\_axesBL(i)\%id\_area = fms\_id}
\DoxyCodeLine{944       diag\_cs\%remap\_axesBi(i)\%id\_area = fms\_id}
\DoxyCodeLine{945 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{946 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a7a21b53f286a9a214cc6aac4e34eb78b}\label{namespacemom__diag__mediator_a7a21b53f286a9a214cc6aac4e34eb78b}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_restore\_grids@{diag\_restore\_grids}}
\index{diag\_restore\_grids@{diag\_restore\_grids}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_restore\_grids()}{diag\_restore\_grids()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+restore\+\_\+grids (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag }\end{DoxyParamCaption})}



Restore the diagnostic grids from the temporary structure within diag. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em diag} & Diagnostic control structure used as the contructor \\
\hline
\end{DoxyParams}


Definition at line 3665 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3666   \textcolor{keywordtype}{type}(diag\_ctrl),         \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{     !< Diagnostic control structure used as the contructor}}
\DoxyCodeLine{3667 }
\DoxyCodeLine{3668   \textcolor{keywordtype}{integer} :: m}
\DoxyCodeLine{3669 }
\DoxyCodeLine{3670   \textcolor{comment}{! Don't do anything else if there are no remapped coordinates}}
\DoxyCodeLine{3671   \textcolor{keywordflow}{if} (diag\%num\_diag\_coords < 1) \textcolor{keywordflow}{return}}
\DoxyCodeLine{3672 }
\DoxyCodeLine{3673   diag\%diag\_grid\_overridden = .false.}
\DoxyCodeLine{3674   \textcolor{keywordflow}{do} m = 1,diag\%num\_diag\_coords}
\DoxyCodeLine{3675     \textcolor{keywordflow}{if} (diag\%diag\_remap\_cs(m)\%nz > 0) \&}
\DoxyCodeLine{3676       diag\%diag\_remap\_cs(m)\%h(:,:,:) = diag\%diag\_grid\_temp\%diag\_grids(m)\%h(:,:,:)}
\DoxyCodeLine{3677 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3678 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_aba48dd8ac75fdf10eda85f8183c2b39e}\label{namespacemom__diag__mediator_aba48dd8ac75fdf10eda85f8183c2b39e}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_save\_grids@{diag\_save\_grids}}
\index{diag\_save\_grids@{diag\_save\_grids}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_save\_grids()}{diag\_save\_grids()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+save\+\_\+grids (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag }\end{DoxyParamCaption})}



Save the current diagnostic grids in the temporary structure within diag. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em diag} & Diagnostic control structure used as the contructor \\
\hline
\end{DoxyParams}


Definition at line 3649 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3650   \textcolor{keywordtype}{type}(diag\_ctrl),         \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{     !< Diagnostic control structure used as the contructor}}
\DoxyCodeLine{3651 }
\DoxyCodeLine{3652   \textcolor{keywordtype}{integer} :: m}
\DoxyCodeLine{3653 }
\DoxyCodeLine{3654   \textcolor{comment}{! Don't do anything else if there are no remapped coordinates}}
\DoxyCodeLine{3655   \textcolor{keywordflow}{if} (diag\%num\_diag\_coords < 1) \textcolor{keywordflow}{return}}
\DoxyCodeLine{3656 }
\DoxyCodeLine{3657   \textcolor{keywordflow}{do} m = 1,diag\%num\_diag\_coords}
\DoxyCodeLine{3658     \textcolor{keywordflow}{if} (diag\%diag\_remap\_cs(m)\%nz > 0) \&}
\DoxyCodeLine{3659       diag\%diag\_grid\_temp\%diag\_grids(m)\%h(:,:,:) = diag\%diag\_remap\_cs(m)\%h(:,:,:)}
\DoxyCodeLine{3660 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3661 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_abe52776bc4a161c4912ce1987acaf1c1}\label{namespacemom__diag__mediator_abe52776bc4a161c4912ce1987acaf1c1}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_set\_state\_ptrs@{diag\_set\_state\_ptrs}}
\index{diag\_set\_state\_ptrs@{diag\_set\_state\_ptrs}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_set\_state\_ptrs()}{diag\_set\_state\_ptrs()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+set\+\_\+state\+\_\+ptrs (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{h,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{T,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{S,  }\item[{type(eos\+\_\+type), intent(in), target}]{eqn\+\_\+of\+\_\+state,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs }\end{DoxyParamCaption})}



Set pointers to the default state fields used to remap diagnostics. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em h} & the model thickness array \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em t} & the model temperature array \\
\hline
\mbox{\texttt{ in}}  & {\em s} & the model salinity array \\
\hline
\mbox{\texttt{ in}}  & {\em eqn\+\_\+of\+\_\+state} & Equation of state structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & diag mediator control structure \\
\hline
\end{DoxyParams}


Definition at line 3247 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3248 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in   )} :: h\textcolor{comment}{ !< the model thickness array [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{3249 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in   )} :: T\textcolor{comment}{ !< the model temperature array}}
\DoxyCodeLine{3250 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in   )} :: S\textcolor{comment}{ !< the model salinity array}}
\DoxyCodeLine{3251   \textcolor{keywordtype}{type}(EOS\_type),         \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in   )} :: eqn\_of\_state\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{3252   \textcolor{keywordtype}{type}(diag\_ctrl),                \textcolor{keywordtype}{intent(inout)} :: diag\_cs\textcolor{comment}{ !< diag mediator control structure}}
\DoxyCodeLine{3253 }
\DoxyCodeLine{3254   \textcolor{comment}{! Keep pointers to h, T, S needed for the diagnostic remapping}}
\DoxyCodeLine{3255   diag\_cs\%h => h}
\DoxyCodeLine{3256   diag\_cs\%T => t}
\DoxyCodeLine{3257   diag\_cs\%S => s}
\DoxyCodeLine{3258   diag\_cs\%eqn\_of\_state => eqn\_of\_state}
\DoxyCodeLine{3259 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_aa78e69709084d0097b3e01bbd83d3509}\label{namespacemom__diag__mediator_aa78e69709084d0097b3e01bbd83d3509}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!diag\_update\_remap\_grids@{diag\_update\_remap\_grids}}
\index{diag\_update\_remap\_grids@{diag\_update\_remap\_grids}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{diag\_update\_remap\_grids()}{diag\_update\_remap\_grids()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::diag\+\_\+update\+\_\+remap\+\_\+grids (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), optional, target}]{alt\+\_\+h,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), optional, target}]{alt\+\_\+T,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), optional, target}]{alt\+\_\+S,  }\item[{logical, intent(in), optional}]{update\+\_\+intensive,  }\item[{logical, intent(in), optional}]{update\+\_\+extensive }\end{DoxyParamCaption})}



Build/update vertical grids for diagnostic remapping. 

\begin{DoxyNote}{Note}
The target grids need to be updated whenever sea surface height changes. 
\end{DoxyNote}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Diagnostics control structure \\
\hline
\mbox{\texttt{ in}}  & {\em alt\+\_\+h} & Used if remapped grids should be something other than the current thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em alt\+\_\+t} & Used if remapped grids should be something other than the current temperatures \\
\hline
\mbox{\texttt{ in}}  & {\em alt\+\_\+s} & Used if remapped grids should be something other than the current salinity \\
\hline
\mbox{\texttt{ in}}  & {\em update\+\_\+intensive} & If true (default), update the grids used for intensive diagnostics \\
\hline
\mbox{\texttt{ in}}  & {\em update\+\_\+extensive} & If true (not default), update the grids used for intensive diagnostics \\
\hline
\end{DoxyParams}


Definition at line 3265 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3266   \textcolor{keywordtype}{type}(diag\_ctrl),        \textcolor{keywordtype}{intent(inout)} :: diag\_cs\textcolor{comment}{      !< Diagnostics control structure}}
\DoxyCodeLine{3267 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in   )} :: alt\_h(:,:,:)\textcolor{comment}{ !< Used if remapped grids should be something other than}}
\DoxyCodeLine{3268 \textcolor{comment}{                                                        !! the current thicknesses [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{3269 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in   )} :: alt\_T(:,:,:)\textcolor{comment}{ !< Used if remapped grids should be something other than}}
\DoxyCodeLine{3270 \textcolor{comment}{                                                        !! the current temperatures}}
\DoxyCodeLine{3271 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{target}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in   )} :: alt\_S(:,:,:)\textcolor{comment}{ !< Used if remapped grids should be something other than}}
\DoxyCodeLine{3272 \textcolor{comment}{                                                        !! the current salinity}}
\DoxyCodeLine{3273   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},      \textcolor{keywordtype}{intent(in   )} :: update\_intensive\textcolor{comment}{ !< If true (default), update the grids used for}}
\DoxyCodeLine{3274 \textcolor{comment}{                                                            !! intensive diagnostics}}
\DoxyCodeLine{3275   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},      \textcolor{keywordtype}{intent(in   )} :: update\_extensive\textcolor{comment}{ !< If true (not default), update the grids used for}}
\DoxyCodeLine{3276 \textcolor{comment}{                                                            !! intensive diagnostics}}
\DoxyCodeLine{3277   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{3278   \textcolor{keywordtype}{integer} :: i}
\DoxyCodeLine{3279 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: h\_diag => null() \textcolor{comment}{! The layer thickneses for diagnostics [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{3280 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: T\_diag => null(), s\_diag => null()}
\DoxyCodeLine{3281   \textcolor{keywordtype}{logical} :: update\_intensive\_local, update\_extensive\_local}
\DoxyCodeLine{3282 }
\DoxyCodeLine{3283   \textcolor{comment}{! Set values based on optional input arguments}}
\DoxyCodeLine{3284   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(alt\_h)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3285     h\_diag => alt\_h}
\DoxyCodeLine{3286   \textcolor{keywordflow}{else}}
\DoxyCodeLine{3287     h\_diag => diag\_cs\%h}
\DoxyCodeLine{3288 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3289 }
\DoxyCodeLine{3290   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(alt\_t)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3291     t\_diag => alt\_t}
\DoxyCodeLine{3292   \textcolor{keywordflow}{else}}
\DoxyCodeLine{3293     t\_diag => diag\_cs\%T}
\DoxyCodeLine{3294 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3295 }
\DoxyCodeLine{3296   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(alt\_s)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3297     s\_diag => alt\_s}
\DoxyCodeLine{3298   \textcolor{keywordflow}{else}}
\DoxyCodeLine{3299     s\_diag => diag\_cs\%S}
\DoxyCodeLine{3300 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3301 }
\DoxyCodeLine{3302   \textcolor{comment}{! Defaults here are based on wanting to update intensive quantities frequently as soon as the model state changes.}}
\DoxyCodeLine{3303   \textcolor{comment}{! Conversely, for extensive quantities, in an effort to close budgets and to be consistent with the total time}}
\DoxyCodeLine{3304   \textcolor{comment}{! tendency, we construct the diagnostic grid at the beginning of the baroclinic timestep and remap all extensive}}
\DoxyCodeLine{3305   \textcolor{comment}{! quantities to the same grid}}
\DoxyCodeLine{3306   update\_intensive\_local = .true.}
\DoxyCodeLine{3307   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(update\_intensive)) update\_intensive\_local = update\_intensive}
\DoxyCodeLine{3308   update\_extensive\_local = .false.}
\DoxyCodeLine{3309   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(update\_extensive)) update\_extensive\_local = update\_extensive}
\DoxyCodeLine{3310 }
\DoxyCodeLine{3311   \textcolor{keywordflow}{if} (id\_clock\_diag\_grid\_updates>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_grid\_updates)}
\DoxyCodeLine{3312 }
\DoxyCodeLine{3313   \textcolor{keywordflow}{if} (diag\_cs\%diag\_grid\_overridden) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3314      \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"diag\_update\_remap\_grids was called, but current grids in "}// \&}
\DoxyCodeLine{3315                            \textcolor{stringliteral}{"diagnostic structure have been overridden"})}
\DoxyCodeLine{3316 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3317 }
\DoxyCodeLine{3318   \textcolor{keywordflow}{if} (update\_intensive\_local) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3319     \textcolor{keywordflow}{do} i=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{3320       \textcolor{keyword}{call }diag\_remap\_update(diag\_cs\%diag\_remap\_cs(i), diag\_cs\%G, diag\_cs\%GV, diag\_cs\%US, h\_diag, t\_diag, s\_diag, \&}
\DoxyCodeLine{3321                              diag\_cs\%eqn\_of\_state, diag\_cs\%diag\_remap\_cs(i)\%h)}
\DoxyCodeLine{3322 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{3323 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3324   \textcolor{keywordflow}{if} (update\_extensive\_local) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3325     diag\_cs\%h\_begin(:,:,:) = diag\_cs\%h(:,:,:)}
\DoxyCodeLine{3326     \textcolor{keywordflow}{do} i=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{3327       \textcolor{keyword}{call }diag\_remap\_update(diag\_cs\%diag\_remap\_cs(i), diag\_cs\%G, diag\_cs\%GV, diag\_cs\%US, h\_diag, t\_diag, s\_diag, \&}
\DoxyCodeLine{3328                              diag\_cs\%eqn\_of\_state, diag\_cs\%diag\_remap\_cs(i)\%h\_extensive)}
\DoxyCodeLine{3329 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{3330 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3331 }
\DoxyCodeLine{3332 \textcolor{preprocessor}{\#if defined(DEBUG) || defined(\_\_DO\_SAFETY\_CHECKS\_\_)}}
\DoxyCodeLine{3333 \textcolor{preprocessor}{}  \textcolor{comment}{! Keep a copy of H -\/ used to check whether grids are up-\/to-\/date}}
\DoxyCodeLine{3334   \textcolor{comment}{! when doing remapping.}}
\DoxyCodeLine{3335   diag\_cs\%h\_old(:,:,:) = diag\_cs\%h(:,:,:)}
\DoxyCodeLine{3336 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{3337 \textcolor{preprocessor}{}}
\DoxyCodeLine{3338   \textcolor{keywordflow}{if} (id\_clock\_diag\_grid\_updates>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_grid\_updates)}
\DoxyCodeLine{3339 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a1761df399ba39742e34ab989469da0f2}\label{namespacemom__diag__mediator_a1761df399ba39742e34ab989469da0f2}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!disable\_averaging@{disable\_averaging}}
\index{disable\_averaging@{disable\_averaging}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{disable\_averaging()}{disable\_averaging()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::disable\+\_\+averaging (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs }\end{DoxyParamCaption})}



Call this subroutine to avoid averaging any offered fields. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\end{DoxyParams}


Definition at line 1905 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1906   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{intent(inout)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1907 }
\DoxyCodeLine{1908   diag\_cs\%time\_int = 0.0}
\DoxyCodeLine{1909   diag\_cs\%ave\_enabled = .false.}
\DoxyCodeLine{1910 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ac19dd9879fd5c480c4bd27d6e7b8c0cf}\label{namespacemom__diag__mediator_ac19dd9879fd5c480c4bd27d6e7b8c0cf}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!downsample\_diag\_field\_2d@{downsample\_diag\_field\_2d}}
\index{downsample\_diag\_field\_2d@{downsample\_diag\_field\_2d}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{downsample\_diag\_field\_2d()}{downsample\_diag\_field\_2d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::downsample\+\_\+diag\+\_\+field\+\_\+2d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), pointer}]{locfield,  }\item[{real, dimension(\+:,\+:), intent(inout), allocatable}]{locfield\+\_\+dsamp,  }\item[{integer, intent(in)}]{dl,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), intent(in)}]{diag,  }\item[{integer, intent(inout)}]{isv,  }\item[{integer, intent(inout)}]{iev,  }\item[{integer, intent(inout)}]{jsv,  }\item[{integer, intent(inout)}]{jev,  }\item[{real, dimension(\+:,\+:), intent(in), optional, target}]{mask }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine allocates and computes a downsampled array from an input array It also determines the diagnostics-\/compurte indices for the downsampled array 2d interface. 


\begin{DoxyParams}[1]{Parameters}
 & {\em locfield} & Input array pointer \\
\hline
\mbox{\texttt{ in,out}}  & {\em locfield\+\_\+dsamp} & Output (downsampled) array \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em diag} & A structure describing the diagnostic to post \\
\hline
\mbox{\texttt{ in}}  & {\em dl} & Level of down sampling \\
\hline
\mbox{\texttt{ in,out}}  & {\em isv} & i-\/start index for diagnostics \\
\hline
\mbox{\texttt{ in,out}}  & {\em iev} & i-\/end index for diagnostics \\
\hline
\mbox{\texttt{ in,out}}  & {\em jsv} & j-\/start index for diagnostics \\
\hline
\mbox{\texttt{ in,out}}  & {\em jev} & j-\/end index for diagnostics \\
\hline
\mbox{\texttt{ in}}  & {\em mask} & If present, use this real array as the data mask. \\
\hline
\end{DoxyParams}


Definition at line 3875 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3876 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: locfield\textcolor{comment}{ !< Input array pointer}}
\DoxyCodeLine{3877 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{intent(inout)} :: locfield\_dsamp\textcolor{comment}{ !< Output (downsampled) array}}
\DoxyCodeLine{3878   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{3879   \textcolor{keywordtype}{type}(diag\_type),   \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{    !< A structure describing the diagnostic to post}}
\DoxyCodeLine{3880   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: dl\textcolor{comment}{                !< Level of down sampling}}
\DoxyCodeLine{3881   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)} :: isv\textcolor{comment}{            !< i-\/start index for diagnostics}}
\DoxyCodeLine{3882   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)} :: iev\textcolor{comment}{            !< i-\/end index for diagnostics}}
\DoxyCodeLine{3883   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)} :: jsv\textcolor{comment}{            !< j-\/start index for diagnostics}}
\DoxyCodeLine{3884   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)} :: jev\textcolor{comment}{            !< j-\/end index for diagnostics}}
\DoxyCodeLine{3885 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{optional},\textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: mask(:,:)\textcolor{comment}{ !< If present, use this real array as the data mask.}}
\DoxyCodeLine{3886   \textcolor{comment}{! Locals}}
\DoxyCodeLine{3887 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: locmask}
\DoxyCodeLine{3888   \textcolor{keywordtype}{integer} :: f1,f2,isv\_o,jsv\_o}
\DoxyCodeLine{3889 }
\DoxyCodeLine{3890   locmask => null()}
\DoxyCodeLine{3891   \textcolor{comment}{!Get the correct indices corresponding to input field}}
\DoxyCodeLine{3892   \textcolor{comment}{!Shape of the input diag field}}
\DoxyCodeLine{3893   f1=\textcolor{keyword}{size}(locfield,1)}
\DoxyCodeLine{3894   f2=\textcolor{keyword}{size}(locfield,2)}
\DoxyCodeLine{3895   \textcolor{comment}{!Save the extents of the original (fine) domain}}
\DoxyCodeLine{3896   isv\_o=isv;jsv\_o=jsv}
\DoxyCodeLine{3897   \textcolor{comment}{!Get the shape of the downsampled field and overwrite isv,iev,jsv,jev with them}}
\DoxyCodeLine{3898   \textcolor{keyword}{call }downsample\_diag\_indices\_get(f1,f2, dl, diag\_cs,isv,iev,jsv,jev)}
\DoxyCodeLine{3899   \textcolor{comment}{!Set the non-\/downsampled mask, it must be associated and initialized}}
\DoxyCodeLine{3900   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3901      locmask => mask}
\DoxyCodeLine{3902   \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(diag\%axes\%mask2d)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3903      locmask => diag\%axes\%mask2d}
\DoxyCodeLine{3904   \textcolor{keywordflow}{else}}
\DoxyCodeLine{3905      \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"downsample\_diag\_field\_2d: Cannot downsample without a mask!!! "})}
\DoxyCodeLine{3906 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3907 }
\DoxyCodeLine{3908   \textcolor{keyword}{call }downsample\_field(locfield, locfield\_dsamp, dl, diag\%xyz\_method, locmask, diag\_cs,diag, \&}
\DoxyCodeLine{3909                       isv\_o,jsv\_o,isv,iev,jsv,jev)}
\DoxyCodeLine{3910 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a30395d7b955b819afa3942700dedead1}\label{namespacemom__diag__mediator_a30395d7b955b819afa3942700dedead1}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!downsample\_diag\_field\_3d@{downsample\_diag\_field\_3d}}
\index{downsample\_diag\_field\_3d@{downsample\_diag\_field\_3d}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{downsample\_diag\_field\_3d()}{downsample\_diag\_field\_3d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::downsample\+\_\+diag\+\_\+field\+\_\+3d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), pointer}]{locfield,  }\item[{real, dimension(\+:,\+:,\+:), intent(inout), allocatable}]{locfield\+\_\+dsamp,  }\item[{integer, intent(in)}]{dl,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), intent(in)}]{diag,  }\item[{integer, intent(inout)}]{isv,  }\item[{integer, intent(inout)}]{iev,  }\item[{integer, intent(inout)}]{jsv,  }\item[{integer, intent(inout)}]{jev,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), optional, target}]{mask }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine allocates and computes a downsampled array from an input array It also determines the diagnostics-\/compurte indices for the downsampled array 3d interface. 


\begin{DoxyParams}[1]{Parameters}
 & {\em locfield} & Input array pointer \\
\hline
\mbox{\texttt{ in,out}}  & {\em locfield\+\_\+dsamp} & Output (downsampled) array \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em diag} & A structure describing the diagnostic to post \\
\hline
\mbox{\texttt{ in}}  & {\em dl} & Level of down sampling \\
\hline
\mbox{\texttt{ in,out}}  & {\em isv} & i-\/start index for diagnostics \\
\hline
\mbox{\texttt{ in,out}}  & {\em iev} & i-\/end index for diagnostics \\
\hline
\mbox{\texttt{ in,out}}  & {\em jsv} & j-\/start index for diagnostics \\
\hline
\mbox{\texttt{ in,out}}  & {\em jev} & j-\/end index for diagnostics \\
\hline
\mbox{\texttt{ in}}  & {\em mask} & If present, use this real array as the data mask. \\
\hline
\end{DoxyParams}


Definition at line 3834 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3835 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: locfield\textcolor{comment}{  !< Input array pointer}}
\DoxyCodeLine{3836 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{intent(inout)} :: locfield\_dsamp\textcolor{comment}{ !< Output (downsampled) array}}
\DoxyCodeLine{3837   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{3838   \textcolor{keywordtype}{type}(diag\_type),   \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{    !< A structure describing the diagnostic to post}}
\DoxyCodeLine{3839   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: dl\textcolor{comment}{                !< Level of down sampling}}
\DoxyCodeLine{3840   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)} :: isv\textcolor{comment}{            !< i-\/start index for diagnostics}}
\DoxyCodeLine{3841   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)} :: iev\textcolor{comment}{            !< i-\/end index for diagnostics}}
\DoxyCodeLine{3842   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)} :: jsv\textcolor{comment}{            !< j-\/start index for diagnostics}}
\DoxyCodeLine{3843   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(inout)} :: jev\textcolor{comment}{            !< j-\/end index for diagnostics}}
\DoxyCodeLine{3844 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{optional},\textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: mask(:,:,:)\textcolor{comment}{ !< If present, use this real array as the data mask.}}
\DoxyCodeLine{3845   \textcolor{comment}{! Locals}}
\DoxyCodeLine{3846 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: locmask}
\DoxyCodeLine{3847   \textcolor{keywordtype}{integer} :: f1,f2,isv\_o,jsv\_o}
\DoxyCodeLine{3848 }
\DoxyCodeLine{3849   locmask => null()}
\DoxyCodeLine{3850   \textcolor{comment}{!Get the correct indices corresponding to input field}}
\DoxyCodeLine{3851   \textcolor{comment}{!Shape of the input diag field}}
\DoxyCodeLine{3852   f1=\textcolor{keyword}{size}(locfield,1)}
\DoxyCodeLine{3853   f2=\textcolor{keyword}{size}(locfield,2)}
\DoxyCodeLine{3854   \textcolor{comment}{!Save the extents of the original (fine) domain}}
\DoxyCodeLine{3855   isv\_o=isv;jsv\_o=jsv}
\DoxyCodeLine{3856   \textcolor{comment}{!Get the shape of the downsampled field and overwrite isv,iev,jsv,jev with them}}
\DoxyCodeLine{3857   \textcolor{keyword}{call }downsample\_diag\_indices\_get(f1,f2, dl, diag\_cs,isv,iev,jsv,jev)}
\DoxyCodeLine{3858   \textcolor{comment}{!Set the non-\/downsampled mask, it must be associated and initialized}}
\DoxyCodeLine{3859   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3860      locmask => mask}
\DoxyCodeLine{3861   \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(diag\%axes\%mask3d)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3862      locmask => diag\%axes\%mask3d}
\DoxyCodeLine{3863   \textcolor{keywordflow}{else}}
\DoxyCodeLine{3864      \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"downsample\_diag\_field\_3d: Cannot downsample without a mask!!! "})}
\DoxyCodeLine{3865 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3866 }
\DoxyCodeLine{3867   \textcolor{keyword}{call }downsample\_field(locfield, locfield\_dsamp, dl, diag\%xyz\_method, locmask, diag\_cs, diag, \&}
\DoxyCodeLine{3868                       isv\_o,jsv\_o,isv,iev,jsv,jev)}
\DoxyCodeLine{3869 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a902b3d966dae0a8f0011d98d8697e22d}\label{namespacemom__diag__mediator_a902b3d966dae0a8f0011d98d8697e22d}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!downsample\_diag\_indices\_get@{downsample\_diag\_indices\_get}}
\index{downsample\_diag\_indices\_get@{downsample\_diag\_indices\_get}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{downsample\_diag\_indices\_get()}{downsample\_diag\_indices\_get()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::downsample\+\_\+diag\+\_\+indices\+\_\+get (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{fo1,  }\item[{integer, intent(in)}]{fo2,  }\item[{integer, intent(in)}]{dl,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs,  }\item[{integer, intent(out)}]{isv,  }\item[{integer, intent(out)}]{iev,  }\item[{integer, intent(out)}]{jsv,  }\item[{integer, intent(out)}]{jev }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Get the diagnostics-\/compute indices (to be passed to send\+\_\+data) based on the shape of the diag field (the same way they are deduced for non-\/downsampled fields) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fo1} & The size of the diag field in x \\
\hline
\mbox{\texttt{ in}}  & {\em fo2} & The size of the diag field in y \\
\hline
\mbox{\texttt{ in}}  & {\em dl} & Integer downsample level \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ out}}  & {\em isv} & i-\/start index for diagnostics \\
\hline
\mbox{\texttt{ out}}  & {\em iev} & i-\/end index for diagnostics \\
\hline
\mbox{\texttt{ out}}  & {\em jsv} & j-\/start index for diagnostics \\
\hline
\mbox{\texttt{ out}}  & {\em jev} & j-\/end index for diagnostics \\
\hline
\end{DoxyParams}


Definition at line 3761 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3762   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)}  :: fo1\textcolor{comment}{     !< The size of the diag field in x}}
\DoxyCodeLine{3763   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)}  :: fo2\textcolor{comment}{     !< The size of the diag field in y}}
\DoxyCodeLine{3764   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)}  :: dl\textcolor{comment}{      !< Integer downsample level}}
\DoxyCodeLine{3765   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{intent(in)}  :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{3766   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(out)} :: isv\textcolor{comment}{     !< i-\/start index for diagnostics}}
\DoxyCodeLine{3767   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(out)} :: iev\textcolor{comment}{     !< i-\/end index for diagnostics}}
\DoxyCodeLine{3768   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(out)} :: jsv\textcolor{comment}{     !< j-\/start index for diagnostics}}
\DoxyCodeLine{3769   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(out)} :: jev\textcolor{comment}{     !< j-\/end index for diagnostics}}
\DoxyCodeLine{3770   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{3771   \textcolor{keywordtype}{integer} :: dszi,cszi,dszj,cszj,f1,f2}
\DoxyCodeLine{3772   \textcolor{keywordtype}{character(len=500)} :: mesg}
\DoxyCodeLine{3773   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{save} :: first\_check = .true.}
\DoxyCodeLine{3774 }
\DoxyCodeLine{3775   \textcolor{comment}{!Check ONCE that the downsampled diag-\/compute domain is commensurate with the original}}
\DoxyCodeLine{3776   \textcolor{comment}{!non-\/downsampled diag-\/compute domain.}}
\DoxyCodeLine{3777   \textcolor{comment}{!This is a major limitation of the current implementation of the downsampled diagnostics.}}
\DoxyCodeLine{3778   \textcolor{comment}{!We assume that the compute domain can be subdivided to dl*dl cells, hence avoiding the need of halo updates.}}
\DoxyCodeLine{3779   \textcolor{comment}{!We want this check to error out only if there was a downsampled diagnostics requested and about to post that is}}
\DoxyCodeLine{3780   \textcolor{comment}{!why the check is here and not in the init routines. This check need to be done only once, hence the outer if.}}
\DoxyCodeLine{3781   \textcolor{keywordflow}{if}(first\_check) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3782      \textcolor{keywordflow}{if}(mod(diag\_cs\%ie-\/diag\_cs\%is+1, dl) .ne. 0 .OR. mod(diag\_cs\%je-\/diag\_cs\%js+1, dl) .ne. 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3783         \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{"Non-\/commensurate downsampled domain is not supported. "}//\&}
\DoxyCodeLine{3784              \textcolor{stringliteral}{"Please choose a layout such that NIGLOBAL/Layout\_X and NJGLOBAL/Layout\_Y are both divisible by dl="},dl,\&}
\DoxyCodeLine{3785              \textcolor{stringliteral}{" Current domain extents: "}, diag\_cs\%is,diag\_cs\%ie, diag\_cs\%js,diag\_cs\%je}
\DoxyCodeLine{3786         \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"downsample\_diag\_indices\_get: "}//trim(mesg))}
\DoxyCodeLine{3787 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{3788      first\_check = .false.}
\DoxyCodeLine{3789 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3790 }
\DoxyCodeLine{3791   cszi = diag\_cs\%dsamp(dl)\%iec-\/diag\_cs\%dsamp(dl)\%isc +1 ; dszi = diag\_cs\%dsamp(dl)\%ied-\/diag\_cs\%dsamp(dl)\%isd +1}
\DoxyCodeLine{3792   cszj = diag\_cs\%dsamp(dl)\%jec-\/diag\_cs\%dsamp(dl)\%jsc +1 ; dszj = diag\_cs\%dsamp(dl)\%jed-\/diag\_cs\%dsamp(dl)\%jsd +1}
\DoxyCodeLine{3793   isv = diag\_cs\%dsamp(dl)\%isc ; iev = diag\_cs\%dsamp(dl)\%iec}
\DoxyCodeLine{3794   jsv = diag\_cs\%dsamp(dl)\%jsc ; jev = diag\_cs\%dsamp(dl)\%jec}
\DoxyCodeLine{3795   f1 = fo1/dl}
\DoxyCodeLine{3796   f2 = fo2/dl}
\DoxyCodeLine{3797   \textcolor{comment}{!Correction for the symmetric case}}
\DoxyCodeLine{3798   \textcolor{keywordflow}{if} (diag\_cs\%G\%symmetric) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3799      f1 = f1 + mod(fo1,dl)}
\DoxyCodeLine{3800      f2 = f2 + mod(fo2,dl)}
\DoxyCodeLine{3801 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3802   \textcolor{keywordflow}{if} ( f1 == dszi ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3803      isv = diag\_cs\%dsamp(dl)\%isc ; iev = diag\_cs\%dsamp(dl)\%iec    \textcolor{comment}{! field on Data domain, take compute domain indcies}}
\DoxyCodeLine{3804   \textcolor{comment}{!The rest is not taken with the full MOM6 diag\_table}}
\DoxyCodeLine{3805   \textcolor{keywordflow}{elseif} ( f1 == dszi + 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3806      isv = diag\_cs\%dsamp(dl)\%isc ; iev = diag\_cs\%dsamp(dl)\%iec+1   \textcolor{comment}{! Symmetric data domain}}
\DoxyCodeLine{3807   \textcolor{keywordflow}{elseif} ( f1 == cszi) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3808      isv = 1 ; iev = (diag\_cs\%dsamp(dl)\%iec-\/diag\_cs\%dsamp(dl)\%isc) +1  \textcolor{comment}{! Computational domain}}
\DoxyCodeLine{3809   \textcolor{keywordflow}{elseif} ( f1 == cszi + 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3810      isv = 1 ; iev = (diag\_cs\%dsamp(dl)\%iec-\/diag\_cs\%dsamp(dl)\%isc) +2  \textcolor{comment}{! Symmetric computational domain}}
\DoxyCodeLine{3811   \textcolor{keywordflow}{else}}
\DoxyCodeLine{3812      \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{" peculiar size "},f1,\textcolor{stringliteral}{" in i-\/direction\(\backslash\)n"}//\&}
\DoxyCodeLine{3813           \textcolor{stringliteral}{"does not match one of "}, cszi, cszi+1, dszi, dszi+1}
\DoxyCodeLine{3814      \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"downsample\_diag\_indices\_get: "}//trim(mesg))}
\DoxyCodeLine{3815 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3816   \textcolor{keywordflow}{if} ( f2 == dszj ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3817      jsv = diag\_cs\%dsamp(dl)\%jsc ; jev = diag\_cs\%dsamp(dl)\%jec     \textcolor{comment}{! Data domain}}
\DoxyCodeLine{3818   \textcolor{keywordflow}{elseif} ( f2 == dszj + 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3819      jsv = diag\_cs\%dsamp(dl)\%jsc ; jev = diag\_cs\%dsamp(dl)\%jec+1   \textcolor{comment}{! Symmetric data domain}}
\DoxyCodeLine{3820   \textcolor{keywordflow}{elseif} ( f2 == cszj) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3821      jsv = 1 ; jev = (diag\_cs\%dsamp(dl)\%jec-\/diag\_cs\%dsamp(dl)\%jsc) +1  \textcolor{comment}{! Computational domain}}
\DoxyCodeLine{3822   \textcolor{keywordflow}{elseif} ( f2 == cszj + 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3823      jsv = 1 ; jev = (diag\_cs\%dsamp(dl)\%jec-\/diag\_cs\%dsamp(dl)\%jsc) +2  \textcolor{comment}{! Symmetric computational domain}}
\DoxyCodeLine{3824   \textcolor{keywordflow}{else}}
\DoxyCodeLine{3825      \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{" peculiar size "},f2,\textcolor{stringliteral}{" in j-\/direction\(\backslash\)n"}//\&}
\DoxyCodeLine{3826           \textcolor{stringliteral}{"does not match one of "}, cszj, cszj+1, dszj, dszj+1}
\DoxyCodeLine{3827      \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"downsample\_diag\_indices\_get: "}//trim(mesg))}
\DoxyCodeLine{3828 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a5f2fcd6b3aa44f8d4f6259d8cf365f04}\label{namespacemom__diag__mediator_a5f2fcd6b3aa44f8d4f6259d8cf365f04}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!downsample\_diag\_masks\_set@{downsample\_diag\_masks\_set}}
\index{downsample\_diag\_masks\_set@{downsample\_diag\_masks\_set}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{downsample\_diag\_masks\_set()}{downsample\_diag\_masks\_set()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::downsample\+\_\+diag\+\_\+masks\+\_\+set (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in), target}]{G,  }\item[{integer, intent(in)}]{nz,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), pointer}]{diag\+\_\+cs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The ocean grid type.\\
\hline
\mbox{\texttt{ in}}  & {\em nz} & The number of layers in the model\textquotesingle{}s native grid.\\
\hline
 & {\em diag\+\_\+cs} & A pointer to a type with many variables used for diagnostics \\
\hline
\end{DoxyParams}


Definition at line 3702 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3703   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{  !< The ocean grid type.}}
\DoxyCodeLine{3704   \textcolor{keywordtype}{integer},                       \textcolor{keywordtype}{intent(in)} :: nz\textcolor{comment}{ !< The number of layers in the model's native grid.}}
\DoxyCodeLine{3705   \textcolor{keywordtype}{type}(diag\_ctrl),               \textcolor{keywordtype}{pointer}    :: diag\_cs\textcolor{comment}{ !< A pointer to a type with many variables}}
\DoxyCodeLine{3706 \textcolor{comment}{                                                       !! used for diagnostics}}
\DoxyCodeLine{3707   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{3708   \textcolor{keywordtype}{integer} :: i,j,k,ii,jj,dl}
\DoxyCodeLine{3709 }
\DoxyCodeLine{3710 \textcolor{comment}{!print*,'original c extents ',G\%isc,G\%iec,G\%jsc,G\%jec}}
\DoxyCodeLine{3711 \textcolor{comment}{!print*,'original c extents ',G\%iscb,G\%iecb,G\%jscb,G\%jecb}}
\DoxyCodeLine{3712 \textcolor{comment}{!print*,'coarse   c extents ',G\%HId2\%isc,G\%HId2\%iec,G\%HId2\%jsc,G\%HId2\%jec}}
\DoxyCodeLine{3713 \textcolor{comment}{!print*,'original d extents ',G\%isd,G\%ied,G\%jsd,G\%jed}}
\DoxyCodeLine{3714 \textcolor{comment}{!print*,'coarse   d extents ',G\%HId2\%isd,G\%HId2\%ied,G\%HId2\%jsd,G\%HId2\%jed}}
\DoxyCodeLine{3715 \textcolor{comment}{! original c  extents           5          52           5          52}}
\DoxyCodeLine{3716 \textcolor{comment}{! original cB-\/nonsym extents    5          52           5          52}}
\DoxyCodeLine{3717 \textcolor{comment}{! original cB-\/sym    extents    4          52           4          52}}
\DoxyCodeLine{3718 \textcolor{comment}{! coarse   c extents            3          26           3          26}}
\DoxyCodeLine{3719 \textcolor{comment}{! original d extents            1          56           1          56}}
\DoxyCodeLine{3720 \textcolor{comment}{! original dB-\/nonsym extents    1          56           1          56}}
\DoxyCodeLine{3721 \textcolor{comment}{! original dB-\/sym extents       0          56           0          56}}
\DoxyCodeLine{3722 \textcolor{comment}{! coarse   d extents            1          28           1          28}}
\DoxyCodeLine{3723 }
\DoxyCodeLine{3724   \textcolor{keywordflow}{do} dl=2,max\_dsamp\_lev}
\DoxyCodeLine{3725      \textcolor{comment}{! 2d mask}}
\DoxyCodeLine{3726      \textcolor{keyword}{call }downsample\_mask(g\%mask2dT, diag\_cs\%dsamp(dl)\%mask2dT,  dl,g\%isc, g\%jsc,  \&}
\DoxyCodeLine{3727           g\%HId2\%isc, g\%HId2\%iec, g\%HId2\%jsc, g\%HId2\%jec, g\%HId2\%isd, g\%HId2\%ied, g\%HId2\%jsd, g\%HId2\%jed)}
\DoxyCodeLine{3728      \textcolor{keyword}{call }downsample\_mask(g\%mask2dBu,diag\_cs\%dsamp(dl)\%mask2dBu, dl,g\%IscB,g\%JscB, \&}
\DoxyCodeLine{3729           g\%HId2\%IscB,g\%HId2\%IecB,g\%HId2\%JscB,g\%HId2\%JecB,g\%HId2\%IsdB,g\%HId2\%IedB,g\%HId2\%JsdB,g\%HId2\%JedB)}
\DoxyCodeLine{3730      \textcolor{keyword}{call }downsample\_mask(g\%mask2dCu,diag\_cs\%dsamp(dl)\%mask2dCu, dl,g\%IscB,g\%JscB, \&}
\DoxyCodeLine{3731           g\%HId2\%IscB,g\%HId2\%IecB,g\%HId2\%jsc, g\%HId2\%jec,g\%HId2\%IsdB,g\%HId2\%IedB,g\%HId2\%jsd, g\%HId2\%jed)}
\DoxyCodeLine{3732      \textcolor{keyword}{call }downsample\_mask(g\%mask2dCv,diag\_cs\%dsamp(dl)\%mask2dCv, dl,g\%isc ,g\%JscB, \&}
\DoxyCodeLine{3733           g\%HId2\%isc ,g\%HId2\%iec, g\%HId2\%JscB,g\%HId2\%JecB,g\%HId2\%isd ,g\%HId2\%ied, g\%HId2\%JsdB,g\%HId2\%JedB)}
\DoxyCodeLine{3734      \textcolor{comment}{! 3d native masks are needed by diag\_manager but the native variables}}
\DoxyCodeLine{3735      \textcolor{comment}{! can only be masked 2d -\/ for ocean points, all layers exists.}}
\DoxyCodeLine{3736      \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%mask3dTL(g\%HId2\%isd:g\%HId2\%ied,g\%HId2\%jsd:g\%HId2\%jed,1:nz))}
\DoxyCodeLine{3737      \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%mask3dBL(g\%HId2\%IsdB:g\%HId2\%IedB,g\%HId2\%JsdB:g\%HId2\%JedB,1:nz))}
\DoxyCodeLine{3738      \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%mask3dCuL(g\%HId2\%IsdB:g\%HId2\%IedB,g\%HId2\%jsd:g\%HId2\%jed,1:nz))}
\DoxyCodeLine{3739      \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%mask3dCvL(g\%HId2\%isd:g\%HId2\%ied,g\%HId2\%JsdB:g\%HId2\%JedB,1:nz))}
\DoxyCodeLine{3740      \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{3741         diag\_cs\%dsamp(dl)\%mask3dTL(:,:,k) = diag\_cs\%dsamp(dl)\%mask2dT(:,:)}
\DoxyCodeLine{3742         diag\_cs\%dsamp(dl)\%mask3dBL(:,:,k) = diag\_cs\%dsamp(dl)\%mask2dBu(:,:)}
\DoxyCodeLine{3743         diag\_cs\%dsamp(dl)\%mask3dCuL(:,:,k) = diag\_cs\%dsamp(dl)\%mask2dCu(:,:)}
\DoxyCodeLine{3744         diag\_cs\%dsamp(dl)\%mask3dCvL(:,:,k) = diag\_cs\%dsamp(dl)\%mask2dCv(:,:)}
\DoxyCodeLine{3745 \textcolor{keywordflow}{     enddo}}
\DoxyCodeLine{3746      \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%mask3dTi(g\%HId2\%isd:g\%HId2\%ied,g\%HId2\%jsd:g\%HId2\%jed,1:nz+1))}
\DoxyCodeLine{3747      \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%mask3dBi(g\%HId2\%IsdB:g\%HId2\%IedB,g\%HId2\%JsdB:g\%HId2\%JedB,1:nz+1))}
\DoxyCodeLine{3748      \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%mask3dCui(g\%HId2\%IsdB:g\%HId2\%IedB,g\%HId2\%jsd:g\%HId2\%jed,1:nz+1))}
\DoxyCodeLine{3749      \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%mask3dCvi(g\%HId2\%isd:g\%HId2\%ied,g\%HId2\%JsdB:g\%HId2\%JedB,1:nz+1))}
\DoxyCodeLine{3750      \textcolor{keywordflow}{do} k=1,nz+1}
\DoxyCodeLine{3751         diag\_cs\%dsamp(dl)\%mask3dTi(:,:,k) = diag\_cs\%dsamp(dl)\%mask2dT(:,:)}
\DoxyCodeLine{3752         diag\_cs\%dsamp(dl)\%mask3dBi(:,:,k) = diag\_cs\%dsamp(dl)\%mask2dBu(:,:)}
\DoxyCodeLine{3753         diag\_cs\%dsamp(dl)\%mask3dCui(:,:,k) = diag\_cs\%dsamp(dl)\%mask2dCu(:,:)}
\DoxyCodeLine{3754         diag\_cs\%dsamp(dl)\%mask3dCvi(:,:,k) = diag\_cs\%dsamp(dl)\%mask2dCv(:,:)}
\DoxyCodeLine{3755 \textcolor{keywordflow}{     enddo}}
\DoxyCodeLine{3756 \textcolor{keywordflow}{  enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_aa46e12f1318ed96f60035cdd32e4157a}\label{namespacemom__diag__mediator_aa46e12f1318ed96f60035cdd32e4157a}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!downsample\_field\_2d@{downsample\_field\_2d}}
\index{downsample\_field\_2d@{downsample\_field\_2d}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{downsample\_field\_2d()}{downsample\_field\_2d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::downsample\+\_\+field\+\_\+2d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), pointer}]{field\+\_\+in,  }\item[{real, dimension(\+:,\+:), allocatable}]{field\+\_\+out,  }\item[{integer, intent(in)}]{dl,  }\item[{integer, intent(in)}]{method,  }\item[{real, dimension(\+:,\+:), pointer}]{mask,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), intent(in)}]{diag,  }\item[{integer, intent(in)}]{isv\+\_\+o,  }\item[{integer, intent(in)}]{jsv\+\_\+o,  }\item[{integer, intent(in)}]{isv\+\_\+d,  }\item[{integer, intent(in)}]{iev\+\_\+d,  }\item[{integer, intent(in)}]{jsv\+\_\+d,  }\item[{integer, intent(in)}]{jev\+\_\+d }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine allocates and computes a down sampled 2d array given an input array The down sample method is based on the \char`\"{}cell\+\_\+methods\char`\"{} for the diagnostics as explained in the above table. 


\begin{DoxyParams}[1]{Parameters}
 & {\em field\+\_\+in} & Original field to be down sampled \\
\hline
 & {\em field\+\_\+out} & Down sampled field \\
\hline
\mbox{\texttt{ in}}  & {\em dl} & Level of down sampling \\
\hline
\mbox{\texttt{ in}}  & {\em method} & Sampling method \\
\hline
 & {\em mask} & Mask for field \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em diag} & A structure describing the diagnostic to post \\
\hline
\mbox{\texttt{ in}}  & {\em isv\+\_\+o} & Original i-\/start index \\
\hline
\mbox{\texttt{ in}}  & {\em jsv\+\_\+o} & Original j-\/start index \\
\hline
\mbox{\texttt{ in}}  & {\em isv\+\_\+d} & i-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em iev\+\_\+d} & i-\/end index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jsv\+\_\+d} & j-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jev\+\_\+d} & j-\/end index of down sampled data \\
\hline
\end{DoxyParams}


Definition at line 4105 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{4107 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: field\_in\textcolor{comment}{      !< Original field to be down sampled}}
\DoxyCodeLine{4108 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{allocatable} :: field\_out\textcolor{comment}{ !< Down sampled field}}
\DoxyCodeLine{4109   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: dl\textcolor{comment}{                !< Level of down sampling}}
\DoxyCodeLine{4110   \textcolor{keywordtype}{integer},  \textcolor{keywordtype}{intent(in)} :: method\textcolor{comment}{           !< Sampling method}}
\DoxyCodeLine{4111 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: mask\textcolor{comment}{    !< Mask for field}}
\DoxyCodeLine{4112   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{4113   \textcolor{keywordtype}{type}(diag\_type),   \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{    !< A structure describing the diagnostic to post}}
\DoxyCodeLine{4114   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: isv\_o\textcolor{comment}{             !< Original i-\/start index}}
\DoxyCodeLine{4115   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jsv\_o\textcolor{comment}{             !< Original j-\/start index}}
\DoxyCodeLine{4116   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: isv\_d\textcolor{comment}{             !< i-\/start index of down sampled data}}
\DoxyCodeLine{4117   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: iev\_d\textcolor{comment}{             !< i-\/end index of down sampled data}}
\DoxyCodeLine{4118   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jsv\_d\textcolor{comment}{             !< j-\/start index of down sampled data}}
\DoxyCodeLine{4119   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jev\_d\textcolor{comment}{             !< j-\/end index of down sampled data}}
\DoxyCodeLine{4120   \textcolor{comment}{! Locals}}
\DoxyCodeLine{4121   \textcolor{keywordtype}{character(len=240)} :: mesg}
\DoxyCodeLine{4122   \textcolor{keywordtype}{integer} :: i,j,ii,jj,i0,j0,f1,f2,f\_in1,f\_in2}
\DoxyCodeLine{4123 \textcolor{keywordtype}{  real} :: ave, total\_weight, weight}
\DoxyCodeLine{4124 \textcolor{keywordtype}{  real} :: epsilon = 1.0e-\/20  \textcolor{comment}{! A negligibly small count of weights [nondim]}}
\DoxyCodeLine{4125 \textcolor{keywordtype}{  real} :: eps\_area  \textcolor{comment}{! A negligibly small area [L2 \string~> m2]}}
\DoxyCodeLine{4126 \textcolor{keywordtype}{  real} :: eps\_len   \textcolor{comment}{! A negligibly small horizontal length [L \string~> m]}}
\DoxyCodeLine{4127 }
\DoxyCodeLine{4128   eps\_len = 1.0e-\/20 * diag\_cs\%G\%US\%m\_to\_L}
\DoxyCodeLine{4129   eps\_area = 1.0e-\/20 * diag\_cs\%G\%US\%m\_to\_L**2}
\DoxyCodeLine{4130 }
\DoxyCodeLine{4131   \textcolor{comment}{! Allocate the down sampled field on the down sampled data domain}}
\DoxyCodeLine{4132 \textcolor{comment}{!  allocate(field\_out(diag\_cs\%dsamp(dl)\%isd:diag\_cs\%dsamp(dl)\%ied,diag\_cs\%dsamp(dl)\%jsd:diag\_cs\%dsamp(dl)\%jed))}}
\DoxyCodeLine{4133 \textcolor{comment}{!  allocate(field\_out(1:size(field\_in,1)/dl,1:size(field\_in,2)/dl))}}
\DoxyCodeLine{4134   \textcolor{comment}{! Fill the down sampled field on the down sampled diagnostics (almost always compuate) domain}}
\DoxyCodeLine{4135   f\_in1 = \textcolor{keyword}{size}(field\_in,1)}
\DoxyCodeLine{4136   f\_in2 = \textcolor{keyword}{size}(field\_in,2)}
\DoxyCodeLine{4137   f1 = f\_in1/dl}
\DoxyCodeLine{4138   f2 = f\_in2/dl}
\DoxyCodeLine{4139   \textcolor{comment}{! Correction for the symmetric case}}
\DoxyCodeLine{4140   \textcolor{keywordflow}{if} (diag\_cs\%G\%symmetric) \textcolor{keywordflow}{then}}
\DoxyCodeLine{4141      f1 = f1 + mod(f\_in1,dl)}
\DoxyCodeLine{4142      f2 = f2 + mod(f\_in2,dl)}
\DoxyCodeLine{4143 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{4144   \textcolor{keyword}{allocate}(field\_out(1:f1,1:f2))}
\DoxyCodeLine{4145 }
\DoxyCodeLine{4146   \textcolor{keywordflow}{if} (method == mmp) \textcolor{keywordflow}{then}}
\DoxyCodeLine{4147      \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4148         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4149         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4150         ave = 0.0}
\DoxyCodeLine{4151         total\_weight = 0.0}
\DoxyCodeLine{4152         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1 ; \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4153 \textcolor{comment}{!        do ii=i0,i0+dl-\/1 ; do jj=j0,j0+dl-\/1}}
\DoxyCodeLine{4154            weight = mask(ii,jj)*diag\_cs\%G\%areaT(ii,jj)}
\DoxyCodeLine{4155            total\_weight = total\_weight + weight}
\DoxyCodeLine{4156            ave = ave+field\_in(ii,jj)*weight}
\DoxyCodeLine{4157         enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4158         field\_out(i,j)  = ave/(total\_weight + eps\_area)  \textcolor{comment}{!Avoid zero mask at all aggregating cells where ave=0.0}}
\DoxyCodeLine{4159      enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4160   \textcolor{keywordflow}{elseif}(method == ssp) \textcolor{keywordflow}{then}    \textcolor{comment}{! e.g., T\_dfxy\_cont\_tendency\_2d}}
\DoxyCodeLine{4161      \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4162         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4163         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4164         ave = 0.0}
\DoxyCodeLine{4165         total\_weight = 0.0}
\DoxyCodeLine{4166         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1 ; \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4167 \textcolor{comment}{!        do ii=i0,i0+dl-\/1 ; do jj=j0,j0+dl-\/1}}
\DoxyCodeLine{4168            weight = mask(ii,jj)}
\DoxyCodeLine{4169            total\_weight = total\_weight + weight}
\DoxyCodeLine{4170            ave=ave+field\_in(ii,jj)*weight}
\DoxyCodeLine{4171         enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4172         field\_out(i,j)  = ave/(total\_weight+epsilon)  \textcolor{comment}{!Avoid zero mask at all aggregating cells where ave=0.0}}
\DoxyCodeLine{4173      enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4174   \textcolor{keywordflow}{elseif}(method == psp) \textcolor{keywordflow}{then}    \textcolor{comment}{! e.g., umo\_2d}}
\DoxyCodeLine{4175      \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4176         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4177         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4178         ave = 0.0}
\DoxyCodeLine{4179         total\_weight = 0.0}
\DoxyCodeLine{4180         ii=i0}
\DoxyCodeLine{4181         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1}
\DoxyCodeLine{4182            weight = mask(ii,jj)}
\DoxyCodeLine{4183            total\_weight = total\_weight +weight}
\DoxyCodeLine{4184            ave=ave+field\_in(ii,jj)*weight}
\DoxyCodeLine{4185 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{4186         field\_out(i,j)  = ave/(total\_weight+epsilon)  \textcolor{comment}{!Avoid zero mask at all aggregating cells where ave=0.0}}
\DoxyCodeLine{4187      enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4188   \textcolor{keywordflow}{elseif}(method == spp) \textcolor{keywordflow}{then}    \textcolor{comment}{! e.g., vmo\_2d}}
\DoxyCodeLine{4189      \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4190         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4191         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4192         ave = 0.0}
\DoxyCodeLine{4193         total\_weight = 0.0}
\DoxyCodeLine{4194         jj=j0}
\DoxyCodeLine{4195         \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4196            weight = mask(ii,jj)}
\DoxyCodeLine{4197            total\_weight = total\_weight +weight}
\DoxyCodeLine{4198            ave=ave+field\_in(ii,jj)*weight}
\DoxyCodeLine{4199 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{4200         field\_out(i,j)  = ave/(total\_weight+epsilon)  \textcolor{comment}{!Avoid zero mask at all aggregating cells where ave=0.0}}
\DoxyCodeLine{4201      enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4202   \textcolor{keywordflow}{elseif}(method == pmp) \textcolor{keywordflow}{then}}
\DoxyCodeLine{4203      \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4204         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4205         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4206         ave = 0.0}
\DoxyCodeLine{4207         total\_weight = 0.0}
\DoxyCodeLine{4208         ii=i0}
\DoxyCodeLine{4209         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1}
\DoxyCodeLine{4210            weight = mask(ii,jj) * diag\_cs\%G\%dyCu(ii,jj)\textcolor{comment}{!*diag\_cs\%h(ii,jj,1) !Niki?}}
\DoxyCodeLine{4211            total\_weight = total\_weight +weight}
\DoxyCodeLine{4212            ave=ave+field\_in(ii,jj)*weight}
\DoxyCodeLine{4213 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{4214         field\_out(i,j)  = ave/(total\_weight+eps\_len)  \textcolor{comment}{!Avoid zero mask at all aggregating cells where ave=0.0}}
\DoxyCodeLine{4215      enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4216   \textcolor{keywordflow}{elseif}(method == mpp) \textcolor{keywordflow}{then}}
\DoxyCodeLine{4217      \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4218         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4219         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4220         ave = 0.0}
\DoxyCodeLine{4221         total\_weight = 0.0}
\DoxyCodeLine{4222         jj=j0}
\DoxyCodeLine{4223         \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4224            weight = mask(ii,jj)* diag\_cs\%G\%dxCv(ii,jj)\textcolor{comment}{!*diag\_cs\%h(ii,jj,1) !Niki?}}
\DoxyCodeLine{4225            total\_weight = total\_weight +weight}
\DoxyCodeLine{4226            ave=ave+field\_in(ii,jj)*weight}
\DoxyCodeLine{4227 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{4228         field\_out(i,j)  = ave/(total\_weight+eps\_len)  \textcolor{comment}{!Avoid zero mask at all aggregating cells where ave=0.0}}
\DoxyCodeLine{4229      enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4230   \textcolor{keywordflow}{elseif}(method == msk) \textcolor{keywordflow}{then} \textcolor{comment}{!The input field is a mask, subsample}}
\DoxyCodeLine{4231      field\_out(:,:) = 0.0}
\DoxyCodeLine{4232      \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4233         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4234         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4235         ave = 0.0}
\DoxyCodeLine{4236         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1 ; \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4237            ave=ave+field\_in(ii,jj)}
\DoxyCodeLine{4238         enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4239         \textcolor{keywordflow}{if}(ave > 0.0) field\_out(i,j)=1.0}
\DoxyCodeLine{4240      enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4241   \textcolor{keywordflow}{else}}
\DoxyCodeLine{4242      \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{" unknown sampling method: "},method}
\DoxyCodeLine{4243      \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"downsample\_field\_2d: "}//trim(mesg)//\textcolor{stringliteral}{" "}//trim(diag\%debug\_str))}
\DoxyCodeLine{4244 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{4245 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a640ec8fac9bad1d0af6f737d7e816403}\label{namespacemom__diag__mediator_a640ec8fac9bad1d0af6f737d7e816403}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!downsample\_field\_3d@{downsample\_field\_3d}}
\index{downsample\_field\_3d@{downsample\_field\_3d}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{downsample\_field\_3d()}{downsample\_field\_3d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::downsample\+\_\+field\+\_\+3d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), pointer}]{field\+\_\+in,  }\item[{real, dimension(\+:,\+:,\+:), allocatable}]{field\+\_\+out,  }\item[{integer, intent(in)}]{dl,  }\item[{integer, intent(in)}]{method,  }\item[{real, dimension(\+:,\+:,\+:), pointer}]{mask,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), intent(in)}]{diag,  }\item[{integer, intent(in)}]{isv\+\_\+o,  }\item[{integer, intent(in)}]{jsv\+\_\+o,  }\item[{integer, intent(in)}]{isv\+\_\+d,  }\item[{integer, intent(in)}]{iev\+\_\+d,  }\item[{integer, intent(in)}]{jsv\+\_\+d,  }\item[{integer, intent(in)}]{jev\+\_\+d }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine allocates and computes a down sampled 3d array given an input array The down sample method is based on the \char`\"{}cell\+\_\+methods\char`\"{} for the diagnostics as explained in the above table. 

\hypertarget{namespacemom__diag__mediator_downsampling}{}\doxysubsection{The down sample algorithm}\label{namespacemom__diag__mediator_downsampling}
The down sample method could be deduced (before send\+\_\+data call) from the diagx\+\_\+cell\+\_\+method, diagy\+\_\+cell\+\_\+method and diagv\+\_\+cell\+\_\+method

This is the summary of the down sample algoritm for a diagnostic field f\+: \[ f(Id,Jd) = \sum_{i,j} f(Id+i,Jd+j) * weight(Id+i,Jd+j) / [ \sum_{i,j} weight(Id+i,Jd+j)] \] Here, i and j run from 0 to dl-\/1 (dl being the down sample level). Id,Jd are the down sampled (coarse grid) indices run over the coarsened compute grid, if and jf are the original (fine grid) indices.

\begin{DoxyVerb} Example   x_cell y_cell v_cell algorithm_id    implemented weight(if,jf)
 ---------------------------------------------------------------------------------------
 theta     mean   mean   mean   MMM =222        G%areaT(if,jf)*h(if,jf)
 u         point  mean   mean   PMM =022        dyCu(if,jf)*h(if,jf)*delta(if,Id)
 v         mean   point  mean   MPM =202        dxCv(if,jf)*h(if,jf)*delta(jf,Jd)
 ?         point  sum    mean   PSM =012        h(if,jf)*delta(if,Id)
 volcello  sum    sum    sum    SSS =111        1
 T_dfxy_co sum    sum    point  SSP =110        1
 umo       point  sum    sum    PSS =011        1*delta(if,Id)
 vmo       sum    point  sum    SPS =101        1*delta(jf,Jd)
 umo_2d    point  sum    point  PSP =010        1*delta(if,Id)
 vmo_2d    sum    point  point  SPP =100        1*delta(jf,Jd)
 ?         point  mean   point  PMP =020        dyCu(if,jf)*delta(if,Id)
 ?         mean   point  point  MPP =200        dxCv(if,jf)*delta(jf,Jd)
 w         mean   mean   point  MMP =220        G%areaT(if,jf)
 h*theta   mean   mean   sum    MMS =221        G%areaT(if,jf)

 delta is the Kronecker delta\end{DoxyVerb}
 
\begin{DoxyParams}[1]{Parameters}
 & {\em field\+\_\+in} & Original field to be down sampled \\
\hline
 & {\em field\+\_\+out} & down sampled field \\
\hline
\mbox{\texttt{ in}}  & {\em dl} & Level of down sampling \\
\hline
\mbox{\texttt{ in}}  & {\em method} & Sampling method \\
\hline
 & {\em mask} & Mask for field \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em diag} & A structure describing the diagnostic to post \\
\hline
\mbox{\texttt{ in}}  & {\em isv\+\_\+o} & Original i-\/start index \\
\hline
\mbox{\texttt{ in}}  & {\em jsv\+\_\+o} & Original j-\/start index \\
\hline
\mbox{\texttt{ in}}  & {\em isv\+\_\+d} & i-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em iev\+\_\+d} & i-\/end index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jsv\+\_\+d} & j-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jev\+\_\+d} & j-\/end index of down sampled data \\
\hline
\end{DoxyParams}


Definition at line 3950 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3951 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: field\_in\textcolor{comment}{      !< Original field to be down sampled}}
\DoxyCodeLine{3952 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{allocatable} :: field\_out\textcolor{comment}{ !< down sampled field}}
\DoxyCodeLine{3953   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: dl\textcolor{comment}{                !< Level of down sampling}}
\DoxyCodeLine{3954   \textcolor{keywordtype}{integer},  \textcolor{keywordtype}{intent(in)} :: method\textcolor{comment}{           !< Sampling method}}
\DoxyCodeLine{3955 \textcolor{keywordtype}{  real},  \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: mask\textcolor{comment}{ !< Mask for field}}
\DoxyCodeLine{3956   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{   !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{3957   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{      !< A structure describing the diagnostic to post}}
\DoxyCodeLine{3958   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: isv\_o\textcolor{comment}{             !< Original i-\/start index}}
\DoxyCodeLine{3959   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jsv\_o\textcolor{comment}{             !< Original j-\/start index}}
\DoxyCodeLine{3960   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: isv\_d\textcolor{comment}{             !< i-\/start index of down sampled data}}
\DoxyCodeLine{3961   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: iev\_d\textcolor{comment}{             !< i-\/end index of down sampled data}}
\DoxyCodeLine{3962   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jsv\_d\textcolor{comment}{             !< j-\/start index of down sampled data}}
\DoxyCodeLine{3963   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jev\_d\textcolor{comment}{             !< j-\/end index of down sampled data}}
\DoxyCodeLine{3964   \textcolor{comment}{! Locals}}
\DoxyCodeLine{3965   \textcolor{keywordtype}{character(len=240)} :: mesg}
\DoxyCodeLine{3966   \textcolor{keywordtype}{integer} :: i,j,ii,jj,i0,j0,f1,f2,f\_in1,f\_in2}
\DoxyCodeLine{3967   \textcolor{keywordtype}{integer} :: k,ks,ke}
\DoxyCodeLine{3968 \textcolor{keywordtype}{  real} :: ave,total\_weight,weight}
\DoxyCodeLine{3969 \textcolor{keywordtype}{  real} :: eps\_vol   \textcolor{comment}{! A negligibly small volume or mass [H L2 \string~> m3 or kg]}}
\DoxyCodeLine{3970 \textcolor{keywordtype}{  real} :: eps\_area  \textcolor{comment}{! A negligibly small area [L2 \string~> m2]}}
\DoxyCodeLine{3971 \textcolor{keywordtype}{  real} :: eps\_face  \textcolor{comment}{! A negligibly small face area [H L \string~> m2 or kg m-\/1]}}
\DoxyCodeLine{3972 }
\DoxyCodeLine{3973   ks = 1 ; ke = \textcolor{keyword}{size}(field\_in,3)}
\DoxyCodeLine{3974   eps\_face = 1.0e-\/20 * diag\_cs\%G\%US\%m\_to\_L * diag\_cs\%GV\%m\_to\_H}
\DoxyCodeLine{3975   eps\_area = 1.0e-\/20 * diag\_cs\%G\%US\%m\_to\_L**2}
\DoxyCodeLine{3976   eps\_vol = 1.0e-\/20 * diag\_cs\%G\%US\%m\_to\_L**2 * diag\_cs\%GV\%m\_to\_H}
\DoxyCodeLine{3977 }
\DoxyCodeLine{3978   \textcolor{comment}{! Allocate the down sampled field on the down sampled data domain}}
\DoxyCodeLine{3979 \textcolor{comment}{!  allocate(field\_out(diag\_cs\%dsamp(dl)\%isd:diag\_cs\%dsamp(dl)\%ied,diag\_cs\%dsamp(dl)\%jsd:diag\_cs\%dsamp(dl)\%jed,ks:ke))}}
\DoxyCodeLine{3980 \textcolor{comment}{!  allocate(field\_out(1:size(field\_in,1)/dl,1:size(field\_in,2)/dl,ks:ke))}}
\DoxyCodeLine{3981   f\_in1 = \textcolor{keyword}{size}(field\_in,1)}
\DoxyCodeLine{3982   f\_in2 = \textcolor{keyword}{size}(field\_in,2)}
\DoxyCodeLine{3983   f1 = f\_in1/dl}
\DoxyCodeLine{3984   f2 = f\_in2/dl}
\DoxyCodeLine{3985   \textcolor{comment}{!Correction for the symmetric case}}
\DoxyCodeLine{3986   \textcolor{keywordflow}{if} (diag\_cs\%G\%symmetric) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3987      f1 = f1 + mod(f\_in1,dl)}
\DoxyCodeLine{3988      f2 = f2 + mod(f\_in2,dl)}
\DoxyCodeLine{3989 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3990   \textcolor{keyword}{allocate}(field\_out(1:f1,1:f2,ks:ke))}
\DoxyCodeLine{3991 }
\DoxyCodeLine{3992   \textcolor{comment}{! Fill the down sampled field on the down sampled diagnostics (almost always compuate) domain}}
\DoxyCodeLine{3993   \textcolor{keywordflow}{if} (method == mmm) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3994      \textcolor{keywordflow}{do} k= ks,ke ; \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{3995         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{3996         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{3997         ave = 0.0}
\DoxyCodeLine{3998         total\_weight = 0.0}
\DoxyCodeLine{3999         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1 ; \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4000 \textcolor{comment}{!        do ii=i0,i0+dl-\/1 ; do jj=j0,j0+dl-\/1 !This seems to be faster!!!!}}
\DoxyCodeLine{4001            weight = mask(ii,jj,k) * diag\_cs\%G\%areaT(ii,jj) * diag\_cs\%h(ii,jj,k)}
\DoxyCodeLine{4002            total\_weight = total\_weight + weight}
\DoxyCodeLine{4003            ave = ave+field\_in(ii,jj,k) * weight}
\DoxyCodeLine{4004         enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4005         field\_out(i,j,k)  = ave/(total\_weight + eps\_vol)  \textcolor{comment}{!Avoid zero mask at all aggregating cells where ave=0.0}}
\DoxyCodeLine{4006      enddo; enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4007   \textcolor{keywordflow}{elseif} (method == sss) \textcolor{keywordflow}{then}    \textcolor{comment}{!e.g., volcello}}
\DoxyCodeLine{4008      \textcolor{keywordflow}{do} k= ks,ke ; \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4009         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4010         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4011         ave = 0.0}
\DoxyCodeLine{4012         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1 ; \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4013            weight = mask(ii,jj,k)}
\DoxyCodeLine{4014            ave = ave+field\_in(ii,jj,k)*weight}
\DoxyCodeLine{4015         enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4016         field\_out(i,j,k)  = ave \textcolor{comment}{!Masked Sum (total\_weight=1)}}
\DoxyCodeLine{4017      enddo; enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4018   \textcolor{keywordflow}{elseif}(method == mmp .or. method == mms) \textcolor{keywordflow}{then}    \textcolor{comment}{!e.g., T\_advection\_xy}}
\DoxyCodeLine{4019      \textcolor{keywordflow}{do} k= ks,ke ; \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4020         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4021         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4022         ave = 0.0}
\DoxyCodeLine{4023         total\_weight = 0.0}
\DoxyCodeLine{4024         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1 ; \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4025 \textcolor{comment}{!        do ii=i0,i0+dl-\/1 ; do jj=j0,j0+dl-\/1}}
\DoxyCodeLine{4026            weight = mask(ii,jj,k) * diag\_cs\%G\%areaT(ii,jj)}
\DoxyCodeLine{4027            total\_weight = total\_weight + weight}
\DoxyCodeLine{4028            ave = ave+field\_in(ii,jj,k)*weight}
\DoxyCodeLine{4029         enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4030         field\_out(i,j,k)  = ave / (total\_weight+eps\_area)  \textcolor{comment}{!Avoid zero mask at all aggregating cells where ave=0.0}}
\DoxyCodeLine{4031      enddo; enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4032   \textcolor{keywordflow}{elseif}(method == pmm) \textcolor{keywordflow}{then}}
\DoxyCodeLine{4033      \textcolor{keywordflow}{do} k= ks,ke ; \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4034         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4035         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4036         ave = 0.0}
\DoxyCodeLine{4037         total\_weight = 0.0}
\DoxyCodeLine{4038         ii=i0}
\DoxyCodeLine{4039         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1}
\DoxyCodeLine{4040            weight =mask(ii,jj,k) * diag\_cs\%G\%dyCu(ii,jj) * diag\_cs\%h(ii,jj,k)}
\DoxyCodeLine{4041            total\_weight = total\_weight +weight}
\DoxyCodeLine{4042            ave=ave+field\_in(ii,jj,k)*weight}
\DoxyCodeLine{4043 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{4044         field\_out(i,j,k)  = ave/(total\_weight+eps\_face)  \textcolor{comment}{!Avoid zero mask at all aggregating cells where ave=0.0}}
\DoxyCodeLine{4045      enddo; enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4046   \textcolor{keywordflow}{elseif}(method == pss) \textcolor{keywordflow}{then}    \textcolor{comment}{!e.g. umo}}
\DoxyCodeLine{4047      \textcolor{keywordflow}{do} k= ks,ke ; \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4048         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4049         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4050         ave = 0.0}
\DoxyCodeLine{4051         ii=i0}
\DoxyCodeLine{4052         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1}
\DoxyCodeLine{4053            weight =mask(ii,jj,k)}
\DoxyCodeLine{4054            ave=ave+field\_in(ii,jj,k)*weight}
\DoxyCodeLine{4055 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{4056         field\_out(i,j,k)  = ave  \textcolor{comment}{!Masked Sum (total\_weight=1)}}
\DoxyCodeLine{4057      enddo; enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4058   \textcolor{keywordflow}{elseif}(method == sps) \textcolor{keywordflow}{then}    \textcolor{comment}{!e.g. vmo}}
\DoxyCodeLine{4059      \textcolor{keywordflow}{do} k= ks,ke ; \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4060         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4061         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4062         ave = 0.0}
\DoxyCodeLine{4063         jj=j0}
\DoxyCodeLine{4064         \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4065            weight =mask(ii,jj,k)}
\DoxyCodeLine{4066            ave=ave+field\_in(ii,jj,k)*weight}
\DoxyCodeLine{4067 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{4068         field\_out(i,j,k)  = ave  \textcolor{comment}{!Masked Sum (total\_weight=1)}}
\DoxyCodeLine{4069      enddo; enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4070   \textcolor{keywordflow}{elseif}(method == mpm) \textcolor{keywordflow}{then}}
\DoxyCodeLine{4071      \textcolor{keywordflow}{do} k= ks,ke ; \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4072         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4073         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4074         ave = 0.0}
\DoxyCodeLine{4075         total\_weight = 0.0}
\DoxyCodeLine{4076         jj=j0}
\DoxyCodeLine{4077         \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4078            weight = mask(ii,jj,k) * diag\_cs\%G\%dxCv(ii,jj) * diag\_cs\%h(ii,jj,k)}
\DoxyCodeLine{4079            total\_weight = total\_weight + weight}
\DoxyCodeLine{4080            ave=ave+field\_in(ii,jj,k)*weight}
\DoxyCodeLine{4081 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{4082         field\_out(i,j,k)  = ave/(total\_weight+eps\_face)  \textcolor{comment}{!Avoid zero mask at all aggregating cells where ave=0.0}}
\DoxyCodeLine{4083      enddo; enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4084   \textcolor{keywordflow}{elseif}(method == msk) \textcolor{keywordflow}{then} \textcolor{comment}{!The input field is a mask, subsample}}
\DoxyCodeLine{4085      field\_out(:,:,:) = 0.0}
\DoxyCodeLine{4086      \textcolor{keywordflow}{do} k= ks,ke ; \textcolor{keywordflow}{do} j=jsv\_d,jev\_d ; \textcolor{keywordflow}{do} i=isv\_d,iev\_d}
\DoxyCodeLine{4087         i0 = isv\_o+dl*(i-\/isv\_d)}
\DoxyCodeLine{4088         j0 = jsv\_o+dl*(j-\/jsv\_d)}
\DoxyCodeLine{4089         ave = 0.0}
\DoxyCodeLine{4090         \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1 ; \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4091            ave=ave+field\_in(ii,jj,k)}
\DoxyCodeLine{4092         enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4093         \textcolor{keywordflow}{if}(ave > 0.0) field\_out(i,j,k)=1.0}
\DoxyCodeLine{4094      enddo; enddo;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{4095   \textcolor{keywordflow}{else}}
\DoxyCodeLine{4096      \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{" unknown sampling method: "},method}
\DoxyCodeLine{4097      \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"downsample\_field\_3d: "}//trim(mesg)//\textcolor{stringliteral}{" "}//trim(diag\%debug\_str))}
\DoxyCodeLine{4098 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{4099 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a8e211bead8fe3f37da32dfa010b55b90}\label{namespacemom__diag__mediator_a8e211bead8fe3f37da32dfa010b55b90}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!downsample\_mask\_2d@{downsample\_mask\_2d}}
\index{downsample\_mask\_2d@{downsample\_mask\_2d}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{downsample\_mask\_2d()}{downsample\_mask\_2d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::downsample\+\_\+mask\+\_\+2d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), intent(in)}]{field\+\_\+in,  }\item[{real, dimension(\+:,\+:), pointer}]{field\+\_\+out,  }\item[{integer, intent(in)}]{dl,  }\item[{integer, intent(in)}]{isc\+\_\+o,  }\item[{integer, intent(in)}]{jsc\+\_\+o,  }\item[{integer, intent(in)}]{isc\+\_\+d,  }\item[{integer, intent(in)}]{iec\+\_\+d,  }\item[{integer, intent(in)}]{jsc\+\_\+d,  }\item[{integer, intent(in)}]{jec\+\_\+d,  }\item[{integer, intent(in)}]{isd\+\_\+d,  }\item[{integer, intent(in)}]{ied\+\_\+d,  }\item[{integer, intent(in)}]{jsd\+\_\+d,  }\item[{integer, intent(in)}]{jed\+\_\+d }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate and compute the 2d down sampled mask The masks are down sampled based on a minority rule, i.\+e., a coarse cell is open (1) if at least one of the sub-\/cells are open, otherwise it\textquotesingle{}s closed (0) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em field\+\_\+in} & Original field to be down sampled \\
\hline
 & {\em field\+\_\+out} & Down sampled field \\
\hline
\mbox{\texttt{ in}}  & {\em dl} & Level of down sampling \\
\hline
\mbox{\texttt{ in}}  & {\em isc\+\_\+o} & Original i-\/start index \\
\hline
\mbox{\texttt{ in}}  & {\em jsc\+\_\+o} & Original j-\/start index \\
\hline
\mbox{\texttt{ in}}  & {\em isc\+\_\+d} & Computational i-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em iec\+\_\+d} & Computational i-\/end index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jsc\+\_\+d} & Computational j-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jec\+\_\+d} & Computational j-\/end index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em isd\+\_\+d} & Computational i-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em ied\+\_\+d} & Computational i-\/end index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jsd\+\_\+d} & Computational j-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jed\+\_\+d} & Computational j-\/end index of down sampled data \\
\hline
\end{DoxyParams}


Definition at line 4251 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{4253 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{intent(in)} :: field\_in\textcolor{comment}{ !< Original field to be down sampled}}
\DoxyCodeLine{4254 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: field\_out\textcolor{comment}{   !< Down sampled field}}
\DoxyCodeLine{4255   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: dl\textcolor{comment}{    !< Level of down sampling}}
\DoxyCodeLine{4256   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: isc\_o\textcolor{comment}{ !< Original i-\/start index}}
\DoxyCodeLine{4257   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jsc\_o\textcolor{comment}{ !< Original j-\/start index}}
\DoxyCodeLine{4258   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: isc\_d\textcolor{comment}{ !< Computational i-\/start index of down sampled data}}
\DoxyCodeLine{4259   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: iec\_d\textcolor{comment}{ !< Computational i-\/end index of down sampled data}}
\DoxyCodeLine{4260   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jsc\_d\textcolor{comment}{ !< Computational j-\/start index of down sampled data}}
\DoxyCodeLine{4261   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jec\_d\textcolor{comment}{ !< Computational j-\/end index of down sampled data}}
\DoxyCodeLine{4262   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: isd\_d\textcolor{comment}{ !< Computational i-\/start index of down sampled data}}
\DoxyCodeLine{4263   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ied\_d\textcolor{comment}{ !< Computational i-\/end index of down sampled data}}
\DoxyCodeLine{4264   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jsd\_d\textcolor{comment}{ !< Computational j-\/start index of down sampled data}}
\DoxyCodeLine{4265   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jed\_d\textcolor{comment}{ !< Computational j-\/end index of down sampled data}}
\DoxyCodeLine{4266   \textcolor{comment}{! Locals}}
\DoxyCodeLine{4267   \textcolor{keywordtype}{integer} :: i,j,ii,jj,i0,j0}
\DoxyCodeLine{4268 \textcolor{keywordtype}{  real}    :: tot\_non\_zero}
\DoxyCodeLine{4269   \textcolor{comment}{! down sampled mask = 0 unless the mask value of one of the down sampling cells is 1}}
\DoxyCodeLine{4270   \textcolor{keyword}{allocate}(field\_out(isd\_d:ied\_d,jsd\_d:jed\_d))}
\DoxyCodeLine{4271   field\_out(:,:) = 0.0}
\DoxyCodeLine{4272   \textcolor{keywordflow}{do} j=jsc\_d,jec\_d ; \textcolor{keywordflow}{do} i=isc\_d,iec\_d}
\DoxyCodeLine{4273      i0 = isc\_o+dl*(i-\/isc\_d)}
\DoxyCodeLine{4274      j0 = jsc\_o+dl*(j-\/jsc\_d)}
\DoxyCodeLine{4275      tot\_non\_zero = 0.0}
\DoxyCodeLine{4276      \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1 ; \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4277         tot\_non\_zero = tot\_non\_zero + field\_in(ii,jj)}
\DoxyCodeLine{4278      enddo;\textcolor{keywordflow}{enddo}}
\DoxyCodeLine{4279      \textcolor{keywordflow}{if}(tot\_non\_zero > 0.0) field\_out(i,j)=1.0}
\DoxyCodeLine{4280   enddo;\textcolor{keywordflow}{ enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a0b0fe5fefbf6a1e9a5b1642f5852cdb6}\label{namespacemom__diag__mediator_a0b0fe5fefbf6a1e9a5b1642f5852cdb6}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!downsample\_mask\_3d@{downsample\_mask\_3d}}
\index{downsample\_mask\_3d@{downsample\_mask\_3d}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{downsample\_mask\_3d()}{downsample\_mask\_3d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::downsample\+\_\+mask\+\_\+3d (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:,\+:), intent(in)}]{field\+\_\+in,  }\item[{real, dimension(\+:,\+:,\+:), pointer}]{field\+\_\+out,  }\item[{integer, intent(in)}]{dl,  }\item[{integer, intent(in)}]{isc\+\_\+o,  }\item[{integer, intent(in)}]{jsc\+\_\+o,  }\item[{integer, intent(in)}]{isc\+\_\+d,  }\item[{integer, intent(in)}]{iec\+\_\+d,  }\item[{integer, intent(in)}]{jsc\+\_\+d,  }\item[{integer, intent(in)}]{jec\+\_\+d,  }\item[{integer, intent(in)}]{isd\+\_\+d,  }\item[{integer, intent(in)}]{ied\+\_\+d,  }\item[{integer, intent(in)}]{jsd\+\_\+d,  }\item[{integer, intent(in)}]{jed\+\_\+d }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocate and compute the 3d down sampled mask The masks are down sampled based on a minority rule, i.\+e., a coarse cell is open (1) if at least one of the sub-\/cells are open, otherwise it\textquotesingle{}s closed (0) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em field\+\_\+in} & Original field to be down sampled \\
\hline
 & {\em field\+\_\+out} & down sampled field \\
\hline
\mbox{\texttt{ in}}  & {\em dl} & Level of down sampling \\
\hline
\mbox{\texttt{ in}}  & {\em isc\+\_\+o} & Original i-\/start index \\
\hline
\mbox{\texttt{ in}}  & {\em jsc\+\_\+o} & Original j-\/start index \\
\hline
\mbox{\texttt{ in}}  & {\em isc\+\_\+d} & Computational i-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em iec\+\_\+d} & Computational i-\/end index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jsc\+\_\+d} & Computational j-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jec\+\_\+d} & Computational j-\/end index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em isd\+\_\+d} & Computational i-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em ied\+\_\+d} & Computational i-\/end index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jsd\+\_\+d} & Computational j-\/start index of down sampled data \\
\hline
\mbox{\texttt{ in}}  & {\em jed\+\_\+d} & Computational j-\/end index of down sampled data \\
\hline
\end{DoxyParams}


Definition at line 4286 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{4288 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{intent(in)} :: field\_in\textcolor{comment}{ !< Original field to be down sampled}}
\DoxyCodeLine{4289 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: field\_out\textcolor{comment}{   !< down sampled field}}
\DoxyCodeLine{4290   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: dl\textcolor{comment}{    !< Level of down sampling}}
\DoxyCodeLine{4291   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: isc\_o\textcolor{comment}{ !< Original i-\/start index}}
\DoxyCodeLine{4292   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jsc\_o\textcolor{comment}{ !< Original j-\/start index}}
\DoxyCodeLine{4293   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: isc\_d\textcolor{comment}{ !< Computational i-\/start index of down sampled data}}
\DoxyCodeLine{4294   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: iec\_d\textcolor{comment}{ !< Computational i-\/end index of down sampled data}}
\DoxyCodeLine{4295   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jsc\_d\textcolor{comment}{ !< Computational j-\/start index of down sampled data}}
\DoxyCodeLine{4296   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jec\_d\textcolor{comment}{ !< Computational j-\/end index of down sampled data}}
\DoxyCodeLine{4297   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: isd\_d\textcolor{comment}{ !< Computational i-\/start index of down sampled data}}
\DoxyCodeLine{4298   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: ied\_d\textcolor{comment}{ !< Computational i-\/end index of down sampled data}}
\DoxyCodeLine{4299   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jsd\_d\textcolor{comment}{ !< Computational j-\/start index of down sampled data}}
\DoxyCodeLine{4300   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: jed\_d\textcolor{comment}{ !< Computational j-\/end index of down sampled data}}
\DoxyCodeLine{4301   \textcolor{comment}{! Locals}}
\DoxyCodeLine{4302   \textcolor{keywordtype}{integer} :: i,j,ii,jj,i0,j0,k,ks,ke}
\DoxyCodeLine{4303 \textcolor{keywordtype}{  real}    :: tot\_non\_zero}
\DoxyCodeLine{4304   \textcolor{comment}{! down sampled mask = 0 unless the mask value of one of the down sampling cells is 1}}
\DoxyCodeLine{4305   ks = lbound(field\_in,3) ; ke = ubound(field\_in,3)}
\DoxyCodeLine{4306   \textcolor{keyword}{allocate}(field\_out(isd\_d:ied\_d,jsd\_d:jed\_d,ks:ke))}
\DoxyCodeLine{4307   field\_out(:,:,:) = 0.0}
\DoxyCodeLine{4308   \textcolor{keywordflow}{do} k= ks,ke ; \textcolor{keywordflow}{do} j=jsc\_d,jec\_d ; \textcolor{keywordflow}{do} i=isc\_d,iec\_d}
\DoxyCodeLine{4309      i0 = isc\_o+dl*(i-\/isc\_d)}
\DoxyCodeLine{4310      j0 = jsc\_o+dl*(j-\/jsc\_d)}
\DoxyCodeLine{4311      tot\_non\_zero = 0.0}
\DoxyCodeLine{4312      \textcolor{keywordflow}{do} jj=j0,j0+dl-\/1 ; \textcolor{keywordflow}{do} ii=i0,i0+dl-\/1}
\DoxyCodeLine{4313         tot\_non\_zero = tot\_non\_zero + field\_in(ii,jj,k)}
\DoxyCodeLine{4314      enddo;\textcolor{keywordflow}{enddo}}
\DoxyCodeLine{4315      \textcolor{keywordflow}{if}(tot\_non\_zero > 0.0) field\_out(i,j,k)=1.0}
\DoxyCodeLine{4316   enddo; enddo;\textcolor{keywordflow}{ enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ada4d9d69fb0d79a0fe20a307eaf1ca9c}\label{namespacemom__diag__mediator_ada4d9d69fb0d79a0fe20a307eaf1ca9c}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!enable\_averages@{enable\_averages}}
\index{enable\_averages@{enable\_averages}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{enable\_averages()}{enable\_averages()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::enable\+\_\+averages (\begin{DoxyParamCaption}\item[{real, intent(in)}]{time\+\_\+int,  }\item[{type(time\+\_\+type), intent(in)}]{time\+\_\+end,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+\+CS,  }\item[{real, intent(in), optional}]{T\+\_\+to\+\_\+s }\end{DoxyParamCaption})}



Enable the accumulation of time averages over the specified time interval in time units. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em time\+\_\+int} & The time interval over which any values that are offered are valid \mbox{[}T $\sim$$>$ s\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em time\+\_\+end} & The end time of the valid interval. \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & A structure that is used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em t\+\_\+to\+\_\+s} & A conversion factor for time\+\_\+int to \mbox{[}s\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 1885 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1886 \textcolor{keywordtype}{  real},            \textcolor{keywordtype}{intent(in)}    :: time\_int\textcolor{comment}{ !< The time interval over which any values}}
\DoxyCodeLine{1887 \textcolor{comment}{                                             !! that are offered are valid [T \string~> s].}}
\DoxyCodeLine{1888   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{intent(in)}    :: time\_end\textcolor{comment}{ !< The end time of the valid interval.}}
\DoxyCodeLine{1889   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{intent(inout)} :: diag\_CS\textcolor{comment}{  !< A structure that is used to regulate diagnostic output}}
\DoxyCodeLine{1890 \textcolor{keywordtype}{  real},  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: T\_to\_s\textcolor{comment}{   !< A conversion factor for time\_int to [s].}}
\DoxyCodeLine{1891 \textcolor{comment}{! This subroutine enables the accumulation of time averages over the specified time interval.}}
\DoxyCodeLine{1892 }
\DoxyCodeLine{1893   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(t\_to\_s)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1894     diag\_cs\%time\_int = time\_int*t\_to\_s}
\DoxyCodeLine{1895   \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(diag\_cs\%US)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1896     diag\_cs\%time\_int = time\_int*diag\_cs\%US\%T\_to\_s}
\DoxyCodeLine{1897   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1898     diag\_cs\%time\_int = time\_int}
\DoxyCodeLine{1899 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1900   diag\_cs\%time\_end = time\_end}
\DoxyCodeLine{1901   diag\_cs\%ave\_enabled = .true.}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a91244f765f2964dfb11f8787f65042f1}\label{namespacemom__diag__mediator_a91244f765f2964dfb11f8787f65042f1}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!enable\_averaging@{enable\_averaging}}
\index{enable\_averaging@{enable\_averaging}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{enable\_averaging()}{enable\_averaging()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::enable\+\_\+averaging (\begin{DoxyParamCaption}\item[{real, intent(in)}]{time\+\_\+int\+\_\+in,  }\item[{type(time\+\_\+type), intent(in)}]{time\+\_\+end\+\_\+in,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs }\end{DoxyParamCaption})}



This subroutine enables the accumulation of time averages over the specified time interval. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em time\+\_\+int\+\_\+in} & The time interval \mbox{[}s\mbox{]} over which any values that are offered are valid. \\
\hline
\mbox{\texttt{ in}}  & {\em time\+\_\+end\+\_\+in} & The end time of the valid interval \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\end{DoxyParams}


Definition at line 1870 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1871 \textcolor{keywordtype}{  real},            \textcolor{keywordtype}{intent(in)}    :: time\_int\_in\textcolor{comment}{ !< The time interval [s] over which any}}
\DoxyCodeLine{1872 \textcolor{comment}{                                                !!  values that are offered are valid.}}
\DoxyCodeLine{1873   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{intent(in)}    :: time\_end\_in\textcolor{comment}{ !< The end time of the valid interval}}
\DoxyCodeLine{1874   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{intent(inout)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1875 }
\DoxyCodeLine{1876 \textcolor{comment}{! This subroutine enables the accumulation of time averages over the specified time interval.}}
\DoxyCodeLine{1877 }
\DoxyCodeLine{1878 \textcolor{comment}{!  if (num\_file==0) return}}
\DoxyCodeLine{1879   diag\_cs\%time\_int = time\_int\_in}
\DoxyCodeLine{1880   diag\_cs\%time\_end = time\_end\_in}
\DoxyCodeLine{1881   diag\_cs\%ave\_enabled = .true.}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a76e845bc64dfd5116f41fe90922b7937}\label{namespacemom__diag__mediator_a76e845bc64dfd5116f41fe90922b7937}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!get\_diag\_time\_end@{get\_diag\_time\_end}}
\index{get\_diag\_time\_end@{get\_diag\_time\_end}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{get\_diag\_time\_end()}{get\_diag\_time\_end()}}
{\footnotesize\ttfamily type(time\+\_\+type) function, public mom\+\_\+diag\+\_\+mediator\+::get\+\_\+diag\+\_\+time\+\_\+end (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs }\end{DoxyParamCaption})}



This function returns the valid end time for use with diagnostics that are handled outside of the M\+O\+M6 diagnostics infrastructure. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\end{DoxyParams}


Definition at line 1928 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1929   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{intent(in)}  :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1930   \textcolor{keywordtype}{type}(time\_type) :: get\_diag\_time\_end}
\DoxyCodeLine{1931   \textcolor{comment}{!   This function returns the valid end time for diagnostics that are handled}}
\DoxyCodeLine{1932   \textcolor{comment}{! outside of the MOM6 infrastructure, such as via the generic tracer code.}}
\DoxyCodeLine{1933 }
\DoxyCodeLine{1934   get\_diag\_time\_end = diag\_cs\%time\_end}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a3f7442639213320f7429e2288a79fda2}\label{namespacemom__diag__mediator_a3f7442639213320f7429e2288a79fda2}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!get\_new\_diag\_id@{get\_new\_diag\_id}}
\index{get\_new\_diag\_id@{get\_new\_diag\_id}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{get\_new\_diag\_id()}{get\_new\_diag\_id()}}
{\footnotesize\ttfamily integer function mom\+\_\+diag\+\_\+mediator\+::get\+\_\+new\+\_\+diag\+\_\+id (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Returns a new diagnostic id, it may be necessary to expand the diagnostics array. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Diagnostics control structure \\
\hline
\end{DoxyParams}


Definition at line 3478 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3479   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{intent(inout)} :: diag\_cs\textcolor{comment}{ !< Diagnostics control structure}}
\DoxyCodeLine{3480   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{3481   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{allocatable} :: tmp}
\DoxyCodeLine{3482   \textcolor{keywordtype}{integer} :: i}
\DoxyCodeLine{3483 }
\DoxyCodeLine{3484   \textcolor{keywordflow}{if} (diag\_cs\%next\_free\_diag\_id > \textcolor{keyword}{size}(diag\_cs\%diags)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3485     \textcolor{keyword}{call }assert(diag\_cs\%next\_free\_diag\_id -\/ \textcolor{keyword}{size}(diag\_cs\%diags) == 1, \&}
\DoxyCodeLine{3486                 \textcolor{stringliteral}{'get\_new\_diag\_id: inconsistent diag id'})}
\DoxyCodeLine{3487 }
\DoxyCodeLine{3488     \textcolor{comment}{! Increase the size of diag\_cs\%diags and copy data over.}}
\DoxyCodeLine{3489     \textcolor{comment}{! Do not use move\_alloc() because it is not supported by Fortran 90}}
\DoxyCodeLine{3490     \textcolor{keyword}{allocate}(tmp(\textcolor{keyword}{size}(diag\_cs\%diags)))}
\DoxyCodeLine{3491     tmp(:) = diag\_cs\%diags(:)}
\DoxyCodeLine{3492     \textcolor{keyword}{deallocate}(diag\_cs\%diags)}
\DoxyCodeLine{3493     \textcolor{keyword}{allocate}(diag\_cs\%diags(\textcolor{keyword}{size}(tmp) + diag\_alloc\_chunk\_size))}
\DoxyCodeLine{3494     diag\_cs\%diags(1:\textcolor{keyword}{size}(tmp)) = tmp(:)}
\DoxyCodeLine{3495     \textcolor{keyword}{deallocate}(tmp)}
\DoxyCodeLine{3496 }
\DoxyCodeLine{3497     \textcolor{comment}{! Initialize new part of the diag array.}}
\DoxyCodeLine{3498     \textcolor{keywordflow}{do} i=diag\_cs\%next\_free\_diag\_id, \textcolor{keyword}{size}(diag\_cs\%diags)}
\DoxyCodeLine{3499       \textcolor{keyword}{call }initialize\_diag\_type(diag\_cs\%diags(i))}
\DoxyCodeLine{3500 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{3501 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3502 }
\DoxyCodeLine{3503   get\_new\_diag\_id = diag\_cs\%next\_free\_diag\_id}
\DoxyCodeLine{3504   diag\_cs\%next\_free\_diag\_id = diag\_cs\%next\_free\_diag\_id + 1}
\DoxyCodeLine{3505 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a82d9bb70db16b1113304936c82d40e82}\label{namespacemom__diag__mediator_a82d9bb70db16b1113304936c82d40e82}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!i2s@{i2s}}
\index{i2s@{i2s}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{i2s()}{i2s()}}
{\footnotesize\ttfamily character(len=15) function mom\+\_\+diag\+\_\+mediator\+::i2s (\begin{DoxyParamCaption}\item[{integer, dimension(\+:), intent(in)}]{a,  }\item[{integer, intent(in), optional}]{n\+\_\+in }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Convert the first n elements (up to 3) of an integer array to an underscore delimited string. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em a} & The array of integers to translate \\
\hline
\mbox{\texttt{ in}}  & {\em n\+\_\+in} & The number of elements to translate, by default all \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The returned string 
\end{DoxyReturn}


Definition at line 3456 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3457   \textcolor{comment}{! "Convert the first n elements of an integer array to a string."}}
\DoxyCodeLine{3458   \textcolor{comment}{! Perhaps this belongs elsewhere in the MOM6 code?}}
\DoxyCodeLine{3459   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)} :: a\textcolor{comment}{    !< The array of integers to translate}}
\DoxyCodeLine{3460   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional}    , \textcolor{keywordtype}{intent(in)} :: n\_in\textcolor{comment}{ !< The number of elements to translate, by default all}}
\DoxyCodeLine{3461   \textcolor{keywordtype}{character(len=15)} :: i2s\textcolor{comment}{ !< The returned string}}
\DoxyCodeLine{3462 }
\DoxyCodeLine{3463   \textcolor{keywordtype}{character(len=15)} :: i2s\_temp}
\DoxyCodeLine{3464   \textcolor{keywordtype}{integer} :: i,n}
\DoxyCodeLine{3465 }
\DoxyCodeLine{3466   n=\textcolor{keyword}{size}(a)}
\DoxyCodeLine{3467   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(n\_in)) n = n\_in}
\DoxyCodeLine{3468 }
\DoxyCodeLine{3469   i2s = \textcolor{stringliteral}{''}}
\DoxyCodeLine{3470   \textcolor{keywordflow}{do} i=1,min(n,3)}
\DoxyCodeLine{3471     \textcolor{keyword}{write} (i2s\_temp, \textcolor{stringliteral}{'(I4.4)'}) a(i)}
\DoxyCodeLine{3472     i2s = trim(i2s) //\textcolor{stringliteral}{'\_'}// trim(i2s\_temp)}
\DoxyCodeLine{3473 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{3474   i2s = adjustl(i2s)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a883862f004e30bbc5211f38635511ba0}\label{namespacemom__diag__mediator_a883862f004e30bbc5211f38635511ba0}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!initialize\_diag\_type@{initialize\_diag\_type}}
\index{initialize\_diag\_type@{initialize\_diag\_type}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{initialize\_diag\_type()}{initialize\_diag\_type()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::initialize\+\_\+diag\+\_\+type (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), intent(inout)}]{diag }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Initializes a \mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}} (used after allocating new memory) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em diag} & \mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}} to be initialized \\
\hline
\end{DoxyParams}


Definition at line 3509 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3510   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{ !< diag\_type to be initialized}}
\DoxyCodeLine{3511 }
\DoxyCodeLine{3512   diag\%in\_use = .false.}
\DoxyCodeLine{3513   diag\%fms\_diag\_id = -\/1}
\DoxyCodeLine{3514   diag\%axes => null()}
\DoxyCodeLine{3515   diag\%next => null()}
\DoxyCodeLine{3516   diag\%conversion\_factor = 0.}
\DoxyCodeLine{3517 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a65fe8d329cf5dbfd08c98874a7a64407}\label{namespacemom__diag__mediator_a65fe8d329cf5dbfd08c98874a7a64407}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!log\_available\_diag@{log\_available\_diag}}
\index{log\_available\_diag@{log\_available\_diag}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{log\_available\_diag()}{log\_available\_diag()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::log\+\_\+available\+\_\+diag (\begin{DoxyParamCaption}\item[{logical, intent(in)}]{used,  }\item[{character(len=$\ast$), intent(in)}]{module\+\_\+name,  }\item[{character(len=$\ast$), intent(in)}]{field\+\_\+name,  }\item[{character(len=$\ast$), intent(in)}]{cell\+\_\+methods\+\_\+string,  }\item[{character(len=$\ast$), intent(in)}]{comment,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+\+CS,  }\item[{character(len=$\ast$), intent(in), optional}]{long\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{character(len=$\ast$), intent(in), optional}]{standard\+\_\+name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Log a diagnostic to the available diagnostics file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em used} & Whether this diagnostic was in the diag\+\_\+table or not \\
\hline
\mbox{\texttt{ in}}  & {\em module\+\_\+name} & Name of the diagnostic module \\
\hline
\mbox{\texttt{ in}}  & {\em field\+\_\+name} & Name of this diagnostic field \\
\hline
\mbox{\texttt{ in}}  & {\em cell\+\_\+methods\+\_\+string} & The spatial component of the CF cell\+\_\+methods attribute \\
\hline
\mbox{\texttt{ in}}  & {\em comment} & A comment to append after \mbox{[}Used$\vert$\+Unused\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & The diagnotics control structure \\
\hline
\mbox{\texttt{ in}}  & {\em long\+\_\+name} & CF long name of diagnostic \\
\hline
\mbox{\texttt{ in}}  & {\em units} & Units for diagnostic \\
\hline
\mbox{\texttt{ in}}  & {\em standard\+\_\+name} & CF standardized name of diagnostic \\
\hline
\end{DoxyParams}


Definition at line 3542 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3544   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{intent(in)} :: used\textcolor{comment}{ !< Whether this diagnostic was in the diag\_table or not}}
\DoxyCodeLine{3545   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: module\_name\textcolor{comment}{ !< Name of the diagnostic module}}
\DoxyCodeLine{3546   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: field\_name\textcolor{comment}{ !< Name of this diagnostic field}}
\DoxyCodeLine{3547   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: cell\_methods\_string\textcolor{comment}{ !< The spatial component of the CF cell\_methods attribute}}
\DoxyCodeLine{3548   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: comment\textcolor{comment}{ !< A comment to append after [Used|Unused]}}
\DoxyCodeLine{3549   \textcolor{keywordtype}{type}(diag\_ctrl),  \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{  !< The diagnotics control structure}}
\DoxyCodeLine{3550   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: long\_name\textcolor{comment}{ !< CF long name of diagnostic}}
\DoxyCodeLine{3551   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{ !< Units for diagnostic}}
\DoxyCodeLine{3552   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: standard\_name\textcolor{comment}{ !< CF standardized name of diagnostic}}
\DoxyCodeLine{3553   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{3554   \textcolor{keywordtype}{character(len=240)} :: mesg}
\DoxyCodeLine{3555 }
\DoxyCodeLine{3556   \textcolor{keywordflow}{if} (used) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3557     mesg = \textcolor{stringliteral}{'"'}//trim(module\_name)//\textcolor{stringliteral}{'", "'}//trim(field\_name)//\textcolor{stringliteral}{'"  [Used]'}}
\DoxyCodeLine{3558   \textcolor{keywordflow}{else}}
\DoxyCodeLine{3559     mesg = \textcolor{stringliteral}{'"'}//trim(module\_name)//\textcolor{stringliteral}{'", "'}//trim(field\_name)//\textcolor{stringliteral}{'"  [Unused]'}}
\DoxyCodeLine{3560 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3561   \textcolor{keywordflow}{if} (len(trim((comment)))>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3562     \textcolor{keyword}{write}(diag\_cs\%available\_diag\_doc\_unit, \textcolor{stringliteral}{'(a,x,"(",a,")")'}) trim(mesg),trim(comment)}
\DoxyCodeLine{3563   \textcolor{keywordflow}{else}}
\DoxyCodeLine{3564     \textcolor{keyword}{write}(diag\_cs\%available\_diag\_doc\_unit, \textcolor{stringliteral}{'(a)'}) trim(mesg)}
\DoxyCodeLine{3565 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3566   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(long\_name)) \textcolor{keyword}{call }describe\_option(\textcolor{stringliteral}{"long\_name"}, long\_name, diag\_cs)}
\DoxyCodeLine{3567   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(units)) \textcolor{keyword}{call }describe\_option(\textcolor{stringliteral}{"units"}, units, diag\_cs)}
\DoxyCodeLine{3568   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(standard\_name)) \&}
\DoxyCodeLine{3569     \textcolor{keyword}{call }describe\_option(\textcolor{stringliteral}{"standard\_name"}, standard\_name, diag\_cs)}
\DoxyCodeLine{3570   \textcolor{keywordflow}{if} (len(trim((cell\_methods\_string)))>0) \&}
\DoxyCodeLine{3571     \textcolor{keyword}{call }describe\_option(\textcolor{stringliteral}{"cell\_methods"}, trim(cell\_methods\_string), diag\_cs)}
\DoxyCodeLine{3572 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_af410974feba66bf49817eccb7d1b6426}\label{namespacemom__diag__mediator_af410974feba66bf49817eccb7d1b6426}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!log\_chksum\_diag@{log\_chksum\_diag}}
\index{log\_chksum\_diag@{log\_chksum\_diag}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{log\_chksum\_diag()}{log\_chksum\_diag()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::log\+\_\+chksum\+\_\+diag (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{docunit,  }\item[{character(len=$\ast$), intent(in)}]{description,  }\item[{integer, intent(in)}]{chksum }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Log the diagnostic chksum to the chksum diag file. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em docunit} & Handle of the log file \\
\hline
\mbox{\texttt{ in}}  & {\em description} & Name of the diagnostic module \\
\hline
\mbox{\texttt{ in}}  & {\em chksum} & chksum of the diagnostic \\
\hline
\end{DoxyParams}


Definition at line 3576 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3577   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{intent(in)} :: docunit\textcolor{comment}{     !< Handle of the log file}}
\DoxyCodeLine{3578   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: description\textcolor{comment}{ !< Name of the diagnostic module}}
\DoxyCodeLine{3579   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{intent(in)} :: chksum\textcolor{comment}{      !< chksum of the diagnostic}}
\DoxyCodeLine{3580 }
\DoxyCodeLine{3581   \textcolor{keyword}{write}(docunit, \textcolor{stringliteral}{'(a,x,i9.8)'}) description, chksum}
\DoxyCodeLine{3582   \textcolor{keyword}{flush}(docunit)}
\DoxyCodeLine{3583 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a21267e25d12fa3e5d2540d2a299d2d2c}\label{namespacemom__diag__mediator_a21267e25d12fa3e5d2540d2a299d2d2c}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!ocean\_register\_diag@{ocean\_register\_diag}}
\index{ocean\_register\_diag@{ocean\_register\_diag}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{ocean\_register\_diag()}{ocean\_register\_diag()}}
{\footnotesize\ttfamily integer function, public mom\+\_\+diag\+\_\+mediator\+::ocean\+\_\+register\+\_\+diag (\begin{DoxyParamCaption}\item[{type(vardesc), intent(in)}]{var\+\_\+desc,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in), target}]{diag\+\_\+\+CS,  }\item[{type(time\+\_\+type), intent(in)}]{day }\end{DoxyParamCaption})}



Registers a diagnostic using the information encapsulated in the vardesc type argument and returns an integer handle to this diagostic. That integer handle is negative if the diagnostic is unused. 

\begin{DoxyReturn}{Returns}
An integer handle to this diagnostic. 
\end{DoxyReturn}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em var\+\_\+desc} & The vardesc type describing the diagnostic \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid type \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & The diagnotic control structure \\
\hline
\mbox{\texttt{ in}}  & {\em day} & The current model time \\
\hline
\end{DoxyParams}


Definition at line 2925 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2926   \textcolor{keywordtype}{integer} :: ocean\_register\_diag\textcolor{comment}{  !< An integer handle to this diagnostic.}}
\DoxyCodeLine{2927   \textcolor{keywordtype}{type}(vardesc),         \textcolor{keywordtype}{intent(in)} :: var\_desc\textcolor{comment}{ !< The vardesc type describing the diagnostic}}
\DoxyCodeLine{2928   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{        !< The ocean's grid type}}
\DoxyCodeLine{2929   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{target} :: diag\_CS\textcolor{comment}{  !< The diagnotic control structure}}
\DoxyCodeLine{2930   \textcolor{keywordtype}{type}(time\_type),       \textcolor{keywordtype}{intent(in)} :: day\textcolor{comment}{      !< The current model time}}
\DoxyCodeLine{2931 }
\DoxyCodeLine{2932   \textcolor{keywordtype}{character(len=64)} :: var\_name         \textcolor{comment}{! A variable's name.}}
\DoxyCodeLine{2933   \textcolor{keywordtype}{character(len=48)} :: units            \textcolor{comment}{! A variable's units.}}
\DoxyCodeLine{2934   \textcolor{keywordtype}{character(len=240)} :: longname        \textcolor{comment}{! A variable's longname.}}
\DoxyCodeLine{2935   \textcolor{keywordtype}{character(len=8)} :: hor\_grid, z\_grid  \textcolor{comment}{! Variable grid info.}}
\DoxyCodeLine{2936   \textcolor{keywordtype}{type}(axes\_grp), \textcolor{keywordtype}{pointer} :: axes => null()}
\DoxyCodeLine{2937 }
\DoxyCodeLine{2938   \textcolor{keyword}{call }query\_vardesc(var\_desc, units=units, longname=longname, hor\_grid=hor\_grid, \&}
\DoxyCodeLine{2939                      z\_grid=z\_grid, caller=\textcolor{stringliteral}{"ocean\_register\_diag"})}
\DoxyCodeLine{2940 }
\DoxyCodeLine{2941   \textcolor{comment}{! Use the hor\_grid and z\_grid components of vardesc to determine the}}
\DoxyCodeLine{2942   \textcolor{comment}{! desired axes to register the diagnostic field for.}}
\DoxyCodeLine{2943   \textcolor{keywordflow}{select case} (z\_grid)}
\DoxyCodeLine{2944 }
\DoxyCodeLine{2945     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"L"})}
\DoxyCodeLine{2946       \textcolor{keywordflow}{select case} (hor\_grid)}
\DoxyCodeLine{2947         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"q"})}
\DoxyCodeLine{2948           axes => diag\_cs\%axesBL}
\DoxyCodeLine{2949         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"h"})}
\DoxyCodeLine{2950           axes => diag\_cs\%axesTL}
\DoxyCodeLine{2951         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"u"})}
\DoxyCodeLine{2952           axes => diag\_cs\%axesCuL}
\DoxyCodeLine{2953         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"v"})}
\DoxyCodeLine{2954           axes => diag\_cs\%axesCvL}
\DoxyCodeLine{2955         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"Bu"})}
\DoxyCodeLine{2956           axes => diag\_cs\%axesBL}
\DoxyCodeLine{2957         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"T"})}
\DoxyCodeLine{2958           axes => diag\_cs\%axesTL}
\DoxyCodeLine{2959         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"Cu"})}
\DoxyCodeLine{2960           axes => diag\_cs\%axesCuL}
\DoxyCodeLine{2961         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"Cv"})}
\DoxyCodeLine{2962           axes => diag\_cs\%axesCvL}
\DoxyCodeLine{2963         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"z"})}
\DoxyCodeLine{2964           axes => diag\_cs\%axeszL}
\DoxyCodeLine{2965 \textcolor{keywordflow}{        case default}}
\DoxyCodeLine{2966           \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"ocean\_register\_diag: "} // \&}
\DoxyCodeLine{2967               \textcolor{stringliteral}{"unknown hor\_grid component "}//trim(hor\_grid))}
\DoxyCodeLine{2968 \textcolor{keywordflow}{      end select}}
\DoxyCodeLine{2969 }
\DoxyCodeLine{2970     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"i"})}
\DoxyCodeLine{2971       \textcolor{keywordflow}{select case} (hor\_grid)}
\DoxyCodeLine{2972         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"q"})}
\DoxyCodeLine{2973           axes => diag\_cs\%axesBi}
\DoxyCodeLine{2974         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"h"})}
\DoxyCodeLine{2975           axes => diag\_cs\%axesTi}
\DoxyCodeLine{2976         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"u"})}
\DoxyCodeLine{2977           axes => diag\_cs\%axesCui}
\DoxyCodeLine{2978         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"v"})}
\DoxyCodeLine{2979           axes => diag\_cs\%axesCvi}
\DoxyCodeLine{2980         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"Bu"})}
\DoxyCodeLine{2981           axes => diag\_cs\%axesBi}
\DoxyCodeLine{2982         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"T"})}
\DoxyCodeLine{2983           axes => diag\_cs\%axesTi}
\DoxyCodeLine{2984         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"Cu"})}
\DoxyCodeLine{2985           axes => diag\_cs\%axesCui}
\DoxyCodeLine{2986         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"Cv"})}
\DoxyCodeLine{2987           axes => diag\_cs\%axesCvi}
\DoxyCodeLine{2988         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"z"})}
\DoxyCodeLine{2989           axes => diag\_cs\%axeszi}
\DoxyCodeLine{2990 \textcolor{keywordflow}{        case default}}
\DoxyCodeLine{2991           \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"ocean\_register\_diag: "} // \&}
\DoxyCodeLine{2992             \textcolor{stringliteral}{"unknown hor\_grid component "}//trim(hor\_grid))}
\DoxyCodeLine{2993 \textcolor{keywordflow}{      end select}}
\DoxyCodeLine{2994 }
\DoxyCodeLine{2995     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"1"})}
\DoxyCodeLine{2996       \textcolor{keywordflow}{select case} (hor\_grid)}
\DoxyCodeLine{2997         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"q"})}
\DoxyCodeLine{2998           axes => diag\_cs\%axesB1}
\DoxyCodeLine{2999         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"h"})}
\DoxyCodeLine{3000           axes => diag\_cs\%axesT1}
\DoxyCodeLine{3001         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"u"})}
\DoxyCodeLine{3002           axes => diag\_cs\%axesCu1}
\DoxyCodeLine{3003         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"v"})}
\DoxyCodeLine{3004           axes => diag\_cs\%axesCv1}
\DoxyCodeLine{3005         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"Bu"})}
\DoxyCodeLine{3006           axes => diag\_cs\%axesB1}
\DoxyCodeLine{3007         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"T"})}
\DoxyCodeLine{3008           axes => diag\_cs\%axesT1}
\DoxyCodeLine{3009         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"Cu"})}
\DoxyCodeLine{3010           axes => diag\_cs\%axesCu1}
\DoxyCodeLine{3011         \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"Cv"})}
\DoxyCodeLine{3012           axes => diag\_cs\%axesCv1}
\DoxyCodeLine{3013 \textcolor{keywordflow}{        case default}}
\DoxyCodeLine{3014           \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"ocean\_register\_diag: "} // \&}
\DoxyCodeLine{3015             \textcolor{stringliteral}{"unknown hor\_grid component "}//trim(hor\_grid))}
\DoxyCodeLine{3016 \textcolor{keywordflow}{      end select}}
\DoxyCodeLine{3017 }
\DoxyCodeLine{3018 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{3019       \textcolor{keyword}{call }mom\_error(fatal,\&}
\DoxyCodeLine{3020         \textcolor{stringliteral}{"ocean\_register\_diag: unknown z\_grid component "}//trim(z\_grid))}
\DoxyCodeLine{3021 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{3022 }
\DoxyCodeLine{3023   ocean\_register\_diag = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, trim(var\_name), \&}
\DoxyCodeLine{3024           axes, day, trim(longname), trim(units), missing\_value=-\/1.0e+34)}
\DoxyCodeLine{3025 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ab98d892c30de2ee865416e519eacfd79}\label{namespacemom__diag__mediator_ab98d892c30de2ee865416e519eacfd79}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!post\_data\_0d@{post\_data\_0d}}
\index{post\_data\_0d@{post\_data\_0d}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{post\_data\_0d()}{post\_data\_0d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::post\+\_\+data\+\_\+0d (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{diag\+\_\+field\+\_\+id,  }\item[{real, intent(in)}]{field,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in), target}]{diag\+\_\+cs,  }\item[{logical, intent(in), optional}]{is\+\_\+static }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Make a real scalar diagnostic available for averaging or output. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag\+\_\+field\+\_\+id} & The id for an output variable returned by a previous call to register\+\_\+diag\+\_\+field. \\
\hline
\mbox{\texttt{ in}}  & {\em field} & real value being offered for output or averaging \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+static} & If true, this is a static field that is always offered. \\
\hline
\end{DoxyParams}


Definition at line 1256 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1257   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)} :: diag\_field\_id\textcolor{comment}{ !< The id for an output variable returned by a}}
\DoxyCodeLine{1258 \textcolor{comment}{                                                 !! previous call to register\_diag\_field.}}
\DoxyCodeLine{1259 \textcolor{keywordtype}{  real},              \textcolor{keywordtype}{intent(in)} :: field\textcolor{comment}{         !< real value being offered for output or averaging}}
\DoxyCodeLine{1260   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1261   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: is\_static\textcolor{comment}{ !< If true, this is a static field that is always offered.}}
\DoxyCodeLine{1262 }
\DoxyCodeLine{1263   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1264 \textcolor{keywordtype}{  real} :: locfield}
\DoxyCodeLine{1265   \textcolor{keywordtype}{logical} :: used, is\_stat}
\DoxyCodeLine{1266   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{pointer} :: diag => null()}
\DoxyCodeLine{1267 }
\DoxyCodeLine{1268   \textcolor{keywordflow}{if} (id\_clock\_diag\_mediator>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_mediator)}
\DoxyCodeLine{1269   is\_stat = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_static)) is\_stat = is\_static}
\DoxyCodeLine{1270 }
\DoxyCodeLine{1271   \textcolor{comment}{! Iterate over list of diag 'variants', e.g. CMOR aliases, call send\_data}}
\DoxyCodeLine{1272   \textcolor{comment}{! for each one.}}
\DoxyCodeLine{1273   \textcolor{keyword}{call }assert(diag\_field\_id < diag\_cs\%next\_free\_diag\_id, \&}
\DoxyCodeLine{1274               \textcolor{stringliteral}{'post\_data\_0d: Unregistered diagnostic id'})}
\DoxyCodeLine{1275   diag => diag\_cs\%diags(diag\_field\_id)}
\DoxyCodeLine{1276 }
\DoxyCodeLine{1277   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (\textcolor{keyword}{associated}(diag))}
\DoxyCodeLine{1278     locfield = field}
\DoxyCodeLine{1279     \textcolor{keywordflow}{if} (diag\%conversion\_factor /= 0.) \&}
\DoxyCodeLine{1280       locfield = locfield * diag\%conversion\_factor}
\DoxyCodeLine{1281 }
\DoxyCodeLine{1282     \textcolor{keywordflow}{if} (diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1283       \textcolor{keyword}{call }chksum0(locfield, diag\%debug\_str, logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1284     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (is\_stat) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1285       used = send\_data(diag\%fms\_diag\_id, locfield)}
\DoxyCodeLine{1286     \textcolor{keywordflow}{elseif} (diag\_cs\%ave\_enabled) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1287       used = send\_data(diag\%fms\_diag\_id, locfield, diag\_cs\%time\_end)}
\DoxyCodeLine{1288 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1289     diag => diag\%next}
\DoxyCodeLine{1290 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{1291 }
\DoxyCodeLine{1292   \textcolor{keywordflow}{if} (id\_clock\_diag\_mediator>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_mediator)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ab5b75b68fa1742ce312c371f4b2c6ac1}\label{namespacemom__diag__mediator_ab5b75b68fa1742ce312c371f4b2c6ac1}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!post\_data\_1d\_k@{post\_data\_1d\_k}}
\index{post\_data\_1d\_k@{post\_data\_1d\_k}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{post\_data\_1d\_k()}{post\_data\_1d\_k()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::post\+\_\+data\+\_\+1d\+\_\+k (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{diag\+\_\+field\+\_\+id,  }\item[{real, dimension(\+:), intent(in), target}]{field,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in), target}]{diag\+\_\+cs,  }\item[{logical, intent(in), optional}]{is\+\_\+static }\end{DoxyParamCaption})}



Make a real 1-\/d array diagnostic available for averaging or output. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag\+\_\+field\+\_\+id} & The id for an output variable returned by a previous call to register\+\_\+diag\+\_\+field. \\
\hline
\mbox{\texttt{ in}}  & {\em field} & 1-\/d array being offered for output or averaging \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+static} & If true, this is a static field that is always offered. \\
\hline
\end{DoxyParams}


Definition at line 1296 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1297   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)} :: diag\_field\_id\textcolor{comment}{ !< The id for an output variable returned by a}}
\DoxyCodeLine{1298 \textcolor{comment}{                                                 !! previous call to register\_diag\_field.}}
\DoxyCodeLine{1299 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{target},      \textcolor{keywordtype}{intent(in)} :: field(:)\textcolor{comment}{      !< 1-\/d array being offered for output or averaging}}
\DoxyCodeLine{1300   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1301   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: is\_static\textcolor{comment}{ !< If true, this is a static field that is always offered.}}
\DoxyCodeLine{1302 }
\DoxyCodeLine{1303   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1304   \textcolor{keywordtype}{logical} :: used  \textcolor{comment}{! The return value of send\_data is not used for anything.}}
\DoxyCodeLine{1305 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{pointer} :: locfield => null()}
\DoxyCodeLine{1306   \textcolor{keywordtype}{logical} :: is\_stat}
\DoxyCodeLine{1307   \textcolor{keywordtype}{integer} :: k, ks, ke}
\DoxyCodeLine{1308   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{pointer} :: diag => null()}
\DoxyCodeLine{1309 }
\DoxyCodeLine{1310   \textcolor{keywordflow}{if} (id\_clock\_diag\_mediator>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_mediator)}
\DoxyCodeLine{1311   is\_stat = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_static)) is\_stat = is\_static}
\DoxyCodeLine{1312 }
\DoxyCodeLine{1313   \textcolor{comment}{! Iterate over list of diag 'variants', e.g. CMOR aliases.}}
\DoxyCodeLine{1314   \textcolor{keyword}{call }assert(diag\_field\_id < diag\_cs\%next\_free\_diag\_id, \&}
\DoxyCodeLine{1315               \textcolor{stringliteral}{'post\_data\_1d\_k: Unregistered diagnostic id'})}
\DoxyCodeLine{1316   diag => diag\_cs\%diags(diag\_field\_id)}
\DoxyCodeLine{1317   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (\textcolor{keyword}{associated}(diag))}
\DoxyCodeLine{1318 }
\DoxyCodeLine{1319     \textcolor{keywordflow}{if} ((diag\%conversion\_factor /= 0.) .and. (diag\%conversion\_factor /= 1.)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1320       ks = lbound(field,1) ; ke = ubound(field,1)}
\DoxyCodeLine{1321       \textcolor{keyword}{allocate}( locfield( ks:ke ) )}
\DoxyCodeLine{1322 }
\DoxyCodeLine{1323       \textcolor{keywordflow}{do} k=ks,ke}
\DoxyCodeLine{1324         \textcolor{keywordflow}{if} (field(k) == diag\_cs\%missing\_value) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1325           locfield(k) = diag\_cs\%missing\_value}
\DoxyCodeLine{1326         \textcolor{keywordflow}{else}}
\DoxyCodeLine{1327           locfield(k) = field(k) * diag\%conversion\_factor}
\DoxyCodeLine{1328 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1329 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{1330     \textcolor{keywordflow}{else}}
\DoxyCodeLine{1331       locfield => field}
\DoxyCodeLine{1332 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1333 }
\DoxyCodeLine{1334     \textcolor{keywordflow}{if} (diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1335       \textcolor{keyword}{call }zchksum(locfield, diag\%debug\_str, logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1336     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (is\_stat) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1337       used = send\_data(diag\%fms\_diag\_id, locfield)}
\DoxyCodeLine{1338     \textcolor{keywordflow}{elseif} (diag\_cs\%ave\_enabled) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1339       used = send\_data(diag\%fms\_diag\_id, locfield, diag\_cs\%time\_end, weight=diag\_cs\%time\_int)}
\DoxyCodeLine{1340 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1341     \textcolor{keywordflow}{if} ((diag\%conversion\_factor /= 0.) .and. (diag\%conversion\_factor /= 1.)) \textcolor{keyword}{deallocate}( locfield )}
\DoxyCodeLine{1342 }
\DoxyCodeLine{1343     diag => diag\%next}
\DoxyCodeLine{1344 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{1345 }
\DoxyCodeLine{1346   \textcolor{keywordflow}{if} (id\_clock\_diag\_mediator>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_mediator)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a2b87038d2cfd2f6709ecb9f4481e0e75}\label{namespacemom__diag__mediator_a2b87038d2cfd2f6709ecb9f4481e0e75}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!post\_data\_2d@{post\_data\_2d}}
\index{post\_data\_2d@{post\_data\_2d}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{post\_data\_2d()}{post\_data\_2d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::post\+\_\+data\+\_\+2d (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{diag\+\_\+field\+\_\+id,  }\item[{real, dimension(\+:,\+:), intent(in)}]{field,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in), target}]{diag\+\_\+cs,  }\item[{logical, intent(in), optional}]{is\+\_\+static,  }\item[{real, dimension(\+:,\+:), intent(in), optional}]{mask }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Make a real 2-\/d array diagnostic available for averaging or output. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag\+\_\+field\+\_\+id} & The id for an output variable returned by a previous call to register\+\_\+diag\+\_\+field. \\
\hline
\mbox{\texttt{ in}}  & {\em field} & 2-\/d array being offered for output or averaging \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+static} & If true, this is a static field that is always offered. \\
\hline
\mbox{\texttt{ in}}  & {\em mask} & If present, use this real array as the data mask. \\
\hline
\end{DoxyParams}


Definition at line 1350 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1351   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)} :: diag\_field\_id\textcolor{comment}{ !< The id for an output variable returned by a}}
\DoxyCodeLine{1352 \textcolor{comment}{                                                 !! previous call to register\_diag\_field.}}
\DoxyCodeLine{1353 \textcolor{keywordtype}{  real},              \textcolor{keywordtype}{intent(in)} :: field(:,:)\textcolor{comment}{    !< 2-\/d array being offered for output or averaging}}
\DoxyCodeLine{1354   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1355   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: is\_static\textcolor{comment}{ !< If true, this is a static field that is always offered.}}
\DoxyCodeLine{1356 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: mask(:,:)\textcolor{comment}{ !< If present, use this real array as the data mask.}}
\DoxyCodeLine{1357 }
\DoxyCodeLine{1358   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1359   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{pointer} :: diag => null()}
\DoxyCodeLine{1360 }
\DoxyCodeLine{1361   \textcolor{keywordflow}{if} (id\_clock\_diag\_mediator>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_mediator)}
\DoxyCodeLine{1362 }
\DoxyCodeLine{1363   \textcolor{comment}{! Iterate over list of diag 'variants' (e.g. CMOR aliases) and post each.}}
\DoxyCodeLine{1364   \textcolor{keyword}{call }assert(diag\_field\_id < diag\_cs\%next\_free\_diag\_id, \&}
\DoxyCodeLine{1365               \textcolor{stringliteral}{'post\_data\_2d: Unregistered diagnostic id'})}
\DoxyCodeLine{1366   diag => diag\_cs\%diags(diag\_field\_id)}
\DoxyCodeLine{1367   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (\textcolor{keyword}{associated}(diag))}
\DoxyCodeLine{1368     \textcolor{keyword}{call }post\_data\_2d\_low(diag, field, diag\_cs, is\_static, mask)}
\DoxyCodeLine{1369     diag => diag\%next}
\DoxyCodeLine{1370 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{1371 }
\DoxyCodeLine{1372   \textcolor{keywordflow}{if} (id\_clock\_diag\_mediator>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_mediator)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a633c4a461809f5843ac522616db8f382}\label{namespacemom__diag__mediator_a633c4a461809f5843ac522616db8f382}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!post\_data\_2d\_low@{post\_data\_2d\_low}}
\index{post\_data\_2d\_low@{post\_data\_2d\_low}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{post\_data\_2d\_low()}{post\_data\_2d\_low()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::post\+\_\+data\+\_\+2d\+\_\+low (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), intent(in)}]{diag,  }\item[{real, dimension(\+:,\+:), intent(in), target}]{field,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs,  }\item[{logical, intent(in), optional}]{is\+\_\+static,  }\item[{real, dimension(\+:,\+:), intent(in), optional, target}]{mask }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Make a real 2-\/d array diagnostic available for averaging or output using a \mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}} instead of an integer id. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag} & A structure describing the diagnostic to post \\
\hline
\mbox{\texttt{ in}}  & {\em field} & 2-\/d array being offered for output or averaging \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+static} & If true, this is a static field that is always offered. \\
\hline
\mbox{\texttt{ in}}  & {\em mask} & If present, use this real array as the data mask. \\
\hline
\end{DoxyParams}


Definition at line 1377 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1378   \textcolor{keywordtype}{type}(diag\_type),   \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{       !< A structure describing the diagnostic to post}}
\DoxyCodeLine{1379 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{target},   \textcolor{keywordtype}{intent(in)} :: field(:,:)\textcolor{comment}{ !< 2-\/d array being offered for output or averaging}}
\DoxyCodeLine{1380   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1381   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: is\_static\textcolor{comment}{ !< If true, this is a static field that is always offered.}}
\DoxyCodeLine{1382 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{optional},\textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: mask(:,:)\textcolor{comment}{ !< If present, use this real array as the data mask.}}
\DoxyCodeLine{1383 }
\DoxyCodeLine{1384   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1385 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: locfield}
\DoxyCodeLine{1386 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: locmask}
\DoxyCodeLine{1387   \textcolor{keywordtype}{character(len=300)} :: mesg}
\DoxyCodeLine{1388   \textcolor{keywordtype}{logical} :: used, is\_stat}
\DoxyCodeLine{1389   \textcolor{keywordtype}{integer} :: cszi, cszj, dszi, dszj}
\DoxyCodeLine{1390   \textcolor{keywordtype}{integer} :: isv, iev, jsv, jev, i, j, chksum, isv\_o,jsv\_o}
\DoxyCodeLine{1391 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{target} :: locfield\_dsamp}
\DoxyCodeLine{1392 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{target} :: locmask\_dsamp}
\DoxyCodeLine{1393   \textcolor{keywordtype}{integer} :: dl}
\DoxyCodeLine{1394 }
\DoxyCodeLine{1395   locfield => null()}
\DoxyCodeLine{1396   locmask => null()}
\DoxyCodeLine{1397   is\_stat = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_static)) is\_stat = is\_static}
\DoxyCodeLine{1398 }
\DoxyCodeLine{1399   \textcolor{comment}{! Determine the propery array indices, noting that because of the (:,:)}}
\DoxyCodeLine{1400   \textcolor{comment}{! declaration of field, symmetric arrays are using a SW-\/grid indexing,}}
\DoxyCodeLine{1401   \textcolor{comment}{! but non-\/symmetric arrays are using a NE-\/grid indexing.  Send\_data}}
\DoxyCodeLine{1402   \textcolor{comment}{! actually only uses the difference between ie and is to determine}}
\DoxyCodeLine{1403   \textcolor{comment}{! the output data size and assumes that halos are symmetric.}}
\DoxyCodeLine{1404   isv = diag\_cs\%is ; iev = diag\_cs\%ie ; jsv = diag\_cs\%js ; jev = diag\_cs\%je}
\DoxyCodeLine{1405 }
\DoxyCodeLine{1406   cszi = diag\_cs\%ie-\/diag\_cs\%is +1 ; dszi = diag\_cs\%ied-\/diag\_cs\%isd +1}
\DoxyCodeLine{1407   cszj = diag\_cs\%je-\/diag\_cs\%js +1 ; dszj = diag\_cs\%jed-\/diag\_cs\%jsd +1}
\DoxyCodeLine{1408   \textcolor{keywordflow}{if} ( \textcolor{keyword}{size}(field,1) == dszi ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1409     isv = diag\_cs\%is ; iev = diag\_cs\%ie     \textcolor{comment}{! Data domain}}
\DoxyCodeLine{1410   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,1) == dszi + 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1411     isv = diag\_cs\%is ; iev = diag\_cs\%ie+1   \textcolor{comment}{! Symmetric data domain}}
\DoxyCodeLine{1412   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,1) == cszi) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1413     isv = 1 ; iev = cszi                    \textcolor{comment}{! Computational domain}}
\DoxyCodeLine{1414   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,1) == cszi + 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1415     isv = 1 ; iev = cszi+1                  \textcolor{comment}{! Symmetric computational domain}}
\DoxyCodeLine{1416   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1417     \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{" peculiar size "},\textcolor{keyword}{size}(field,1),\textcolor{stringliteral}{" in i-\/direction\(\backslash\)n"}//\&}
\DoxyCodeLine{1418        \textcolor{stringliteral}{"does not match one of "}, cszi, cszi+1, dszi, dszi+1}
\DoxyCodeLine{1419     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"post\_data\_2d\_low: "}//trim(diag\%debug\_str)//trim(mesg))}
\DoxyCodeLine{1420 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1421 }
\DoxyCodeLine{1422   \textcolor{keywordflow}{if} ( \textcolor{keyword}{size}(field,2) == dszj ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1423     jsv = diag\_cs\%js ; jev = diag\_cs\%je     \textcolor{comment}{! Data domain}}
\DoxyCodeLine{1424   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,2) == dszj + 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1425     jsv = diag\_cs\%js ; jev = diag\_cs\%je+1   \textcolor{comment}{! Symmetric data domain}}
\DoxyCodeLine{1426   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,2) == cszj ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1427     jsv = 1 ; jev = cszj                    \textcolor{comment}{! Computational domain}}
\DoxyCodeLine{1428   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,2) == cszj+1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1429     jsv = 1 ; jev = cszj+1                  \textcolor{comment}{! Symmetric computational domain}}
\DoxyCodeLine{1430   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1431     \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{" peculiar size "},\textcolor{keyword}{size}(field,2),\textcolor{stringliteral}{" in j-\/direction\(\backslash\)n"}//\&}
\DoxyCodeLine{1432        \textcolor{stringliteral}{"does not match one of "}, cszj, cszj+1, dszj, dszj+1}
\DoxyCodeLine{1433     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"post\_data\_2d\_low: "}//trim(diag\%debug\_str)//trim(mesg))}
\DoxyCodeLine{1434 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1435 }
\DoxyCodeLine{1436   \textcolor{keywordflow}{if} ((diag\%conversion\_factor /= 0.) .and. (diag\%conversion\_factor /= 1.)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1437     \textcolor{keyword}{allocate}( locfield( lbound(field,1):ubound(field,1), lbound(field,2):ubound(field,2) ) )}
\DoxyCodeLine{1438     \textcolor{keywordflow}{do} j=jsv,jev ; \textcolor{keywordflow}{do} i=isv,iev}
\DoxyCodeLine{1439       \textcolor{keywordflow}{if} (field(i,j) == diag\_cs\%missing\_value) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1440         locfield(i,j) = diag\_cs\%missing\_value}
\DoxyCodeLine{1441       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1442         locfield(i,j) = field(i,j) * diag\%conversion\_factor}
\DoxyCodeLine{1443 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1444 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1445     locfield(isv:iev,jsv:jev) = field(isv:iev,jsv:jev) * diag\%conversion\_factor}
\DoxyCodeLine{1446   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1447     locfield => field}
\DoxyCodeLine{1448 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1449 }
\DoxyCodeLine{1450   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1451      locmask => mask}
\DoxyCodeLine{1452   \textcolor{keywordflow}{elseif}(.NOT. is\_stat) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1453      \textcolor{keywordflow}{if}(\textcolor{keyword}{associated}(diag\%axes\%mask2d)) locmask => diag\%axes\%mask2d}
\DoxyCodeLine{1454 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1455 }
\DoxyCodeLine{1456   dl=1}
\DoxyCodeLine{1457   \textcolor{keywordflow}{if}(.NOT. is\_stat) dl = diag\%axes\%downsample\_level \textcolor{comment}{!static field downsample i not supported yet}}
\DoxyCodeLine{1458   \textcolor{comment}{!Downsample the diag field and mask (if present)}}
\DoxyCodeLine{1459   \textcolor{keywordflow}{if} (dl > 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1460      isv\_o=isv ; jsv\_o=jsv}
\DoxyCodeLine{1461      \textcolor{keyword}{call }downsample\_diag\_field(locfield, locfield\_dsamp, dl, diag\_cs, diag,isv,iev,jsv,jev, mask)}
\DoxyCodeLine{1462      \textcolor{keywordflow}{if} ((diag\%conversion\_factor /= 0.) .and. (diag\%conversion\_factor /= 1.)) \textcolor{keyword}{deallocate}( locfield )}
\DoxyCodeLine{1463      locfield => locfield\_dsamp}
\DoxyCodeLine{1464      \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1465         \textcolor{keyword}{call }downsample\_field\_2d(locmask, locmask\_dsamp, dl, msk, locmask, diag\_cs,diag,isv\_o,jsv\_o,isv,iev,jsv,jev)}
\DoxyCodeLine{1466         locmask => locmask\_dsamp}
\DoxyCodeLine{1467      \textcolor{keywordflow}{elseif}(\textcolor{keyword}{associated}(diag\%axes\%dsamp(dl)\%mask2d)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1468         locmask => diag\%axes\%dsamp(dl)\%mask2d}
\DoxyCodeLine{1469 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{1470 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1471 }
\DoxyCodeLine{1472   \textcolor{keywordflow}{if} (diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1473     \textcolor{keywordflow}{if} (diag\%axes\%is\_h\_point) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1474       \textcolor{keyword}{call }hchksum(locfield, diag\%debug\_str, diag\_cs\%G\%HI, \&}
\DoxyCodeLine{1475                    logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1476     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (diag\%axes\%is\_u\_point) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1477       \textcolor{keyword}{call }uchksum(locfield, diag\%debug\_str, diag\_cs\%G\%HI, \&}
\DoxyCodeLine{1478                    logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1479     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (diag\%axes\%is\_v\_point) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1480       \textcolor{keyword}{call }vchksum(locfield, diag\%debug\_str, diag\_cs\%G\%HI, \&}
\DoxyCodeLine{1481                    logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1482     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (diag\%axes\%is\_q\_point) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1483       \textcolor{keyword}{call }bchksum(locfield, diag\%debug\_str, diag\_cs\%G\%HI, \&}
\DoxyCodeLine{1484                    logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1485     \textcolor{keywordflow}{else}}
\DoxyCodeLine{1486       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"post\_data\_2d\_low: unknown axis type."})}
\DoxyCodeLine{1487 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1488   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1489     \textcolor{keywordflow}{if} (is\_stat) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1490       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1491         \textcolor{keyword}{call }assert(\textcolor{keyword}{size}(locfield) == \textcolor{keyword}{size}(locmask), \&}
\DoxyCodeLine{1492             \textcolor{stringliteral}{'post\_data\_2d\_low is\_stat: mask size mismatch: '}//diag\%debug\_str)}
\DoxyCodeLine{1493         used = send\_data(diag\%fms\_diag\_id, locfield, \&}
\DoxyCodeLine{1494                          is\_in=isv, js\_in=jsv, ie\_in=iev, je\_in=jev, rmask=locmask)}
\DoxyCodeLine{1495      \textcolor{comment}{!elseif (associated(diag\%axes\%mask2d)) then}}
\DoxyCodeLine{1496      \textcolor{comment}{!  used = send\_data(diag\%fms\_diag\_id, locfield, \&}}
\DoxyCodeLine{1497      \textcolor{comment}{!                   is\_in=isv, js\_in=jsv, ie\_in=iev, je\_in=jev, rmask=diag\%axes\%mask2d)}}
\DoxyCodeLine{1498       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1499         used = send\_data(diag\%fms\_diag\_id, locfield, \&}
\DoxyCodeLine{1500                          is\_in=isv, js\_in=jsv, ie\_in=iev, je\_in=jev)}
\DoxyCodeLine{1501 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1502     \textcolor{keywordflow}{elseif} (diag\_cs\%ave\_enabled) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1503       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(locmask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1504         \textcolor{keyword}{call }assert(\textcolor{keyword}{size}(locfield) == \textcolor{keyword}{size}(locmask), \&}
\DoxyCodeLine{1505             \textcolor{stringliteral}{'post\_data\_2d\_low: mask size mismatch: '}//diag\%debug\_str)}
\DoxyCodeLine{1506         used = send\_data(diag\%fms\_diag\_id, locfield, diag\_cs\%time\_end, \&}
\DoxyCodeLine{1507                          is\_in=isv, js\_in=jsv, ie\_in=iev, je\_in=jev, \&}
\DoxyCodeLine{1508                          weight=diag\_cs\%time\_int, rmask=locmask)}
\DoxyCodeLine{1509       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1510         used = send\_data(diag\%fms\_diag\_id, locfield, diag\_cs\%time\_end, \&}
\DoxyCodeLine{1511                          is\_in=isv, js\_in=jsv, ie\_in=iev, je\_in=jev, \&}
\DoxyCodeLine{1512                          weight=diag\_cs\%time\_int)}
\DoxyCodeLine{1513 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1514 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1515 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1516   \textcolor{keywordflow}{if} ((diag\%conversion\_factor /= 0.) .and. (diag\%conversion\_factor /= 1.) .and. dl<2) \&}
\DoxyCodeLine{1517     \textcolor{keyword}{deallocate}( locfield )}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a70116fa6034dcf977a8bdcb4d81f9207}\label{namespacemom__diag__mediator_a70116fa6034dcf977a8bdcb4d81f9207}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!post\_data\_3d@{post\_data\_3d}}
\index{post\_data\_3d@{post\_data\_3d}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{post\_data\_3d()}{post\_data\_3d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::post\+\_\+data\+\_\+3d (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{diag\+\_\+field\+\_\+id,  }\item[{real, dimension(\+:,\+:,\+:), intent(in)}]{field,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in), target}]{diag\+\_\+cs,  }\item[{logical, intent(in), optional}]{is\+\_\+static,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), optional}]{mask,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), optional, target}]{alt\+\_\+h }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Make a real 3-\/d array diagnostic available for averaging or output. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag\+\_\+field\+\_\+id} & The id for an output variable returned by a previous call to register\+\_\+diag\+\_\+field. \\
\hline
\mbox{\texttt{ in}}  & {\em field} & 3-\/d array being offered for output or averaging \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+static} & If true, this is a static field that is always offered. \\
\hline
\mbox{\texttt{ in}}  & {\em mask} & If present, use this real array as the data mask. \\
\hline
\mbox{\texttt{ in}}  & {\em alt\+\_\+h} & An alternate thickness to use for vertically \\
\hline
\end{DoxyParams}


Definition at line 1521 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1522 }
\DoxyCodeLine{1523   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)} :: diag\_field\_id\textcolor{comment}{ !< The id for an output variable returned by a}}
\DoxyCodeLine{1524 \textcolor{comment}{                                                 !! previous call to register\_diag\_field.}}
\DoxyCodeLine{1525 \textcolor{keywordtype}{  real},              \textcolor{keywordtype}{intent(in)} :: field(:,:,:)\textcolor{comment}{  !< 3-\/d array being offered for output or averaging}}
\DoxyCodeLine{1526   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1527   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: is\_static\textcolor{comment}{ !< If true, this is a static field that is always offered.}}
\DoxyCodeLine{1528 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: mask(:,:,:)\textcolor{comment}{ !< If present, use this real array as the data mask.}}
\DoxyCodeLine{1529 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \&}
\DoxyCodeLine{1530          \textcolor{keywordtype}{target}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: alt\_h\textcolor{comment}{  !< An alternate thickness to use for vertically}}
\DoxyCodeLine{1531 \textcolor{comment}{                                                !! remapping this diagnostic [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{1532 }
\DoxyCodeLine{1533   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1534   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{pointer} :: diag => null()}
\DoxyCodeLine{1535   \textcolor{keywordtype}{integer} :: nz, i, j, k}
\DoxyCodeLine{1536 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{allocatable} :: remapped\_field}
\DoxyCodeLine{1537   \textcolor{keywordtype}{logical} :: staggered\_in\_x, staggered\_in\_y}
\DoxyCodeLine{1538 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: h\_diag => null()}
\DoxyCodeLine{1539 }
\DoxyCodeLine{1540   \textcolor{keywordflow}{if} (id\_clock\_diag\_mediator>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_mediator)}
\DoxyCodeLine{1541 }
\DoxyCodeLine{1542   \textcolor{comment}{! For intensive variables only, we can choose to use a different diagnostic grid}}
\DoxyCodeLine{1543   \textcolor{comment}{! to map to}}
\DoxyCodeLine{1544   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(alt\_h)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1545     h\_diag => alt\_h}
\DoxyCodeLine{1546   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1547     h\_diag => diag\_cs\%h}
\DoxyCodeLine{1548 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1549 }
\DoxyCodeLine{1550   \textcolor{comment}{! Iterate over list of diag 'variants', e.g. CMOR aliases, different vertical}}
\DoxyCodeLine{1551   \textcolor{comment}{! grids, and post each.}}
\DoxyCodeLine{1552   \textcolor{keyword}{call }assert(diag\_field\_id < diag\_cs\%next\_free\_diag\_id, \&}
\DoxyCodeLine{1553               \textcolor{stringliteral}{'post\_data\_3d: Unregistered diagnostic id'})}
\DoxyCodeLine{1554   diag => diag\_cs\%diags(diag\_field\_id)}
\DoxyCodeLine{1555   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (\textcolor{keyword}{associated}(diag))}
\DoxyCodeLine{1556     \textcolor{keyword}{call }assert(\textcolor{keyword}{associated}(diag\%axes), \textcolor{stringliteral}{'post\_data\_3d: axes is not associated'})}
\DoxyCodeLine{1557 }
\DoxyCodeLine{1558     staggered\_in\_x = diag\%axes\%is\_u\_point .or. diag\%axes\%is\_q\_point}
\DoxyCodeLine{1559     staggered\_in\_y = diag\%axes\%is\_v\_point .or. diag\%axes\%is\_q\_point}
\DoxyCodeLine{1560 }
\DoxyCodeLine{1561     \textcolor{keywordflow}{if} (diag\%v\_extensive .and. .not.diag\%axes\%is\_native) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1562       \textcolor{comment}{! The field is vertically integrated and needs to be re-\/gridded}}
\DoxyCodeLine{1563       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1564         \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"post\_data\_3d: no mask for regridded field."})}
\DoxyCodeLine{1565 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1566 }
\DoxyCodeLine{1567       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_remap)}
\DoxyCodeLine{1568       \textcolor{keyword}{allocate}(remapped\_field(\textcolor{keyword}{size}(field,1), \textcolor{keyword}{size}(field,2), diag\%axes\%nz))}
\DoxyCodeLine{1569       \textcolor{keyword}{call }vertically\_reintegrate\_diag\_field(                                    \&}
\DoxyCodeLine{1570         diag\_cs\%diag\_remap\_cs(diag\%axes\%vertical\_coordinate\_number), diag\_cs\%G,  \&}
\DoxyCodeLine{1571         diag\_cs\%h\_begin,                                                         \&}
\DoxyCodeLine{1572         diag\_cs\%diag\_remap\_cs(diag\%axes\%vertical\_coordinate\_number)\%h\_extensive, \&}
\DoxyCodeLine{1573         staggered\_in\_x, staggered\_in\_y, diag\%axes\%mask3d, field, remapped\_field)}
\DoxyCodeLine{1574       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_remap)}
\DoxyCodeLine{1575       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(diag\%axes\%mask3d)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1576         \textcolor{comment}{! Since 3d masks do not vary in the vertical, just use as much as is}}
\DoxyCodeLine{1577         \textcolor{comment}{! needed.}}
\DoxyCodeLine{1578         \textcolor{keyword}{call }post\_data\_3d\_low(diag, remapped\_field, diag\_cs, is\_static, \&}
\DoxyCodeLine{1579                               mask=diag\%axes\%mask3d)}
\DoxyCodeLine{1580       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1581         \textcolor{keyword}{call }post\_data\_3d\_low(diag, remapped\_field, diag\_cs, is\_static)}
\DoxyCodeLine{1582 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1583       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_remap)}
\DoxyCodeLine{1584       \textcolor{keyword}{deallocate}(remapped\_field)}
\DoxyCodeLine{1585       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_remap)}
\DoxyCodeLine{1586     \textcolor{keywordflow}{elseif} (diag\%axes\%needs\_remapping) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1587       \textcolor{comment}{! Remap this field to another vertical coordinate.}}
\DoxyCodeLine{1588       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1589         \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"post\_data\_3d: no mask for regridded field."})}
\DoxyCodeLine{1590 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1591 }
\DoxyCodeLine{1592       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_remap)}
\DoxyCodeLine{1593       \textcolor{keyword}{allocate}(remapped\_field(\textcolor{keyword}{size}(field,1), \textcolor{keyword}{size}(field,2), diag\%axes\%nz))}
\DoxyCodeLine{1594       \textcolor{keyword}{call }diag\_remap\_do\_remap(diag\_cs\%diag\_remap\_cs(diag\%axes\%vertical\_coordinate\_number), \&}
\DoxyCodeLine{1595               diag\_cs\%G, diag\_cs\%GV, h\_diag, staggered\_in\_x, staggered\_in\_y, \&}
\DoxyCodeLine{1596               diag\%axes\%mask3d, field, remapped\_field)}
\DoxyCodeLine{1597       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_remap)}
\DoxyCodeLine{1598       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(diag\%axes\%mask3d)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1599         \textcolor{comment}{! Since 3d masks do not vary in the vertical, just use as much as is}}
\DoxyCodeLine{1600         \textcolor{comment}{! needed.}}
\DoxyCodeLine{1601         \textcolor{keyword}{call }post\_data\_3d\_low(diag, remapped\_field, diag\_cs, is\_static, \&}
\DoxyCodeLine{1602                               mask=diag\%axes\%mask3d)}
\DoxyCodeLine{1603       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1604         \textcolor{keyword}{call }post\_data\_3d\_low(diag, remapped\_field, diag\_cs, is\_static)}
\DoxyCodeLine{1605 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1606       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_remap)}
\DoxyCodeLine{1607       \textcolor{keyword}{deallocate}(remapped\_field)}
\DoxyCodeLine{1608       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_remap)}
\DoxyCodeLine{1609     \textcolor{keywordflow}{elseif} (diag\%axes\%needs\_interpolating) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1610       \textcolor{comment}{! Interpolate this field to another vertical coordinate.}}
\DoxyCodeLine{1611       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1612         \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"post\_data\_3d: no mask for regridded field."})}
\DoxyCodeLine{1613 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1614 }
\DoxyCodeLine{1615       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_remap)}
\DoxyCodeLine{1616       \textcolor{keyword}{allocate}(remapped\_field(\textcolor{keyword}{size}(field,1), \textcolor{keyword}{size}(field,2), diag\%axes\%nz+1))}
\DoxyCodeLine{1617       \textcolor{keyword}{call }vertically\_interpolate\_diag\_field(diag\_cs\%diag\_remap\_cs( \&}
\DoxyCodeLine{1618               diag\%axes\%vertical\_coordinate\_number), \&}
\DoxyCodeLine{1619               diag\_cs\%G, h\_diag, staggered\_in\_x, staggered\_in\_y, \&}
\DoxyCodeLine{1620               diag\%axes\%mask3d, field, remapped\_field)}
\DoxyCodeLine{1621       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_remap)}
\DoxyCodeLine{1622       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(diag\%axes\%mask3d)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1623         \textcolor{comment}{! Since 3d masks do not vary in the vertical, just use as much as is}}
\DoxyCodeLine{1624         \textcolor{comment}{! needed.}}
\DoxyCodeLine{1625         \textcolor{keyword}{call }post\_data\_3d\_low(diag, remapped\_field, diag\_cs, is\_static, \&}
\DoxyCodeLine{1626                               mask=diag\%axes\%mask3d)}
\DoxyCodeLine{1627       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1628         \textcolor{keyword}{call }post\_data\_3d\_low(diag, remapped\_field, diag\_cs, is\_static)}
\DoxyCodeLine{1629 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1630       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_begin(id\_clock\_diag\_remap)}
\DoxyCodeLine{1631       \textcolor{keyword}{deallocate}(remapped\_field)}
\DoxyCodeLine{1632       \textcolor{keywordflow}{if} (id\_clock\_diag\_remap>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_remap)}
\DoxyCodeLine{1633     \textcolor{keywordflow}{else}}
\DoxyCodeLine{1634       \textcolor{keyword}{call }post\_data\_3d\_low(diag, field, diag\_cs, is\_static, mask)}
\DoxyCodeLine{1635 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1636     diag => diag\%next}
\DoxyCodeLine{1637 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{1638   \textcolor{keywordflow}{if} (id\_clock\_diag\_mediator>0) \textcolor{keyword}{call }cpu\_clock\_end(id\_clock\_diag\_mediator)}
\DoxyCodeLine{1639 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ae11cae949c3f8cf68d2c70f656aa9c54}\label{namespacemom__diag__mediator_ae11cae949c3f8cf68d2c70f656aa9c54}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!post\_data\_3d\_low@{post\_data\_3d\_low}}
\index{post\_data\_3d\_low@{post\_data\_3d\_low}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{post\_data\_3d\_low()}{post\_data\_3d\_low()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::post\+\_\+data\+\_\+3d\+\_\+low (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), intent(in)}]{diag,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{field,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs,  }\item[{logical, intent(in), optional}]{is\+\_\+static,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), optional, target}]{mask }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Make a real 3-\/d array diagnostic available for averaging or output using a \mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}} instead of an integer id. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag} & A structure describing the diagnostic to post \\
\hline
\mbox{\texttt{ in}}  & {\em field} & 3-\/d array being offered for output or averaging \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em is\+\_\+static} & If true, this is a static field that is always offered. \\
\hline
\mbox{\texttt{ in}}  & {\em mask} & If present, use this real array as the data mask. \\
\hline
\end{DoxyParams}


Definition at line 1644 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1645   \textcolor{keywordtype}{type}(diag\_type),   \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{       !< A structure describing the diagnostic to post}}
\DoxyCodeLine{1646 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{target},   \textcolor{keywordtype}{intent(in)} :: field(:,:,:)\textcolor{comment}{ !< 3-\/d array being offered for output or averaging}}
\DoxyCodeLine{1647   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{intent(in)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1648   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: is\_static\textcolor{comment}{ !< If true, this is a static field that is always offered.}}
\DoxyCodeLine{1649 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{optional},\textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: mask(:,:,:)\textcolor{comment}{ !< If present, use this real array as the data mask.}}
\DoxyCodeLine{1650 }
\DoxyCodeLine{1651   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1652 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: locfield}
\DoxyCodeLine{1653 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{pointer} :: locmask}
\DoxyCodeLine{1654   \textcolor{keywordtype}{character(len=300)} :: mesg}
\DoxyCodeLine{1655   \textcolor{keywordtype}{logical} :: used  \textcolor{comment}{! The return value of send\_data is not used for anything.}}
\DoxyCodeLine{1656   \textcolor{keywordtype}{logical} :: staggered\_in\_x, staggered\_in\_y}
\DoxyCodeLine{1657   \textcolor{keywordtype}{logical} :: is\_stat}
\DoxyCodeLine{1658   \textcolor{keywordtype}{integer} :: cszi, cszj, dszi, dszj}
\DoxyCodeLine{1659   \textcolor{keywordtype}{integer} :: isv, iev, jsv, jev, ks, ke, i, j, k, isv\_c, jsv\_c, isv\_o,jsv\_o}
\DoxyCodeLine{1660   \textcolor{keywordtype}{integer} :: chksum}
\DoxyCodeLine{1661 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{target} :: locfield\_dsamp}
\DoxyCodeLine{1662 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:)}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{target} :: locmask\_dsamp}
\DoxyCodeLine{1663   \textcolor{keywordtype}{integer} :: dl}
\DoxyCodeLine{1664 }
\DoxyCodeLine{1665   locfield => null()}
\DoxyCodeLine{1666   locmask => null()}
\DoxyCodeLine{1667   is\_stat = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(is\_static)) is\_stat = is\_static}
\DoxyCodeLine{1668 }
\DoxyCodeLine{1669   \textcolor{comment}{! Determine the proper array indices, noting that because of the (:,:)}}
\DoxyCodeLine{1670   \textcolor{comment}{! declaration of field, symmetric arrays are using a SW-\/grid indexing,}}
\DoxyCodeLine{1671   \textcolor{comment}{! but non-\/symmetric arrays are using a NE-\/grid indexing.  Send\_data}}
\DoxyCodeLine{1672   \textcolor{comment}{! actually only uses the difference between ie and is to determine}}
\DoxyCodeLine{1673   \textcolor{comment}{! the output data size and assumes that halos are symmetric.}}
\DoxyCodeLine{1674   isv = diag\_cs\%is ; iev = diag\_cs\%ie ; jsv = diag\_cs\%js ; jev = diag\_cs\%je}
\DoxyCodeLine{1675 }
\DoxyCodeLine{1676   cszi = (diag\_cs\%ie-\/diag\_cs\%is) +1 ; dszi = (diag\_cs\%ied-\/diag\_cs\%isd) +1}
\DoxyCodeLine{1677   cszj = (diag\_cs\%je-\/diag\_cs\%js) +1 ; dszj = (diag\_cs\%jed-\/diag\_cs\%jsd) +1}
\DoxyCodeLine{1678   \textcolor{keywordflow}{if} ( \textcolor{keyword}{size}(field,1) == dszi ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1679     isv = diag\_cs\%is ; iev = diag\_cs\%ie     \textcolor{comment}{! Data domain}}
\DoxyCodeLine{1680   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,1) == dszi + 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1681     isv = diag\_cs\%is ; iev = diag\_cs\%ie+1   \textcolor{comment}{! Symmetric data domain}}
\DoxyCodeLine{1682   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,1) == cszi) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1683     isv = 1 ; iev = cszi                    \textcolor{comment}{! Computational domain}}
\DoxyCodeLine{1684   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,1) == cszi + 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1685     isv = 1 ; iev = cszi+1                  \textcolor{comment}{! Symmetric computational domain}}
\DoxyCodeLine{1686   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1687     \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{" peculiar size "},\textcolor{keyword}{size}(field,1),\textcolor{stringliteral}{" in i-\/direction\(\backslash\)n"}//\&}
\DoxyCodeLine{1688        \textcolor{stringliteral}{"does not match one of "}, cszi, cszi+1, dszi, dszi+1}
\DoxyCodeLine{1689     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"post\_data\_3d\_low: "}//trim(diag\%debug\_str)//trim(mesg))}
\DoxyCodeLine{1690 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1691 }
\DoxyCodeLine{1692   \textcolor{keywordflow}{if} ( \textcolor{keyword}{size}(field,2) == dszj ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1693     jsv = diag\_cs\%js ; jev = diag\_cs\%je     \textcolor{comment}{! Data domain}}
\DoxyCodeLine{1694   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,2) == dszj + 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1695     jsv = diag\_cs\%js ; jev = diag\_cs\%je+1   \textcolor{comment}{! Symmetric data domain}}
\DoxyCodeLine{1696   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,2) == cszj ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1697     jsv = 1 ; jev = cszj                    \textcolor{comment}{! Computational domain}}
\DoxyCodeLine{1698   \textcolor{keywordflow}{elseif} ( \textcolor{keyword}{size}(field,2) == cszj+1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1699     jsv = 1 ; jev = cszj+1                  \textcolor{comment}{! Symmetric computational domain}}
\DoxyCodeLine{1700   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1701     \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{" peculiar size "},\textcolor{keyword}{size}(field,2),\textcolor{stringliteral}{" in j-\/direction\(\backslash\)n"}//\&}
\DoxyCodeLine{1702        \textcolor{stringliteral}{"does not match one of "}, cszj, cszj+1, dszj, dszj+1}
\DoxyCodeLine{1703     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"post\_data\_3d\_low: "}//trim(diag\%debug\_str)//trim(mesg))}
\DoxyCodeLine{1704 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1705 }
\DoxyCodeLine{1706   ks = lbound(field,3) ; ke = ubound(field,3)}
\DoxyCodeLine{1707   \textcolor{keywordflow}{if} ((diag\%conversion\_factor /= 0.) .and. (diag\%conversion\_factor /= 1.)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1708     \textcolor{keyword}{allocate}( locfield( lbound(field,1):ubound(field,1), lbound(field,2):ubound(field,2), ks:ke ) )}
\DoxyCodeLine{1709     \textcolor{comment}{! locfield(:,:,:) = 0.0  ! Zeroing out this array would be a good idea, but it appears}}
\DoxyCodeLine{1710                              \textcolor{comment}{! not to be necessary.}}
\DoxyCodeLine{1711     isv\_c = isv ; jsv\_c = jsv}
\DoxyCodeLine{1712     \textcolor{keywordflow}{if} (diag\%fms\_xyave\_diag\_id>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1713       staggered\_in\_x = diag\%axes\%is\_u\_point .or. diag\%axes\%is\_q\_point}
\DoxyCodeLine{1714       staggered\_in\_y = diag\%axes\%is\_v\_point .or. diag\%axes\%is\_q\_point}
\DoxyCodeLine{1715       \textcolor{comment}{! When averaging a staggered field, edge points are always required.}}
\DoxyCodeLine{1716       \textcolor{keywordflow}{if} (staggered\_in\_x) isv\_c = iev -\/ (diag\_cs\%ie -\/ diag\_cs\%is) -\/ 1}
\DoxyCodeLine{1717       \textcolor{keywordflow}{if} (staggered\_in\_y) jsv\_c = jev -\/ (diag\_cs\%je -\/ diag\_cs\%js) -\/ 1}
\DoxyCodeLine{1718       \textcolor{keywordflow}{if} (isv\_c < lbound(locfield,1)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1719         \textcolor{stringliteral}{"It is an error to average a staggered diagnostic field that does not "}//\&}
\DoxyCodeLine{1720         \textcolor{stringliteral}{"have i-\/direction space to represent the symmetric computational domain."})}
\DoxyCodeLine{1721       \textcolor{keywordflow}{if} (jsv\_c < lbound(locfield,2)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1722         \textcolor{stringliteral}{"It is an error to average a staggered diagnostic field that does not "}//\&}
\DoxyCodeLine{1723         \textcolor{stringliteral}{"have j-\/direction space to represent the symmetric computational domain."})}
\DoxyCodeLine{1724 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1725 }
\DoxyCodeLine{1726     \textcolor{keywordflow}{do} k=ks,ke ; \textcolor{keywordflow}{do} j=jsv,jev ; \textcolor{keywordflow}{do} i=isv,iev}
\DoxyCodeLine{1727       \textcolor{keywordflow}{if} (field(i,j,k) == diag\_cs\%missing\_value) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1728         locfield(i,j,k) = diag\_cs\%missing\_value}
\DoxyCodeLine{1729       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1730         locfield(i,j,k) = field(i,j,k) * diag\%conversion\_factor}
\DoxyCodeLine{1731 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1732 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1733   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1734     locfield => field}
\DoxyCodeLine{1735 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1736 }
\DoxyCodeLine{1737   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1738      locmask => mask}
\DoxyCodeLine{1739   \textcolor{keywordflow}{elseif}(\textcolor{keyword}{associated}(diag\%axes\%mask3d)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1740      locmask => diag\%axes\%mask3d}
\DoxyCodeLine{1741 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1742 }
\DoxyCodeLine{1743   dl=1}
\DoxyCodeLine{1744   \textcolor{keywordflow}{if}(.NOT. is\_stat) dl = diag\%axes\%downsample\_level \textcolor{comment}{!static field downsample i not supported yet}}
\DoxyCodeLine{1745   \textcolor{comment}{!Downsample the diag field and mask (if present)}}
\DoxyCodeLine{1746   \textcolor{keywordflow}{if} (dl > 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1747      isv\_o=isv ; jsv\_o=jsv}
\DoxyCodeLine{1748      \textcolor{keyword}{call }downsample\_diag\_field(locfield, locfield\_dsamp, dl, diag\_cs, diag,isv,iev,jsv,jev, mask)}
\DoxyCodeLine{1749      \textcolor{keywordflow}{if} ((diag\%conversion\_factor /= 0.) .and. (diag\%conversion\_factor /= 1.)) \textcolor{keyword}{deallocate}( locfield )}
\DoxyCodeLine{1750      locfield => locfield\_dsamp}
\DoxyCodeLine{1751      \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1752         \textcolor{keyword}{call }downsample\_field\_3d(locmask, locmask\_dsamp, dl, msk, locmask, diag\_cs,diag,isv\_o,jsv\_o,isv,iev,jsv,jev)}
\DoxyCodeLine{1753         locmask => locmask\_dsamp}
\DoxyCodeLine{1754       \textcolor{keywordflow}{elseif}(\textcolor{keyword}{associated}(diag\%axes\%dsamp(dl)\%mask3d)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1755         locmask => diag\%axes\%dsamp(dl)\%mask3d}
\DoxyCodeLine{1756 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{1757 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1758 }
\DoxyCodeLine{1759   \textcolor{keywordflow}{if} (diag\%fms\_diag\_id>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1760     \textcolor{keywordflow}{if} (diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1761       \textcolor{keywordflow}{if} (diag\%axes\%is\_h\_point) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1762         \textcolor{keyword}{call }hchksum(locfield, diag\%debug\_str, diag\_cs\%G\%HI, \&}
\DoxyCodeLine{1763                      logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1764       \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (diag\%axes\%is\_u\_point) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1765         \textcolor{keyword}{call }uchksum(locfield, diag\%debug\_str, diag\_cs\%G\%HI, \&}
\DoxyCodeLine{1766                      logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1767       \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (diag\%axes\%is\_v\_point) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1768         \textcolor{keyword}{call }vchksum(locfield, diag\%debug\_str, diag\_cs\%G\%HI, \&}
\DoxyCodeLine{1769                      logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1770       \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (diag\%axes\%is\_q\_point) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1771         \textcolor{keyword}{call }bchksum(locfield, diag\%debug\_str, diag\_cs\%G\%HI, \&}
\DoxyCodeLine{1772                      logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1773       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1774         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"post\_data\_3d\_low: unknown axis type."})}
\DoxyCodeLine{1775 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1776     \textcolor{keywordflow}{else}}
\DoxyCodeLine{1777       \textcolor{keywordflow}{if} (is\_stat) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1778         \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(mask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1779           \textcolor{keyword}{call }assert(\textcolor{keyword}{size}(locfield) == \textcolor{keyword}{size}(locmask), \&}
\DoxyCodeLine{1780               \textcolor{stringliteral}{'post\_data\_3d\_low is\_stat: mask size mismatch: '}//diag\%debug\_str)}
\DoxyCodeLine{1781           used = send\_data(diag\%fms\_diag\_id, locfield, \&}
\DoxyCodeLine{1782                          is\_in=isv, js\_in=jsv, ie\_in=iev, je\_in=jev, rmask=locmask)}
\DoxyCodeLine{1783        \textcolor{comment}{!elseif (associated(diag\%axes\%mask2d)) then}}
\DoxyCodeLine{1784        \textcolor{comment}{!  used = send\_data(diag\%fms\_diag\_id, locfield, \&}}
\DoxyCodeLine{1785        \textcolor{comment}{!                   is\_in=isv, js\_in=jsv, ie\_in=iev, je\_in=jev, rmask=diag\%axes\%mask2d)}}
\DoxyCodeLine{1786         \textcolor{keywordflow}{else}}
\DoxyCodeLine{1787           used = send\_data(diag\%fms\_diag\_id, locfield, \&}
\DoxyCodeLine{1788                            is\_in=isv, js\_in=jsv, ie\_in=iev, je\_in=jev)}
\DoxyCodeLine{1789 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1790       \textcolor{keywordflow}{elseif} (diag\_cs\%ave\_enabled) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1791         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(locmask)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1792           \textcolor{keyword}{call }assert(\textcolor{keyword}{size}(locfield) == \textcolor{keyword}{size}(locmask), \&}
\DoxyCodeLine{1793               \textcolor{stringliteral}{'post\_data\_3d\_low: mask size mismatch: '}//diag\%debug\_str)}
\DoxyCodeLine{1794           used = send\_data(diag\%fms\_diag\_id, locfield, diag\_cs\%time\_end, \&}
\DoxyCodeLine{1795                            is\_in=isv, js\_in=jsv, ie\_in=iev, je\_in=jev, \&}
\DoxyCodeLine{1796                            weight=diag\_cs\%time\_int, rmask=locmask)}
\DoxyCodeLine{1797         \textcolor{keywordflow}{else}}
\DoxyCodeLine{1798           used = send\_data(diag\%fms\_diag\_id, locfield, diag\_cs\%time\_end, \&}
\DoxyCodeLine{1799                            is\_in=isv, js\_in=jsv, ie\_in=iev, je\_in=jev, \&}
\DoxyCodeLine{1800                            weight=diag\_cs\%time\_int)}
\DoxyCodeLine{1801 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{1802 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1803 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1804 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1805 }
\DoxyCodeLine{1806   \textcolor{keywordflow}{if} (diag\%fms\_xyave\_diag\_id>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1807     \textcolor{keyword}{call }post\_xy\_average(diag\_cs, diag, locfield)}
\DoxyCodeLine{1808 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1809 }
\DoxyCodeLine{1810   \textcolor{keywordflow}{if} ((diag\%conversion\_factor /= 0.) .and. (diag\%conversion\_factor /= 1.) .and. dl<2) \&}
\DoxyCodeLine{1811     \textcolor{keyword}{deallocate}( locfield )}
\DoxyCodeLine{1812 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ab41a1779c5edb50aa7256477cef952ae}\label{namespacemom__diag__mediator_ab41a1779c5edb50aa7256477cef952ae}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!post\_xy\_average@{post\_xy\_average}}
\index{post\_xy\_average@{post\_xy\_average}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{post\_xy\_average()}{post\_xy\_average()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::post\+\_\+xy\+\_\+average (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__type}{diag\+\_\+type}}), intent(in)}]{diag,  }\item[{real, dimension(\+:,\+:,\+:), intent(in), target}]{field }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Post the horizontally area-\/averaged diagnostic. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag} & This diagnostic \\
\hline
\mbox{\texttt{ in}}  & {\em field} & Diagnostic field \\
\hline
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Diagnostics mediator control structure \\
\hline
\end{DoxyParams}


Definition at line 1816 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1817   \textcolor{keywordtype}{type}(diag\_type),   \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{ !< This diagnostic}}
\DoxyCodeLine{1818 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{target},   \textcolor{keywordtype}{intent(in)} :: field(:,:,:)\textcolor{comment}{ !< Diagnostic field}}
\DoxyCodeLine{1819   \textcolor{keywordtype}{type}(diag\_ctrl),   \textcolor{keywordtype}{intent(in)} :: diag\_cs\textcolor{comment}{ !< Diagnostics mediator control structure}}
\DoxyCodeLine{1820   \textcolor{comment}{! Local variable}}
\DoxyCodeLine{1821 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(field,3))} :: averaged\_field}
\DoxyCodeLine{1822   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{dimension(size(field,3))} :: averaged\_mask}
\DoxyCodeLine{1823   \textcolor{keywordtype}{logical} :: staggered\_in\_x, staggered\_in\_y, used}
\DoxyCodeLine{1824   \textcolor{keywordtype}{integer} :: nz, remap\_nz, coord}
\DoxyCodeLine{1825 }
\DoxyCodeLine{1826   \textcolor{keywordflow}{if} (.not. diag\_cs\%ave\_enabled) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1827     \textcolor{keywordflow}{return}}
\DoxyCodeLine{1828 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1829 }
\DoxyCodeLine{1830   staggered\_in\_x = diag\%axes\%is\_u\_point .or. diag\%axes\%is\_q\_point}
\DoxyCodeLine{1831   staggered\_in\_y = diag\%axes\%is\_v\_point .or. diag\%axes\%is\_q\_point}
\DoxyCodeLine{1832 }
\DoxyCodeLine{1833   \textcolor{keywordflow}{if} (diag\%axes\%is\_native) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1834     \textcolor{keyword}{call }horizontally\_average\_diag\_field(diag\_cs\%G, diag\_cs\%GV, diag\_cs\%h, \&}
\DoxyCodeLine{1835                                          staggered\_in\_x, staggered\_in\_y, \&}
\DoxyCodeLine{1836                                          diag\%axes\%is\_layer, diag\%v\_extensive, \&}
\DoxyCodeLine{1837                                          field, \&}
\DoxyCodeLine{1838                                          averaged\_field, averaged\_mask)}
\DoxyCodeLine{1839   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1840     nz = \textcolor{keyword}{size}(field, 3)}
\DoxyCodeLine{1841     coord = diag\%axes\%vertical\_coordinate\_number}
\DoxyCodeLine{1842     remap\_nz = diag\_cs\%diag\_remap\_cs(coord)\%nz}
\DoxyCodeLine{1843 }
\DoxyCodeLine{1844     \textcolor{keyword}{call }assert(diag\_cs\%diag\_remap\_cs(coord)\%initialized, \&}
\DoxyCodeLine{1845                 \textcolor{stringliteral}{'post\_xy\_average: remap\_cs not initialized.'})}
\DoxyCodeLine{1846 }
\DoxyCodeLine{1847     \textcolor{keyword}{call }assert(implies(diag\%axes\%is\_layer, nz == remap\_nz), \&}
\DoxyCodeLine{1848               \textcolor{stringliteral}{'post\_xy\_average: layer field dimension mismatch.'})}
\DoxyCodeLine{1849     \textcolor{keyword}{call }assert(implies(.not. diag\%axes\%is\_layer, nz == remap\_nz+1), \&}
\DoxyCodeLine{1850               \textcolor{stringliteral}{'post\_xy\_average: interface field dimension mismatch.'})}
\DoxyCodeLine{1851 }
\DoxyCodeLine{1852     \textcolor{keyword}{call }horizontally\_average\_diag\_field(diag\_cs\%G, diag\_cs\%GV, \&}
\DoxyCodeLine{1853                                          diag\_cs\%diag\_remap\_cs(coord)\%h, \&}
\DoxyCodeLine{1854                                          staggered\_in\_x, staggered\_in\_y, \&}
\DoxyCodeLine{1855                                          diag\%axes\%is\_layer, diag\%v\_extensive, \&}
\DoxyCodeLine{1856                                          field, \&}
\DoxyCodeLine{1857                                          averaged\_field, averaged\_mask)}
\DoxyCodeLine{1858 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1859 }
\DoxyCodeLine{1860   \textcolor{keywordflow}{if} (diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1861     \textcolor{keyword}{call }zchksum(averaged\_field, trim(diag\%debug\_str)//\textcolor{stringliteral}{'\_xyave'}, \&}
\DoxyCodeLine{1862                  logunit=diag\_cs\%chksum\_iounit)}
\DoxyCodeLine{1863   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1864     used = send\_data(diag\%fms\_xyave\_diag\_id, averaged\_field, diag\_cs\%time\_end, \&}
\DoxyCodeLine{1865                      weight=diag\_cs\%time\_int, mask=averaged\_mask)}
\DoxyCodeLine{1866 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a0be5d1cbc6c6f8f63950ce7d9bc6455a}\label{namespacemom__diag__mediator_a0be5d1cbc6c6f8f63950ce7d9bc6455a}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!query\_averaging\_enabled@{query\_averaging\_enabled}}
\index{query\_averaging\_enabled@{query\_averaging\_enabled}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{query\_averaging\_enabled()}{query\_averaging\_enabled()}}
{\footnotesize\ttfamily logical function, public mom\+\_\+diag\+\_\+mediator\+::query\+\_\+averaging\+\_\+enabled (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in)}]{diag\+\_\+cs,  }\item[{real, intent(out), optional}]{time\+\_\+int,  }\item[{type(time\+\_\+type), intent(out), optional}]{time\+\_\+end }\end{DoxyParamCaption})}



Call this subroutine to determine whether the averaging is currently enabled. .true. is returned if it is. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\mbox{\texttt{ out}}  & {\em time\+\_\+int} & Current setting of diagtime\+\_\+int \mbox{[}s\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em time\+\_\+end} & Current setting of diagtime\+\_\+end \\
\hline
\end{DoxyParams}


Definition at line 1915 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1916   \textcolor{keywordtype}{type}(diag\_ctrl),           \textcolor{keywordtype}{intent(in)}  :: diag\_CS\textcolor{comment}{  !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1917 \textcolor{keywordtype}{  real},            \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: time\_int\textcolor{comment}{ !< Current setting of diag\%time\_int [s]}}
\DoxyCodeLine{1918   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: time\_end\textcolor{comment}{ !< Current setting of diag\%time\_end}}
\DoxyCodeLine{1919   \textcolor{keywordtype}{logical} :: query\_averaging\_enabled}
\DoxyCodeLine{1920 }
\DoxyCodeLine{1921   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(time\_int)) time\_int = diag\_cs\%time\_int}
\DoxyCodeLine{1922   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(time\_end)) time\_end = diag\_cs\%time\_end}
\DoxyCodeLine{1923   query\_averaging\_enabled = diag\_cs\%ave\_enabled}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a820eb49d3acf041c630ce1373bef799e}\label{namespacemom__diag__mediator_a820eb49d3acf041c630ce1373bef799e}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!register\_cell\_measure@{register\_cell\_measure}}
\index{register\_cell\_measure@{register\_cell\_measure}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{register\_cell\_measure()}{register\_cell\_measure()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::register\+\_\+cell\+\_\+measure (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout), target}]{diag,  }\item[{type(time\+\_\+type), intent(in)}]{Time }\end{DoxyParamCaption})}



Sets a handle inside diagnostics mediator to associate 3d cell measures. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & Ocean grid structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag} & Regulates diagnostic output \\
\hline
\mbox{\texttt{ in}}  & {\em time} & Model time \\
\hline
\end{DoxyParams}


Definition at line 950 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{951   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{    !< Ocean grid structure}}
\DoxyCodeLine{952   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{ !< Regulates diagnostic output}}
\DoxyCodeLine{953   \textcolor{keywordtype}{type}(time\_type),         \textcolor{keywordtype}{intent(in)}    :: Time\textcolor{comment}{ !< Model time}}
\DoxyCodeLine{954   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{955   \textcolor{keywordtype}{integer} :: id}
\DoxyCodeLine{956   id = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'volcello'}, diag\%axesTL, \&}
\DoxyCodeLine{957                            time, \textcolor{stringliteral}{'Ocean grid-\/cell volume'}, \textcolor{stringliteral}{'m3'}, \&}
\DoxyCodeLine{958                            standard\_name=\textcolor{stringliteral}{'ocean\_volume'}, v\_extensive=.true., \&}
\DoxyCodeLine{959                            x\_cell\_method=\textcolor{stringliteral}{'sum'}, y\_cell\_method=\textcolor{stringliteral}{'sum'})}
\DoxyCodeLine{960   \textcolor{keyword}{call }diag\_associate\_volume\_cell\_measure(diag, id)}
\DoxyCodeLine{961 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ada491446bf7216fe101e6b0f6ed551e1}\label{namespacemom__diag__mediator_ada491446bf7216fe101e6b0f6ed551e1}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!register\_diag\_field@{register\_diag\_field}}
\index{register\_diag\_field@{register\_diag\_field}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{register\_diag\_field()}{register\_diag\_field()}}
{\footnotesize\ttfamily integer function, public mom\+\_\+diag\+\_\+mediator\+::register\+\_\+diag\+\_\+field (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{module\+\_\+name,  }\item[{character(len=$\ast$), intent(in)}]{field\+\_\+name,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), intent(in), target}]{axes\+\_\+in,  }\item[{type(time\+\_\+type), intent(in)}]{init\+\_\+time,  }\item[{character(len=$\ast$), intent(in), optional}]{long\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{real, intent(in), optional}]{missing\+\_\+value,  }\item[{real, dimension(2), intent(in), optional}]{range,  }\item[{logical, intent(in), optional}]{mask\+\_\+variant,  }\item[{character(len=$\ast$), intent(in), optional}]{standard\+\_\+name,  }\item[{logical, intent(in), optional}]{verbose,  }\item[{logical, intent(in), optional}]{do\+\_\+not\+\_\+log,  }\item[{character(len=$\ast$), intent(out), optional}]{err\+\_\+msg,  }\item[{character(len=$\ast$), intent(in), optional}]{interp\+\_\+method,  }\item[{integer, intent(in), optional}]{tile\+\_\+count,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+field\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+long\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+units,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+standard\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cell\+\_\+methods,  }\item[{character(len=$\ast$), intent(in), optional}]{x\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{y\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{v\+\_\+cell\+\_\+method,  }\item[{real, intent(in), optional}]{conversion,  }\item[{logical, intent(in), optional}]{v\+\_\+extensive }\end{DoxyParamCaption})}



Returns the \char`\"{}diag\+\_\+mediator\char`\"{} handle for a group (native, C\+M\+OR, z-\/coord, ...) of diagnostics derived from one field. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em module\+\_\+name} & Name of this module, usually \char`\"{}ocean\+\_\+model\char`\"{} or \char`\"{}ice\+\_\+shelf\+\_\+model\char`\"{} \\
\hline
\mbox{\texttt{ in}}  & {\em field\+\_\+name} & Name of the diagnostic field \\
\hline
\mbox{\texttt{ in}}  & {\em axes\+\_\+in} & Container w/ up to 3 integer handles that indicates axes for this field \\
\hline
\mbox{\texttt{ in}}  & {\em init\+\_\+time} & Time at which a field is first available? \\
\hline
\mbox{\texttt{ in}}  & {\em long\+\_\+name} & Long name of a field. \\
\hline
\mbox{\texttt{ in}}  & {\em units} & Units of a field. \\
\hline
\mbox{\texttt{ in}}  & {\em standard\+\_\+name} & Standardized name associated with a field \\
\hline
\mbox{\texttt{ in}}  & {\em missing\+\_\+value} & A value that indicates missing values. \\
\hline
\mbox{\texttt{ in}}  & {\em range} & Valid range of a variable (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em mask\+\_\+variant} & If true a logical mask must be provided with \mbox{\hyperlink{interfacemom__diag__mediator_1_1post__data}{post\+\_\+data}} calls (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em verbose} & If true, F\+MS is verbose (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em do\+\_\+not\+\_\+log} & If true, do not log something (not used in M\+OM?) \\
\hline
\mbox{\texttt{ out}}  & {\em err\+\_\+msg} & String into which an error message might be placed (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em interp\+\_\+method} & If \textquotesingle{}none\textquotesingle{} indicates the field should not be interpolated as a scalar \\
\hline
\mbox{\texttt{ in}}  & {\em tile\+\_\+count} & no clue (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+field\+\_\+name} & C\+M\+OR name of a field \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+long\+\_\+name} & C\+M\+OR long name of a field \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+units} & C\+M\+OR units of a field \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+standard\+\_\+name} & C\+M\+OR standardized name associated with a field \\
\hline
\mbox{\texttt{ in}}  & {\em cell\+\_\+methods} & String to append as cell\+\_\+methods attribute. Use \textquotesingle{}\textquotesingle{} to have no attribute. If present, this overrides the default constructed from the default for each individual axis direction. \\
\hline
\mbox{\texttt{ in}}  & {\em x\+\_\+cell\+\_\+method} & Specifies the cell method for the x-\/direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em y\+\_\+cell\+\_\+method} & Specifies the cell method for the y-\/direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em v\+\_\+cell\+\_\+method} & Specifies the cell method for the vertical direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em conversion} & A value to multiply data by before writing to file \\
\hline
\mbox{\texttt{ in}}  & {\em v\+\_\+extensive} & True for vertically extensive fields (vertically integrated). Default/absent for intensive. \\
\hline
\end{DoxyParams}


Definition at line 1939 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1944   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: module\_name\textcolor{comment}{ !< Name of this module, usually "ocean\_model"}}
\DoxyCodeLine{1945 \textcolor{comment}{                                              !! or "ice\_shelf\_model"}}
\DoxyCodeLine{1946   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: field\_name\textcolor{comment}{ !< Name of the diagnostic field}}
\DoxyCodeLine{1947   \textcolor{keywordtype}{type}(axes\_grp), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: axes\_in\textcolor{comment}{ !< Container w/ up to 3 integer handles that}}
\DoxyCodeLine{1948 \textcolor{comment}{                                             !! indicates axes for this field}}
\DoxyCodeLine{1949   \textcolor{keywordtype}{type}(time\_type),  \textcolor{keywordtype}{intent(in)} :: init\_time\textcolor{comment}{ !< Time at which a field is first available?}}
\DoxyCodeLine{1950   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: long\_name\textcolor{comment}{ !< Long name of a field.}}
\DoxyCodeLine{1951   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{ !< Units of a field.}}
\DoxyCodeLine{1952   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: standard\_name\textcolor{comment}{ !< Standardized name associated with a field}}
\DoxyCodeLine{1953 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: missing\_value\textcolor{comment}{ !< A value that indicates missing values.}}
\DoxyCodeLine{1954 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: range(2)\textcolor{comment}{ !< Valid range of a variable (not used in MOM?)}}
\DoxyCodeLine{1955   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: mask\_variant\textcolor{comment}{ !< If true a logical mask must be provided with}}
\DoxyCodeLine{1956 \textcolor{comment}{                                                         !! post\_data calls (not used in MOM?)}}
\DoxyCodeLine{1957   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: verbose\textcolor{comment}{ !< If true, FMS is verbose (not used in MOM?)}}
\DoxyCodeLine{1958   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: do\_not\_log\textcolor{comment}{ !< If true, do not log something (not used in MOM?)}}
\DoxyCodeLine{1959   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}:: err\_msg\textcolor{comment}{ !< String into which an error message might be}}
\DoxyCodeLine{1960 \textcolor{comment}{                                                         !! placed (not used in MOM?)}}
\DoxyCodeLine{1961   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: interp\_method\textcolor{comment}{ !< If 'none' indicates the field should not}}
\DoxyCodeLine{1962 \textcolor{comment}{                                                         !! be interpolated as a scalar}}
\DoxyCodeLine{1963   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: tile\_count\textcolor{comment}{ !< no clue (not used in MOM?)}}
\DoxyCodeLine{1964   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_field\_name\textcolor{comment}{ !< CMOR name of a field}}
\DoxyCodeLine{1965   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_long\_name\textcolor{comment}{ !< CMOR long name of a field}}
\DoxyCodeLine{1966   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_units\textcolor{comment}{ !< CMOR units of a field}}
\DoxyCodeLine{1967   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_standard\_name\textcolor{comment}{ !< CMOR standardized name associated with a field}}
\DoxyCodeLine{1968   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cell\_methods\textcolor{comment}{ !< String to append as cell\_methods attribute. Use '' to}}
\DoxyCodeLine{1969 \textcolor{comment}{                                                         !! have no attribute.  If present, this overrides the}}
\DoxyCodeLine{1970 \textcolor{comment}{                                                         !! default constructed from the default for}}
\DoxyCodeLine{1971 \textcolor{comment}{                                                         !! each individual axis direction.}}
\DoxyCodeLine{1972   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: x\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the x-\/direction.}}
\DoxyCodeLine{1973 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{1974   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: y\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the y-\/direction.}}
\DoxyCodeLine{1975 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{1976   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: v\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the vertical direction.}}
\DoxyCodeLine{1977 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{1978 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: conversion\textcolor{comment}{ !< A value to multiply data by before writing to file}}
\DoxyCodeLine{1979   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: v\_extensive\textcolor{comment}{ !< True for vertically extensive fields (vertically}}
\DoxyCodeLine{1980 \textcolor{comment}{                                                         !! integrated). Default/absent for intensive.}}
\DoxyCodeLine{1981   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1982 \textcolor{keywordtype}{  real} :: MOM\_missing\_value}
\DoxyCodeLine{1983   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{pointer} :: diag\_cs => null()}
\DoxyCodeLine{1984   \textcolor{keywordtype}{type}(axes\_grp), \textcolor{keywordtype}{pointer} :: remap\_axes => null()}
\DoxyCodeLine{1985   \textcolor{keywordtype}{type}(axes\_grp), \textcolor{keywordtype}{pointer} :: axes => null()}
\DoxyCodeLine{1986   \textcolor{keywordtype}{integer} :: dm\_id, i, dl}
\DoxyCodeLine{1987   \textcolor{keywordtype}{character(len=256)} :: new\_module\_name}
\DoxyCodeLine{1988   \textcolor{keywordtype}{logical} :: active}
\DoxyCodeLine{1989 }
\DoxyCodeLine{1990   axes => axes\_in}
\DoxyCodeLine{1991   mom\_missing\_value = axes\%diag\_cs\%missing\_value}
\DoxyCodeLine{1992   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(missing\_value)) mom\_missing\_value = missing\_value}
\DoxyCodeLine{1993 }
\DoxyCodeLine{1994   diag\_cs => axes\%diag\_cs}
\DoxyCodeLine{1995   dm\_id = -\/1}
\DoxyCodeLine{1996 }
\DoxyCodeLine{1997   \textcolor{keywordflow}{if} (axes\_in\%id == diag\_cs\%axesTL\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1998      axes => diag\_cs\%axesTL}
\DoxyCodeLine{1999   \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesBL\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2000      axes => diag\_cs\%axesBL}
\DoxyCodeLine{2001   \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCuL\%id ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2002      axes => diag\_cs\%axesCuL}
\DoxyCodeLine{2003   \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCvL\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2004      axes => diag\_cs\%axesCvL}
\DoxyCodeLine{2005   \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesTi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2006      axes => diag\_cs\%axesTi}
\DoxyCodeLine{2007   \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesBi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2008      axes => diag\_cs\%axesBi}
\DoxyCodeLine{2009   \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCui\%id ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2010      axes => diag\_cs\%axesCui}
\DoxyCodeLine{2011   \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCvi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2012      axes => diag\_cs\%axesCvi}
\DoxyCodeLine{2013 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2014 }
\DoxyCodeLine{2015   \textcolor{comment}{! Register the native diagnostic}}
\DoxyCodeLine{2016   active = register\_diag\_field\_expand\_cmor(dm\_id, module\_name, field\_name, axes, \&}
\DoxyCodeLine{2017              init\_time, long\_name=long\_name, units=units, missing\_value=mom\_missing\_value, \&}
\DoxyCodeLine{2018              range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2019              verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2020              interp\_method=interp\_method, tile\_count=tile\_count, \&}
\DoxyCodeLine{2021              cmor\_field\_name=cmor\_field\_name, cmor\_long\_name=cmor\_long\_name, \&}
\DoxyCodeLine{2022              cmor\_units=cmor\_units, cmor\_standard\_name=cmor\_standard\_name, \&}
\DoxyCodeLine{2023              cell\_methods=cell\_methods, x\_cell\_method=x\_cell\_method, \&}
\DoxyCodeLine{2024              y\_cell\_method=y\_cell\_method, v\_cell\_method=v\_cell\_method, \&}
\DoxyCodeLine{2025              conversion=conversion, v\_extensive=v\_extensive)}
\DoxyCodeLine{2026 }
\DoxyCodeLine{2027   \textcolor{comment}{! For each diagnostic coordinate register the diagnostic again under a different module name}}
\DoxyCodeLine{2028   \textcolor{keywordflow}{do} i=1,diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{2029     new\_module\_name = trim(module\_name)//\textcolor{stringliteral}{'\_'}//trim(diag\_cs\%diag\_remap\_cs(i)\%diag\_module\_suffix)}
\DoxyCodeLine{2030 }
\DoxyCodeLine{2031     \textcolor{comment}{! Register diagnostics remapped to z vertical coordinate}}
\DoxyCodeLine{2032     \textcolor{keywordflow}{if} (axes\_in\%rank == 3) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2033       remap\_axes => null()}
\DoxyCodeLine{2034       \textcolor{keywordflow}{if} ((axes\_in\%id == diag\_cs\%axesTL\%id)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2035           remap\_axes => diag\_cs\%remap\_axesTL(i)}
\DoxyCodeLine{2036       \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesBL\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2037           remap\_axes => diag\_cs\%remap\_axesBL(i)}
\DoxyCodeLine{2038       \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCuL\%id ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2039           remap\_axes => diag\_cs\%remap\_axesCuL(i)}
\DoxyCodeLine{2040       \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCvL\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2041           remap\_axes => diag\_cs\%remap\_axesCvL(i)}
\DoxyCodeLine{2042       \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesTi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2043           remap\_axes => diag\_cs\%remap\_axesTi(i)}
\DoxyCodeLine{2044       \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesBi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2045           remap\_axes => diag\_cs\%remap\_axesBi(i)}
\DoxyCodeLine{2046       \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCui\%id ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2047           remap\_axes => diag\_cs\%remap\_axesCui(i)}
\DoxyCodeLine{2048       \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCvi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2049           remap\_axes => diag\_cs\%remap\_axesCvi(i)}
\DoxyCodeLine{2050 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2051       \textcolor{comment}{! When the MOM\_diag\_to\_Z module has been obsoleted we can assume remap\_axes will}}
\DoxyCodeLine{2052       \textcolor{comment}{! always exist but in the mean-\/time we have to do this check:}}
\DoxyCodeLine{2053       \textcolor{comment}{! call assert(associated(remap\_axes), 'register\_diag\_field: remap\_axes not set')}}
\DoxyCodeLine{2054       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(remap\_axes)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2055         \textcolor{keywordflow}{if} (remap\_axes\%needs\_remapping .or. remap\_axes\%needs\_interpolating) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2056           active = register\_diag\_field\_expand\_cmor(dm\_id, new\_module\_name, field\_name, remap\_axes, \&}
\DoxyCodeLine{2057                      init\_time, long\_name=long\_name, units=units, missing\_value=mom\_missing\_value, \&}
\DoxyCodeLine{2058                      range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2059                      verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2060                      interp\_method=interp\_method, tile\_count=tile\_count, \&}
\DoxyCodeLine{2061                      cmor\_field\_name=cmor\_field\_name, cmor\_long\_name=cmor\_long\_name, \&}
\DoxyCodeLine{2062                      cmor\_units=cmor\_units, cmor\_standard\_name=cmor\_standard\_name, \&}
\DoxyCodeLine{2063                      cell\_methods=cell\_methods, x\_cell\_method=x\_cell\_method, \&}
\DoxyCodeLine{2064                      y\_cell\_method=y\_cell\_method, v\_cell\_method=v\_cell\_method, \&}
\DoxyCodeLine{2065                      conversion=conversion, v\_extensive=v\_extensive)}
\DoxyCodeLine{2066           \textcolor{keywordflow}{if} (active) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2067             \textcolor{keyword}{call }diag\_remap\_set\_active(diag\_cs\%diag\_remap\_cs(i))}
\DoxyCodeLine{2068 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{2069 \textcolor{keywordflow}{        endif} \textcolor{comment}{! remap\_axes\%needs\_remapping}}
\DoxyCodeLine{2070 \textcolor{keywordflow}{      endif} \textcolor{comment}{! associated(remap\_axes)}}
\DoxyCodeLine{2071 \textcolor{keywordflow}{    endif} \textcolor{comment}{! axes\%rank == 3}}
\DoxyCodeLine{2072 \textcolor{keywordflow}{  enddo} \textcolor{comment}{! i}}
\DoxyCodeLine{2073 }
\DoxyCodeLine{2074   \textcolor{comment}{!Register downsampled diagnostics}}
\DoxyCodeLine{2075   \textcolor{keywordflow}{do} dl=2,max\_dsamp\_lev}
\DoxyCodeLine{2076      \textcolor{comment}{! Do not attempt to checksum the downsampled diagnostics}}
\DoxyCodeLine{2077      \textcolor{keywordflow}{if} (diag\_cs\%diag\_as\_chksum) cycle}
\DoxyCodeLine{2078 }
\DoxyCodeLine{2079      new\_module\_name = trim(module\_name)//\textcolor{stringliteral}{'\_d2'}}
\DoxyCodeLine{2080 }
\DoxyCodeLine{2081      \textcolor{keywordflow}{if} (axes\_in\%rank == 3 .or. axes\_in\%rank == 2 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2082         axes => null()}
\DoxyCodeLine{2083         \textcolor{keywordflow}{if} (axes\_in\%id == diag\_cs\%axesTL\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2084            axes => diag\_cs\%dsamp(dl)\%axesTL}
\DoxyCodeLine{2085         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesBL\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2086            axes => diag\_cs\%dsamp(dl)\%axesBL}
\DoxyCodeLine{2087         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCuL\%id ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2088            axes => diag\_cs\%dsamp(dl)\%axesCuL}
\DoxyCodeLine{2089         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCvL\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2090            axes => diag\_cs\%dsamp(dl)\%axesCvL}
\DoxyCodeLine{2091         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesTi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2092            axes => diag\_cs\%dsamp(dl)\%axesTi}
\DoxyCodeLine{2093         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesBi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2094            axes => diag\_cs\%dsamp(dl)\%axesBi}
\DoxyCodeLine{2095         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCui\%id ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2096            axes => diag\_cs\%dsamp(dl)\%axesCui}
\DoxyCodeLine{2097         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCvi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2098            axes => diag\_cs\%dsamp(dl)\%axesCvi}
\DoxyCodeLine{2099         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesT1\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2100            axes => diag\_cs\%dsamp(dl)\%axesT1}
\DoxyCodeLine{2101         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesB1\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2102            axes => diag\_cs\%dsamp(dl)\%axesB1}
\DoxyCodeLine{2103         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCu1\%id ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2104            axes => diag\_cs\%dsamp(dl)\%axesCu1}
\DoxyCodeLine{2105         \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCv1\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2106            axes => diag\_cs\%dsamp(dl)\%axesCv1}
\DoxyCodeLine{2107         \textcolor{keywordflow}{else}}
\DoxyCodeLine{2108            \textcolor{comment}{!Niki: Should we worry about these, e.g., diag\_to\_Z\_CS?}}
\DoxyCodeLine{2109            \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"register\_diag\_field: Could not find a proper axes for "} \&}
\DoxyCodeLine{2110                 //trim( new\_module\_name)//\textcolor{stringliteral}{"-\/"}//trim(field\_name))}
\DoxyCodeLine{2111 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2112 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{2113      \textcolor{comment}{! Register the native diagnostic}}
\DoxyCodeLine{2114      \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(axes)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2115      active = register\_diag\_field\_expand\_cmor(dm\_id, new\_module\_name, field\_name, axes, \&}
\DoxyCodeLine{2116                 init\_time, long\_name=long\_name, units=units, missing\_value=mom\_missing\_value, \&}
\DoxyCodeLine{2117                 range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2118                 verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2119                 interp\_method=interp\_method, tile\_count=tile\_count, \&}
\DoxyCodeLine{2120                 cmor\_field\_name=cmor\_field\_name, cmor\_long\_name=cmor\_long\_name, \&}
\DoxyCodeLine{2121                 cmor\_units=cmor\_units, cmor\_standard\_name=cmor\_standard\_name, \&}
\DoxyCodeLine{2122                 cell\_methods=cell\_methods, x\_cell\_method=x\_cell\_method, \&}
\DoxyCodeLine{2123                 y\_cell\_method=y\_cell\_method, v\_cell\_method=v\_cell\_method, \&}
\DoxyCodeLine{2124                 conversion=conversion, v\_extensive=v\_extensive)}
\DoxyCodeLine{2125 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{2126 }
\DoxyCodeLine{2127      \textcolor{comment}{! For each diagnostic coordinate register the diagnostic again under a different module name}}
\DoxyCodeLine{2128      \textcolor{keywordflow}{do} i=1,diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{2129         new\_module\_name = trim(module\_name)//\textcolor{stringliteral}{'\_'}//trim(diag\_cs\%diag\_remap\_cs(i)\%diag\_module\_suffix)//\textcolor{stringliteral}{'\_d2'}}
\DoxyCodeLine{2130 }
\DoxyCodeLine{2131         \textcolor{comment}{! Register diagnostics remapped to z vertical coordinate}}
\DoxyCodeLine{2132         \textcolor{keywordflow}{if} (axes\_in\%rank == 3) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2133            remap\_axes => null()}
\DoxyCodeLine{2134            \textcolor{keywordflow}{if} ((axes\_in\%id == diag\_cs\%axesTL\%id)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2135               remap\_axes => diag\_cs\%dsamp(dl)\%remap\_axesTL(i)}
\DoxyCodeLine{2136            \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesBL\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2137               remap\_axes => diag\_cs\%dsamp(dl)\%remap\_axesBL(i)}
\DoxyCodeLine{2138            \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCuL\%id ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2139               remap\_axes => diag\_cs\%dsamp(dl)\%remap\_axesCuL(i)}
\DoxyCodeLine{2140            \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCvL\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2141               remap\_axes => diag\_cs\%dsamp(dl)\%remap\_axesCvL(i)}
\DoxyCodeLine{2142            \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesTi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2143               remap\_axes => diag\_cs\%dsamp(dl)\%remap\_axesTi(i)}
\DoxyCodeLine{2144            \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesBi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2145               remap\_axes => diag\_cs\%dsamp(dl)\%remap\_axesBi(i)}
\DoxyCodeLine{2146            \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCui\%id ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2147               remap\_axes => diag\_cs\%dsamp(dl)\%remap\_axesCui(i)}
\DoxyCodeLine{2148            \textcolor{keywordflow}{elseif} (axes\_in\%id == diag\_cs\%axesCvi\%id) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2149               remap\_axes => diag\_cs\%dsamp(dl)\%remap\_axesCvi(i)}
\DoxyCodeLine{2150 \textcolor{keywordflow}{           endif}}
\DoxyCodeLine{2151 }
\DoxyCodeLine{2152            \textcolor{comment}{! When the MOM\_diag\_to\_Z module has been obsoleted we can assume remap\_axes will}}
\DoxyCodeLine{2153            \textcolor{comment}{! always exist but in the mean-\/time we have to do this check:}}
\DoxyCodeLine{2154            \textcolor{comment}{! call assert(associated(remap\_axes), 'register\_diag\_field: remap\_axes not set')}}
\DoxyCodeLine{2155            \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(remap\_axes)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2156               \textcolor{keywordflow}{if} (remap\_axes\%needs\_remapping .or. remap\_axes\%needs\_interpolating) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2157                  active = register\_diag\_field\_expand\_cmor(dm\_id, new\_module\_name, field\_name, remap\_axes, \&}
\DoxyCodeLine{2158                       init\_time, long\_name=long\_name, units=units, missing\_value=mom\_missing\_value, \&}
\DoxyCodeLine{2159                       range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2160                       verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2161                       interp\_method=interp\_method, tile\_count=tile\_count, \&}
\DoxyCodeLine{2162                       cmor\_field\_name=cmor\_field\_name, cmor\_long\_name=cmor\_long\_name, \&}
\DoxyCodeLine{2163                       cmor\_units=cmor\_units, cmor\_standard\_name=cmor\_standard\_name, \&}
\DoxyCodeLine{2164                       cell\_methods=cell\_methods, x\_cell\_method=x\_cell\_method, \&}
\DoxyCodeLine{2165                       y\_cell\_method=y\_cell\_method, v\_cell\_method=v\_cell\_method, \&}
\DoxyCodeLine{2166                       conversion=conversion, v\_extensive=v\_extensive)}
\DoxyCodeLine{2167                  \textcolor{keywordflow}{if} (active) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2168                     \textcolor{keyword}{call }diag\_remap\_set\_active(diag\_cs\%diag\_remap\_cs(i))}
\DoxyCodeLine{2169 \textcolor{keywordflow}{                 endif}}
\DoxyCodeLine{2170 \textcolor{keywordflow}{              endif} \textcolor{comment}{! remap\_axes\%needs\_remapping}}
\DoxyCodeLine{2171 \textcolor{keywordflow}{           endif} \textcolor{comment}{! associated(remap\_axes)}}
\DoxyCodeLine{2172 \textcolor{keywordflow}{        endif} \textcolor{comment}{! axes\%rank == 3}}
\DoxyCodeLine{2173 \textcolor{keywordflow}{     enddo} \textcolor{comment}{! i}}
\DoxyCodeLine{2174 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{2175 }
\DoxyCodeLine{2176   register\_diag\_field = dm\_id}
\DoxyCodeLine{2177 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_aca4a32fea8dade9f51e076a56b9bad2b}\label{namespacemom__diag__mediator_aca4a32fea8dade9f51e076a56b9bad2b}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!register\_diag\_field\_expand\_axes@{register\_diag\_field\_expand\_axes}}
\index{register\_diag\_field\_expand\_axes@{register\_diag\_field\_expand\_axes}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{register\_diag\_field\_expand\_axes()}{register\_diag\_field\_expand\_axes()}}
{\footnotesize\ttfamily integer function mom\+\_\+diag\+\_\+mediator\+::register\+\_\+diag\+\_\+field\+\_\+expand\+\_\+axes (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{module\+\_\+name,  }\item[{character(len=$\ast$), intent(in)}]{field\+\_\+name,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), intent(in), target}]{axes,  }\item[{type(time\+\_\+type), intent(in)}]{init\+\_\+time,  }\item[{character(len=$\ast$), intent(in), optional}]{long\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{real, intent(in), optional}]{missing\+\_\+value,  }\item[{real, dimension(2), intent(in), optional}]{range,  }\item[{logical, intent(in), optional}]{mask\+\_\+variant,  }\item[{character(len=$\ast$), intent(in), optional}]{standard\+\_\+name,  }\item[{logical, intent(in), optional}]{verbose,  }\item[{logical, intent(in), optional}]{do\+\_\+not\+\_\+log,  }\item[{character(len=$\ast$), intent(out), optional}]{err\+\_\+msg,  }\item[{character(len=$\ast$), intent(in), optional}]{interp\+\_\+method,  }\item[{integer, intent(in), optional}]{tile\+\_\+count }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Returns an F\+MS id from register\+\_\+diag\+\_\+field\+\_\+fms (the diag\+\_\+manager routine) after expanding axes (axes-\/group) into handles and conditionally adding an F\+MS area\+\_\+id for cell\+\_\+measures. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em module\+\_\+name} & Name of this module, usually \char`\"{}ocean\+\_\+model\char`\"{} or \char`\"{}ice\+\_\+shelf\+\_\+model\char`\"{} \\
\hline
\mbox{\texttt{ in}}  & {\em field\+\_\+name} & Name of the diagnostic field \\
\hline
\mbox{\texttt{ in}}  & {\em axes} & Container w/ up to 3 integer handles that indicates axes for this field \\
\hline
\mbox{\texttt{ in}}  & {\em init\+\_\+time} & Time at which a field is first available? \\
\hline
\mbox{\texttt{ in}}  & {\em long\+\_\+name} & Long name of a field. \\
\hline
\mbox{\texttt{ in}}  & {\em units} & Units of a field. \\
\hline
\mbox{\texttt{ in}}  & {\em standard\+\_\+name} & Standardized name associated with a field \\
\hline
\mbox{\texttt{ in}}  & {\em missing\+\_\+value} & A value that indicates missing values. \\
\hline
\mbox{\texttt{ in}}  & {\em range} & Valid range of a variable (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em mask\+\_\+variant} & If true a logical mask must be provided with \mbox{\hyperlink{interfacemom__diag__mediator_1_1post__data}{post\+\_\+data}} calls (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em verbose} & If true, F\+MS is verbose (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em do\+\_\+not\+\_\+log} & If true, do not log something (not used in M\+OM?) \\
\hline
\mbox{\texttt{ out}}  & {\em err\+\_\+msg} & String into which an error message might be placed (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em interp\+\_\+method} & If \textquotesingle{}none\textquotesingle{} indicates the field should not be interpolated as a scalar \\
\hline
\mbox{\texttt{ in}}  & {\em tile\+\_\+count} & no clue (not used in M\+OM?) \\
\hline
\end{DoxyParams}


Definition at line 2349 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2352   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: module\_name\textcolor{comment}{ !< Name of this module, usually "ocean\_model"}}
\DoxyCodeLine{2353 \textcolor{comment}{                                              !! or "ice\_shelf\_model"}}
\DoxyCodeLine{2354   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: field\_name\textcolor{comment}{ !< Name of the diagnostic field}}
\DoxyCodeLine{2355   \textcolor{keywordtype}{type}(axes\_grp), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: axes\textcolor{comment}{ !< Container w/ up to 3 integer handles that indicates}}
\DoxyCodeLine{2356 \textcolor{comment}{                                             !! axes for this field}}
\DoxyCodeLine{2357   \textcolor{keywordtype}{type}(time\_type),  \textcolor{keywordtype}{intent(in)} :: init\_time\textcolor{comment}{ !< Time at which a field is first available?}}
\DoxyCodeLine{2358   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: long\_name\textcolor{comment}{ !< Long name of a field.}}
\DoxyCodeLine{2359   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{ !< Units of a field.}}
\DoxyCodeLine{2360   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: standard\_name\textcolor{comment}{ !< Standardized name associated with a field}}
\DoxyCodeLine{2361 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: missing\_value\textcolor{comment}{ !< A value that indicates missing values.}}
\DoxyCodeLine{2362 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: range(2)\textcolor{comment}{ !< Valid range of a variable (not used in MOM?)}}
\DoxyCodeLine{2363   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: mask\_variant\textcolor{comment}{ !< If true a logical mask must be provided}}
\DoxyCodeLine{2364 \textcolor{comment}{                                                         !! with post\_data calls (not used in MOM?)}}
\DoxyCodeLine{2365   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: verbose\textcolor{comment}{ !< If true, FMS is verbose (not used in MOM?)}}
\DoxyCodeLine{2366   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: do\_not\_log\textcolor{comment}{ !< If true, do not log something}}
\DoxyCodeLine{2367 \textcolor{comment}{                                                       !! (not used in MOM?)}}
\DoxyCodeLine{2368   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}:: err\_msg\textcolor{comment}{ !< String into which an error message might be}}
\DoxyCodeLine{2369 \textcolor{comment}{                                                         !! placed (not used in MOM?)}}
\DoxyCodeLine{2370   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: interp\_method\textcolor{comment}{ !< If 'none' indicates the field should}}
\DoxyCodeLine{2371 \textcolor{comment}{                                                         !! not be interpolated as a scalar}}
\DoxyCodeLine{2372   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: tile\_count\textcolor{comment}{ !< no clue (not used in MOM?)}}
\DoxyCodeLine{2373   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{2374   \textcolor{keywordtype}{integer} :: fms\_id, area\_id, volume\_id}
\DoxyCodeLine{2375 }
\DoxyCodeLine{2376   \textcolor{comment}{! This gets the cell area associated with the grid location of this variable}}
\DoxyCodeLine{2377   area\_id = axes\%id\_area}
\DoxyCodeLine{2378   volume\_id = axes\%id\_volume}
\DoxyCodeLine{2379 }
\DoxyCodeLine{2380   \textcolor{comment}{! Get the FMS diagnostic id}}
\DoxyCodeLine{2381   \textcolor{keywordflow}{if} (axes\%diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2382     fms\_id = axes\%diag\_cs\%num\_chksum\_diags + 1}
\DoxyCodeLine{2383     axes\%diag\_cs\%num\_chksum\_diags = fms\_id}
\DoxyCodeLine{2384   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(interp\_method) .or. axes\%is\_h\_point) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2385     \textcolor{comment}{! If interp\_method is provided we must use it}}
\DoxyCodeLine{2386     \textcolor{keywordflow}{if} (area\_id>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2387       \textcolor{keywordflow}{if} (volume\_id>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2388         fms\_id = register\_diag\_field\_fms(module\_name, field\_name, axes\%handles, \&}
\DoxyCodeLine{2389                  init\_time, long\_name=long\_name, units=units, missing\_value=missing\_value, \&}
\DoxyCodeLine{2390                  range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2391                  verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2392                  interp\_method=interp\_method, tile\_count=tile\_count, area=area\_id, volume=volume\_id)}
\DoxyCodeLine{2393       \textcolor{keywordflow}{else}}
\DoxyCodeLine{2394         fms\_id = register\_diag\_field\_fms(module\_name, field\_name, axes\%handles, \&}
\DoxyCodeLine{2395                  init\_time, long\_name=long\_name, units=units, missing\_value=missing\_value, \&}
\DoxyCodeLine{2396                  range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2397                  verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2398                  interp\_method=interp\_method, tile\_count=tile\_count, area=area\_id)}
\DoxyCodeLine{2399 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2400     \textcolor{keywordflow}{else}}
\DoxyCodeLine{2401       \textcolor{keywordflow}{if} (volume\_id>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2402         fms\_id = register\_diag\_field\_fms(module\_name, field\_name, axes\%handles, \&}
\DoxyCodeLine{2403                  init\_time, long\_name=long\_name, units=units, missing\_value=missing\_value, \&}
\DoxyCodeLine{2404                  range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2405                  verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2406                  interp\_method=interp\_method, tile\_count=tile\_count, volume=volume\_id)}
\DoxyCodeLine{2407       \textcolor{keywordflow}{else}}
\DoxyCodeLine{2408         fms\_id = register\_diag\_field\_fms(module\_name, field\_name, axes\%handles, \&}
\DoxyCodeLine{2409                  init\_time, long\_name=long\_name, units=units, missing\_value=missing\_value, \&}
\DoxyCodeLine{2410                  range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2411                  verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2412                  interp\_method=interp\_method, tile\_count=tile\_count)}
\DoxyCodeLine{2413 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2414 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2415   \textcolor{keywordflow}{else}}
\DoxyCodeLine{2416     \textcolor{comment}{! If interp\_method is not provided and the field is not at an h-\/point then interp\_method='none'}}
\DoxyCodeLine{2417     \textcolor{keywordflow}{if} (area\_id>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2418       \textcolor{keywordflow}{if} (volume\_id>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2419         fms\_id = register\_diag\_field\_fms(module\_name, field\_name, axes\%handles, \&}
\DoxyCodeLine{2420                  init\_time, long\_name=long\_name, units=units, missing\_value=missing\_value, \&}
\DoxyCodeLine{2421                  range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2422                  verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2423                  interp\_method=\textcolor{stringliteral}{'none'}, tile\_count=tile\_count, area=area\_id, volume=volume\_id)}
\DoxyCodeLine{2424       \textcolor{keywordflow}{else}}
\DoxyCodeLine{2425         fms\_id = register\_diag\_field\_fms(module\_name, field\_name, axes\%handles, \&}
\DoxyCodeLine{2426                  init\_time, long\_name=long\_name, units=units, missing\_value=missing\_value, \&}
\DoxyCodeLine{2427                  range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2428                  verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2429                  interp\_method=\textcolor{stringliteral}{'none'}, tile\_count=tile\_count, area=area\_id)}
\DoxyCodeLine{2430 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2431     \textcolor{keywordflow}{else}}
\DoxyCodeLine{2432       \textcolor{keywordflow}{if} (volume\_id>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2433         fms\_id = register\_diag\_field\_fms(module\_name, field\_name, axes\%handles, \&}
\DoxyCodeLine{2434                  init\_time, long\_name=long\_name, units=units, missing\_value=missing\_value, \&}
\DoxyCodeLine{2435                  range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2436                  verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2437                  interp\_method=\textcolor{stringliteral}{'none'}, tile\_count=tile\_count, volume=volume\_id)}
\DoxyCodeLine{2438       \textcolor{keywordflow}{else}}
\DoxyCodeLine{2439         fms\_id = register\_diag\_field\_fms(module\_name, field\_name, axes\%handles, \&}
\DoxyCodeLine{2440                  init\_time, long\_name=long\_name, units=units, missing\_value=missing\_value, \&}
\DoxyCodeLine{2441                  range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2442                  verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2443                  interp\_method=\textcolor{stringliteral}{'none'}, tile\_count=tile\_count)}
\DoxyCodeLine{2444 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2445 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2446 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2447 }
\DoxyCodeLine{2448   register\_diag\_field\_expand\_axes = fms\_id}
\DoxyCodeLine{2449 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ae50b35cba800ac5fd8975929fd2b9f4a}\label{namespacemom__diag__mediator_ae50b35cba800ac5fd8975929fd2b9f4a}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!register\_diag\_field\_expand\_cmor@{register\_diag\_field\_expand\_cmor}}
\index{register\_diag\_field\_expand\_cmor@{register\_diag\_field\_expand\_cmor}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{register\_diag\_field\_expand\_cmor()}{register\_diag\_field\_expand\_cmor()}}
{\footnotesize\ttfamily logical function mom\+\_\+diag\+\_\+mediator\+::register\+\_\+diag\+\_\+field\+\_\+expand\+\_\+cmor (\begin{DoxyParamCaption}\item[{integer, intent(inout)}]{dm\+\_\+id,  }\item[{character(len=$\ast$), intent(in)}]{module\+\_\+name,  }\item[{character(len=$\ast$), intent(in)}]{field\+\_\+name,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), intent(in), target}]{axes,  }\item[{type(time\+\_\+type), intent(in)}]{init\+\_\+time,  }\item[{character(len=$\ast$), intent(in), optional}]{long\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{real, intent(in), optional}]{missing\+\_\+value,  }\item[{real, dimension(2), intent(in), optional}]{range,  }\item[{logical, intent(in), optional}]{mask\+\_\+variant,  }\item[{character(len=$\ast$), intent(in), optional}]{standard\+\_\+name,  }\item[{logical, intent(in), optional}]{verbose,  }\item[{logical, intent(in), optional}]{do\+\_\+not\+\_\+log,  }\item[{character(len=$\ast$), intent(out), optional}]{err\+\_\+msg,  }\item[{character(len=$\ast$), intent(in), optional}]{interp\+\_\+method,  }\item[{integer, intent(in), optional}]{tile\+\_\+count,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+field\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+long\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+units,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+standard\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cell\+\_\+methods,  }\item[{character(len=$\ast$), intent(in), optional}]{x\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{y\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{v\+\_\+cell\+\_\+method,  }\item[{real, intent(in), optional}]{conversion,  }\item[{logical, intent(in), optional}]{v\+\_\+extensive }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Returns True if either the native or C\+M\+Or version of the diagnostic were registered. Updates \textquotesingle{}dm\+\_\+id\textquotesingle{} after calling \mbox{\hyperlink{namespacemom__diag__mediator_aca4a32fea8dade9f51e076a56b9bad2b}{register\+\_\+diag\+\_\+field\+\_\+expand\+\_\+axes()}} for both native and C\+M\+OR variants of the field. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em dm\+\_\+id} & The diag\+\_\+mediator ID for this diagnostic group \\
\hline
\mbox{\texttt{ in}}  & {\em module\+\_\+name} & Name of this module, usually \char`\"{}ocean\+\_\+model\char`\"{} or \char`\"{}ice\+\_\+shelf\+\_\+model\char`\"{} \\
\hline
\mbox{\texttt{ in}}  & {\em field\+\_\+name} & Name of the diagnostic field \\
\hline
\mbox{\texttt{ in}}  & {\em axes} & Container w/ up to 3 integer handles that indicates axes for this field \\
\hline
\mbox{\texttt{ in}}  & {\em init\+\_\+time} & Time at which a field is first available? \\
\hline
\mbox{\texttt{ in}}  & {\em long\+\_\+name} & Long name of a field. \\
\hline
\mbox{\texttt{ in}}  & {\em units} & Units of a field. \\
\hline
\mbox{\texttt{ in}}  & {\em standard\+\_\+name} & Standardized name associated with a field \\
\hline
\mbox{\texttt{ in}}  & {\em missing\+\_\+value} & A value that indicates missing values. \\
\hline
\mbox{\texttt{ in}}  & {\em range} & Valid range of a variable (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em mask\+\_\+variant} & If true a logical mask must be provided with \mbox{\hyperlink{interfacemom__diag__mediator_1_1post__data}{post\+\_\+data}} calls (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em verbose} & If true, F\+MS is verbose (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em do\+\_\+not\+\_\+log} & If true, do not log something (not used in M\+OM?) \\
\hline
\mbox{\texttt{ out}}  & {\em err\+\_\+msg} & String into which an error message might be placed (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em interp\+\_\+method} & If \textquotesingle{}none\textquotesingle{} indicates the field should not be interpolated as a scalar \\
\hline
\mbox{\texttt{ in}}  & {\em tile\+\_\+count} & no clue (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+field\+\_\+name} & C\+M\+OR name of a field \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+long\+\_\+name} & C\+M\+OR long name of a field \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+units} & C\+M\+OR units of a field \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+standard\+\_\+name} & C\+M\+OR standardized name associated with a field \\
\hline
\mbox{\texttt{ in}}  & {\em cell\+\_\+methods} & String to append as cell\+\_\+methods attribute. Use \textquotesingle{}\textquotesingle{} to have no attribute. If present, this overrides the default constructed from the default for each individual axis direction. \\
\hline
\mbox{\texttt{ in}}  & {\em x\+\_\+cell\+\_\+method} & Specifies the cell method for the x-\/direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em y\+\_\+cell\+\_\+method} & Specifies the cell method for the y-\/direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em v\+\_\+cell\+\_\+method} & Specifies the cell method for the vertical direction. Use \textquotesingle{}\textquotesingle{} have no method. \\
\hline
\mbox{\texttt{ in}}  & {\em conversion} & A value to multiply data by before writing to file \\
\hline
\mbox{\texttt{ in}}  & {\em v\+\_\+extensive} & True for vertically extensive fields (vertically integrated). Default/absent for intensive. \\
\hline
\end{DoxyParams}


Definition at line 2182 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2187   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{intent(inout)} :: dm\_id\textcolor{comment}{ !< The diag\_mediator ID for this diagnostic group}}
\DoxyCodeLine{2188   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: module\_name\textcolor{comment}{ !< Name of this module, usually "ocean\_model" or "ice\_shelf\_model"}}
\DoxyCodeLine{2189   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: field\_name\textcolor{comment}{ !< Name of the diagnostic field}}
\DoxyCodeLine{2190   \textcolor{keywordtype}{type}(axes\_grp), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: axes\textcolor{comment}{ !< Container w/ up to 3 integer handles that indicates axes}}
\DoxyCodeLine{2191 \textcolor{comment}{                                             !! for this field}}
\DoxyCodeLine{2192   \textcolor{keywordtype}{type}(time\_type),  \textcolor{keywordtype}{intent(in)} :: init\_time\textcolor{comment}{ !< Time at which a field is first available?}}
\DoxyCodeLine{2193   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: long\_name\textcolor{comment}{ !< Long name of a field.}}
\DoxyCodeLine{2194   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{ !< Units of a field.}}
\DoxyCodeLine{2195   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: standard\_name\textcolor{comment}{ !< Standardized name associated with a field}}
\DoxyCodeLine{2196 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: missing\_value\textcolor{comment}{ !< A value that indicates missing values.}}
\DoxyCodeLine{2197 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: range(2)\textcolor{comment}{ !< Valid range of a variable (not used in MOM?)}}
\DoxyCodeLine{2198   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: mask\_variant\textcolor{comment}{ !< If true a logical mask must be provided}}
\DoxyCodeLine{2199 \textcolor{comment}{                                                         !! with post\_data calls (not used in MOM?)}}
\DoxyCodeLine{2200   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: verbose\textcolor{comment}{ !< If true, FMS is verbose (not used in MOM?)}}
\DoxyCodeLine{2201   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: do\_not\_log\textcolor{comment}{ !< If true, do not log something (not used in MOM?)}}
\DoxyCodeLine{2202   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}:: err\_msg\textcolor{comment}{ !< String into which an error message might be}}
\DoxyCodeLine{2203 \textcolor{comment}{                                                         !! placed (not used in MOM?)}}
\DoxyCodeLine{2204   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: interp\_method\textcolor{comment}{ !< If 'none' indicates the field should}}
\DoxyCodeLine{2205 \textcolor{comment}{                                                         !! not be interpolated as a scalar}}
\DoxyCodeLine{2206   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: tile\_count\textcolor{comment}{ !< no clue (not used in MOM?)}}
\DoxyCodeLine{2207   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_field\_name\textcolor{comment}{ !< CMOR name of a field}}
\DoxyCodeLine{2208   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_long\_name\textcolor{comment}{ !< CMOR long name of a field}}
\DoxyCodeLine{2209   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_units\textcolor{comment}{ !< CMOR units of a field}}
\DoxyCodeLine{2210   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_standard\_name\textcolor{comment}{ !< CMOR standardized name associated with a field}}
\DoxyCodeLine{2211   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cell\_methods\textcolor{comment}{ !< String to append as cell\_methods attribute.}}
\DoxyCodeLine{2212 \textcolor{comment}{                                                         !! Use '' to have no attribute. If present, this}}
\DoxyCodeLine{2213 \textcolor{comment}{                                                         !! overrides the default constructed from the default}}
\DoxyCodeLine{2214 \textcolor{comment}{                                                         !! for each individual axis direction.}}
\DoxyCodeLine{2215   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: x\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the x-\/direction.}}
\DoxyCodeLine{2216 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{2217   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: y\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the y-\/direction.}}
\DoxyCodeLine{2218 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{2219   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: v\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the vertical direction.}}
\DoxyCodeLine{2220 \textcolor{comment}{                                                         !! Use '' have no method.}}
\DoxyCodeLine{2221 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: conversion\textcolor{comment}{ !< A value to multiply data by before writing to file}}
\DoxyCodeLine{2222   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: v\_extensive\textcolor{comment}{ !< True for vertically extensive fields (vertically}}
\DoxyCodeLine{2223 \textcolor{comment}{                                                         !! integrated). Default/absent for intensive.}}
\DoxyCodeLine{2224   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{2225 \textcolor{keywordtype}{  real} :: MOM\_missing\_value}
\DoxyCodeLine{2226   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{pointer} :: diag\_cs => null()}
\DoxyCodeLine{2227   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{pointer} :: this\_diag => null()}
\DoxyCodeLine{2228   \textcolor{keywordtype}{integer} :: fms\_id, fms\_xyave\_id}
\DoxyCodeLine{2229   \textcolor{keywordtype}{character(len=256)} :: posted\_cmor\_units, posted\_cmor\_standard\_name, posted\_cmor\_long\_name, cm\_string, msg}
\DoxyCodeLine{2230 }
\DoxyCodeLine{2231   mom\_missing\_value = axes\%diag\_cs\%missing\_value}
\DoxyCodeLine{2232   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(missing\_value)) mom\_missing\_value = missing\_value}
\DoxyCodeLine{2233 }
\DoxyCodeLine{2234   register\_diag\_field\_expand\_cmor = .false.}
\DoxyCodeLine{2235   diag\_cs => axes\%diag\_cs}
\DoxyCodeLine{2236 }
\DoxyCodeLine{2237   \textcolor{comment}{! Set up the 'primary' diagnostic, first get an underlying FMS id}}
\DoxyCodeLine{2238   fms\_id = register\_diag\_field\_expand\_axes(module\_name, field\_name, axes, init\_time, \&}
\DoxyCodeLine{2239              long\_name=long\_name, units=units, missing\_value=mom\_missing\_value, \&}
\DoxyCodeLine{2240              range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2241              verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2242              interp\_method=interp\_method, tile\_count=tile\_count)}
\DoxyCodeLine{2243   \textcolor{keywordflow}{if} (.not. diag\_cs\%diag\_as\_chksum) \&}
\DoxyCodeLine{2244     \textcolor{keyword}{call }attach\_cell\_methods(fms\_id, axes, cm\_string, cell\_methods, \&}
\DoxyCodeLine{2245                              x\_cell\_method, y\_cell\_method, v\_cell\_method, \&}
\DoxyCodeLine{2246                              v\_extensive=v\_extensive)}
\DoxyCodeLine{2247   \textcolor{keywordflow}{if} (is\_root\_pe() .and. diag\_cs\%available\_diag\_doc\_unit > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2248     msg = \textcolor{stringliteral}{''}}
\DoxyCodeLine{2249     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_field\_name)) msg = \textcolor{stringliteral}{'CMOR equivalent is "'}//trim(cmor\_field\_name)//\textcolor{stringliteral}{'"'}}
\DoxyCodeLine{2250     \textcolor{keyword}{call }log\_available\_diag(fms\_id>0, module\_name, field\_name, cm\_string, \&}
\DoxyCodeLine{2251                             msg, diag\_cs, long\_name, units, standard\_name)}
\DoxyCodeLine{2252 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2253   \textcolor{comment}{! Associated horizontally area-\/averaged diagnostic}}
\DoxyCodeLine{2254   fms\_xyave\_id = diag\_field\_not\_found}
\DoxyCodeLine{2255   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(axes\%xyave\_axes)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2256     fms\_xyave\_id = register\_diag\_field\_expand\_axes(module\_name, trim(field\_name)//\textcolor{stringliteral}{'\_xyave'}, \&}
\DoxyCodeLine{2257              axes\%xyave\_axes, init\_time, \&}
\DoxyCodeLine{2258              long\_name=long\_name, units=units, missing\_value=mom\_missing\_value, \&}
\DoxyCodeLine{2259              range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2260              verbose=verbose, do\_not\_log=do\_not\_log, err\_msg=err\_msg, \&}
\DoxyCodeLine{2261              interp\_method=interp\_method, tile\_count=tile\_count)}
\DoxyCodeLine{2262     \textcolor{keywordflow}{if} (.not. diag\_cs\%diag\_as\_chksum) \&}
\DoxyCodeLine{2263       \textcolor{keyword}{call }attach\_cell\_methods(fms\_xyave\_id, axes\%xyave\_axes, cm\_string, \&}
\DoxyCodeLine{2264                                cell\_methods, v\_cell\_method, v\_extensive=v\_extensive)}
\DoxyCodeLine{2265     \textcolor{keywordflow}{if} (is\_root\_pe() .and. diag\_cs\%available\_diag\_doc\_unit > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2266       msg = \textcolor{stringliteral}{''}}
\DoxyCodeLine{2267       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_field\_name)) msg = \textcolor{stringliteral}{'CMOR equivalent is "'}//trim(cmor\_field\_name)//\textcolor{stringliteral}{'\_xyave"'}}
\DoxyCodeLine{2268       \textcolor{keyword}{call }log\_available\_diag(fms\_xyave\_id>0, module\_name, trim(field\_name)//\textcolor{stringliteral}{'\_xyave'}, cm\_string, \&}
\DoxyCodeLine{2269                               msg, diag\_cs, long\_name, units, standard\_name)}
\DoxyCodeLine{2270 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2271 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2272   this\_diag => null()}
\DoxyCodeLine{2273   \textcolor{keywordflow}{if} (fms\_id /= diag\_field\_not\_found .or. fms\_xyave\_id /= diag\_field\_not\_found) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2274     \textcolor{keyword}{call }add\_diag\_to\_list(diag\_cs, dm\_id, fms\_id, this\_diag, axes, module\_name, field\_name, msg)}
\DoxyCodeLine{2275     this\_diag\%fms\_xyave\_diag\_id = fms\_xyave\_id}
\DoxyCodeLine{2276     \textcolor{comment}{!Encode and save the cell methods for this diag}}
\DoxyCodeLine{2277     \textcolor{keyword}{call }add\_xyz\_method(this\_diag, axes, x\_cell\_method, y\_cell\_method, v\_cell\_method, v\_extensive)}
\DoxyCodeLine{2278     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(v\_extensive)) this\_diag\%v\_extensive = v\_extensive}
\DoxyCodeLine{2279     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(conversion)) this\_diag\%conversion\_factor = conversion}
\DoxyCodeLine{2280     register\_diag\_field\_expand\_cmor = .true.}
\DoxyCodeLine{2281 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2282 }
\DoxyCodeLine{2283   \textcolor{comment}{! For the CMOR variation of the above diagnostic}}
\DoxyCodeLine{2284   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_field\_name) .and. .not. diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2285     \textcolor{comment}{! Fallback values for strings set to "NULL"}}
\DoxyCodeLine{2286     posted\_cmor\_units = \textcolor{stringliteral}{"not provided"}         \textcolor{comment}{!}}
\DoxyCodeLine{2287     posted\_cmor\_standard\_name = \textcolor{stringliteral}{"not provided"} \textcolor{comment}{! Values might be able to be replaced with a CS\%missing field?}}
\DoxyCodeLine{2288     posted\_cmor\_long\_name = \textcolor{stringliteral}{"not provided"}     \textcolor{comment}{!}}
\DoxyCodeLine{2289 }
\DoxyCodeLine{2290     \textcolor{comment}{! If attributes are present for MOM variable names, use them first for the register\_diag\_field}}
\DoxyCodeLine{2291     \textcolor{comment}{! call for CMOR verison of the variable}}
\DoxyCodeLine{2292     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(units)) posted\_cmor\_units = units}
\DoxyCodeLine{2293     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(standard\_name)) posted\_cmor\_standard\_name = standard\_name}
\DoxyCodeLine{2294     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(long\_name)) posted\_cmor\_long\_name = long\_name}
\DoxyCodeLine{2295 }
\DoxyCodeLine{2296     \textcolor{comment}{! If specified in the call to register\_diag\_field, override attributes with the CMOR versions}}
\DoxyCodeLine{2297     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_units)) posted\_cmor\_units = cmor\_units}
\DoxyCodeLine{2298     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_standard\_name)) posted\_cmor\_standard\_name = cmor\_standard\_name}
\DoxyCodeLine{2299     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_long\_name)) posted\_cmor\_long\_name = cmor\_long\_name}
\DoxyCodeLine{2300 }
\DoxyCodeLine{2301     fms\_id = register\_diag\_field\_expand\_axes(module\_name, cmor\_field\_name, axes, init\_time,    \&}
\DoxyCodeLine{2302                long\_name=trim(posted\_cmor\_long\_name), units=trim(posted\_cmor\_units),                  \&}
\DoxyCodeLine{2303                missing\_value=mom\_missing\_value, range=range, mask\_variant=mask\_variant,               \&}
\DoxyCodeLine{2304                standard\_name=trim(posted\_cmor\_standard\_name), verbose=verbose, do\_not\_log=do\_not\_log, \&}
\DoxyCodeLine{2305                err\_msg=err\_msg, interp\_method=interp\_method, tile\_count=tile\_count)}
\DoxyCodeLine{2306     \textcolor{keyword}{call }attach\_cell\_methods(fms\_id, axes, cm\_string, \&}
\DoxyCodeLine{2307                              cell\_methods, x\_cell\_method, y\_cell\_method, v\_cell\_method, \&}
\DoxyCodeLine{2308                              v\_extensive=v\_extensive)}
\DoxyCodeLine{2309     \textcolor{keywordflow}{if} (is\_root\_pe() .and. diag\_cs\%available\_diag\_doc\_unit > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2310       msg = \textcolor{stringliteral}{'native name is "'}//trim(field\_name)//\textcolor{stringliteral}{'"'}}
\DoxyCodeLine{2311       \textcolor{keyword}{call }log\_available\_diag(fms\_id>0, module\_name, cmor\_field\_name, cm\_string, \&}
\DoxyCodeLine{2312                               msg, diag\_cs, posted\_cmor\_long\_name, posted\_cmor\_units, \&}
\DoxyCodeLine{2313                               posted\_cmor\_standard\_name)}
\DoxyCodeLine{2314 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2315     \textcolor{comment}{! Associated horizontally area-\/averaged diagnostic}}
\DoxyCodeLine{2316     fms\_xyave\_id = diag\_field\_not\_found}
\DoxyCodeLine{2317     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(axes\%xyave\_axes)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2318       fms\_xyave\_id = register\_diag\_field\_expand\_axes(module\_name, trim(cmor\_field\_name)//\textcolor{stringliteral}{'\_xyave'}, \&}
\DoxyCodeLine{2319                axes\%xyave\_axes, init\_time, \&}
\DoxyCodeLine{2320                long\_name=trim(posted\_cmor\_long\_name), units=trim(posted\_cmor\_units),                  \&}
\DoxyCodeLine{2321                missing\_value=mom\_missing\_value, range=range, mask\_variant=mask\_variant,               \&}
\DoxyCodeLine{2322                standard\_name=trim(posted\_cmor\_standard\_name), verbose=verbose, do\_not\_log=do\_not\_log, \&}
\DoxyCodeLine{2323                err\_msg=err\_msg, interp\_method=interp\_method, tile\_count=tile\_count)}
\DoxyCodeLine{2324       \textcolor{keyword}{call }attach\_cell\_methods(fms\_xyave\_id, axes\%xyave\_axes, cm\_string, \&}
\DoxyCodeLine{2325                                cell\_methods, v\_cell\_method, v\_extensive=v\_extensive)}
\DoxyCodeLine{2326       \textcolor{keywordflow}{if} (is\_root\_pe() .and. diag\_cs\%available\_diag\_doc\_unit > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2327         msg = \textcolor{stringliteral}{'native name is "'}//trim(field\_name)//\textcolor{stringliteral}{'\_xyave"'}}
\DoxyCodeLine{2328         \textcolor{keyword}{call }log\_available\_diag(fms\_xyave\_id>0, module\_name, trim(cmor\_field\_name)//\textcolor{stringliteral}{'\_xyave'}, \&}
\DoxyCodeLine{2329                                 cm\_string, msg, diag\_cs, posted\_cmor\_long\_name, posted\_cmor\_units, \&}
\DoxyCodeLine{2330                                 posted\_cmor\_standard\_name)}
\DoxyCodeLine{2331 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2332 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2333     this\_diag => null()}
\DoxyCodeLine{2334     \textcolor{keywordflow}{if} (fms\_id /= diag\_field\_not\_found .or. fms\_xyave\_id /= diag\_field\_not\_found) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2335       \textcolor{keyword}{call }add\_diag\_to\_list(diag\_cs, dm\_id, fms\_id, this\_diag, axes, module\_name, field\_name, msg)}
\DoxyCodeLine{2336       this\_diag\%fms\_xyave\_diag\_id = fms\_xyave\_id}
\DoxyCodeLine{2337       \textcolor{comment}{!Encode and save the cell methods for this diag}}
\DoxyCodeLine{2338       \textcolor{keyword}{call }add\_xyz\_method(this\_diag, axes, x\_cell\_method, y\_cell\_method, v\_cell\_method, v\_extensive)}
\DoxyCodeLine{2339       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(v\_extensive)) this\_diag\%v\_extensive = v\_extensive}
\DoxyCodeLine{2340       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(conversion)) this\_diag\%conversion\_factor = conversion}
\DoxyCodeLine{2341       register\_diag\_field\_expand\_cmor = .true.}
\DoxyCodeLine{2342 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2343 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2344 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_afb4254e1cfbbcfc43028f14915173f80}\label{namespacemom__diag__mediator_afb4254e1cfbbcfc43028f14915173f80}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!register\_scalar\_field@{register\_scalar\_field}}
\index{register\_scalar\_field@{register\_scalar\_field}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{register\_scalar\_field()}{register\_scalar\_field()}}
{\footnotesize\ttfamily integer function, public mom\+\_\+diag\+\_\+mediator\+::register\+\_\+scalar\+\_\+field (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{module\+\_\+name,  }\item[{character(len=$\ast$), intent(in)}]{field\+\_\+name,  }\item[{type(time\+\_\+type), intent(in)}]{init\+\_\+time,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs,  }\item[{character(len=$\ast$), intent(in), optional}]{long\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{real, intent(in), optional}]{missing\+\_\+value,  }\item[{real, dimension(2), intent(in), optional}]{range,  }\item[{character(len=$\ast$), intent(in), optional}]{standard\+\_\+name,  }\item[{logical, intent(in), optional}]{do\+\_\+not\+\_\+log,  }\item[{character(len=$\ast$), intent(out), optional}]{err\+\_\+msg,  }\item[{character(len=$\ast$), intent(in), optional}]{interp\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+field\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+long\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+units,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+standard\+\_\+name }\end{DoxyParamCaption})}

\begin{DoxyReturn}{Returns}
An integer handle for a diagnostic array.
\end{DoxyReturn}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em module\+\_\+name} & Name of this module, usually \char`\"{}ocean\+\_\+model\char`\"{} or \char`\"{}ice\+\_\+shelf\+\_\+model\char`\"{}\\
\hline
\mbox{\texttt{ in}}  & {\em field\+\_\+name} & Name of the diagnostic field\\
\hline
\mbox{\texttt{ in}}  & {\em init\+\_\+time} & Time at which a field is first available?\\
\hline
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output\\
\hline
\mbox{\texttt{ in}}  & {\em long\+\_\+name} & Long name of a field.\\
\hline
\mbox{\texttt{ in}}  & {\em units} & Units of a field.\\
\hline
\mbox{\texttt{ in}}  & {\em standard\+\_\+name} & Standardized name associated with a field\\
\hline
\mbox{\texttt{ in}}  & {\em missing\+\_\+value} & A value that indicates missing values.\\
\hline
\mbox{\texttt{ in}}  & {\em range} & Valid range of a variable (not used in M\+OM?)\\
\hline
\mbox{\texttt{ in}}  & {\em do\+\_\+not\+\_\+log} & If true, do not log something (not used in M\+OM?)\\
\hline
\mbox{\texttt{ out}}  & {\em err\+\_\+msg} & String into which an error message might be placed (not used in M\+OM?)\\
\hline
\mbox{\texttt{ in}}  & {\em interp\+\_\+method} & If \textquotesingle{}none\textquotesingle{} indicates the field should not be interpolated as a scalar\\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+field\+\_\+name} & C\+M\+OR name of a field\\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+long\+\_\+name} & C\+M\+OR long name of a field\\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+units} & C\+M\+OR units of a field\\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+standard\+\_\+name} & C\+M\+OR standardized name associated with a field \\
\hline
\end{DoxyParams}


Definition at line 2658 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2662   \textcolor{keywordtype}{integer} :: register\_scalar\_field\textcolor{comment}{ !< An integer handle for a diagnostic array.}}
\DoxyCodeLine{2663   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: module\_name\textcolor{comment}{ !< Name of this module, usually "ocean\_model"}}
\DoxyCodeLine{2664 \textcolor{comment}{                                              !! or "ice\_shelf\_model"}}
\DoxyCodeLine{2665   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: field\_name\textcolor{comment}{ !< Name of the diagnostic field}}
\DoxyCodeLine{2666   \textcolor{keywordtype}{type}(time\_type),  \textcolor{keywordtype}{intent(in)} :: init\_time\textcolor{comment}{ !< Time at which a field is first available?}}
\DoxyCodeLine{2667   \textcolor{keywordtype}{type}(diag\_ctrl),  \textcolor{keywordtype}{intent(inout)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{2668   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: long\_name\textcolor{comment}{ !< Long name of a field.}}
\DoxyCodeLine{2669   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{ !< Units of a field.}}
\DoxyCodeLine{2670   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: standard\_name\textcolor{comment}{ !< Standardized name associated with a field}}
\DoxyCodeLine{2671 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: missing\_value\textcolor{comment}{ !< A value that indicates missing values.}}
\DoxyCodeLine{2672 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: range(2)\textcolor{comment}{ !< Valid range of a variable (not used in MOM?)}}
\DoxyCodeLine{2673   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: do\_not\_log\textcolor{comment}{ !< If true, do not log something (not used in MOM?)}}
\DoxyCodeLine{2674   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}:: err\_msg\textcolor{comment}{ !< String into which an error message might be}}
\DoxyCodeLine{2675 \textcolor{comment}{                                                         !! placed (not used in MOM?)}}
\DoxyCodeLine{2676   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: interp\_method\textcolor{comment}{ !< If 'none' indicates the field should not}}
\DoxyCodeLine{2677 \textcolor{comment}{                                                         !! be interpolated as a scalar}}
\DoxyCodeLine{2678   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_field\_name\textcolor{comment}{ !< CMOR name of a field}}
\DoxyCodeLine{2679   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_long\_name\textcolor{comment}{ !< CMOR long name of a field}}
\DoxyCodeLine{2680   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_units\textcolor{comment}{ !< CMOR units of a field}}
\DoxyCodeLine{2681   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_standard\_name\textcolor{comment}{ !< CMOR standardized name associated with a field}}
\DoxyCodeLine{2682 }
\DoxyCodeLine{2683   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{2684 \textcolor{keywordtype}{  real} :: MOM\_missing\_value}
\DoxyCodeLine{2685   \textcolor{keywordtype}{integer} :: dm\_id, fms\_id}
\DoxyCodeLine{2686   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{pointer} :: diag => null(), cmor\_diag => null()}
\DoxyCodeLine{2687   \textcolor{keywordtype}{character(len=256)} :: posted\_cmor\_units, posted\_cmor\_standard\_name, posted\_cmor\_long\_name}
\DoxyCodeLine{2688 }
\DoxyCodeLine{2689   mom\_missing\_value = diag\_cs\%missing\_value}
\DoxyCodeLine{2690   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(missing\_value)) mom\_missing\_value = missing\_value}
\DoxyCodeLine{2691 }
\DoxyCodeLine{2692   dm\_id = -\/1}
\DoxyCodeLine{2693   diag => null()}
\DoxyCodeLine{2694   cmor\_diag => null()}
\DoxyCodeLine{2695 }
\DoxyCodeLine{2696   \textcolor{keywordflow}{if} (diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2697     fms\_id = diag\_cs\%num\_chksum\_diags + 1}
\DoxyCodeLine{2698     diag\_cs\%num\_chksum\_diags = fms\_id}
\DoxyCodeLine{2699   \textcolor{keywordflow}{else}}
\DoxyCodeLine{2700     fms\_id = register\_diag\_field\_fms(module\_name, field\_name, init\_time, \&}
\DoxyCodeLine{2701         long\_name=long\_name, units=units, missing\_value=mom\_missing\_value, \&}
\DoxyCodeLine{2702         range=range, standard\_name=standard\_name, do\_not\_log=do\_not\_log, \&}
\DoxyCodeLine{2703         err\_msg=err\_msg)}
\DoxyCodeLine{2704 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2705 }
\DoxyCodeLine{2706   \textcolor{keywordflow}{if} (fms\_id /= diag\_field\_not\_found) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2707     dm\_id = get\_new\_diag\_id(diag\_cs)}
\DoxyCodeLine{2708     \textcolor{keyword}{call }alloc\_diag\_with\_id(dm\_id, diag\_cs, diag)}
\DoxyCodeLine{2709     \textcolor{keyword}{call }assert(\textcolor{keyword}{associated}(diag), \textcolor{stringliteral}{'register\_scalar\_field: diag allocation failed'})}
\DoxyCodeLine{2710     diag\%fms\_diag\_id = fms\_id}
\DoxyCodeLine{2711     diag\%debug\_str = trim(module\_name)//\textcolor{stringliteral}{"-\/"}//trim(field\_name)}
\DoxyCodeLine{2712 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2713 }
\DoxyCodeLine{2714   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_field\_name)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2715     \textcolor{comment}{! Fallback values for strings set to "not provided"}}
\DoxyCodeLine{2716     posted\_cmor\_units = \textcolor{stringliteral}{"not provided"}}
\DoxyCodeLine{2717     posted\_cmor\_standard\_name = \textcolor{stringliteral}{"not provided"}}
\DoxyCodeLine{2718     posted\_cmor\_long\_name = \textcolor{stringliteral}{"not provided"}}
\DoxyCodeLine{2719 }
\DoxyCodeLine{2720     \textcolor{comment}{! If attributes are present for MOM variable names, use them first for the register\_static\_field}}
\DoxyCodeLine{2721     \textcolor{comment}{! call for CMOR verison of the variable}}
\DoxyCodeLine{2722     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(units)) posted\_cmor\_units = units}
\DoxyCodeLine{2723     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(standard\_name)) posted\_cmor\_standard\_name = standard\_name}
\DoxyCodeLine{2724     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(long\_name)) posted\_cmor\_long\_name = long\_name}
\DoxyCodeLine{2725 }
\DoxyCodeLine{2726     \textcolor{comment}{! If specified in the call to register\_static\_field, override attributes with the CMOR versions}}
\DoxyCodeLine{2727     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_units)) posted\_cmor\_units = cmor\_units}
\DoxyCodeLine{2728     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_standard\_name)) posted\_cmor\_standard\_name = cmor\_standard\_name}
\DoxyCodeLine{2729     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_long\_name)) posted\_cmor\_long\_name = cmor\_long\_name}
\DoxyCodeLine{2730 }
\DoxyCodeLine{2731     fms\_id = register\_diag\_field\_fms(module\_name, cmor\_field\_name, init\_time, \&}
\DoxyCodeLine{2732        long\_name=trim(posted\_cmor\_long\_name), units=trim(posted\_cmor\_units), \&}
\DoxyCodeLine{2733        missing\_value=mom\_missing\_value, range=range, \&}
\DoxyCodeLine{2734        standard\_name=trim(posted\_cmor\_standard\_name), do\_not\_log=do\_not\_log, err\_msg=err\_msg)}
\DoxyCodeLine{2735     \textcolor{keywordflow}{if} (fms\_id /= diag\_field\_not\_found) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2736       \textcolor{keywordflow}{if} (dm\_id == -\/1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2737         dm\_id = get\_new\_diag\_id(diag\_cs)}
\DoxyCodeLine{2738 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2739       \textcolor{keyword}{call }alloc\_diag\_with\_id(dm\_id, diag\_cs, cmor\_diag)}
\DoxyCodeLine{2740       cmor\_diag\%fms\_diag\_id = fms\_id}
\DoxyCodeLine{2741       cmor\_diag\%debug\_str = trim(module\_name)//\textcolor{stringliteral}{"-\/"}//trim(cmor\_field\_name)}
\DoxyCodeLine{2742 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2743 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2744 }
\DoxyCodeLine{2745   \textcolor{comment}{! Document diagnostics in list of available diagnostics}}
\DoxyCodeLine{2746   \textcolor{keywordflow}{if} (is\_root\_pe() .and. diag\_cs\%available\_diag\_doc\_unit > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2747     \textcolor{keyword}{call }log\_available\_diag(\textcolor{keyword}{associated}(diag), module\_name, field\_name, \textcolor{stringliteral}{''}, \textcolor{stringliteral}{''}, diag\_cs, \&}
\DoxyCodeLine{2748                             long\_name, units, standard\_name)}
\DoxyCodeLine{2749     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_field\_name)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2750       \textcolor{keyword}{call }log\_available\_diag(\textcolor{keyword}{associated}(cmor\_diag), module\_name, cmor\_field\_name, \&}
\DoxyCodeLine{2751                               \textcolor{stringliteral}{''}, \textcolor{stringliteral}{''}, diag\_cs, posted\_cmor\_long\_name, posted\_cmor\_units, \&}
\DoxyCodeLine{2752                               posted\_cmor\_standard\_name)}
\DoxyCodeLine{2753 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2754 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2755 }
\DoxyCodeLine{2756   register\_scalar\_field = dm\_id}
\DoxyCodeLine{2757 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a87fa69b9e2ba3205756d93e1e13e1dc7}\label{namespacemom__diag__mediator_a87fa69b9e2ba3205756d93e1e13e1dc7}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!register\_static\_field@{register\_static\_field}}
\index{register\_static\_field@{register\_static\_field}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{register\_static\_field()}{register\_static\_field()}}
{\footnotesize\ttfamily integer function, public mom\+\_\+diag\+\_\+mediator\+::register\+\_\+static\+\_\+field (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{module\+\_\+name,  }\item[{character(len=$\ast$), intent(in)}]{field\+\_\+name,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1axes__grp}{axes\+\_\+grp}}), intent(in), target}]{axes,  }\item[{character(len=$\ast$), intent(in), optional}]{long\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{units,  }\item[{real, intent(in), optional}]{missing\+\_\+value,  }\item[{real, dimension(2), intent(in), optional}]{range,  }\item[{logical, intent(in), optional}]{mask\+\_\+variant,  }\item[{character(len=$\ast$), intent(in), optional}]{standard\+\_\+name,  }\item[{logical, intent(in), optional}]{do\+\_\+not\+\_\+log,  }\item[{character(len=$\ast$), intent(in), optional}]{interp\+\_\+method,  }\item[{integer, intent(in), optional}]{tile\+\_\+count,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+field\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+long\+\_\+name,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+units,  }\item[{character(len=$\ast$), intent(in), optional}]{cmor\+\_\+standard\+\_\+name,  }\item[{integer, intent(in), optional}]{area,  }\item[{character(len=$\ast$), intent(in), optional}]{x\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{y\+\_\+cell\+\_\+method,  }\item[{character(len=$\ast$), intent(in), optional}]{area\+\_\+cell\+\_\+method,  }\item[{real, intent(in), optional}]{conversion }\end{DoxyParamCaption})}



Registers a static diagnostic, returning an integer handle. 

\begin{DoxyReturn}{Returns}
An integer handle for a diagnostic array. 
\end{DoxyReturn}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em module\+\_\+name} & Name of this module, usually \char`\"{}ocean\+\_\+model\char`\"{} or \char`\"{}ice\+\_\+shelf\+\_\+model\char`\"{} \\
\hline
\mbox{\texttt{ in}}  & {\em field\+\_\+name} & Name of the diagnostic field \\
\hline
\mbox{\texttt{ in}}  & {\em axes} & Container w/ up to 3 integer handles that indicates axes for this field \\
\hline
\mbox{\texttt{ in}}  & {\em long\+\_\+name} & Long name of a field. \\
\hline
\mbox{\texttt{ in}}  & {\em units} & Units of a field. \\
\hline
\mbox{\texttt{ in}}  & {\em standard\+\_\+name} & Standardized name associated with a field \\
\hline
\mbox{\texttt{ in}}  & {\em missing\+\_\+value} & A value that indicates missing values. \\
\hline
\mbox{\texttt{ in}}  & {\em range} & Valid range of a variable (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em mask\+\_\+variant} & If true a logical mask must be provided with \mbox{\hyperlink{interfacemom__diag__mediator_1_1post__data}{post\+\_\+data}} calls (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em do\+\_\+not\+\_\+log} & If true, do not log something (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em interp\+\_\+method} & If \textquotesingle{}none\textquotesingle{} indicates the field should not be interpolated as a scalar \\
\hline
\mbox{\texttt{ in}}  & {\em tile\+\_\+count} & no clue (not used in M\+OM?) \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+field\+\_\+name} & C\+M\+OR name of a field \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+long\+\_\+name} & C\+M\+OR long name of a field \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+units} & C\+M\+OR units of a field \\
\hline
\mbox{\texttt{ in}}  & {\em cmor\+\_\+standard\+\_\+name} & C\+M\+OR standardized name associated with a field \\
\hline
\mbox{\texttt{ in}}  & {\em area} & fms\+\_\+id for area\+\_\+t \\
\hline
\mbox{\texttt{ in}}  & {\em x\+\_\+cell\+\_\+method} & Specifies the cell method for the x-\/direction. \\
\hline
\mbox{\texttt{ in}}  & {\em y\+\_\+cell\+\_\+method} & Specifies the cell method for the y-\/direction. \\
\hline
\mbox{\texttt{ in}}  & {\em area\+\_\+cell\+\_\+method} & Specifies the cell method for area \\
\hline
\mbox{\texttt{ in}}  & {\em conversion} & A value to multiply data by before writing to file \\
\hline
\end{DoxyParams}


Definition at line 2761 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2766   \textcolor{keywordtype}{integer} :: register\_static\_field\textcolor{comment}{ !< An integer handle for a diagnostic array.}}
\DoxyCodeLine{2767   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: module\_name\textcolor{comment}{ !< Name of this module, usually "ocean\_model"}}
\DoxyCodeLine{2768 \textcolor{comment}{                                              !! or "ice\_shelf\_model"}}
\DoxyCodeLine{2769   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: field\_name\textcolor{comment}{ !< Name of the diagnostic field}}
\DoxyCodeLine{2770   \textcolor{keywordtype}{type}(axes\_grp), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: axes\textcolor{comment}{ !< Container w/ up to 3 integer handles that}}
\DoxyCodeLine{2771 \textcolor{comment}{                                             !! indicates axes for this field}}
\DoxyCodeLine{2772   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: long\_name\textcolor{comment}{ !< Long name of a field.}}
\DoxyCodeLine{2773   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: units\textcolor{comment}{ !< Units of a field.}}
\DoxyCodeLine{2774   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: standard\_name\textcolor{comment}{ !< Standardized name associated with a field}}
\DoxyCodeLine{2775 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: missing\_value\textcolor{comment}{ !< A value that indicates missing values.}}
\DoxyCodeLine{2776 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: range(2)\textcolor{comment}{ !< Valid range of a variable (not used in MOM?)}}
\DoxyCodeLine{2777   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: mask\_variant\textcolor{comment}{ !< If true a logical mask must be provided with}}
\DoxyCodeLine{2778 \textcolor{comment}{                                                         !! post\_data calls (not used in MOM?)}}
\DoxyCodeLine{2779   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: do\_not\_log\textcolor{comment}{ !< If true, do not log something (not used in MOM?)}}
\DoxyCodeLine{2780   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: interp\_method\textcolor{comment}{ !< If 'none' indicates the field should not}}
\DoxyCodeLine{2781 \textcolor{comment}{                                                         !! be interpolated as a scalar}}
\DoxyCodeLine{2782   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: tile\_count\textcolor{comment}{ !< no clue (not used in MOM?)}}
\DoxyCodeLine{2783   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_field\_name\textcolor{comment}{ !< CMOR name of a field}}
\DoxyCodeLine{2784   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_long\_name\textcolor{comment}{ !< CMOR long name of a field}}
\DoxyCodeLine{2785   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_units\textcolor{comment}{ !< CMOR units of a field}}
\DoxyCodeLine{2786   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: cmor\_standard\_name\textcolor{comment}{ !< CMOR standardized name associated with a field}}
\DoxyCodeLine{2787   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: area\textcolor{comment}{ !< fms\_id for area\_t}}
\DoxyCodeLine{2788   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: x\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the x-\/direction.}}
\DoxyCodeLine{2789   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: y\_cell\_method\textcolor{comment}{ !< Specifies the cell method for the y-\/direction.}}
\DoxyCodeLine{2790   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: area\_cell\_method\textcolor{comment}{ !< Specifies the cell method for area}}
\DoxyCodeLine{2791 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: conversion\textcolor{comment}{ !< A value to multiply data by before writing to file}}
\DoxyCodeLine{2792 }
\DoxyCodeLine{2793   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{2794 \textcolor{keywordtype}{  real} :: MOM\_missing\_value}
\DoxyCodeLine{2795   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{pointer} :: diag\_cs => null()}
\DoxyCodeLine{2796   \textcolor{keywordtype}{type}(diag\_type), \textcolor{keywordtype}{pointer} :: diag => null(), cmor\_diag => null()}
\DoxyCodeLine{2797   \textcolor{keywordtype}{integer} :: dm\_id, fms\_id, cmor\_id}
\DoxyCodeLine{2798   \textcolor{keywordtype}{character(len=256)} :: posted\_cmor\_units, posted\_cmor\_standard\_name, posted\_cmor\_long\_name}
\DoxyCodeLine{2799   \textcolor{keywordtype}{character(len=9)} :: axis\_name}
\DoxyCodeLine{2800 }
\DoxyCodeLine{2801   mom\_missing\_value = axes\%diag\_cs\%missing\_value}
\DoxyCodeLine{2802   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(missing\_value)) mom\_missing\_value = missing\_value}
\DoxyCodeLine{2803 }
\DoxyCodeLine{2804   diag\_cs => axes\%diag\_cs}
\DoxyCodeLine{2805   dm\_id = -\/1}
\DoxyCodeLine{2806   diag => null()}
\DoxyCodeLine{2807   cmor\_diag => null()}
\DoxyCodeLine{2808 }
\DoxyCodeLine{2809   \textcolor{keywordflow}{if} (diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2810     fms\_id = diag\_cs\%num\_chksum\_diags + 1}
\DoxyCodeLine{2811     diag\_cs\%num\_chksum\_diags = fms\_id}
\DoxyCodeLine{2812   \textcolor{keywordflow}{else}}
\DoxyCodeLine{2813     fms\_id = register\_static\_field\_fms(module\_name, field\_name, axes\%handles, \&}
\DoxyCodeLine{2814            long\_name=long\_name, units=units, missing\_value=mom\_missing\_value, \&}
\DoxyCodeLine{2815            range=range, mask\_variant=mask\_variant, standard\_name=standard\_name, \&}
\DoxyCodeLine{2816            do\_not\_log=do\_not\_log, \&}
\DoxyCodeLine{2817            interp\_method=interp\_method, tile\_count=tile\_count, area=area)}
\DoxyCodeLine{2818 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2819 }
\DoxyCodeLine{2820   \textcolor{keywordflow}{if} (fms\_id /= diag\_field\_not\_found) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2821     dm\_id = get\_new\_diag\_id(diag\_cs)}
\DoxyCodeLine{2822     \textcolor{keyword}{call }alloc\_diag\_with\_id(dm\_id, diag\_cs, diag)}
\DoxyCodeLine{2823     \textcolor{keyword}{call }assert(\textcolor{keyword}{associated}(diag), \textcolor{stringliteral}{'register\_static\_field: diag allocation failed'})}
\DoxyCodeLine{2824     diag\%fms\_diag\_id = fms\_id}
\DoxyCodeLine{2825     diag\%debug\_str = trim(module\_name)//\textcolor{stringliteral}{"-\/"}//trim(field\_name)}
\DoxyCodeLine{2826     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(conversion)) diag\%conversion\_factor = conversion}
\DoxyCodeLine{2827 }
\DoxyCodeLine{2828     \textcolor{keywordflow}{if} (diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2829       diag\%axes => axes}
\DoxyCodeLine{2830     \textcolor{keywordflow}{else}}
\DoxyCodeLine{2831       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(x\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2832         \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(1), axis\_name)}
\DoxyCodeLine{2833         \textcolor{keyword}{call }diag\_field\_add\_attribute(fms\_id, \textcolor{stringliteral}{'cell\_methods'}, \&}
\DoxyCodeLine{2834             trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(x\_cell\_method))}
\DoxyCodeLine{2835 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2836       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(y\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2837         \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(2), axis\_name)}
\DoxyCodeLine{2838         \textcolor{keyword}{call }diag\_field\_add\_attribute(fms\_id, \textcolor{stringliteral}{'cell\_methods'}, \&}
\DoxyCodeLine{2839             trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(y\_cell\_method))}
\DoxyCodeLine{2840 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2841       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(area\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2842         \textcolor{keyword}{call }diag\_field\_add\_attribute(fms\_id, \textcolor{stringliteral}{'cell\_methods'}, \&}
\DoxyCodeLine{2843             \textcolor{stringliteral}{'area:'}//trim(area\_cell\_method))}
\DoxyCodeLine{2844 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2845 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2846 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2847 }
\DoxyCodeLine{2848   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_field\_name) .and. .not. diag\_cs\%diag\_as\_chksum) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2849     \textcolor{comment}{! Fallback values for strings set to "not provided"}}
\DoxyCodeLine{2850     posted\_cmor\_units = \textcolor{stringliteral}{"not provided"}}
\DoxyCodeLine{2851     posted\_cmor\_standard\_name = \textcolor{stringliteral}{"not provided"}}
\DoxyCodeLine{2852     posted\_cmor\_long\_name = \textcolor{stringliteral}{"not provided"}}
\DoxyCodeLine{2853 }
\DoxyCodeLine{2854     \textcolor{comment}{! If attributes are present for MOM variable names, use them first for the register\_static\_field}}
\DoxyCodeLine{2855     \textcolor{comment}{! call for CMOR verison of the variable}}
\DoxyCodeLine{2856     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(units)) posted\_cmor\_units = units}
\DoxyCodeLine{2857     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(standard\_name)) posted\_cmor\_standard\_name = standard\_name}
\DoxyCodeLine{2858     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(long\_name)) posted\_cmor\_long\_name = long\_name}
\DoxyCodeLine{2859 }
\DoxyCodeLine{2860     \textcolor{comment}{! If specified in the call to register\_static\_field, override attributes with the CMOR versions}}
\DoxyCodeLine{2861     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_units)) posted\_cmor\_units = cmor\_units}
\DoxyCodeLine{2862     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_standard\_name)) posted\_cmor\_standard\_name = cmor\_standard\_name}
\DoxyCodeLine{2863     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_long\_name)) posted\_cmor\_long\_name = cmor\_long\_name}
\DoxyCodeLine{2864 }
\DoxyCodeLine{2865     fms\_id = register\_static\_field\_fms(module\_name, cmor\_field\_name, \&}
\DoxyCodeLine{2866       axes\%handles, long\_name=trim(posted\_cmor\_long\_name), units=trim(posted\_cmor\_units), \&}
\DoxyCodeLine{2867       missing\_value=mom\_missing\_value, range=range, mask\_variant=mask\_variant,            \&}
\DoxyCodeLine{2868       standard\_name=trim(posted\_cmor\_standard\_name), do\_not\_log=do\_not\_log,               \&}
\DoxyCodeLine{2869       interp\_method=interp\_method, tile\_count=tile\_count, area=area)}
\DoxyCodeLine{2870     \textcolor{keywordflow}{if} (fms\_id /= diag\_field\_not\_found) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2871       \textcolor{keywordflow}{if} (dm\_id == -\/1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2872         dm\_id = get\_new\_diag\_id(diag\_cs)}
\DoxyCodeLine{2873 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2874       \textcolor{keyword}{call }alloc\_diag\_with\_id(dm\_id, diag\_cs, cmor\_diag)}
\DoxyCodeLine{2875       cmor\_diag\%fms\_diag\_id = fms\_id}
\DoxyCodeLine{2876       cmor\_diag\%debug\_str = trim(module\_name)//\textcolor{stringliteral}{"-\/"}//trim(cmor\_field\_name)}
\DoxyCodeLine{2877       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(conversion)) cmor\_diag\%conversion\_factor = conversion}
\DoxyCodeLine{2878       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(x\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2879         \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(1), axis\_name)}
\DoxyCodeLine{2880         \textcolor{keyword}{call }diag\_field\_add\_attribute(fms\_id, \textcolor{stringliteral}{'cell\_methods'}, trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(x\_cell\_method))}
\DoxyCodeLine{2881 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2882       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(y\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2883         \textcolor{keyword}{call }get\_diag\_axis\_name(axes\%handles(2), axis\_name)}
\DoxyCodeLine{2884         \textcolor{keyword}{call }diag\_field\_add\_attribute(fms\_id, \textcolor{stringliteral}{'cell\_methods'}, trim(axis\_name)//\textcolor{stringliteral}{':'}//trim(y\_cell\_method))}
\DoxyCodeLine{2885 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2886       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(area\_cell\_method)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2887         \textcolor{keyword}{call }diag\_field\_add\_attribute(fms\_id, \textcolor{stringliteral}{'cell\_methods'}, \textcolor{stringliteral}{'area:'}//trim(area\_cell\_method))}
\DoxyCodeLine{2888 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2889 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2890 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2891 }
\DoxyCodeLine{2892   \textcolor{comment}{! Document diagnostics in list of available diagnostics}}
\DoxyCodeLine{2893   \textcolor{keywordflow}{if} (is\_root\_pe() .and. diag\_cs\%available\_diag\_doc\_unit > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2894     \textcolor{keyword}{call }log\_available\_diag(\textcolor{keyword}{associated}(diag), module\_name, field\_name, \textcolor{stringliteral}{''}, \textcolor{stringliteral}{''}, diag\_cs, \&}
\DoxyCodeLine{2895                             long\_name, units, standard\_name)}
\DoxyCodeLine{2896     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(cmor\_field\_name)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2897       \textcolor{keyword}{call }log\_available\_diag(\textcolor{keyword}{associated}(cmor\_diag), module\_name, cmor\_field\_name, \&}
\DoxyCodeLine{2898                               \textcolor{stringliteral}{''}, \textcolor{stringliteral}{''}, diag\_cs, posted\_cmor\_long\_name, posted\_cmor\_units, \&}
\DoxyCodeLine{2899                               posted\_cmor\_standard\_name)}
\DoxyCodeLine{2900 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2901 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2902 }
\DoxyCodeLine{2903   register\_static\_field = dm\_id}
\DoxyCodeLine{2904 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a76c9267c7744e3573f78afbaa0b716a5}\label{namespacemom__diag__mediator_a76c9267c7744e3573f78afbaa0b716a5}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!set\_axes\_info@{set\_axes\_info}}
\index{set\_axes\_info@{set\_axes\_info}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{set\_axes\_info()}{set\_axes\_info()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::set\+\_\+axes\+\_\+info (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs,  }\item[{logical, intent(in), optional}]{set\+\_\+vertical }\end{DoxyParamCaption})}



Sets up diagnostics axes. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & Ocean grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Diagnostics control structure \\
\hline
\mbox{\texttt{ in}}  & {\em set\+\_\+vertical} & If true or missing, set up vertical axes \\
\hline
\end{DoxyParams}


Definition at line 348 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{349   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{  !< Ocean grid structure}}
\DoxyCodeLine{350   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{ !< ocean vertical grid structure}}
\DoxyCodeLine{351   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{352   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{353   \textcolor{keywordtype}{type}(diag\_ctrl),         \textcolor{keywordtype}{intent(inout)} :: diag\_cs\textcolor{comment}{ !< Diagnostics control structure}}
\DoxyCodeLine{354   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: set\_vertical\textcolor{comment}{ !< If true or missing, set up}}
\DoxyCodeLine{355 \textcolor{comment}{                                                       !! vertical axes}}
\DoxyCodeLine{356   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{357   \textcolor{keywordtype}{integer} :: id\_xq, id\_yq, id\_zl, id\_zi, id\_xh, id\_yh}
\DoxyCodeLine{358   \textcolor{keywordtype}{integer} :: id\_zl\_native, id\_zi\_native}
\DoxyCodeLine{359   \textcolor{keywordtype}{integer} :: i, j, k, nz}
\DoxyCodeLine{360 \textcolor{keywordtype}{  real} :: zlev(GV\%ke), zinter(GV\%ke+1)}
\DoxyCodeLine{361   \textcolor{keywordtype}{logical} :: set\_vert}
\DoxyCodeLine{362 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:)} :: IaxB,iax}
\DoxyCodeLine{363 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{allocatable}, \textcolor{keywordtype}{dimension(:)} :: JaxB,jax}
\DoxyCodeLine{364 }
\DoxyCodeLine{365 }
\DoxyCodeLine{366   set\_vert = .true. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(set\_vertical)) set\_vert = set\_vertical}
\DoxyCodeLine{367 }
\DoxyCodeLine{368 }
\DoxyCodeLine{369   \textcolor{keywordflow}{if} (diag\_cs\%grid\_space\_axes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{370      \textcolor{keyword}{allocate}(iaxb(g\%IsgB:g\%IegB))}
\DoxyCodeLine{371      \textcolor{keywordflow}{do} i=g\%IsgB, g\%IegB}
\DoxyCodeLine{372        iaxb(i)=real(i)}
\DoxyCodeLine{373 \textcolor{keywordflow}{     enddo}}
\DoxyCodeLine{374      \textcolor{keyword}{allocate}(iax(g\%isg:g\%ieg))}
\DoxyCodeLine{375      \textcolor{keywordflow}{do} i=g\%isg, g\%ieg}
\DoxyCodeLine{376        iax(i)=real(i)-\/0.5}
\DoxyCodeLine{377 \textcolor{keywordflow}{     enddo}}
\DoxyCodeLine{378      \textcolor{keyword}{allocate}(jaxb(g\%JsgB:g\%JegB))}
\DoxyCodeLine{379      \textcolor{keywordflow}{do} j=g\%JsgB, g\%JegB}
\DoxyCodeLine{380        jaxb(j)=real(j)}
\DoxyCodeLine{381 \textcolor{keywordflow}{     enddo}}
\DoxyCodeLine{382      \textcolor{keyword}{allocate}(jax(g\%jsg:g\%jeg))}
\DoxyCodeLine{383      \textcolor{keywordflow}{do} j=g\%jsg, g\%jeg}
\DoxyCodeLine{384        jax(j)=real(j)-\/0.5}
\DoxyCodeLine{385 \textcolor{keywordflow}{     enddo}}
\DoxyCodeLine{386 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{387 }
\DoxyCodeLine{388   \textcolor{comment}{! Horizontal axes for the native grids}}
\DoxyCodeLine{389   \textcolor{keywordflow}{if} (g\%symmetric) \textcolor{keywordflow}{then}}
\DoxyCodeLine{390      \textcolor{keywordflow}{if} (diag\_cs\%grid\_space\_axes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{391         id\_xq = diag\_axis\_init(\textcolor{stringliteral}{'iq'}, iaxb(g\%isgB:g\%iegB), \textcolor{stringliteral}{'none'}, \textcolor{stringliteral}{'x'}, \&}
\DoxyCodeLine{392              \textcolor{stringliteral}{'q point grid-\/space longitude'}, domain2=g\%Domain\%mpp\_domain, domain\_position=east)}
\DoxyCodeLine{393         id\_yq = diag\_axis\_init(\textcolor{stringliteral}{'jq'}, jaxb(g\%jsgB:g\%jegB), \textcolor{stringliteral}{'none'}, \textcolor{stringliteral}{'y'}, \&}
\DoxyCodeLine{394          \textcolor{stringliteral}{'q point grid space latitude'}, domain2=g\%Domain\%mpp\_domain, domain\_position=north)}
\DoxyCodeLine{395      \textcolor{keywordflow}{else}}
\DoxyCodeLine{396         id\_xq = diag\_axis\_init(\textcolor{stringliteral}{'xq'}, g\%gridLonB(g\%isgB:g\%iegB), g\%x\_axis\_units, \textcolor{stringliteral}{'x'}, \&}
\DoxyCodeLine{397              \textcolor{stringliteral}{'q point nominal longitude'}, domain2=g\%Domain\%mpp\_domain, domain\_position=east)}
\DoxyCodeLine{398         id\_yq = diag\_axis\_init(\textcolor{stringliteral}{'yq'}, g\%gridLatB(g\%jsgB:g\%jegB), g\%y\_axis\_units, \textcolor{stringliteral}{'y'}, \&}
\DoxyCodeLine{399             \textcolor{stringliteral}{'q point nominal latitude'}, domain2=g\%Domain\%mpp\_domain, domain\_position=north)}
\DoxyCodeLine{400 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{401   \textcolor{keywordflow}{else}}
\DoxyCodeLine{402      \textcolor{keywordflow}{if} (diag\_cs\%grid\_space\_axes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{403         id\_xq = diag\_axis\_init(\textcolor{stringliteral}{'Iq'}, iaxb(g\%isg:g\%ieg), \textcolor{stringliteral}{'none'}, \textcolor{stringliteral}{'x'}, \&}
\DoxyCodeLine{404              \textcolor{stringliteral}{'q point grid-\/space longitude'}, domain2=g\%Domain\%mpp\_domain, domain\_position=east)}
\DoxyCodeLine{405         id\_yq = diag\_axis\_init(\textcolor{stringliteral}{'Jq'}, jaxb(g\%jsg:g\%jeg), \textcolor{stringliteral}{'none'}, \textcolor{stringliteral}{'y'}, \&}
\DoxyCodeLine{406              \textcolor{stringliteral}{'q point grid space latitude'}, domain2=g\%Domain\%mpp\_domain, domain\_position=north)}
\DoxyCodeLine{407      \textcolor{keywordflow}{else}}
\DoxyCodeLine{408         id\_xq = diag\_axis\_init(\textcolor{stringliteral}{'xq'}, g\%gridLonB(g\%isg:g\%ieg), g\%x\_axis\_units, \textcolor{stringliteral}{'x'}, \&}
\DoxyCodeLine{409              \textcolor{stringliteral}{'q point nominal longitude'}, domain2=g\%Domain\%mpp\_domain, domain\_position=east)}
\DoxyCodeLine{410         id\_yq = diag\_axis\_init(\textcolor{stringliteral}{'yq'}, g\%gridLatB(g\%jsg:g\%jeg), g\%y\_axis\_units, \textcolor{stringliteral}{'y'}, \&}
\DoxyCodeLine{411              \textcolor{stringliteral}{'q point nominal latitude'}, domain2=g\%Domain\%mpp\_domain, domain\_position=north)}
\DoxyCodeLine{412 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{413 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{414 }
\DoxyCodeLine{415 }
\DoxyCodeLine{416   \textcolor{keywordflow}{if} (diag\_cs\%grid\_space\_axes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{417      id\_xh = diag\_axis\_init(\textcolor{stringliteral}{'ih'}, iax(g\%isg:g\%ieg), \textcolor{stringliteral}{'none'}, \textcolor{stringliteral}{'x'}, \&}
\DoxyCodeLine{418           \textcolor{stringliteral}{'h point grid-\/space longitude'}, domain2=g\%Domain\%mpp\_domain, domain\_position=east)}
\DoxyCodeLine{419      id\_yh = diag\_axis\_init(\textcolor{stringliteral}{'jh'}, jax(g\%jsg:g\%jeg), \textcolor{stringliteral}{'none'}, \textcolor{stringliteral}{'y'}, \&}
\DoxyCodeLine{420          \textcolor{stringliteral}{'h point grid space latitude'}, domain2=g\%Domain\%mpp\_domain, domain\_position=north)}
\DoxyCodeLine{421   \textcolor{keywordflow}{else}}
\DoxyCodeLine{422      id\_xh = diag\_axis\_init(\textcolor{stringliteral}{'xh'}, g\%gridLonT(g\%isg:g\%ieg), g\%x\_axis\_units, \textcolor{stringliteral}{'x'}, \&}
\DoxyCodeLine{423           \textcolor{stringliteral}{'h point nominal longitude'}, domain2=g\%Domain\%mpp\_domain)}
\DoxyCodeLine{424      id\_yh = diag\_axis\_init(\textcolor{stringliteral}{'yh'}, g\%gridLatT(g\%jsg:g\%jeg), g\%y\_axis\_units, \textcolor{stringliteral}{'y'}, \&}
\DoxyCodeLine{425           \textcolor{stringliteral}{'h point nominal latitude'}, domain2=g\%Domain\%mpp\_domain)}
\DoxyCodeLine{426 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{427 }
\DoxyCodeLine{428   \textcolor{keywordflow}{if} (set\_vert) \textcolor{keywordflow}{then}}
\DoxyCodeLine{429     nz = gv\%ke}
\DoxyCodeLine{430     zinter(1:nz+1) = gv\%sInterface(1:nz+1)}
\DoxyCodeLine{431     zlev(1:nz) = gv\%sLayer(1:nz)}
\DoxyCodeLine{432     id\_zl = diag\_axis\_init(\textcolor{stringliteral}{'zl'}, zlev, trim(gv\%zAxisUnits), \textcolor{stringliteral}{'z'}, \&}
\DoxyCodeLine{433                            \textcolor{stringliteral}{'Layer '}//trim(gv\%zAxisLongName),     \&}
\DoxyCodeLine{434                            direction=gv\%direction)}
\DoxyCodeLine{435     id\_zi = diag\_axis\_init(\textcolor{stringliteral}{'zi'}, zinter, trim(gv\%zAxisUnits), \textcolor{stringliteral}{'z'}, \&}
\DoxyCodeLine{436                            \textcolor{stringliteral}{'Interface '}//trim(gv\%zAxisLongName),   \&}
\DoxyCodeLine{437                            direction=gv\%direction)}
\DoxyCodeLine{438   \textcolor{keywordflow}{else}}
\DoxyCodeLine{439     id\_zl = -\/1 ; id\_zi = -\/1}
\DoxyCodeLine{440 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{441   id\_zl\_native = id\_zl ; id\_zi\_native = id\_zi}
\DoxyCodeLine{442   \textcolor{comment}{! Vertical axes for the interfaces and layers}}
\DoxyCodeLine{443   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_zi /), diag\_cs\%axesZi, \&}
\DoxyCodeLine{444        v\_cell\_method=\textcolor{stringliteral}{'point'}, is\_interface=.true.)}
\DoxyCodeLine{445   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_zl /), diag\_cs\%axesZL, \&}
\DoxyCodeLine{446        v\_cell\_method=\textcolor{stringliteral}{'mean'}, is\_layer=.true.)}
\DoxyCodeLine{447 }
\DoxyCodeLine{448   \textcolor{comment}{! Axis groupings for the model layers}}
\DoxyCodeLine{449   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xh, id\_yh, id\_zl /), diag\_cs\%axesTL, \&}
\DoxyCodeLine{450        x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{451        is\_h\_point=.true., is\_layer=.true., xyave\_axes=diag\_cs\%axesZL)}
\DoxyCodeLine{452   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xq, id\_yq, id\_zl /), diag\_cs\%axesBL, \&}
\DoxyCodeLine{453        x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{454        is\_q\_point=.true., is\_layer=.true.)}
\DoxyCodeLine{455   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xq, id\_yh, id\_zl /), diag\_cs\%axesCuL, \&}
\DoxyCodeLine{456        x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{457        is\_u\_point=.true., is\_layer=.true., xyave\_axes=diag\_cs\%axesZL)}
\DoxyCodeLine{458   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xh, id\_yq, id\_zl /), diag\_cs\%axesCvL, \&}
\DoxyCodeLine{459        x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{460        is\_v\_point=.true., is\_layer=.true., xyave\_axes=diag\_cs\%axesZL)}
\DoxyCodeLine{461 }
\DoxyCodeLine{462   \textcolor{comment}{! Axis groupings for the model interfaces}}
\DoxyCodeLine{463   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xh, id\_yh, id\_zi /), diag\_cs\%axesTi, \&}
\DoxyCodeLine{464        x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{465        is\_h\_point=.true., is\_interface=.true., xyave\_axes=diag\_cs\%axesZi)}
\DoxyCodeLine{466   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xq, id\_yq, id\_zi /), diag\_cs\%axesBi, \&}
\DoxyCodeLine{467        x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{468        is\_q\_point=.true., is\_interface=.true.)}
\DoxyCodeLine{469   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xq, id\_yh, id\_zi /), diag\_cs\%axesCui, \&}
\DoxyCodeLine{470        x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{471        is\_u\_point=.true., is\_interface=.true., xyave\_axes=diag\_cs\%axesZi)}
\DoxyCodeLine{472   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xh, id\_yq, id\_zi /), diag\_cs\%axesCvi, \&}
\DoxyCodeLine{473        x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{474        is\_v\_point=.true., is\_interface=.true., xyave\_axes=diag\_cs\%axesZi)}
\DoxyCodeLine{475 }
\DoxyCodeLine{476   \textcolor{comment}{! Axis groupings for 2-\/D arrays}}
\DoxyCodeLine{477   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xh, id\_yh /), diag\_cs\%axesT1, \&}
\DoxyCodeLine{478        x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, is\_h\_point=.true.)}
\DoxyCodeLine{479   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xq, id\_yq /), diag\_cs\%axesB1, \&}
\DoxyCodeLine{480        x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, is\_q\_point=.true.)}
\DoxyCodeLine{481   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xq, id\_yh /), diag\_cs\%axesCu1, \&}
\DoxyCodeLine{482        x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, is\_u\_point=.true.)}
\DoxyCodeLine{483   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xh, id\_yq /), diag\_cs\%axesCv1, \&}
\DoxyCodeLine{484        x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, is\_v\_point=.true.)}
\DoxyCodeLine{485 }
\DoxyCodeLine{486   \textcolor{comment}{! Axis group for special null axis from diag manager}}
\DoxyCodeLine{487   \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ null\_axis\_id /), diag\_cs\%axesNull)}
\DoxyCodeLine{488 }
\DoxyCodeLine{489 }
\DoxyCodeLine{490   \textcolor{comment}{!Non-\/native Non-\/downsampled}}
\DoxyCodeLine{491   \textcolor{keywordflow}{if} (diag\_cs\%num\_diag\_coords>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{492     \textcolor{keyword}{allocate}(diag\_cs\%remap\_axesZL(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{493     \textcolor{keyword}{allocate}(diag\_cs\%remap\_axesTL(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{494     \textcolor{keyword}{allocate}(diag\_cs\%remap\_axesBL(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{495     \textcolor{keyword}{allocate}(diag\_cs\%remap\_axesCuL(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{496     \textcolor{keyword}{allocate}(diag\_cs\%remap\_axesCvL(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{497     \textcolor{keyword}{allocate}(diag\_cs\%remap\_axesZi(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{498     \textcolor{keyword}{allocate}(diag\_cs\%remap\_axesTi(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{499     \textcolor{keyword}{allocate}(diag\_cs\%remap\_axesBi(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{500     \textcolor{keyword}{allocate}(diag\_cs\%remap\_axesCui(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{501     \textcolor{keyword}{allocate}(diag\_cs\%remap\_axesCvi(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{502 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{503 }
\DoxyCodeLine{504   \textcolor{keywordflow}{do} i=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{505     \textcolor{comment}{! For each possible diagnostic coordinate}}
\DoxyCodeLine{506     \textcolor{keyword}{call }diag\_remap\_configure\_axes(diag\_cs\%diag\_remap\_cs(i), gv, us, param\_file)}
\DoxyCodeLine{507 }
\DoxyCodeLine{508     \textcolor{comment}{! Allocate these arrays since the size of the diagnostic array is now known}}
\DoxyCodeLine{509     \textcolor{keyword}{allocate}(diag\_cs\%diag\_remap\_cs(i)\%h(g\%isd:g\%ied,g\%jsd:g\%jed, diag\_cs\%diag\_remap\_cs(i)\%nz))}
\DoxyCodeLine{510     \textcolor{keyword}{allocate}(diag\_cs\%diag\_remap\_cs(i)\%h\_extensive(g\%isd:g\%ied,g\%jsd:g\%jed, diag\_cs\%diag\_remap\_cs(i)\%nz))}
\DoxyCodeLine{511 }
\DoxyCodeLine{512     \textcolor{comment}{! This vertical coordinate has been configured so can be used.}}
\DoxyCodeLine{513     \textcolor{keywordflow}{if} (diag\_remap\_axes\_configured(diag\_cs\%diag\_remap\_cs(i))) \textcolor{keywordflow}{then}}
\DoxyCodeLine{514 }
\DoxyCodeLine{515       \textcolor{comment}{! This fetches the 1D-\/axis id for layers and interfaces and overwrite}}
\DoxyCodeLine{516       \textcolor{comment}{! id\_zl and id\_zi from above. It also returns the number of layers.}}
\DoxyCodeLine{517       \textcolor{keyword}{call }diag\_remap\_get\_axes\_info(diag\_cs\%diag\_remap\_cs(i), nz, id\_zl, id\_zi)}
\DoxyCodeLine{518 }
\DoxyCodeLine{519       \textcolor{comment}{! Axes for z layers}}
\DoxyCodeLine{520       \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_zl /), diag\_cs\%remap\_axesZL(i), \&}
\DoxyCodeLine{521            nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{522            v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{523            is\_h\_point=.true., is\_layer=.true., is\_native=.false., needs\_remapping=.true.)}
\DoxyCodeLine{524       \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xh, id\_yh, id\_zl /), diag\_cs\%remap\_axesTL(i), \&}
\DoxyCodeLine{525            nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{526            x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{527            is\_h\_point=.true., is\_layer=.true., is\_native=.false., needs\_remapping=.true., \&}
\DoxyCodeLine{528            xyave\_axes=diag\_cs\%remap\_axesZL(i))}
\DoxyCodeLine{529 }
\DoxyCodeLine{530        \textcolor{comment}{!! \(\backslash\)note Remapping for B points is not yet implemented so needs\_remapping is not}}
\DoxyCodeLine{531        \textcolor{comment}{!! provided for remap\_axesBL}}
\DoxyCodeLine{532       \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xq, id\_yq, id\_zl /), diag\_cs\%remap\_axesBL(i), \&}
\DoxyCodeLine{533            nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{534            x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{535            is\_q\_point=.true., is\_layer=.true., is\_native=.false.)}
\DoxyCodeLine{536 }
\DoxyCodeLine{537       \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xq, id\_yh, id\_zl /), diag\_cs\%remap\_axesCuL(i), \&}
\DoxyCodeLine{538            nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{539            x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{540            is\_u\_point=.true., is\_layer=.true., is\_native=.false., needs\_remapping=.true., \&}
\DoxyCodeLine{541            xyave\_axes=diag\_cs\%remap\_axesZL(i))}
\DoxyCodeLine{542 }
\DoxyCodeLine{543       \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xh, id\_yq, id\_zl /), diag\_cs\%remap\_axesCvL(i), \&}
\DoxyCodeLine{544            nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{545            x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{546            is\_v\_point=.true., is\_layer=.true., is\_native=.false., needs\_remapping=.true., \&}
\DoxyCodeLine{547            xyave\_axes=diag\_cs\%remap\_axesZL(i))}
\DoxyCodeLine{548 }
\DoxyCodeLine{549       \textcolor{comment}{! Axes for z interfaces}}
\DoxyCodeLine{550       \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_zi /), diag\_cs\%remap\_axesZi(i), \&}
\DoxyCodeLine{551            nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{552            v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{553            is\_h\_point=.true., is\_interface=.true., is\_native=.false., needs\_interpolating=.true.)}
\DoxyCodeLine{554       \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xh, id\_yh, id\_zi /), diag\_cs\%remap\_axesTi(i), \&}
\DoxyCodeLine{555            nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{556            x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{557            is\_h\_point=.true., is\_interface=.true., is\_native=.false., needs\_interpolating=.true., \&}
\DoxyCodeLine{558            xyave\_axes=diag\_cs\%remap\_axesZi(i))}
\DoxyCodeLine{559 }
\DoxyCodeLine{560       \textcolor{comment}{!! \(\backslash\)note Remapping for B points is not yet implemented so needs\_remapping is not provided for remap\_axesBi}}
\DoxyCodeLine{561       \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xq, id\_yq, id\_zi /), diag\_cs\%remap\_axesBi(i), \&}
\DoxyCodeLine{562            nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{563            x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{564            is\_q\_point=.true., is\_interface=.true., is\_native=.false.)}
\DoxyCodeLine{565 }
\DoxyCodeLine{566       \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xq, id\_yh, id\_zi /), diag\_cs\%remap\_axesCui(i), \&}
\DoxyCodeLine{567            nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{568            x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{569            is\_u\_point=.true., is\_interface=.true., is\_native=.false., \&}
\DoxyCodeLine{570            needs\_interpolating=.true., xyave\_axes=diag\_cs\%remap\_axesZi(i))}
\DoxyCodeLine{571 }
\DoxyCodeLine{572       \textcolor{keyword}{call }define\_axes\_group(diag\_cs, (/ id\_xh, id\_yq, id\_zi /), diag\_cs\%remap\_axesCvi(i), \&}
\DoxyCodeLine{573            nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{574            x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{575            is\_v\_point=.true., is\_interface=.true., is\_native=.false., \&}
\DoxyCodeLine{576            needs\_interpolating=.true., xyave\_axes=diag\_cs\%remap\_axesZi(i))}
\DoxyCodeLine{577 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{578 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{579 }
\DoxyCodeLine{580   \textcolor{keywordflow}{if} (diag\_cs\%grid\_space\_axes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{581      \textcolor{keyword}{deallocate}(iaxb,iax,jaxb,jax)}
\DoxyCodeLine{582 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{583   \textcolor{comment}{!Define the downsampled axes}}
\DoxyCodeLine{584   \textcolor{keyword}{call }set\_axes\_info\_dsamp(g, gv, param\_file, diag\_cs, id\_zl\_native, id\_zi\_native)}
\DoxyCodeLine{585 }
\DoxyCodeLine{586   \textcolor{keyword}{call }diag\_grid\_storage\_init(diag\_cs\%diag\_grid\_temp, g, diag\_cs)}
\DoxyCodeLine{587 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a1abcee77dbc8e8a48f4b48144fc0923c}\label{namespacemom__diag__mediator_a1abcee77dbc8e8a48f4b48144fc0923c}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!set\_axes\_info\_dsamp@{set\_axes\_info\_dsamp}}
\index{set\_axes\_info\_dsamp@{set\_axes\_info\_dsamp}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{set\_axes\_info\_dsamp()}{set\_axes\_info\_dsamp()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::set\+\_\+axes\+\_\+info\+\_\+dsamp (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs,  }\item[{integer, intent(in)}]{id\+\_\+zl\+\_\+native,  }\item[{integer, intent(in)}]{id\+\_\+zi\+\_\+native }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & Ocean grid structure\\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure\\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure\\
\hline
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Diagnostics control structure\\
\hline
\mbox{\texttt{ in}}  & {\em id\+\_\+zl\+\_\+native} & ID of native layers\\
\hline
\mbox{\texttt{ in}}  & {\em id\+\_\+zi\+\_\+native} & ID of native interfaces \\
\hline
\end{DoxyParams}


Definition at line 590 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{591   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{ !< Ocean grid structure}}
\DoxyCodeLine{592   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{ !< ocean vertical grid structure}}
\DoxyCodeLine{593   \textcolor{keywordtype}{type}(param\_file\_type), \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{594   \textcolor{keywordtype}{type}(diag\_ctrl),       \textcolor{keywordtype}{intent(inout)} :: diag\_cs\textcolor{comment}{ !< Diagnostics control structure}}
\DoxyCodeLine{595   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(in)}    :: id\_zl\_native\textcolor{comment}{ !< ID of native layers}}
\DoxyCodeLine{596   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(in)}    :: id\_zi\_native\textcolor{comment}{ !< ID of native interfaces}}
\DoxyCodeLine{597 }
\DoxyCodeLine{598   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{599   \textcolor{keywordtype}{integer} :: id\_xq, id\_yq, id\_zl, id\_zi, id\_xh, id\_yh}
\DoxyCodeLine{600   \textcolor{keywordtype}{integer} :: i, j, k, nz, dl}
\DoxyCodeLine{601 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{pointer} :: gridLonT\_dsamp =>null()}
\DoxyCodeLine{602 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{pointer} :: gridLatT\_dsamp =>null()}
\DoxyCodeLine{603 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{pointer} :: gridLonB\_dsamp =>null()}
\DoxyCodeLine{604 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{pointer} :: gridLatB\_dsamp =>null()}
\DoxyCodeLine{605 }
\DoxyCodeLine{606   id\_zl = id\_zl\_native ; id\_zi = id\_zi\_native}
\DoxyCodeLine{607   \textcolor{comment}{!Axes group for native downsampled diagnostics}}
\DoxyCodeLine{608   \textcolor{keywordflow}{do} dl=2,max\_dsamp\_lev}
\DoxyCodeLine{609      \textcolor{keywordflow}{if}(dl .ne. 2) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"set\_axes\_info\_dsamp: Downsample level other than 2 is not supported yet!"})}
\DoxyCodeLine{610      \textcolor{keywordflow}{if} (g\%symmetric) \textcolor{keywordflow}{then}}
\DoxyCodeLine{611         \textcolor{keyword}{allocate}(gridlonb\_dsamp(diag\_cs\%dsamp(dl)\%isgB:diag\_cs\%dsamp(dl)\%iegB))}
\DoxyCodeLine{612         \textcolor{keyword}{allocate}(gridlatb\_dsamp(diag\_cs\%dsamp(dl)\%jsgB:diag\_cs\%dsamp(dl)\%jegB))}
\DoxyCodeLine{613         \textcolor{keywordflow}{do} i=diag\_cs\%dsamp(dl)\%isgB,diag\_cs\%dsamp(dl)\%iegB;  gridlonb\_dsamp(i) = g\%gridLonB(g\%isgB+dl*i);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{614         \textcolor{keywordflow}{do} j=diag\_cs\%dsamp(dl)\%jsgB,diag\_cs\%dsamp(dl)\%jegB;  gridlatb\_dsamp(j) = g\%gridLatB(g\%jsgB+dl*j);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{615         id\_xq = diag\_axis\_init(\textcolor{stringliteral}{'xq'}, gridlonb\_dsamp, g\%x\_axis\_units, \textcolor{stringliteral}{'x'}, \&}
\DoxyCodeLine{616                   \textcolor{stringliteral}{'q point nominal longitude'}, domain2=g\%Domain\%mpp\_domain\_d2)}
\DoxyCodeLine{617         id\_yq = diag\_axis\_init(\textcolor{stringliteral}{'yq'}, gridlatb\_dsamp, g\%y\_axis\_units, \textcolor{stringliteral}{'y'}, \&}
\DoxyCodeLine{618                   \textcolor{stringliteral}{'q point nominal latitude'}, domain2=g\%Domain\%mpp\_domain\_d2)}
\DoxyCodeLine{619         \textcolor{keyword}{deallocate}(gridlonb\_dsamp,gridlatb\_dsamp)}
\DoxyCodeLine{620      \textcolor{keywordflow}{else}}
\DoxyCodeLine{621         \textcolor{keyword}{allocate}(gridlonb\_dsamp(diag\_cs\%dsamp(dl)\%isg:diag\_cs\%dsamp(dl)\%ieg))}
\DoxyCodeLine{622         \textcolor{keyword}{allocate}(gridlatb\_dsamp(diag\_cs\%dsamp(dl)\%jsg:diag\_cs\%dsamp(dl)\%jeg))}
\DoxyCodeLine{623         \textcolor{keywordflow}{do} i=diag\_cs\%dsamp(dl)\%isg,diag\_cs\%dsamp(dl)\%ieg;  gridlonb\_dsamp(i) = g\%gridLonB(g\%isg+dl*i-\/2);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{624         \textcolor{keywordflow}{do} j=diag\_cs\%dsamp(dl)\%jsg,diag\_cs\%dsamp(dl)\%jeg;  gridlatb\_dsamp(j) = g\%gridLatB(g\%jsg+dl*j-\/2);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{625         id\_xq = diag\_axis\_init(\textcolor{stringliteral}{'xq'}, gridlonb\_dsamp, g\%x\_axis\_units, \textcolor{stringliteral}{'x'}, \&}
\DoxyCodeLine{626                   \textcolor{stringliteral}{'q point nominal longitude'}, domain2=g\%Domain\%mpp\_domain\_d2)}
\DoxyCodeLine{627         id\_yq = diag\_axis\_init(\textcolor{stringliteral}{'yq'}, gridlatb\_dsamp, g\%y\_axis\_units, \textcolor{stringliteral}{'y'}, \&}
\DoxyCodeLine{628                   \textcolor{stringliteral}{'q point nominal latitude'}, domain2=g\%Domain\%mpp\_domain\_d2)}
\DoxyCodeLine{629         \textcolor{keyword}{deallocate}(gridlonb\_dsamp,gridlatb\_dsamp)}
\DoxyCodeLine{630 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{631 }
\DoxyCodeLine{632      \textcolor{keyword}{allocate}(gridlont\_dsamp(diag\_cs\%dsamp(dl)\%isg:diag\_cs\%dsamp(dl)\%ieg))}
\DoxyCodeLine{633      \textcolor{keyword}{allocate}(gridlatt\_dsamp(diag\_cs\%dsamp(dl)\%jsg:diag\_cs\%dsamp(dl)\%jeg))}
\DoxyCodeLine{634      \textcolor{keywordflow}{do} i=diag\_cs\%dsamp(dl)\%isg,diag\_cs\%dsamp(dl)\%ieg;  gridlont\_dsamp(i) = g\%gridLonT(g\%isg+dl*i-\/2);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{635      \textcolor{keywordflow}{do} j=diag\_cs\%dsamp(dl)\%jsg,diag\_cs\%dsamp(dl)\%jeg;  gridlatt\_dsamp(j) = g\%gridLatT(g\%jsg+dl*j-\/2);\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{636      id\_xh = diag\_axis\_init(\textcolor{stringliteral}{'xh'}, gridlont\_dsamp, g\%x\_axis\_units, \textcolor{stringliteral}{'x'}, \&}
\DoxyCodeLine{637           \textcolor{stringliteral}{'h point nominal longitude'}, domain2=g\%Domain\%mpp\_domain\_d2)}
\DoxyCodeLine{638      id\_yh = diag\_axis\_init(\textcolor{stringliteral}{'yh'}, gridlatt\_dsamp, g\%y\_axis\_units, \textcolor{stringliteral}{'y'}, \&}
\DoxyCodeLine{639           \textcolor{stringliteral}{'h point nominal latitude'}, domain2=g\%Domain\%mpp\_domain\_d2)}
\DoxyCodeLine{640 }
\DoxyCodeLine{641      \textcolor{keyword}{deallocate}(gridlont\_dsamp,gridlatt\_dsamp)}
\DoxyCodeLine{642 }
\DoxyCodeLine{643      \textcolor{comment}{! Axis groupings for the model layers}}
\DoxyCodeLine{644      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xh, id\_yh, id\_zl /), diag\_cs\%dsamp(dl)\%axesTL, dl, \&}
\DoxyCodeLine{645           x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{646           is\_h\_point=.true., is\_layer=.true., xyave\_axes=diag\_cs\%axesZL)}
\DoxyCodeLine{647      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xq, id\_yq, id\_zl /), diag\_cs\%dsamp(dl)\%axesBL, dl, \&}
\DoxyCodeLine{648           x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{649           is\_q\_point=.true., is\_layer=.true.)}
\DoxyCodeLine{650      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xq, id\_yh, id\_zl /), diag\_cs\%dsamp(dl)\%axesCuL, dl, \&}
\DoxyCodeLine{651           x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{652           is\_u\_point=.true., is\_layer=.true., xyave\_axes=diag\_cs\%axesZL)}
\DoxyCodeLine{653      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xh, id\_yq, id\_zl /), diag\_cs\%dsamp(dl)\%axesCvL, dl, \&}
\DoxyCodeLine{654           x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{655           is\_v\_point=.true., is\_layer=.true., xyave\_axes=diag\_cs\%axesZL)}
\DoxyCodeLine{656 }
\DoxyCodeLine{657      \textcolor{comment}{! Axis groupings for the model interfaces}}
\DoxyCodeLine{658      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xh, id\_yh, id\_zi /), diag\_cs\%dsamp(dl)\%axesTi, dl, \&}
\DoxyCodeLine{659           x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{660           is\_h\_point=.true., is\_interface=.true., xyave\_axes=diag\_cs\%axesZi)}
\DoxyCodeLine{661      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xq, id\_yq, id\_zi /), diag\_cs\%dsamp(dl)\%axesBi, dl, \&}
\DoxyCodeLine{662           x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{663           is\_q\_point=.true., is\_interface=.true.)}
\DoxyCodeLine{664      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xq, id\_yh, id\_zi /), diag\_cs\%dsamp(dl)\%axesCui, dl, \&}
\DoxyCodeLine{665           x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{666           is\_u\_point=.true., is\_interface=.true., xyave\_axes=diag\_cs\%axesZi)}
\DoxyCodeLine{667      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xh, id\_yq, id\_zi /), diag\_cs\%dsamp(dl)\%axesCvi, dl, \&}
\DoxyCodeLine{668           x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{669           is\_v\_point=.true., is\_interface=.true., xyave\_axes=diag\_cs\%axesZi)}
\DoxyCodeLine{670 }
\DoxyCodeLine{671      \textcolor{comment}{! Axis groupings for 2-\/D arrays}}
\DoxyCodeLine{672      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xh, id\_yh /), diag\_cs\%dsamp(dl)\%axesT1, dl, \&}
\DoxyCodeLine{673           x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, is\_h\_point=.true.)}
\DoxyCodeLine{674      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xq, id\_yq /), diag\_cs\%dsamp(dl)\%axesB1, dl, \&}
\DoxyCodeLine{675           x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, is\_q\_point=.true.)}
\DoxyCodeLine{676      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xq, id\_yh /), diag\_cs\%dsamp(dl)\%axesCu1, dl, \&}
\DoxyCodeLine{677           x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, is\_u\_point=.true.)}
\DoxyCodeLine{678      \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xh, id\_yq /), diag\_cs\%dsamp(dl)\%axesCv1, dl, \&}
\DoxyCodeLine{679           x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, is\_v\_point=.true.)}
\DoxyCodeLine{680 }
\DoxyCodeLine{681      \textcolor{comment}{!Non-\/native axes}}
\DoxyCodeLine{682      \textcolor{keywordflow}{if} (diag\_cs\%num\_diag\_coords>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{683         \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%remap\_axesTL(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{684         \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%remap\_axesBL(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{685         \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%remap\_axesCuL(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{686         \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%remap\_axesCvL(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{687         \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%remap\_axesTi(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{688         \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%remap\_axesBi(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{689         \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%remap\_axesCui(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{690         \textcolor{keyword}{allocate}(diag\_cs\%dsamp(dl)\%remap\_axesCvi(diag\_cs\%num\_diag\_coords))}
\DoxyCodeLine{691 \textcolor{keywordflow}{     endif}}
\DoxyCodeLine{692 }
\DoxyCodeLine{693      \textcolor{keywordflow}{do} i=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{694         \textcolor{comment}{! For each possible diagnostic coordinate}}
\DoxyCodeLine{695         \textcolor{comment}{!call diag\_remap\_configure\_axes(diag\_cs\%diag\_remap\_cs(i), GV, param\_file)}}
\DoxyCodeLine{696 }
\DoxyCodeLine{697         \textcolor{comment}{! This vertical coordinate has been configured so can be used.}}
\DoxyCodeLine{698         \textcolor{keywordflow}{if} (diag\_remap\_axes\_configured(diag\_cs\%diag\_remap\_cs(i))) \textcolor{keywordflow}{then}}
\DoxyCodeLine{699 }
\DoxyCodeLine{700            \textcolor{comment}{! This fetches the 1D-\/axis id for layers and interfaces and overwrite}}
\DoxyCodeLine{701            \textcolor{comment}{! id\_zl and id\_zi from above. It also returns the number of layers.}}
\DoxyCodeLine{702            \textcolor{keyword}{call }diag\_remap\_get\_axes\_info(diag\_cs\%diag\_remap\_cs(i), nz, id\_zl, id\_zi)}
\DoxyCodeLine{703 }
\DoxyCodeLine{704            \textcolor{comment}{! Axes for z layers}}
\DoxyCodeLine{705            \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xh, id\_yh, id\_zl /), diag\_cs\%dsamp(dl)\%remap\_axesTL(i), dl, \&}
\DoxyCodeLine{706                 nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{707                 x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{708                 is\_h\_point=.true., is\_layer=.true., is\_native=.false., needs\_remapping=.true., \&}
\DoxyCodeLine{709                 xyave\_axes=diag\_cs\%remap\_axesZL(i))}
\DoxyCodeLine{710 }
\DoxyCodeLine{711            \textcolor{comment}{!! \(\backslash\)note Remapping for B points is not yet implemented so needs\_remapping is not}}
\DoxyCodeLine{712            \textcolor{comment}{!! provided for remap\_axesBL}}
\DoxyCodeLine{713            \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xq, id\_yq, id\_zl /), diag\_cs\%dsamp(dl)\%remap\_axesBL(i), dl, \&}
\DoxyCodeLine{714                 nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{715                 x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{716                 is\_q\_point=.true., is\_layer=.true., is\_native=.false.)}
\DoxyCodeLine{717 }
\DoxyCodeLine{718            \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xq, id\_yh, id\_zl /), diag\_cs\%dsamp(dl)\%remap\_axesCuL(i), dl, \&}
\DoxyCodeLine{719                 nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{720                 x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{721                 is\_u\_point=.true., is\_layer=.true., is\_native=.false., needs\_remapping=.true., \&}
\DoxyCodeLine{722                 xyave\_axes=diag\_cs\%remap\_axesZL(i))}
\DoxyCodeLine{723 }
\DoxyCodeLine{724            \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xh, id\_yq, id\_zl /), diag\_cs\%dsamp(dl)\%remap\_axesCvL(i), dl, \&}
\DoxyCodeLine{725                 nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{726                 x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'mean'}, \&}
\DoxyCodeLine{727                 is\_v\_point=.true., is\_layer=.true., is\_native=.false., needs\_remapping=.true., \&}
\DoxyCodeLine{728                 xyave\_axes=diag\_cs\%remap\_axesZL(i))}
\DoxyCodeLine{729 }
\DoxyCodeLine{730            \textcolor{comment}{! Axes for z interfaces}}
\DoxyCodeLine{731            \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xh, id\_yh, id\_zi /), diag\_cs\%dsamp(dl)\%remap\_axesTi(i), dl, \&}
\DoxyCodeLine{732                 nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{733                 x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{734                 is\_h\_point=.true., is\_interface=.true., is\_native=.false., needs\_interpolating=.true., \&}
\DoxyCodeLine{735                 xyave\_axes=diag\_cs\%remap\_axesZi(i))}
\DoxyCodeLine{736 }
\DoxyCodeLine{737            \textcolor{comment}{!! \(\backslash\)note Remapping for B points is not yet implemented so needs\_remapping is not provided for remap\_axesBi}}
\DoxyCodeLine{738            \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xq, id\_yq, id\_zi /), diag\_cs\%dsamp(dl)\%remap\_axesBi(i), dl, \&}
\DoxyCodeLine{739                 nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{740                 x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{741                 is\_q\_point=.true., is\_interface=.true., is\_native=.false.)}
\DoxyCodeLine{742 }
\DoxyCodeLine{743            \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xq, id\_yh, id\_zi /), diag\_cs\%dsamp(dl)\%remap\_axesCui(i), dl, \&}
\DoxyCodeLine{744                 nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{745                 x\_cell\_method=\textcolor{stringliteral}{'point'}, y\_cell\_method=\textcolor{stringliteral}{'mean'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{746                 is\_u\_point=.true., is\_interface=.true., is\_native=.false., \&}
\DoxyCodeLine{747                 needs\_interpolating=.true., xyave\_axes=diag\_cs\%remap\_axesZi(i))}
\DoxyCodeLine{748 }
\DoxyCodeLine{749            \textcolor{keyword}{call }define\_axes\_group\_dsamp(diag\_cs, (/ id\_xh, id\_yq, id\_zi /), diag\_cs\%dsamp(dl)\%remap\_axesCvi(i), dl, \&}
\DoxyCodeLine{750                 nz=nz, vertical\_coordinate\_number=i, \&}
\DoxyCodeLine{751                 x\_cell\_method=\textcolor{stringliteral}{'mean'}, y\_cell\_method=\textcolor{stringliteral}{'point'}, v\_cell\_method=\textcolor{stringliteral}{'point'}, \&}
\DoxyCodeLine{752                 is\_v\_point=.true., is\_interface=.true., is\_native=.false., \&}
\DoxyCodeLine{753                 needs\_interpolating=.true., xyave\_axes=diag\_cs\%remap\_axesZi(i))}
\DoxyCodeLine{754 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{755 \textcolor{keywordflow}{     enddo}}
\DoxyCodeLine{756 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{757 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a36d062ce991a3bd7250b3224e6508eb5}\label{namespacemom__diag__mediator_a36d062ce991a3bd7250b3224e6508eb5}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!set\_diag\_mediator\_grid@{set\_diag\_mediator\_grid}}
\index{set\_diag\_mediator\_grid@{set\_diag\_mediator\_grid}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{set\_diag\_mediator\_grid()}{set\_diag\_mediator\_grid()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::set\+\_\+diag\+\_\+mediator\+\_\+grid (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(inout)}]{diag\+\_\+cs }\end{DoxyParamCaption})}



Set up the array extents for doing diagnostics. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag\+\_\+cs} & Structure used to regulate diagnostic output \\
\hline
\end{DoxyParams}


Definition at line 1244 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1245   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{1246   \textcolor{keywordtype}{type}(diag\_ctrl),  \textcolor{keywordtype}{intent(inout)} :: diag\_CS\textcolor{comment}{ !< Structure used to regulate diagnostic output}}
\DoxyCodeLine{1247 }
\DoxyCodeLine{1248   diag\_cs\%is = g\%isc -\/ (g\%isd-\/1) ; diag\_cs\%ie = g\%iec -\/ (g\%isd-\/1)}
\DoxyCodeLine{1249   diag\_cs\%js = g\%jsc -\/ (g\%jsd-\/1) ; diag\_cs\%je = g\%jec -\/ (g\%jsd-\/1)}
\DoxyCodeLine{1250   diag\_cs\%isd = g\%isd ; diag\_cs\%ied = g\%ied}
\DoxyCodeLine{1251   diag\_cs\%jsd = g\%jsd ; diag\_cs\%jed = g\%jed}
\DoxyCodeLine{1252 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_a19d8a5e2782eb57ab3d7824028fafd56}\label{namespacemom__diag__mediator_a19d8a5e2782eb57ab3d7824028fafd56}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!set\_masks\_for\_axes@{set\_masks\_for\_axes}}
\index{set\_masks\_for\_axes@{set\_masks\_for\_axes}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{set\_masks\_for\_axes()}{set\_masks\_for\_axes()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+diag\+\_\+mediator\+::set\+\_\+masks\+\_\+for\+\_\+axes (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in), target}]{G,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), pointer}]{diag\+\_\+cs }\end{DoxyParamCaption})}



set\+\_\+masks\+\_\+for\+\_\+axes sets up the 2d and 3d masks for diagnostics using the current grid recorded after calling \mbox{\hyperlink{namespacemom__diag__mediator_aa78e69709084d0097b3e01bbd83d3509}{diag\+\_\+update\+\_\+remap\+\_\+grids()}} 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The ocean grid type. \\
\hline
 & {\em diag\+\_\+cs} & A pointer to a type with many variables used for diagnostics \\
\hline
\end{DoxyParams}


Definition at line 763 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{764   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{ !< The ocean grid type.}}
\DoxyCodeLine{765   \textcolor{keywordtype}{type}(diag\_ctrl),               \textcolor{keywordtype}{pointer}    :: diag\_cs\textcolor{comment}{ !< A pointer to a type with many variables}}
\DoxyCodeLine{766 \textcolor{comment}{                                                       !! used for diagnostics}}
\DoxyCodeLine{767   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{768   \textcolor{keywordtype}{integer} :: c, nk, i, j, k, ii, jj}
\DoxyCodeLine{769   \textcolor{keywordtype}{type}(axes\_grp), \textcolor{keywordtype}{pointer} :: axes => null(), h\_axes => null() \textcolor{comment}{! Current axes, for convenience}}
\DoxyCodeLine{770 }
\DoxyCodeLine{771   \textcolor{keywordflow}{do} c=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{772     \textcolor{comment}{! This vertical coordinate has been configured so can be used.}}
\DoxyCodeLine{773     \textcolor{keywordflow}{if} (diag\_remap\_axes\_configured(diag\_cs\%diag\_remap\_cs(c))) \textcolor{keywordflow}{then}}
\DoxyCodeLine{774 }
\DoxyCodeLine{775       \textcolor{comment}{! Level/layer h-\/points in diagnostic coordinate}}
\DoxyCodeLine{776       axes => diag\_cs\%remap\_axesTL(c)}
\DoxyCodeLine{777       nk = axes\%nz}
\DoxyCodeLine{778       \textcolor{keyword}{allocate}( axes\%mask3d(g\%isd:g\%ied,g\%jsd:g\%jed,nk) ) ; axes\%mask3d(:,:,:) = 0.}
\DoxyCodeLine{779       \textcolor{keyword}{call }diag\_remap\_calc\_hmask(diag\_cs\%diag\_remap\_cs(c), g, axes\%mask3d)}
\DoxyCodeLine{780 }
\DoxyCodeLine{781       h\_axes => diag\_cs\%remap\_axesTL(c) \textcolor{comment}{! Use the h-\/point masks to generate the u-\/, v-\/ and q-\/ masks}}
\DoxyCodeLine{782 }
\DoxyCodeLine{783       \textcolor{comment}{! Level/layer u-\/points in diagnostic coordinate}}
\DoxyCodeLine{784       axes => diag\_cs\%remap\_axesCuL(c)}
\DoxyCodeLine{785       \textcolor{keyword}{call }assert(axes\%nz == nk, \textcolor{stringliteral}{'set\_masks\_for\_axes: vertical size mismatch at u-\/layers'})}
\DoxyCodeLine{786       \textcolor{keyword}{call }assert(.not. \textcolor{keyword}{associated}(axes\%mask3d), \textcolor{stringliteral}{'set\_masks\_for\_axes: already associated'})}
\DoxyCodeLine{787       \textcolor{keyword}{allocate}( axes\%mask3d(g\%IsdB:g\%IedB,g\%jsd:g\%jed,nk) ) ; axes\%mask3d(:,:,:) = 0.}
\DoxyCodeLine{788       \textcolor{keywordflow}{do} k = 1, nk ; \textcolor{keywordflow}{do} j=g\%jsc,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc-\/1,g\%iec}
\DoxyCodeLine{789         \textcolor{keywordflow}{if} (h\_axes\%mask3d(i,j,k) + h\_axes\%mask3d(i+1,j,k) > 0.) axes\%mask3d(i,j,k) = 1.}
\DoxyCodeLine{790 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{791 }
\DoxyCodeLine{792       \textcolor{comment}{! Level/layer v-\/points in diagnostic coordinate}}
\DoxyCodeLine{793       axes => diag\_cs\%remap\_axesCvL(c)}
\DoxyCodeLine{794       \textcolor{keyword}{call }assert(axes\%nz == nk, \textcolor{stringliteral}{'set\_masks\_for\_axes: vertical size mismatch at v-\/layers'})}
\DoxyCodeLine{795       \textcolor{keyword}{call }assert(.not. \textcolor{keyword}{associated}(axes\%mask3d), \textcolor{stringliteral}{'set\_masks\_for\_axes: already associated'})}
\DoxyCodeLine{796       \textcolor{keyword}{allocate}( axes\%mask3d(g\%isd:g\%ied,g\%JsdB:g\%JedB,nk) ) ; axes\%mask3d(:,:,:) = 0.}
\DoxyCodeLine{797       \textcolor{keywordflow}{do} k = 1, nk ; \textcolor{keywordflow}{do} j=g\%jsc-\/1,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc,g\%iec}
\DoxyCodeLine{798         \textcolor{keywordflow}{if} (h\_axes\%mask3d(i,j,k) + h\_axes\%mask3d(i,j+1,k) > 0.) axes\%mask3d(i,j,k) = 1.}
\DoxyCodeLine{799 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{800 }
\DoxyCodeLine{801       \textcolor{comment}{! Level/layer q-\/points in diagnostic coordinate}}
\DoxyCodeLine{802       axes => diag\_cs\%remap\_axesBL(c)}
\DoxyCodeLine{803       \textcolor{keyword}{call }assert(axes\%nz == nk, \textcolor{stringliteral}{'set\_masks\_for\_axes: vertical size mismatch at q-\/layers'})}
\DoxyCodeLine{804       \textcolor{keyword}{call }assert(.not. \textcolor{keyword}{associated}(axes\%mask3d), \textcolor{stringliteral}{'set\_masks\_for\_axes: already associated'})}
\DoxyCodeLine{805       \textcolor{keyword}{allocate}( axes\%mask3d(g\%IsdB:g\%IedB,g\%JsdB:g\%JedB,nk) ) ; axes\%mask3d(:,:,:) = 0.}
\DoxyCodeLine{806       \textcolor{keywordflow}{do} k = 1, nk ; \textcolor{keywordflow}{do} j=g\%jsc-\/1,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc-\/1,g\%iec}
\DoxyCodeLine{807         \textcolor{keywordflow}{if} (h\_axes\%mask3d(i,j,k) + h\_axes\%mask3d(i+1,j+1,k) + \&}
\DoxyCodeLine{808             h\_axes\%mask3d(i+1,j,k) + h\_axes\%mask3d(i,j+1,k) > 0.) axes\%mask3d(i,j,k) = 1.}
\DoxyCodeLine{809 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{810 }
\DoxyCodeLine{811       \textcolor{comment}{! Interface h-\/points in diagnostic coordinate (w-\/point)}}
\DoxyCodeLine{812       axes => diag\_cs\%remap\_axesTi(c)}
\DoxyCodeLine{813       \textcolor{keyword}{call }assert(axes\%nz == nk, \textcolor{stringliteral}{'set\_masks\_for\_axes: vertical size mismatch at h-\/interfaces'})}
\DoxyCodeLine{814       \textcolor{keyword}{call }assert(.not. \textcolor{keyword}{associated}(axes\%mask3d), \textcolor{stringliteral}{'set\_masks\_for\_axes: already associated'})}
\DoxyCodeLine{815       \textcolor{keyword}{allocate}( axes\%mask3d(g\%isd:g\%ied,g\%jsd:g\%jed,nk+1) ) ; axes\%mask3d(:,:,:) = 0.}
\DoxyCodeLine{816       \textcolor{keywordflow}{do} j=g\%jsc-\/1,g\%jec+1 ; \textcolor{keywordflow}{do} i=g\%isc-\/1,g\%iec+1}
\DoxyCodeLine{817         \textcolor{keywordflow}{if} (h\_axes\%mask3d(i,j,1) > 0.) axes\%mask3d(i,j,1) = 1.}
\DoxyCodeLine{818         \textcolor{keywordflow}{do} k = 2, nk}
\DoxyCodeLine{819           \textcolor{keywordflow}{if} (h\_axes\%mask3d(i,j,k-\/1) + h\_axes\%mask3d(i,j,k) > 0.) axes\%mask3d(i,j,k) = 1.}
\DoxyCodeLine{820 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{821         \textcolor{keywordflow}{if} (h\_axes\%mask3d(i,j,nk) > 0.) axes\%mask3d(i,j,nk+1) = 1.}
\DoxyCodeLine{822 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{823 }
\DoxyCodeLine{824       h\_axes => diag\_cs\%remap\_axesTi(c) \textcolor{comment}{! Use the w-\/point masks to generate the u-\/, v-\/ and q-\/ masks}}
\DoxyCodeLine{825 }
\DoxyCodeLine{826       \textcolor{comment}{! Interface u-\/points in diagnostic coordinate}}
\DoxyCodeLine{827       axes => diag\_cs\%remap\_axesCui(c)}
\DoxyCodeLine{828       \textcolor{keyword}{call }assert(axes\%nz == nk, \textcolor{stringliteral}{'set\_masks\_for\_axes: vertical size mismatch at u-\/interfaces'})}
\DoxyCodeLine{829       \textcolor{keyword}{call }assert(.not. \textcolor{keyword}{associated}(axes\%mask3d), \textcolor{stringliteral}{'set\_masks\_for\_axes: already associated'})}
\DoxyCodeLine{830       \textcolor{keyword}{allocate}( axes\%mask3d(g\%IsdB:g\%IedB,g\%jsd:g\%jed,nk+1) ) ; axes\%mask3d(:,:,:) = 0.}
\DoxyCodeLine{831       \textcolor{keywordflow}{do} k = 1, nk+1 ; \textcolor{keywordflow}{do} j=g\%jsc,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc-\/1,g\%iec}
\DoxyCodeLine{832         \textcolor{keywordflow}{if} (h\_axes\%mask3d(i,j,k) + h\_axes\%mask3d(i+1,j,k) > 0.) axes\%mask3d(i,j,k) = 1.}
\DoxyCodeLine{833 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{834 }
\DoxyCodeLine{835       \textcolor{comment}{! Interface v-\/points in diagnostic coordinate}}
\DoxyCodeLine{836       axes => diag\_cs\%remap\_axesCvi(c)}
\DoxyCodeLine{837       \textcolor{keyword}{call }assert(axes\%nz == nk, \textcolor{stringliteral}{'set\_masks\_for\_axes: vertical size mismatch at v-\/interfaces'})}
\DoxyCodeLine{838       \textcolor{keyword}{call }assert(.not. \textcolor{keyword}{associated}(axes\%mask3d), \textcolor{stringliteral}{'set\_masks\_for\_axes: already associated'})}
\DoxyCodeLine{839       \textcolor{keyword}{allocate}( axes\%mask3d(g\%isd:g\%ied,g\%JsdB:g\%JedB,nk+1) ) ; axes\%mask3d(:,:,:) = 0.}
\DoxyCodeLine{840       \textcolor{keywordflow}{do} k = 1, nk+1 ; \textcolor{keywordflow}{do} j=g\%jsc-\/1,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc,g\%iec}
\DoxyCodeLine{841         \textcolor{keywordflow}{if} (h\_axes\%mask3d(i,j,k) + h\_axes\%mask3d(i,j+1,k) > 0.) axes\%mask3d(i,j,k) = 1.}
\DoxyCodeLine{842 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{843 }
\DoxyCodeLine{844       \textcolor{comment}{! Interface q-\/points in diagnostic coordinate}}
\DoxyCodeLine{845       axes => diag\_cs\%remap\_axesBi(c)}
\DoxyCodeLine{846       \textcolor{keyword}{call }assert(axes\%nz == nk, \textcolor{stringliteral}{'set\_masks\_for\_axes: vertical size mismatch at q-\/interfaces'})}
\DoxyCodeLine{847       \textcolor{keyword}{call }assert(.not. \textcolor{keyword}{associated}(axes\%mask3d), \textcolor{stringliteral}{'set\_masks\_for\_axes: already associated'})}
\DoxyCodeLine{848       \textcolor{keyword}{allocate}( axes\%mask3d(g\%IsdB:g\%IedB,g\%JsdB:g\%JedB,nk+1) ) ; axes\%mask3d(:,:,:) = 0.}
\DoxyCodeLine{849       \textcolor{keywordflow}{do} k = 1, nk ; \textcolor{keywordflow}{do} j=g\%jsc-\/1,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc-\/1,g\%iec}
\DoxyCodeLine{850         \textcolor{keywordflow}{if} (h\_axes\%mask3d(i,j,k) + h\_axes\%mask3d(i+1,j+1,k) + \&}
\DoxyCodeLine{851             h\_axes\%mask3d(i+1,j,k) + h\_axes\%mask3d(i,j+1,k) > 0.) axes\%mask3d(i,j,k) = 1.}
\DoxyCodeLine{852 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{853 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{854 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{855 }
\DoxyCodeLine{856   \textcolor{comment}{!Allocate and initialize the downsampled masks for the axes}}
\DoxyCodeLine{857   \textcolor{keyword}{call }set\_masks\_for\_axes\_dsamp(g, diag\_cs)}
\DoxyCodeLine{858 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__diag__mediator_ade968ef275fa55cf8a2301debdd7e88a}\label{namespacemom__diag__mediator_ade968ef275fa55cf8a2301debdd7e88a}} 
\index{mom\_diag\_mediator@{mom\_diag\_mediator}!set\_masks\_for\_axes\_dsamp@{set\_masks\_for\_axes\_dsamp}}
\index{set\_masks\_for\_axes\_dsamp@{set\_masks\_for\_axes\_dsamp}!mom\_diag\_mediator@{mom\_diag\_mediator}}
\doxysubsubsection{\texorpdfstring{set\_masks\_for\_axes\_dsamp()}{set\_masks\_for\_axes\_dsamp()}}
{\footnotesize\ttfamily subroutine mom\+\_\+diag\+\_\+mediator\+::set\+\_\+masks\+\_\+for\+\_\+axes\+\_\+dsamp (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in), target}]{G,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), pointer}]{diag\+\_\+cs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The ocean grid type.\\
\hline
 & {\em diag\+\_\+cs} & A pointer to a type with many variables used for diagnostics \\
\hline
\end{DoxyParams}


Definition at line 861 of file M\+O\+M\+\_\+diag\+\_\+mediator.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{862   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{ !< The ocean grid type.}}
\DoxyCodeLine{863   \textcolor{keywordtype}{type}(diag\_ctrl),               \textcolor{keywordtype}{pointer}    :: diag\_cs\textcolor{comment}{ !< A pointer to a type with many variables}}
\DoxyCodeLine{864 \textcolor{comment}{                                                       !! used for diagnostics}}
\DoxyCodeLine{865   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{866   \textcolor{keywordtype}{integer} :: c, nk, i, j, k, ii, jj}
\DoxyCodeLine{867   \textcolor{keywordtype}{integer} :: dl}
\DoxyCodeLine{868   \textcolor{keywordtype}{type}(axes\_grp), \textcolor{keywordtype}{pointer} :: axes => null(), h\_axes => null() \textcolor{comment}{! Current axes, for convenience}}
\DoxyCodeLine{869 }
\DoxyCodeLine{870   \textcolor{comment}{!Each downsampled axis needs both downsampled and non-\/downsampled mask}}
\DoxyCodeLine{871   \textcolor{comment}{!The downsampled mask is needed for sending out the diagnostics output via diag\_manager}}
\DoxyCodeLine{872   \textcolor{comment}{!The non-\/downsampled mask is needed for downsampling the diagnostics field}}
\DoxyCodeLine{873   \textcolor{keywordflow}{do} dl=2,max\_dsamp\_lev}
\DoxyCodeLine{874      \textcolor{keywordflow}{if}(dl .ne. 2) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"set\_masks\_for\_axes\_dsamp: Downsample level other than 2 is not supported!"})}
\DoxyCodeLine{875      \textcolor{keywordflow}{do} c=1, diag\_cs\%num\_diag\_coords}
\DoxyCodeLine{876         \textcolor{comment}{! Level/layer h-\/points in diagnostic coordinate}}
\DoxyCodeLine{877         axes => diag\_cs\%remap\_axesTL(c)}
\DoxyCodeLine{878         \textcolor{keyword}{call }downsample\_mask(axes\%mask3d, diag\_cs\%dsamp(dl)\%remap\_axesTL(c)\%dsamp(dl)\%mask3d, dl,g\%isc, g\%jsc,  \&}
\DoxyCodeLine{879           g\%HId2\%isc, g\%HId2\%iec, g\%HId2\%jsc, g\%HId2\%jec, g\%HId2\%isd, g\%HId2\%ied, g\%HId2\%jsd, g\%HId2\%jed)}
\DoxyCodeLine{880         diag\_cs\%dsamp(dl)\%remap\_axesTL(c)\%mask3d => axes\%mask3d \textcolor{comment}{!set non-\/downsampled mask}}
\DoxyCodeLine{881         \textcolor{comment}{! Level/layer u-\/points in diagnostic coordinate}}
\DoxyCodeLine{882         axes => diag\_cs\%remap\_axesCuL(c)}
\DoxyCodeLine{883         \textcolor{keyword}{call }downsample\_mask(axes\%mask3d, diag\_cs\%dsamp(dl)\%remap\_axesCuL(c)\%dsamp(dl)\%mask3d, dl,g\%IscB,g\%JscB, \&}
\DoxyCodeLine{884           g\%HId2\%IscB,g\%HId2\%IecB,g\%HId2\%jsc, g\%HId2\%jec,g\%HId2\%IsdB,g\%HId2\%IedB,g\%HId2\%jsd, g\%HId2\%jed)}
\DoxyCodeLine{885         diag\_cs\%dsamp(dl)\%remap\_axesCul(c)\%mask3d => axes\%mask3d \textcolor{comment}{!set non-\/downsampled mask}}
\DoxyCodeLine{886         \textcolor{comment}{! Level/layer v-\/points in diagnostic coordinate}}
\DoxyCodeLine{887         axes => diag\_cs\%remap\_axesCvL(c)}
\DoxyCodeLine{888         \textcolor{keyword}{call }downsample\_mask(axes\%mask3d, diag\_cs\%dsamp(dl)\%remap\_axesCvL(c)\%dsamp(dl)\%mask3d, dl,g\%isc ,g\%JscB, \&}
\DoxyCodeLine{889           g\%HId2\%isc ,g\%HId2\%iec, g\%HId2\%JscB,g\%HId2\%JecB,g\%HId2\%isd ,g\%HId2\%ied, g\%HId2\%JsdB,g\%HId2\%JedB)}
\DoxyCodeLine{890         diag\_cs\%dsamp(dl)\%remap\_axesCvL(c)\%mask3d => axes\%mask3d \textcolor{comment}{!set non-\/downsampled mask}}
\DoxyCodeLine{891         \textcolor{comment}{! Level/layer q-\/points in diagnostic coordinate}}
\DoxyCodeLine{892         axes => diag\_cs\%remap\_axesBL(c)}
\DoxyCodeLine{893         \textcolor{keyword}{call }downsample\_mask(axes\%mask3d, diag\_cs\%dsamp(dl)\%remap\_axesBL(c)\%dsamp(dl)\%mask3d, dl,g\%IscB,g\%JscB, \&}
\DoxyCodeLine{894           g\%HId2\%IscB,g\%HId2\%IecB,g\%HId2\%JscB,g\%HId2\%JecB,g\%HId2\%IsdB,g\%HId2\%IedB,g\%HId2\%JsdB,g\%HId2\%JedB)}
\DoxyCodeLine{895         diag\_cs\%dsamp(dl)\%remap\_axesBL(c)\%mask3d => axes\%mask3d \textcolor{comment}{!set non-\/downsampled mask}}
\DoxyCodeLine{896         \textcolor{comment}{! Interface h-\/points in diagnostic coordinate (w-\/point)}}
\DoxyCodeLine{897         axes => diag\_cs\%remap\_axesTi(c)}
\DoxyCodeLine{898         \textcolor{keyword}{call }downsample\_mask(axes\%mask3d, diag\_cs\%dsamp(dl)\%remap\_axesTi(c)\%dsamp(dl)\%mask3d, dl,g\%isc, g\%jsc,  \&}
\DoxyCodeLine{899           g\%HId2\%isc, g\%HId2\%iec, g\%HId2\%jsc, g\%HId2\%jec, g\%HId2\%isd, g\%HId2\%ied, g\%HId2\%jsd, g\%HId2\%jed)}
\DoxyCodeLine{900         diag\_cs\%dsamp(dl)\%remap\_axesTi(c)\%mask3d => axes\%mask3d \textcolor{comment}{!set non-\/downsampled mask}}
\DoxyCodeLine{901         \textcolor{comment}{! Interface u-\/points in diagnostic coordinate}}
\DoxyCodeLine{902         axes => diag\_cs\%remap\_axesCui(c)}
\DoxyCodeLine{903         \textcolor{keyword}{call }downsample\_mask(axes\%mask3d, diag\_cs\%dsamp(dl)\%remap\_axesCui(c)\%dsamp(dl)\%mask3d, dl,g\%IscB,g\%JscB, \&}
\DoxyCodeLine{904           g\%HId2\%IscB,g\%HId2\%IecB,g\%HId2\%jsc, g\%HId2\%jec,g\%HId2\%IsdB,g\%HId2\%IedB,g\%HId2\%jsd, g\%HId2\%jed)}
\DoxyCodeLine{905         diag\_cs\%dsamp(dl)\%remap\_axesCui(c)\%mask3d => axes\%mask3d \textcolor{comment}{!set non-\/downsampled mask}}
\DoxyCodeLine{906         \textcolor{comment}{! Interface v-\/points in diagnostic coordinate}}
\DoxyCodeLine{907         axes => diag\_cs\%remap\_axesCvi(c)}
\DoxyCodeLine{908         \textcolor{keyword}{call }downsample\_mask(axes\%mask3d, diag\_cs\%dsamp(dl)\%remap\_axesCvi(c)\%dsamp(dl)\%mask3d, dl,g\%isc ,g\%JscB, \&}
\DoxyCodeLine{909           g\%HId2\%isc ,g\%HId2\%iec, g\%HId2\%JscB,g\%HId2\%JecB,g\%HId2\%isd ,g\%HId2\%ied, g\%HId2\%JsdB,g\%HId2\%JedB)}
\DoxyCodeLine{910         diag\_cs\%dsamp(dl)\%remap\_axesCvi(c)\%mask3d => axes\%mask3d \textcolor{comment}{!set non-\/downsampled mask}}
\DoxyCodeLine{911         \textcolor{comment}{! Interface q-\/points in diagnostic coordinate}}
\DoxyCodeLine{912         axes => diag\_cs\%remap\_axesBi(c)}
\DoxyCodeLine{913         \textcolor{keyword}{call }downsample\_mask(axes\%mask3d, diag\_cs\%dsamp(dl)\%remap\_axesBi(c)\%dsamp(dl)\%mask3d, dl,g\%IscB,g\%JscB, \&}
\DoxyCodeLine{914           g\%HId2\%IscB,g\%HId2\%IecB,g\%HId2\%JscB,g\%HId2\%JecB,g\%HId2\%IsdB,g\%HId2\%IedB,g\%HId2\%JsdB,g\%HId2\%JedB)}
\DoxyCodeLine{915         diag\_cs\%dsamp(dl)\%remap\_axesBi(c)\%mask3d => axes\%mask3d \textcolor{comment}{!set non-\/downsampled mask}}
\DoxyCodeLine{916 \textcolor{keywordflow}{     enddo}}
\DoxyCodeLine{917 \textcolor{keywordflow}{  enddo}}

\end{DoxyCode}
