From 3343f81c0f3cb1c92c2a51c11d363c3642406100 Mon Sep 17 00:00:00 2001 From: veenstrajelmer Date: Tue, 9 Apr 2024 18:28:56 +0200 Subject: [PATCH] remove always true statement from example file, fixes #821 --- tests/examples/postprocess_map_monthlymean.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/examples/postprocess_map_monthlymean.py b/tests/examples/postprocess_map_monthlymean.py index 2ac1eef68..f260a72e9 100644 --- a/tests/examples/postprocess_map_monthlymean.py +++ b/tests/examples/postprocess_map_monthlymean.py @@ -12,10 +12,9 @@ import datetime as dt import dfm_tools as dfmt -#TODO: experiment with monthly/daily means or depth average of his/map fields (to show power of pandas/xarray) +#TODO: experiment with monthly/daily means or depth average of his/map fields (to show convenience of pandas/xarray) overwrite = True -yearmonth = True file_nc = dfmt.data.fm_grevelingen_map(return_filepath=True) file_basename = os.path.basename(file_nc.replace('_0*_','_0000_')) @@ -29,11 +28,10 @@ print('>> computing monthly means: ', end='') dtstart = dt.datetime.now() -if yearmonth: # on unique year+month combinations - data_xr_monthmean = data_frommap_merged.resample(time='MS').mean(dim='time') -else: #on unique month numbers - data_xr_monthmean = data_frommap_merged.groupby('time.month').mean() - data_xr_monthmean = data_xr_monthmean.rename({'month':'time'}) +data_xr_monthmean = data_frommap_merged.resample(time='MS').mean(dim='time') +# on unique month numbers +# data_xr_monthmean = data_frommap_merged.groupby('time.month').mean() +# data_xr_monthmean = data_xr_monthmean.rename({'month':'time'}) print(f'{(dt.datetime.now()-dtstart).total_seconds():.2f} sec') #reconnect data and grid #TODO: support resampling/groupby in xugrid?