This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>To: "support(a)unidata.ucar.edu" <address@hidden> >From: address@hidden >Subject: Question about NetCDF >Organization: . >Keywords: 199607161033.AA03373 Hi Rahul, > I have a question on extracting data from a netcdf file. > > > I have a .cdf from which I would like to extract information pertaining > to peak names. The peak names are defined in the 'variable section of the > header' as > > > variables: > > - - - > - - - > char peak_name(peak_numnber,_32_byte_string); > - - - > - - - > > > The peak name has the folowing data: > > > peak_name = > > "Unident0001", > "Unident0002", > "Unident0003", > so on till > "Unident0017"; /* i.e. 17 peak_names */ > > > I could not follow the manual on how to define and extract this information > from the .cdf file. > > Please give me an input on this. Are you using C, Fortran, C++, or perl? The way to do it with each of these languages is different. For guidelines that show what functions to call from C or Fortran, you could look at the section of the User's Guide titled "Reading a NetCDF File with Known Names", which is also available on-line at http://www.unidata.ucar.edu/packages/netcdf/guide_6.html#SEC34 For examples of reading character variables from C and Fortran, you might also want to look at the section "Reading and Writing Character String Values", in the NetCDF User's Guide and also available on-line at http://www.unidata.ucar.edu/packages/netcdf/guide_9.html#SEC68 ______________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu