o $g@sddlZddlZddZdS)Nc Cstj|std|ddSzt|WdStyLtd|dt|dd}|d|dWd YdS1sDwYYdSw) z Checks if a file exists and is a NetCDF file. Args: filename: The file name with whole path. Returns: True if the file exists and is a NetCDF file, False otherwise. zWarning: File z does not existFTz$ is corrupted or unknown file formatz /obs_log.txtaz% is corrupted or unknown file format N) ospathexistsprintn4DatasetOSErroropenwrite)filenameworkDirZobs_logr>/lfs/h1/ops/para/packages/nosofs.v3.6.9/ush/pysh/is_nc_file.py is_nc_files    r)rnetCDF4rrrrrrs