
copy_VarMeta
Copies all attributes, named dimensions and coordinate variables from one variable to another.
Prototype
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 copy_VarMeta ( var_from , var_to )
Arguments
var_fromAn array of any dimensionality. Must have attributes, named dimensions and coordinate variables.
var_toAn array of any dimensionality. Its dimensions must be a subset of the leftmost dimensions of var_from. For example, if var_from is dimensioned time x lev x lat x lon, then var_to can be dimensioned:
- the same size
- time x lev x lat
- lev x lat
- lat
Description
This procedure copies all attributes, named dimensions and coordinate variables from var_from to var_to.
If var_from and var_to are not the same size, this procedure is "smart" enough to only calculate the appropriate number of dimensions possessed by var_to.
See Also
copy_VarMeta, copy_VarAtts, copy_VarCoords, copy_VarCoords_1, copy_VarCoords_2
There are many other metadata tools
Examples
;---read in zonal winds
a = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc","r")
u = a->U(1,:,:)
v = a->V(1,:,:)
spd = sqrt(u^2+v^2) ; spd won't have any metadata
copy_VarMeta(u,spd) ; Copy metadata from u to spd