move utility function from NetcdfDataset to Misc