Louis, to access an attribute in ncl, you need to use the @ sign. the &
sign you used is for the coordinate variables:
e.g. print(x@long_name)
or print(x&lat)
sm
On Mon, 29 Sep 2003, Louis Wicker wrote:
> All:
>
> for various reasons, I need to use HDF4 for writing out some cloud model
> data. I am using some data compression in HDF4, and need to store off
> some information for the compression.
>
> I realize I can do this in another way, but I was hoping that NCL could
> access either some file attributes and more importantly, the attributes
> of the HDF SDS's.
>
> Interestingly, when I write an SDS with attributes, NCL seems to know
> they are there, but I cannot see how to get at them - see example below:
>
> m5:/home/wicker/SRC/NCL/hdftest 31# ncl
> Copyright (C) 1995-2002 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 4.2.0.a026
> The use of this software is governed by a License Agreement.
> See http://ngwww.ucar.edu/ncl/ for more details.
> ncl 0> fil = addfile("SDS.hdf", "r")
> ncl 1> data = fil->SDStemplate
> ncl 2> printVarSummary(data)
>
>
> Variable: data
> Type: short
> Total Size: 20000 bytes
> 10000 values
> Number of Dimensions: 2
> Dimensions and sizes: [Y_Axis | 100] x [X_Axis | 100]
> Coordinates:
> Y_Axis: [ 0..9.900000147521496]
> X_Axis: [0..99]
> Number Of Attributes: 1
> Valid_range : <ARRAY>
> ncl 3> print(data&Valid_range)
> fatal:(Valid_range) is not a named dimension in variable (data).
> fatal:Execute: Error occurred at or near line 3
>
> Is there a way to reference the information stored in the Attributes?
>
> Thanks.
>
> Lou Wicker
>
******************************************************
Sylvia Murphy EML: murphys AT ucar.edu
NCAR CGD/CAS PHN: 303-497-1720
3080 Center Green Drive FAX: 303-497-1333
Boulder CO 80301
WEB: http://www.cgd.ucar.edu/csm/support/
http://www.cgd.ucar.edu/csm/support/CSM_Graphics/
******************************************************
_______________________________________________
ncl-talk mailing list
ncl-talk AT ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Mon Sep 29 2003 - 11:06:36 MDT