[ncl-talk] todouble() Keep meta data?
Dennis Shea
shea at ucar.edu
Wed Jun 24 11:30:58 MDT 2015
Not really.
Adding meta data does add some overhead so computations and built-in
functions do not handle meta data (except _FillValue). Further, it can get
complicated.
A = (X*B/C + sqrt(dim_avg_n(Q,1)*828.11))^2
Say X, B, C, Q all have meta data. All the variables have different named
dimensions, coordinate variables and attributes. Some have 'dimension
reduction'. All may have different reference times
What to do? What are the units after computation? What is the long_name?
Which coordinates are appropriate?
Even trivial T (degC)
T = T + 273.15 ; same variable but NCL does not know there is a units
change
T at units = "degK" ; user must update
or a new variable
TF = T*1.8 + 32
Is the 'T' long_name still appropriate? What about the units of 'TF'?
==
Many built in function have a _Wrap equivalent. These handle meta data in a
reasonable fashion.
==
I suggest you build your own library ('myLib.ncl') to isolate tasks
undef("my_todouble")
function my_todouble(x:numeric)
local xd
begin
xd = todouble(x)
copy_VarMeta(x, xd)
return(xd)
end
====
Ultimately, why are you converting to double?
All NCL computations are done in double precision.
=======
On Wed, Jun 24, 2015 at 10:20 AM, Erik J. Schaffernicht <
eschaffe at uni-koeln.de> wrote:
> If I transform a field with todouble() I loose all meta data. Why?
>
> Do I always have to do it like this or is there a shorter way?:
>
> t2=todouble(oro)
> copy_VarMeta(oro,t2)
> oro:=t2
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150624/bb735350/attachment.html
More information about the ncl-talk
mailing list