NetcdfAttribute Class Reference

Container for numeric or string data. More...

#import <NetcdfAttribute.h>

Inherits NetcdfTypedComponent.

Collaboration diagram for NetcdfAttribute:

Collaboration graph
[legend]

List of all members.

Public Member Functions

(id) - initByOwner:varid:attnum:
 Called by an instance of NetcdfDataset or NetcdfVariable that owns the attribute.
(NSError *) - lastError
 Return an autoreleased NSError report on the last error, or nil if no error.
(id) - valuesAsChar
 Returns a NSString.
(id) - valuesAsUchar
 Returns the attribute value converted to 8-bit unsigned char.
(id) - valuesAsSchar
 Returns the attribute value converted to 8-bit signed char.
(id) - valuesAsShort
 Returns the attribute value converted to 16-bit short.
(id) - valuesAsInt
 Returns the attribute value converted to 32-bit int.
(id) - valuesAsLong
 Returns the attribute value converted to 32-bit long.
(id) - valuesAsFloat
 Returns the attribute value converted to 32-bit float.
(id) - valuesAsDouble
 Returns the attribute value converted to 64-bit double.
(NSString *) - valuesAsString
 Returns the attribute value as NSString; a synonym for valuesAsChar.
(id) - values
 Automatically calls an appropriate method based on a default conversion.
(NSNumber *) - valueAtIndex:
 Returns a single numeric value from a vector attribute using automatic type conversion.
(NSMutableDictionary *) - schema
 Structure of the attribute.


Detailed Description

Container for numeric or string data.

Attributes provide additional descriptive or modifying data. Global attributes may be associated with the dataset; variable attributes may be associated with a single variable. An attribute has a name, a length, a type, and value(s). Attributes are most commonly a string or scalar value, but a 1-dimensional numeric vector is also possible.

Attribute data is returned as the appropriate Objective C data type. For scalar numeric values, the return type is NSNumber. For vector numeric values, the return type is an NSArray of NSNumber. For Character data is returned as NSString.

On error, the return is NIL and ncErrNo is set; use -lastError to get a descriptive NSError object.


Member Function Documentation

- (NSError *) lastError  

Return an autoreleased NSError report on the last error, or nil if no error.

The NSError will have the error code set to ncErrNo, domain set to "netCDF" and its userInfo dictionary will contain:
key: NSLocalizedDescription value: NSString human readable error message
key: "path" value: NSString path to the netCDF data file
key: "class" value: NSString "NetcdfAttribute"
key: "name" value: NSString name of attribute

- (NSMutableDictionary *) schema  

Structure of the attribute.

key: "name" value: attribute name string (NSString)
key: "type" value: attribute data nc_type (NSNumber)
key: "length" value: number of data elements (NSNumber)
key: "values" value: [self values]

Reimplemented from NetcdfTypedComponent.

- (NSNumber *) valueAtIndex: (unsigned int)  index  

Returns a single numeric value from a vector attribute using automatic type conversion.

Uses the same conversion defaults as -values. An out-of-range index returns NIL. Returns NIL for string attributes.

- (id) values  

Automatically calls an appropriate method based on a default conversion.

NC_CHAR ==> -valuesAsString
NC_BYTE ==> -valuesAsSchar
NC_SHORT ==> -valuesAsShort
NC_INT ==> -valuesAsInt
NC_FLOAT ==> -valuesAsFloat
NC_DOUBLE ==> -valuesAsDouble

- (id) valuesAsChar  

Returns a NSString.

The NSString will be padded with zeros to the length of the attribute.


Generated on Thu Sep 24 23:22:18 2009 for NetcdfStep by  doxygen 1.5.7.1