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

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 12 2011 - 16:48:59 MST

As you put it a function is "value only". Could they be anything else?
Consider

    T : units K

    P : units hPa

    theta = T*(1000/P)^(R/Cp)

What units should theta be? Should NCL choose the 1st or last units.
What general 'rule' could be used by NCL?

There are many _Wrap function that will return meta data.

You can also use [contributed.ncl ]

   copy_VarMeta (...)
   copy_VarCoords(...)
   copy_VarAtts(...)

http://www.ncl.ucar.edu/Document/Functions/Contributed/copy_VarMeta.shtml

===
Cheers

On 01/12/2011 03: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

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 12 16:49:04 2011

This archive was generated by hypermail 2.1.8 : Thu Jan 13 2011 - 09:24:20 MST