Commit eeec6129 authored by Carl Schreck's avatar Carl Schreck

Automated Nightly Commit - Wed Aug 21 00:01:31 EDT 2019

parent c1d69a6f
""" Open a set of 30-minute IMERG files, read the data, and write it out."""
__author__ = "Carl Schreck"
__email__ = ""
__copyright__ = "Copyright 2019, North Carolina State University"
__license__ = "BSD-3.0"
import xarray as xr
import sys
import cjs
import glob
import numpy as np
cjs.tstamp('Here we go!')
in_path = '/home/carl/data/imerg/2017/3B-HHR.MS.MRG.3IMERG.201706*0000-E*nc'
out_path = '/home/carl/data/imerg/'
in_files = glob.glob(in_path)
# print(np.c_[in_files])
ds = xr.open_mfdataset(in_files, concat_dim='time')
ds.time.encoding['units'] = 'days since 1800-01-01'
ds.time.encoding['dtype'] = 'float64'
# ds.encoding['_FillValue'] = -9999.
ds.sel(lat=slice(10, 20), lon=slice(-120, 0)).to_netcdf(out_path)
cjs.tstamp('Thank you, come again.')
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