Skip to content

Commit

Permalink
remove always true statement from example file, fixes #821
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Apr 9, 2024
1 parent e9a8a40 commit 3343f81
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/examples/postprocess_map_monthlymean.py
Expand Up @@ -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_'))
Expand All @@ -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?
Expand Down

0 comments on commit 3343f81

Please sign in to comment.