Hi Martin,
This does look like a bug. Another variation for making the
definitions would be this:
yes? let atval = {($istr), ($iend), `is`, `ie`}
yes? define att/output/type=float
(`($var)_3D_climatology,return=xaxis`).domain_decomposition =
attval
yes? save ...
The attribute values are correct if they are added to a variable,
but I also see the incorrect values, 0., 1.875, 0., 3.76660 when
the attribute is added to a coordinate variable. We'll check into
this, and I agree, there should be more data types for attributes
than just string or float.
There are of course workarounds using NCO.
Ansley
On 5/13/2016 3:47 AM, Martin Schmidt
wrote:
Hi,
I am trying to add an attribute to the horizontal axes of a 4d -
data field. The background is a decomposition into horizontal
domains.
The attribute should have the form:
xt_ocean:domain_decomposition = 1, 273, 20, 70 ;
I read the horizontal grid size with: ($1) is the variable name
define symbol istr=`$1,return=istart`
define symbol iend=`$1,return=iend`
define symbol jstr=`$1,return=jstart`
define symbol jend=`$1,return=jend`
and define the subgrid size:
let is=$2
let ie=$3
let js=$4
let je=$5
set region /i=`is`:`ie`/j=`js`:`je`
Now I can define the attribute like follows:
define att/output/type=string
(`($var)_3D_climatology,return=xaxis`).domain_decomposition
"($istr), ($iend), `is`, `ie`"
xt_ocean:domain_decomposition = "1, 273, 20, 70" ;
Almost done ... but the quotation marks are disturbing.
Alternatively:
define att/output/type=float
(`($var)_3D_climatology,return=xaxis`).domain_decomposition
{($istr), ($iend), `is`, `ie`}
This gives in the output file:
xt_ocean:domain_decomposition = 0.f, 1.875f, 0.f, 3.766602f ;
This is not only wrong format, but it is wrong! Both, the sysmbols
and the numbers are not translated correctly.
define att/output/type=float
(`($var)_3D_climatology,return=xaxis`).domain_decomposition {1,
273, 20, 70}
gives the same result.
So this is may be a bug. It shows up with v6.96 (PyFerret 1.2) and
the normal v6.85 and v6.951.
And, if I would have a wish - it would be useful in some cases to
have an integer attribute type.
Greetings,
Martin Schmidt
|