pro getgrid,fname,gridname,thegrid,dims,dimnames,dim0,dim1,dim2,dim3,dim4 ; This routine reads an SDS grid from the LIS/OTD HDF climatology files ; and optionally returns the grid dimensions (DIMS) names (DIMNAMES) and ; values (DIM0 ... DIM4, depending on the number of dimensions) sd_id = hdf_sd_start(fname) hdf_sd_fileinfo,sd_id,numsds,attributes if numsds lt 1 then message,"No scientific data sets in file!" index = HDF_SD_NAMETOINDEX(sd_id, gridname) sds_id=HDF_SD_SELECT(sd_id,index) HDF_SD_GETINFO,sds_id,RANGE=RANGE HDF_SD_GETINFO,sds_id,NDIMS=NDIMS,LABEL=LABEL,DIMS=DIMS,TYPE=TYPE HDF_SD_GETDATA,sds_id,thegrid dimnames = strarr(ndims) for dim=0,ndims-1,1 do begin dim_id = HDF_SD_DIMGETID(SDS_ID, dim) HDF_SD_DIMGET, Dim_ID, count=count, format=format, label=label, name=name, nattr=nattr, scale=scale, type=type, unit=unit dimnames[dim] =name case dim of 0:begin dim0 = scale end 1:begin dim1 = scale end 2:begin dim2 = scale end 3:begin dim3 = scale end 4:begin dim4 = scale end endcase endfor HDF_SD_ENDACCESS, sds_id HDF_SD_END, sd_id end pro testgetgrid getgrid,'LISOTD_HRFC.hdf','HRFC_COM_FR',thegrid help,thegrid getgrid,'LISOTD_HRFC.hdf','HRFC_OTD_VT',thegrid,dims,dimnames,dim0,dim1 print,dims,dimnames getgrid,'LISOTD_HRFC.hdf','HRFC_OTD_DE',thegrid,dims,dimnames print,dims,dimnames stop end