reading HDF file and SDS attributes in NCL?

From: Louis Wicker (Louis.Wicker AT XXXXXX)
Date: Mon Sep 29 2003 - 09:21:30 MDT


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 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]
            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?


Lou Wicker

ncl-talk mailing list
ncl-talk AT

This archive was generated by hypermail 2b29 : Mon Sep 29 2003 - 11:06:36 MDT