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.
Abara, So, if I understand correctly, you want to be able to programmatically generate an ncML file that converts values from a unit specified in the netCDF file into the unit specified in the ncML file? Is this correct? According to an ncML developer, ncML can't do that type of conversion. > Hello, > > My objectif is to implement a generator of ncml descriptions. > > For example, suppose that we want to modify the 'K' unit to 'degC' > unit in a netcdf file. In this cas, we need to introduce the add_offset > attribut with the value X=273,15 in the ncml description. > > <netcdf xmlns="" location=".... /netdcf_file.nc"> > <attribute name="degC" orgName="K" /> > <attribut name="add_offset" type="double" value="273.15" /> > </netcdf> > > Why a program which uses the udunits library determines that the > conversion type is OFFSET and the X value is 273.15. > > We can propose this simple interface : > > ######################################################### > enum CONV_TYPE = {SCALE_CONV, OFFSET_CONV, ........}; > > /* > * return the type of the converter 'conv' > */ > > CONV_TYPE typeConv (ut_converter * conv); > > or > > int isScaleConv (ut_converter * conv); > > ... > > int isOffsetConv (ut_converter * conv); > > for the parameters, we can define a structure or functions as : > > /* > * return the scale if 'conv' have the scale type, error otherwise. > */ > double scaleConv (ut_converter * conv); > ... > /* > * return the scale if 'conv' have the offset type, error otherwise. > */ > double offsetConv (ut_converter * conv); > ######################################################### > > Thank you very much in advance. > > Abdelrezzak BARA. Regards, Steve Emmerson Ticket Details =================== Ticket ID: PKD-127901 Department: Support UDUNITS Priority: Normal Status: Closed