;$Id:$ ;-------------------------------------------------------------------- ; a function to return the rank of a table in a netcdf file ;-------------------------------------------------------------------- function determine_table_rank, nc_filename ;--- open file sd_id = ncdf_open(nc_filename) ;--- check to see file could be opened, if not return 0 if (sd_id lt 0) then begin print, 'failed to determine rank for ', nc_filename return, 0 endif ;--- determine the group name in the table (aka the classifier name) grp_ids = ncdf_groupsinq(sd_id) grp_id = grp_ids[0] classifier_name = ncdf_groupname(grp_id) ;------------------------------------------------- ; make a structure to hold data and attributes ;------------------------------------------------- @attributes_define.pro ;------------------------------------------------- ; read data into structure ;------------------------------------------------- ncdf_attget, grp_id, /global, "rank", x & attributes.rank = x ;--- close the netcdf file ncdf_close, sd_id return, attributes.rank end ;--------------------------------------------------------------------------------------------- ; ;---------------------------------------------------------------------------------------------