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

Reprojection on daily averaged files.

parent 6dabf077
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,7 @@ if __name__ == '__main__':
ds.to_netcdf(tmp, engine='h5netcdf')
# reproject and resample to target grid in parallel
LOGGER.info('Reprojecting and resampling to target grid ...')
target = Parallel(n_jobs=-1, verbose=51)(
delayed(reproject_cdo)(args.grid, tmp, trg, args.mode,
args.overwrite)
......@@ -110,7 +111,7 @@ if __name__ == '__main__':
# aggregate files for different years into a single file using
# xarray and dask
LOGGER.info('Reading ERA5 data ...')
LOGGER.info('Aggregating different years into single file ...')
ds = xr.open_mfdataset(target, parallel=True).compute()
# set NetCDF file compression for each variable
......@@ -122,6 +123,10 @@ if __name__ == '__main__':
LOGGER.info('Compressing NetCDF: {}'.format(filename))
ds.to_netcdf(filename, engine='h5netcdf')
# remove single-year files
for trg in target:
trg.unlink()
else:
LOGGER.info('{} does not exist.'.format(str(args.source)))
sys.exit()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment