#import <NetcdfMutableAttribute.h>
Public Member Functions | |
| (NSString *) | - renameAs:error: |
| Modifies the name of the attribute. | |
| (BOOL) | - putValues: |
| Puts new values into an existing attribute. | |
| (NetcdfAttribute *) | - copyAttributeTo:error: |
| Copies the attribute to a dataset or variable. | |
Initializer | |
| (id) | - createByOwner:varid:fromSchema: |
| Creates a new attribute in the data set. | |
| - (NetcdfAttribute *) copyAttributeTo: | (id) | netcdfObject | ||
| error: | (NSError **) | errorP | ||
Copies the attribute to a dataset or variable.
Copies the attribute into another object in the same or a different dataset. The object may be either a NetcdfDataset or NetcdfVariable. Returns a pointer to the new attribute.
On error, returns nil and an NSError. If errorP is NULL, no error information is returned.
| - (id) createByOwner: | (NetcdfDataset *) | newOwner | ||
| varid: | (int) | newVarid | ||
| fromSchema: | (NSDictionary *) | schema | ||
Creates a new attribute in the data set.
This is an initializer that not only initializes a newly allocated NetcdfAttribute, it also creates the new attribute in the underlying netCDF dataset. The dataset must be opened for read/write access. The dataset must be in Define Mode. Normally, this method is only called by an instance of NetcdfDataset or NetcdfVariable to which it will be associated. The associated object coordinates entering and leaving define mode.
Unlike variables, attributes must be created with their values, which are contained in the schema. Values may be NSNumber for scalars, NSArray of NSNumber for 1-D arrays, or NSString for text data. Type conversion is automatic, but type conversions that result in data overflow will cause an error; truncation does not cause an error, but may be undesirable. Data length is derived from the values rather than the length key in the schema.
If the creation fails, returns an object with isValid = NO and ncErrNo = error code. The owner should extract the error information and release the failed attribute.
| - (BOOL) putValues: | (id) | values |
Puts new values into an existing attribute.
The values parameter may be NSNumber, NSArray of NSNumber, NSString, or a compatible subclass. Type conversion is automatic; type conversions that result in data overflow will cause an error; truncation does not cause an error, but may be undesirable. If the number of data exceeds the current allocation, it will enter and leave Define Mode to allocate more space, which is an expensive operation.
| - (NSString *) renameAs: | (NSString *) | newName | ||
| error: | (NSError **) | errorP | ||
Modifies the name of the attribute.
If the new name is longer than the old one, the dataset will automatically enter and leave Define Mode, which is an expensive operation. The new name, possibly recoded, is returned.
On error, returns nil and an NSError. If errorP is NULL, no error information is returned.
1.5.7.1