Created
April 3, 2017 09:08
-
-
Save monkeybutter/82dd9f57106f482717fad664523e062d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
from datetime import datetime | |
import pytz | |
import numpy as np | |
with netCDF4.Dataset("a_FMC_File.nc", 'r+', format='NETCDF4') as src: | |
temp = np.zeros(src["time"].shape) | |
for i, t in enumerate(src["time"]): | |
d_local = datetime.fromtimestamp(t) | |
t_utc = (pytz.utc.localize(d_local)-pytz.utc.localize(datetime(1970,1,1))).total_seconds() | |
temp[i] = t_utc | |
src["time"][:] = temp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment