uniget, uniput, olrget -- translate between netCDF file and Candis file
uniget [time_variable offset] netCDF_file
uniput [-r] netCDF_file
Uniget translates a Unidata-defined netCDF file into a Candis common data format file. The netCDF file name is given as the command line argument, and the Candis common data format file appears on the standard output. Uniput accepts a Candis file on the standard input and translates it into a netCDF file, whose name is given as the command line argument.
Since Candis has only the float data type, byte, short, int, long, and double types are all converted to float. Since Candis can have a maximum of four dimensions per field, uniget fails when a netCDF file exceeds this limit. Uniput creates all variables in the netCDF file with type float.
Sometimes the time or other indexing variable is represented in double precision float format because single precision doesn’t contain enough digits. A work-around is to subtract off an offset so that the deviation from the offset is representable as a single precision float. The optional arguments time_variable and offset implement this workaround, the first being the name of the variable in question, the second being the size of the offset to be subtracted.
Uniget expects the history attribute in the netCDF file, and converts it to the comment section of the Candis header. The reverse takes place in uniput. If this attribute doesn’t exist, a short default is used for the comment instead.
The last of the absolute values of the validmin, validmax, valid_range, and 0.999*missing_value attributes becomes the Candis parameter "badlim" in uniget. The parameter "bad" is set to 1.001*"badlim". Data in the netCDF file out of the valid range are given the value "bad" in the Candis file. In the reverse translation, the values of valid_range are set to minus and plus the "badlim" value and missing_value is set to "bad". If validmin, validmax, valid_range, or missing_value parameters don’t exist, the Candis default values are used for "bad" and "badlim".
In uniget, dummy index fields are created in the Candis file if dimensions exist without corresponding index fields in the netCDF file. These index fields are given the values 0, 1, 2, etc. Corresponding index parameters are also created.
The "-r" flag in uniput means that the output netCDF file will not have the "record" dimension. It also means that only one variable slice will be read from the Candis file. This option is for cases in which only one variable slice exists and it is undesirable to define a record dimension in the output file.
Olrget is just like uniget except that it subtracts 17259888 hours from the Time variable so that the base time is 1 Jan 1970 rather than 1 Jan 0001. This is specifically for NOAA/CDC OLR daily files. This hack is made necessary by the fact that the existing time variable is double in netCDF and float in Candis, and a float doesn’t have enough significant digits to accurately represent the time when measured relative to the earlier date.
In the continuing battle against shouting text, all variable and dimension names from netCDF files are converted to lower case. Some people might consider this a bug.
If a variable or dimension name in a netCDF file has an initial character which is non-alphabetic (like a number or a special character), it is changed to "X" since Candis doesn’t like such variable names.