NCL Home > Documentation > Functions > Printing


Prints the minimum and maximum values of a variable.


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  ; This library is automatically loaded
                                                             ; from NCL V6.2.0 onward.
                                                             ; No need for user to explicitly load.

	procedure printMinMax (
		data    : numeric,             
		opt [1] : logical or integer   



A variable of any dimensionality.


  • Setting opt=True (or 1) will result in a 'line feed' prior to printing the min/max values.
  • Setting opt=False(or 0) will result no line feed prior to printing the min/max values.


The printMinMax procedure prints a numeric variable's minimum and maximum values.

If a "long_name", "description", or "standard_name" attribute exists, then this is added to the print output. In NCL V6.4.0, if a "units" type attribute exists, then this is also added to the print output.

It does not allow for any format control. For limited format control, use the sprintf function for floating point numbers, and sprinti for integers. To "pretty print" 2D arrays, use the write_matrix or write_table procedures.

printMinMax is often used with printVarSummary.

See Also

print, printVarSummary, printFileVarSummary, sprinti, sprintf, write_matrix, write_table


Print an overview of a variable's contents and the minimum and maximum values.

  f = addfile ("", "r")
  T = f->T
  printVarSummary (T)
  printMinMax (T, False)     ; or printMinMax(T, 0) =>  no line feed
The above yields:

   Variable: T
   Type: float
   Total Size: 72192 bytes
               18048 values
   Number of Dimensions: 3
   Dimensions and sizes:   [time | 1] x [lat | 94] x [lon | 192]
               time: [197901..197901]
               lat: [-88.54195..88.54195]
               lon: [ 0..358.125]
   Number Of Attributes: 4
     units :       K
     short_name :  T2m
     long_name :   Temperature (2m)
     _FillValue :  1e+36
   Temperature (2m) (K) : min=224.89    max=308.2
If opt=True, then the last few lines would look like:

     long_name :   Temperature (2m)
     _FillValue :  1e+36
                                                              (skip one line)
   Temperature (2m) (K) : min=224.89    max=308.2