diff options
author | Aaron LI <aly@aaronly.me> | 2019-01-29 15:00:16 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2019-01-29 15:00:16 +0800 |
commit | 67b720f6d36891b17dad02ea6aca187c0813a412 (patch) | |
tree | 0e7a2c7ceaa6a137b3b96ef3ac4312cee75d50c4 /fg21sim/utils/io.py | |
parent | e2e1606538d3f412ee210171ff5f4d64c4da903b (diff) | |
download | fg21sim-67b720f6d36891b17dad02ea6aca187c0813a412.tar.bz2 |
Use UTC time instead of local time
Diffstat (limited to 'fg21sim/utils/io.py')
-rw-r--r-- | fg21sim/utils/io.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fg21sim/utils/io.py b/fg21sim/utils/io.py index b3666b6..b6719ec 100644 --- a/fg21sim/utils/io.py +++ b/fg21sim/utils/io.py @@ -1,5 +1,5 @@ -# Copyright (c) 2017 Weitian LI <weitian@aaronly.me> -# MIT license +# Copyright (c) 2017,2019 Weitian LI <wt@liwt.net> +# MIT License """ Input/output utilities @@ -29,7 +29,7 @@ Input/output utilities import os import logging import pickle -from datetime import datetime, timezone +from datetime import datetime import numpy as np import pandas as pd @@ -119,7 +119,7 @@ def dataframe_to_csv(df, outfile, comment=None, clobber=False): if comment is None: comment = [ "by %s" % __name__, - "at %s" % datetime.now(timezone.utc).astimezone().isoformat(), + "at %sZ" % datetime.utcnow().isoformat(), ] with open(outfile, "w") as fh: @@ -240,8 +240,7 @@ def write_fits_image(outfile, image, header=None, float32=False, hdr = fits.Header() hdr["CREATOR"] = (__name__, "File creator") - hdr["DATE"] = (datetime.now(timezone.utc).astimezone().isoformat(), - "File creation date") + hdr["DATE"] = (datetime.utcnow().isoformat()+"Z", "File creation date") if header is not None: hdr.extend(header, update=True) @@ -368,8 +367,7 @@ def write_fits_healpix(outfile, hpmap, header=None, float32=False, # hdr["EXTNAME"] = ("HEALPIX", "Name of the binary table extension") hdr["CREATOR"] = (__name__, "File creator") - hdr["DATE"] = (datetime.now(timezone.utc).astimezone().isoformat(), - "File creation date") + hdr["DATE"] = (datetime.utcnow().isoformat()+"Z", "File creation date") # Merge user-provided header # NOTE: use the `.extend()` method instead of `.update()` method if header is not None: |