/[MITgcm]/manual/s_outp_pkgs/text/mnc.tex
ViewVC logotype

Annotation of /manual/s_outp_pkgs/text/mnc.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (hide annotations) (download) (as text)
Tue Dec 20 21:25:16 2005 UTC (19 years, 7 months ago) by edhill
Branch: MAIN
Changes since 1.3: +31 -11 lines
File MIME type: application/x-tex
 o better explain the MNC file-naming and file-splitting since the
   documentation was not up-to-date with the actual code

1 edhill 1.4 % $Header: /u/gcmpack/manual/part7/mnc.tex,v 1.3 2005/08/06 16:28:14 edhill Exp $
2 molod 1.1 % $Name: $
3    
4 edhill 1.3 \section{NetCDF I/O Integration: MNC}
5 molod 1.1 \label{sec:pkg:mnc}
6     \begin{rawhtml}
7     <!-- CMIREDIR:package_mnc: -->
8     \end{rawhtml}
9    
10     The \texttt{mnc} package is a set of convenience routines written to
11     expedite the process of creating, appending, and reading NetCDF files.
12     NetCDF is an increasingly popular self-describing file format
13     \cite{rew:97} intended primarily for scientific data sets. An
14     extensive collection of NetCDF reference papers, user guides,
15     software, FAQs, and other information can be obtained from UCAR's web
16     site at:
17     \begin{rawhtml} <A href="http://www.unidata.ucar.edu/packages/netcdf/"> \end{rawhtml}
18     \begin{verbatim}
19     http://www.unidata.ucar.edu/packages/netcdf/
20     \end{verbatim}
21     \begin{rawhtml} </A> \end{rawhtml}
22    
23     Since it is a ``wrapper'' for netCDF, MNC depends upon the Fortran-77
24     interface included with the standard netCDF v3.x library which is
25     often called \texttt{libnetcdf.a}. Please contact your local systems
26     administrators or the
27     \begin{rawhtml} <A href="mailto:mitgcm-support@mitgcm.org"> \end{rawhtml}
28     MITgcm-support
29     \begin{rawhtml} </A> \end{rawhtml}
30     list for help building and installing netCDF for your particular
31     platform.
32    
33    
34 edhill 1.3 \subsection{Using MNC}
35 molod 1.1
36 edhill 1.3 \subsubsection{MNC Configuration:}
37 molod 1.1
38     As with all MITgcm packages, MNC can be turned on or off at compile time
39     using the \texttt{packages.conf} file or the \texttt{genmake2}
40     \texttt{-enable=mnc} or \texttt{-disable=mnc} switches.
41    
42     While MNC is likely to work ``as is'', there are a few compile--time
43     constants that may need to be increased for simulations that employ
44     large numbers of tiles within each process. Note that the important
45     quantity is the maximum number of tiles \textbf{per process}. Since
46     MPI configurations tend to distribute large numbers of tiles over
47     relatively large numbers of MPI processes, these constants will rarely
48     need to be increased.
49    
50     If MNC runs out of space within its ``lookup'' tables during a
51     simulation, then it will provide an error message along with a
52     recommendation of which parameter to increase. The parameters are all
53     located within \filelink{pkg/mnc/mnc\_common.h}{pkg-mnc-mnc_common.h}
54     and the ones that may need to be increased are:
55    
56     \begin{center}
57     {\footnotesize
58     \begin{tabular}[htb]{|l|r|l|}\hline
59     \textbf{Name} &
60     \textbf{Default} & \textbf{Description} \\\hline
61     & & \\
62     \texttt{MNC\_MAX\_ID} & 1000 &
63     \textbf{IDs for various low-level entities} \\
64     \texttt{MNC\_MAX\_INFO} & 400 &
65     \textbf{IDs (mostly for object sizes)} \\
66     \texttt{MNC\_CW\_MAX\_I} & 150 &
67     \textbf{IDs for the ``wrapper'' layer} \\\hline
68     \end{tabular}
69     }
70     \end{center}
71    
72     In those rare cases where MNC ``out-of-memory'' error messages are
73     encountered, it is a good idea to increase the too-small parameter by
74     a factor of \textbf{2--10} in order to avoid wasting time on an
75     iterative compile--test sequence.
76    
77    
78 edhill 1.3 \subsubsection{MNC Inputs:}
79 molod 1.1
80     Like most MITgcm packages, all of MNC can be turned on/off at runtime
81     using a single flag in \texttt{data.pkg}
82     \begin{center}
83     {\footnotesize
84     \begin{tabular}[htb]{|l|c|l|l|}\hline
85     \textbf{Name} & \textbf{T} &
86     \textbf{Default} & \textbf{Description} \\\hline
87     & & & \\
88     \texttt{useMNC} & L & \texttt{.FALSE.} &
89     overall MNC ON/OFF switch \\\hline
90     \end{tabular}
91     }
92     \end{center}
93    
94     One important MNC--related flag is present in the main \texttt{data}
95     namelist file in the \texttt{PARM03} section and it is:
96     \begin{center}
97     {\footnotesize
98     \begin{tabular}[htb]{|l|c|l|l|}\hline
99     \textbf{Name} & \textbf{T} &
100     \textbf{Default} & \textbf{Description} \\\hline
101     & & & \\
102     \texttt{outputTypesInclusive} & L & \texttt{.FALSE.} &
103     use all available output ``types'' \\\hline
104     \end{tabular}
105     }
106     \end{center}
107     which specifies that turning on MNC for a particular type of output
108     should not simultaneously turn off the default output method as it
109     normally does. Usually, this option is only used for debugging
110     purposes since it is inefficient to write output types using both MNC
111     and MDSIO or ASCII output. This option can also be helpful when
112     transitioning from MDSIO to MNC since the output can be readily
113     compared.
114    
115     For run-time configuration, most of the MNC--related model parameters
116     are contained within a Fortran namelist file called
117     \texttt{data.mnc}. The availabe parameters currently include:
118     \begin{center}
119     {\footnotesize
120     \begin{tabular}[htb]{|l|c|l|l|}\hline
121     \textbf{Name} & \textbf{T} &
122     \textbf{Default} & \textbf{Description} \\\hline
123     & & & \\
124     \texttt{mnc\_use\_outdir} & L & \texttt{.FALSE.} &
125     create a directory for output \\
126     \ \ \texttt{mnc\_outdir\_str} & S & \texttt{'mnc\_'} &
127     output directory name \\
128     \ \ \texttt{mnc\_outdir\_date} & L & \texttt{.FALSE.} &
129     embed date in the outdir name \\
130     \ \ \texttt{mnc\_outdir\_num} & L & \texttt{.FALSE.} &
131     optional \\
132     \texttt{pickup\_write\_mnc} & L & \texttt{.FALSE.} &
133     use MNC to write pickup files \\
134     \texttt{pickup\_read\_mnc} & L & \texttt{.FALSE.} &
135     use MNC to read pickup files \\
136     \texttt{mnc\_use\_indir} & L & \texttt{.FALSE.} &
137     use a directory (path) for input \\
138     \ \ \texttt{mnc\_indir\_str} & S & \texttt{''} &
139     input directory (or path) name \\
140     \texttt{snapshot\_mnc} & L & \texttt{.FALSE.} &
141     write \texttt{snapshot} output w/MNC \\
142     \texttt{monitor\_mnc} & L & \texttt{.FALSE.} &
143     write \texttt{monitor} output w/MNC \\
144     \texttt{timeave\_mnc} & L & \texttt{.FALSE.} &
145     write \texttt{timeave} output w/MNC \\
146     \texttt{autodiff\_mnc} & L & \texttt{.FALSE.} &
147     write \texttt{autodiff} output w/MNC \\
148     \texttt{mnc\_max\_fsize} & R & 2.1e+09 &
149     max allowable file size \\
150 edhill 1.4 \texttt{mnc\_filefreq} & R & -1 &
151     frequency of new file creation (seconds) \\
152 molod 1.1 \texttt{readgrid\_mnc} & L & \texttt{.FALSE.} &
153     read grid quantities using MNC \\
154     \texttt{mnc\_echo\_gvtypes} & L & \texttt{.FALSE.} &
155     list pre-defined ``types'' (debug) \\\hline
156     \end{tabular}
157     }
158     \end{center}
159    
160     Unlike the older MDSIO method, MNC has the ability to create or use
161     existing output directories. If either \texttt{mnc\_outdir\_date} or
162     \texttt{mnc\_outdir\_num} is true, then MNC will try to create
163     directories on a \textit{PER PROCESS} basis for its output. This
164     means that a single directory will be created for a non-MPI run and
165     multiple directories (one per MPI process) will be created for an MPI
166     run. This approach was chosen since it works safely on both shared
167     global file systems (such as NFS and AFS) and on local
168     (per-compute-node) file systems. And if both
169     \texttt{mnc\_outdir\_date} and \texttt{mnc\_outdir\_num} are false,
170     then the MNC package will assume that the directory specified in
171     \texttt{mnc\_outdir\_str} already exists and will use it. This allows
172     the user to create and specify directories outside of the model.
173    
174     For input, MNC can use a single global input directory. This is a
175     just convenience that allows MNC to gather all of its input files from a
176     path other than the current working directory. As with MDSIO, the
177     default is to use the current working directory.
178    
179     The flags \texttt{snapshot\_mnc}, \texttt{monitor\_mnc},
180     \texttt{timeave\_mnc}, and \texttt{autodiff\_mnc} allow the user to
181     turn on MNC for particular ``types'' of output. If a type is
182     selected, then MNC will be used for all output that matches that type.
183     This applies to output from the main model and from all of the
184     optional MITgcm packages. Mostly, the names used here correspond to
185     the names used for the output frequencies in the main \texttt{data}
186     namelist file.
187    
188     The \texttt{mnc\_max\_fsize} parameter is a convenience added to help
189     users work around common file size limitations. On many computer
190     systems, either the opterating system, the file system(s), and/or the
191     netCDF libraries are unable to handle files greater than two or four
192     gigabytes in size. The MNC package is able to work within this
193     limitation by creating new files which grow along the netCDF
194     ``unlimited'' (usually, time) dimension. The default value for this
195     parameter is just slightly less than 2GB which is safe on virtually
196     all operating systems. Essentially, this feature is a way to
197     intelligently and automatically split files output along the unlimited
198     dimension. On systems that support large file sizes, these splits can
199     be readily concatenated (that is, un-done) using tools such as the
200     netCDF Operators (with \texttt{ncrcat}) which is available at:
201     \begin{rawhtml} <A href="http://nco.sourceforge.net/"> \end{rawhtml}
202     \begin{verbatim}
203     http://nco.sourceforge.net/
204     \end{verbatim}
205     \begin{rawhtml} </A> \end{rawhtml}
206    
207 edhill 1.4 Another way users can force the splitting of MNC files along the time
208     dimension is the \texttt{mnc\_filefreq} option. With it, files that
209     contain variables with a temporal dimension can be split at regular
210     intervals based solely upon the model time (specified in seconds).
211     For some problems, this can be much more convenient than splitting
212     based upon file size.
213    
214 molod 1.1 Additional MNC--related parameters may be contained within each
215     package. Please see the individual packages for descriptions of their
216     use of MNC.
217    
218    
219 edhill 1.3 \subsubsection{MNC Output:}
220 molod 1.1
221     Depending upon the flags used, MNC will produce zero or more
222     directories containing one or more netCDF files as output. These
223     files are either mostly or entirely compliant with the netCDF ``CF''
224     convention (v1.0) and any conformance issues will be fixed over time.
225     The patterns used for file names are:
226     \begin{center}
227 edhill 1.4 {\footnotesize
228     \begin{tabular}[htb]{l}
229     \texttt{BASENAME.tileNum.nc} \\
230     \texttt{BASENAME.nIter.faceNum.nc} \\
231     \texttt{BASENAME.nIter.tileNum.nc}
232     \end{tabular}
233     }
234 molod 1.1 \end{center}
235 edhill 1.4 and examples are:
236 molod 1.1 \begin{center}
237 edhill 1.4 {\footnotesize
238     \begin{tabular}[htb]{l}
239     \texttt{grid.t001.nc}, \texttt{grid.t002.nc} \\
240     \texttt{state.0000000000.t001.nc},
241     \texttt{surfDiag.0000036000.t001.nc} \\
242     \texttt{input.0000072000.f001.nc}
243     \end{tabular}
244     }
245 molod 1.1 \end{center}
246     where \texttt{BASENAME} is the name selected to represent a set of
247 edhill 1.4 variables written together, \texttt{nIter} is the current iteration
248 molod 1.1 number as specified in the main \texttt{data} namelist input file and
249 edhill 1.4 written in a zero-filled 10-digit format, \texttt{tileNum} is a
250     three-or-more-digit zero-filled and ``\texttt{t}''--prefixed tile
251     number, \texttt{faceNum} is a three-or-more-digit zero-filled and
252     ``\texttt{f}''--prefixed face number, and \texttt{.nc} is the file
253 molod 1.1 suffix specified by the current netCDF ``CF'' conventions.
254    
255     Some example \texttt{BASENAME} values are:
256     \begin{description}
257     \item[grid] contains the variables that describe the various grid
258     constants related to locations, lengths, areas, etc.
259     \item[state] contains the variables output at the snapshot or
260     \texttt{dumpFreq} time frequency
261     \item[pickup.ckptA, pickup.ckptB] are the ``rolling'' checkpoint files
262     \item[tave] contains the time-averaged quantities from the main model
263     \end{description}
264    
265     All MNC output is currently done in a ``file-per-tile'' fashion since
266     most NetCDF v3.x implementions cannot write safely within MPI or
267     multi-threaded environments. This tiling is done in a global fashion
268     and the tile numbers are appended to the base names as described
269     above. Some scripts to manipulate MNC output are available at
270     \texttt{MITgcm/utils/matlab/} which includes a spatial ``assembly''
271     script called \texttt{MITgcm/utils/matlab/mnc\_assembly.m}.
272    
273     More general manipulations can be performed on netCDF files with
274     \begin{rawhtml} <A href="http://nco.sourceforge.net"> \end{rawhtml}
275     \begin{verbatim}
276     the NetCDF Operators (``NCO'')
277     at http://nco.sourceforge.net
278     \end{verbatim}
279     \begin{rawhtml} </A> \end{rawhtml}
280     or with
281     \begin{rawhtml} <A href=''http://www.mpimet.mpg.de/~cdo/"> \end{rawhtml}
282     \begin{verbatim}
283     the Climate Data Operators (``CDO'')
284     at http://www.mpimet.mpg.de/~cdo/
285     \end{verbatim}
286     \begin{rawhtml} </A> \end{rawhtml}
287    
288     Unlike the older MDSIO routines, MNC reads and writes variables on
289     different ``grids'' depending upon their location on, for instance, an
290     Arakawa C--grid. The following table provides examples:
291     \begin{center}
292     {\footnotesize
293     \begin{tabular}[htb]{|l|c|c|c|}\hline
294     \textbf{Name} & \textbf{C--grid location} &
295     \textbf{\# in X} & \textbf{\# in Y} \\\hline
296     Temperature & mass & \texttt{sNx} & \texttt{sNy} \\
297     Salinity & mass & \texttt{sNx} & \texttt{sNy} \\
298     U velocity & U & \texttt{sNx+1} & \texttt{sNy} \\
299     V velocity & V & \texttt{sNx} & \texttt{sNy+1} \\
300     Vorticity & vorticity & \texttt{sNx+1} & \texttt{sNy+1} \\\hline
301     \end{tabular}
302     }
303     \end{center}
304     and the intent is two--fold:
305     \begin{enumerate}
306     \item For some grid topologies it is impossible to output all
307     quantities using only \texttt{sNx,sNy} arrays for every tile. Two
308     examples of this failure are the missing corners problem for
309     vorticity values on the cubesphere and the velocity edge values for
310     some open--boundary domains.
311     \item Writing quantities located on velocity or vorticity points with
312     the above scheme introduces a very small data redundancy. However,
313     any slight inconvenience is easily offset by the ease with which one
314     can, on every individual tile, interpolate these values to mass
315     points without having to perform an ``exchange'' (or
316     ``halo-filling'') operation to collect the values from neighboring
317     tiles. This makes the most common post--processing operations much
318     easier to implement.
319     \end{enumerate}
320    
321    
322 edhill 1.3 \subsection{MNC Troubleshooting}
323 molod 1.1
324 edhill 1.3 \subsubsection{Build Troubleshooting:}
325 molod 1.1
326     In order to build MITgcm with MNC enabled, the netCDF v3.x Fortran-77
327     (not Fortran-90) library must be available. This library is compposed
328     of a single header file (called \texttt{netcdf.inc}) and a single
329     library file (usually called \texttt{libnetcdf.a}) and it must be
330     built with the same compiler (or a binary-compatible compiler) with
331     compatible compiler options as the one used to build MITgcm.
332    
333     For more details concerning the netCDF build and install process,
334     please visit the netCDF home page at:
335     \begin{rawhtml} <A href="http://www.unidata.ucar.edu/packages/netcdf/"> \end{rawhtml}
336     \begin{verbatim}
337     http://www.unidata.ucar.edu/packages/netcdf/
338     \end{verbatim}
339     \begin{rawhtml} </A> \end{rawhtml}
340     which includes an extensive list of known--good netCDF configurations
341     for various platforms
342    
343 edhill 1.3 \subsubsection{Runtime Troubleshooting:}
344 molod 1.1
345     Please be aware of the following:
346    
347     \begin{itemize}
348     \item As a safety feature, the MNC package does not, by default, allow
349     pre-existing files to be appended to or overwritten. This is in
350     contrast to the older MDSIO package which will, without any warning,
351     overwrite existing files. If MITgcm aborts with an error message
352     about the inability to open or write to a netCDF file, please check
353     \textbf{first} whether you are attempting to overwrite files from a
354     previous run.
355    
356     \item The constraints placed upon the ``unlimited'' (or ``record'')
357     dimension inherent with NetCDF v3.x make it very inefficient to put
358     variables written at potentially different intervals within the same
359     file. For this reason, MNC output is split into groups of files
360     which attempt to reflect the nature of their content.
361    
362     \item On many systems, netCDF has practical file size limits on the
363     order of 2--4GB (the maximium memory addressable with 32bit pointers
364     or pointer differences) due to a lack of operating system, compiler,
365     and/or library support. The latest revisions of netCDF v3.x have
366     large file support and, on some operating systems, file sizes are
367     only limited by available disk space.
368    
369     \item There is an 80 character limit to the total length of all file
370     names. This limit includes the directory (or path) since paths and
371     file names are internally appended. Generally, file names will not
372     exceed the limit and paths can usually be shortened using, for
373     example, soft links.
374    
375     \item MNC does not (yet) provide a mechanism for reading information
376     from a single ``global'' file as can be done with the MDSIO
377     package. This is in progress.
378     \end{itemize}
379    
380    
381 edhill 1.3 \subsection{MNC Internals}
382 molod 1.1
383     The \texttt{mnc} package is a two-level convenience library (or
384     ``wrapper'') for most of the NetCDF Fortran API. Its purpose is to
385     streamline the user interface to NetCDF by maintaining internal
386     relations (look-up tables) keyed with strings (or names) and entities
387     such as NetCDF files, variables, and attributes.
388    
389     The two levels of the \texttt{mnc} package are:
390     \begin{description}
391    
392     \item[Upper level] \
393    
394     The upper level contains information about two kinds of
395     associations:
396     \begin{description}
397     \item[grid type] is lookup table indexed with a grid type name.
398     Each grid type name is associated with a number of dimensions, the
399     dimension sizes (one of which may be unlimited), and starting and
400     ending index arrays. The intent is to store all the necessary
401     size and shape information for the Fortran arrays containing
402     MITgcm--style ``tile'' variables (that is, a central region
403     surrounded by a variably-sized ``halo'' or exchange region as
404     shown in Figures \ref{fig:communication_primitives} and
405     \ref{fig:tiling-strategy}).
406    
407     \item[variable type] is a lookup table indexed by a variable type
408     name. For each name, the table contains a reference to a grid
409     type for the variable and the names and values of various
410     attributes.
411     \end{description}
412    
413     Within the upper level, these associations are not permanently tied
414     to any particular NetCDF file. This allows the information to be
415     re-used over multiple file reads and writes.
416    
417     \item[Lower level] \
418    
419     In the lower (or internal) level, associations are stored for NetCDF
420     files and many of the entities that they contain including
421     dimensions, variables, and global attributes. All associations are
422     on a per-file basis. Thus, each entity is tied to a unique NetCDF
423     file and will be created or destroyed when files are, respectively,
424     opened or closed.
425    
426     \end{description}
427    
428    
429 edhill 1.3 \subsubsection{MNC Grid--Types and Variable--Types:}
430 molod 1.1
431     As a convenience for users, the MNC package includes numerous routines
432     to aid in the writing of data to NetCDF format. Probably the biggest
433     convenience is the use of pre-defined ``grid types'' and ``variable
434     types''. These ``types'' are simply look-up tables that store
435     dimensions, indicies, attributes, and other information that can all
436     be retrieved using a single character string.
437    
438     The ``grid types'' are a way of mapping variables within MITgcm to
439     NetCDF arrays. Within MITgcm, most spatial variables are defined
440     using two-- or three--dimensional arrays with ``overlap'' regions (see
441     Figures \ref{fig:communication_primitives}, a possible vertical index,
442     and \ref{fig:tiling-strategy}) and tile indicies such as the following
443     ``U'' velocity:
444     \begin{verbatim}
445     _RL uVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
446     \end{verbatim}
447     as defined in \filelink{model/inc/DYNVARS.h}{model-inc-DYNVARS.h}
448    
449     The grid type is a character string that encodes the presence and
450     types associated with the four possible dimensions. The character
451     string follows the format
452     \begin{center}
453     \texttt{H0\_H1\_H2\_\_V\_\_T}
454     \end{center}
455     where the terms \textit{H0}, \textit{H1}, \textit{H2}, \textit{V},
456     \textit{T} can be almost any combination of the following:
457     \begin{center}
458     \begin{tabular}[h]{|ccc|c|c|}\hline
459     \multicolumn{3}{|c|}{Horizontal} & Vertical & Time \\
460     \textbf{H0}: location & \textbf{H1}: dimensions & \textbf{H2}: halo
461     & \textbf{V}: location & \textbf{T}: level \\\hline
462     \texttt{-} & xy & Hn & \texttt{-} & \texttt{-} \\
463     U & x & Hy & i & t \\
464     V & y & & c & \\
465     Cen & & & & \\
466     Cor & & & & \\\hline
467     \end{tabular}
468     \end{center}
469     A example list of all pre-defined combinations is contained in the
470     file
471     \begin{center}
472     \texttt{pkg/mnc/pre-defined\_grids.txt}.
473     \end{center}
474    
475     The variable type is an association between a variable type name and the
476     following items:
477     \begin{center}
478     \begin{tabular}[h]{|l|l|}\hline
479     \textbf{Item} & \textbf{Purpose} \\\hline
480     grid type & defines the in-memory arrangement \\
481     \texttt{bi,bj} dimensions & tiling indices, if present \\\hline
482     \end{tabular}
483     \end{center}
484     and is used by the \texttt{mnc\_cw\_*\_[R|W]} subroutines for reading
485     and writing variables.
486    
487    
488 edhill 1.3 \subsubsection{Using MNC: Examples:}
489 molod 1.1
490     Writing variables to NetCDF files can be accomplished in as few as two
491     function calls. The first function call defines a variable type,
492     associates it with a name (character string), and provides additional
493     information about the indicies for the tile (\texttt{bi},\texttt{bj})
494     dimensions. The second function call will write the data at, if
495     necessary, the current time level within the model.
496    
497     Examples of the initialization calls can be found in the file
498 edhill 1.2 \filelink{model/src/ini\_mnc\_io.F}{model-src-ini_model_io.F}
499 molod 1.1 where these function calls:
500     {\footnotesize
501     \begin{verbatim}
502     C Create MNC definitions for DYNVARS.h variables
503     CALL MNC_CW_ADD_VNAME('iter', '-_-_--__-__t', 0,0, myThid)
504     CALL MNC_CW_ADD_VATTR_TEXT('iter',1,
505     & 'long_name','iteration_count', myThid)
506    
507     CALL MNC_CW_ADD_VNAME('model_time', '-_-_--__-__t', 0,0, myThid)
508     CALL MNC_CW_ADD_VATTR_TEXT('model_time',1,
509     & 'long_name','Model Time', myThid)
510     CALL MNC_CW_ADD_VATTR_TEXT('model_time',1,'units','s', myThid)
511    
512     CALL MNC_CW_ADD_VNAME('U', 'U_xy_Hn__C__t', 4,5, myThid)
513     CALL MNC_CW_ADD_VATTR_TEXT('U',1,'units','m/s', myThid)
514     CALL MNC_CW_ADD_VATTR_TEXT('U',1,
515     & 'coordinates','XU YU RC iter', myThid)
516    
517     CALL MNC_CW_ADD_VNAME('T', 'Cen_xy_Hn__C__t', 4,5, myThid)
518     CALL MNC_CW_ADD_VATTR_TEXT('T',1,'units','degC', myThid)
519     CALL MNC_CW_ADD_VATTR_TEXT('T',1,'long_name',
520     & 'potential_temperature', myThid)
521     CALL MNC_CW_ADD_VATTR_TEXT('T',1,
522     & 'coordinates','XC YC RC iter', myThid)
523     \end{verbatim}
524     }
525     {\noindent initialize four \texttt{VNAME}s and add one or more NetCDF
526     attributes to each.}
527    
528     The four variables defined above are subsequently written at specific
529     time steps within
530     \filelink{model/src/write\_state.F}{model-src-write_state.F}
531     using the function calls:
532     {\footnotesize
533     \begin{verbatim}
534     C Write dynvars using the MNC package
535     CALL MNC_CW_SET_UDIM('state', -1, myThid)
536     CALL MNC_CW_I_W('I','state',0,0,'iter', myIter, myThid)
537     CALL MNC_CW_SET_UDIM('state', 0, myThid)
538     CALL MNC_CW_RL_W('D','state',0,0,'model_time',myTime, myThid)
539     CALL MNC_CW_RL_W('D','state',0,0,'U', uVel, myThid)
540     CALL MNC_CW_RL_W('D','state',0,0,'T', theta, myThid)
541     \end{verbatim}
542     }
543    
544     While it is easiest to write variables within typical 2D and 3D fields
545     where all data is known at a given time, it is also possible to write
546     fields where only a portion (\textit{eg.} a ``slab'' or ``slice'') is
547     known at a given instant. An example is provided within
548     \filelink{pkg/mom\_vecinv/mom\_vecinv.F}{pkg-mom_vecinv-mom_vecinv.F}
549     where an offset vector is used: {\footnotesize
550     \begin{verbatim}
551     IF (useMNC .AND. snapshot_mnc) THEN
552     CALL MNC_CW_RL_W_OFFSET('D','mom_vi',bi,bj, 'fV', uCf,
553     & offsets, myThid)
554     CALL MNC_CW_RL_W_OFFSET('D','mom_vi',bi,bj, 'fU', vCf,
555     & offsets, myThid)
556     ENDIF
557     \end{verbatim}
558     }
559     to write a 3D field one depth slice at a time.
560    
561     Each element in the offset vector corresponds (in order) to the
562     dimensions of the ``full'' (or virtual) array and specifies which are
563     known at the time of the call. A zero within the offset array means
564     that all values along that dimension are available while a positive
565     integer means that only values along that index of the dimension are
566     available. In all cases, the matrix passed is assumed to start (that
567     is, have an in-memory structure) coinciding with the start of the
568     specified slice. Thus, using this offset array mechanism, a slice
569     can be written along any single dimension or combinations of
570     dimensions.
571    

  ViewVC Help
Powered by ViewVC 1.1.22