Re: Do functions always strip their results from any attributes?

From: wxtofly <wxtofly_at_nyahnyahspammersnyahnyah>
Date: Fri Jan 14 2011 - 12:47:48 MST
Sorry for muddying the waters, I was thinking only dimensions and coordinate variables, not units and labels and descriptions.

Dennis is absolutely right.

But you can carry forward much of the meta data by copying the variable.

To check on what does and does not come along. try

printVarSummary(myvar)

mynewvar=myvar

printVarSummary(mynewvar)

then your transformation

mynewvar = round(myvar,3) => mynewvar is an integer variable with no @description.

then check again.
printVarSummary(mynewvar)

As to what the default description of such a new variable should be, why not a string of the transform that created it as a default?
So above mynewvar would have @description "round (myvar,3)"   If one needs more, one can always do it over, but often that is all that is needed, something to keep track of where the variable came from.

TJ Olney


On 01/12/2011 02:36 PM, Emilie Vanvyve wrote:
Hello,

I have noticed that when I use functions (at least some of them), the end result has lost all traces of attributes.

Example 1:
myvar = a float variable with attribute @description defined.
mynewvar = round(myvar,3) => mynewvar is an integer variable with no @description.

Example 2:
myvar = a variable with attribute @units defined.
mynewvar = ndtooned(myvar) => mynewvar doesn't have any @units attribute.

The second case is a bit more annoying when it comes down to handling date/time variables. Most time handling functions require the @units attribute to be defined in order to function correctly (e.g. ut_string). One needs to redefine each time the @units attribute before using the function.

I was wondering why this is happening. Is any function intrinsically a "value-only" assignment as explained here http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#Assignment?

Emilie

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk


_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jan 14 12:47:55 2011

This archive was generated by hypermail 2.1.8 : Tue Jan 25 2011 - 14:22:16 MST