netCDF global attributes

Oct 17, 2011 at 9:46 AM

Hello!

How can i access netCDF global attributes using sds?

Oct 17, 2011 at 10:05 AM

Hi,

Use the DataSet.Metadata property:

using (DataSet ds = DataSet.Open("sample.nc?openMode=open"))
   {
       // Getting metadata from the dataset:
       // (note that types of attributes must be correct in such type casting)
       string descr = (string)ds.Metadata["description"];
       double[] range = (double[])ds.Metadata["range"];

       // Updating metadata:
       ds.Metadata["range"] = new double[] { -10.0, 10.0 };
   }

See also the reference on the MetadataDictionary class (a type of the ds.Metadata property), available after the SDS is installed.

 

Regards, Dmitry.

Oct 17, 2011 at 10:12 AM

Thank you Dmitry!