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

Skip reading for dry-run.

parent 068a7583
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,15 @@ if __name__ == '__main__':
'_'.join(['^ERA5', var, '[0-9]{4}.nc$']))
ymin, ymax = (re.search('[0-9]{4}', files[0].name)[0],
re.search('[0-9]{4}', files[-1].name)[0])
LogConfig.init_log('Aggregating ERA5 years: {}'.format(
'-'.join([ymin, ymax])))
LOGGER.info(('\n ' + (len(__name__) + 1) * ' ').join(
['{}'.format(file) for file in files]))
# check for dry-run
if args.dry_run:
LOGGER.info('Dry run: No output produced.')
continue
# check if aggregated file exists
filename = '_'.join(['ERA5', var, ymin, ymax])
......@@ -64,15 +73,6 @@ if __name__ == '__main__':
# aggregate files for different years into a single file using
# xarray and dask
ds = xr.open_mfdataset(files, parallel=True).compute()
LogConfig.init_log('Aggregating ERA5 years: {}'.format(
'-'.join([ymin, ymax])))
LOGGER.info(('\n ' + (len(__name__) + 1) * ' ').join(
['{}'.format(file) for file in files]))
# check for dry-run
if args.dry_run:
LOGGER.info('Dry run: No output produced.')
continue
# aggregate hourly data to daily data: resample in case of missing
# days
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment