Skip to content
Snippets Groups Projects
Commit bf46f189 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Fix filename and add logs.

parent 897a6d1c
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@ if __name__ == '__main__':
continue
# check if aggregated file exists
filename = '_'.join(['ERA5', var, ymin, ymax])
filename = '_'.join(['ERA5', var, ymin, ymax]) + '.nc'
filename = args.target.joinpath(var, filename)
if filename.exists() and not args.overwrite:
LOGGER.info('{} already exists.'.format(filename))
......@@ -72,10 +72,12 @@ if __name__ == '__main__':
# aggregate files for different years into a single file using
# xarray and dask
LOGGER.info('Reading ERA5 data ...')
ds = xr.open_mfdataset(files, parallel=True).compute()
# aggregate hourly data to daily data: resample in case of missing
# days
LOGGER.info('Computing daily averages ...')
ds = ds.resample(time='D').mean(dim='time')
# set NetCDF file compression for each variable
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment