The NCDF_GROUPNAME function returns the name of the specified group.
A file’s root group is represented by the forward slash (/) character.
Examples
The following code sample uses the NetCDF 4 file ncgroup.nc, which is located in the IDL distribution’s /examples/data directory. The file contains groups, group dimensions, and variables. The groups are ordered in the following parent/child hierarchy:
Submarine
Diesel_Electric
Nuclear
Attack
Missile
The code sample opens ncgroup.nc, queries various group, dimension, and variable information, and prints out the results. Click on each of the code snippets to execute the entire example.
Section 1:
filename = FILEPATH('ncgroup.nc', $
SUBDIR=['examples', 'data'])
fileId = NCDF_OPEN(fileName)
parentId = NCDF_GROUPSINQ(fileId)
parentName = NCDF_GROUPNAME(parentId[0])
PRINT, 'Parent group: ', parentName
childId = NCDF_GROUPSINQ(parentId[0])
childName1 = NCDF_GROUPNAME(childId[0])
childName2 = NCDF_GROUPNAME(childId[1])
PRINT, 'Child groups: ', childName1, ', ', childName2
Section 2:
PRINT, 'Nuclear parent group ID: ', $
NCDF_GROUPPARENT(childId[1])
PRINT, 'Diesel_Electric group ID: ', $
NCDF_NCIDINQ(parentId[0], 'Diesel_Electric')
PRINT, 'Diesel_Electric group full name: ', $
NCDF_FULLGROUPNAME(childId[0])
Section 3:
dieselDimIds = NCDF_DIMIDSINQ(childId[0])
NCDF_DIMINQ, childId[0], dieselDimIds[0], dimName1, dimSize1
PRINT, 'Diesel_Electric group dimensions'
PRINT, 'Dimension ID: ', dieselDimIds[0]
PRINT, 'Name: ', dimName1
PRINT, 'Size: ', dimSize1
dieselGrpVarIds = NCDF_VARIDSINQ(childId[0])
dieselVarIds = NCDF_VARIDSINQ(childId[0])
dieselVarStruct1 = NCDF_VARINQ(childId[0], dieselVarIds[0])
PRINT, 'Diesel-Electric group variables'
PRINT, 'Name: ', dieselVarStruct1.Name
PRINT, 'ID: ', dieselGrpVarIds[0]
PRINT, 'Type: ', dieselVarStruct1.DataType
PRINT, 'Number of dimensions: ', dieselVarStruct1.Ndims
PRINT, 'Number of attributes: ', dieselVarStruct1.Natts
NCDF_CLOSE, fileId
Syntax
Result = NCDF_GROUPNAME( Grpid )
Return Value
Returns a string containing the group name. If Grpid is invalid, an error message is displayed.
Arguments
Grpid
The ID of the group to query, returned from a previous call to NCDF_OPEN, NCDF_CREATE, or NCDF_GROUPDEF.
Keywords
None
Version History
See Also
NCDF_FULLGROUPNAME, NCDF_GROUPPARENT, NCDF_NCIDINQ