Commit d93b3aba authored by Michael Giansiracusa's avatar Michael Giansiracusa
Browse files

fixing issue where netCDF4.num2date throws ValueError when using time_offset variable

parent 0c073de1
......@@ -447,6 +447,14 @@ def process_one_file(variables: list, datastream: str, out_dir: str,
except OverflowError as ofe:
nc2csv_logger.warning("{}: {} skipped.".format(ofe, file_name))
return None
except TypeError as te:
try:
df["date_time"] = netCDF4.num2date(rootgrp.variables['time'][:],
rootgrp.variables['time'].units,
calendar='standard')
except Exception as e:
nc2csv_logger.warning("{}: {} skipped.".format(e, file_name))
return None
nc2csv_logger.debug("created date_time column")
# Set the new column as the index so we can do date based slicing for dqr filtering later.
df.set_index("date_time", inplace=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment