ncap2 provides intrinsic functions for performing manual type
conversions.
This, for example, converts variable tpt to external type
NC_SHORT (a C-type short), and variable prs to
external type NC_DOUBLE (a C-type double).
ncap2 -s 'tpt=short(tpt);prs=double(prs)' in.nc out.nc
See ncap2 netCDF Arithmetic Processor, for more details.