html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/2313#issuecomment-1135302642,https://api.github.com/repos/pydata/xarray/issues/2313,1135302642,IC_kwDOAMm_X85Dq1fy,54370222,2022-05-24T01:31:22Z,2022-05-24T01:31:22Z,NONE,"Hello: I have to find maximum precipitation of each year (for example: 2007 and 2008, Dataset link are: [2007](https://downloads.psl.noaa.gov/Datasets/cpc_us_precip/RT/precip.V1.0.2007.nc) and [2008](https://downloads.psl.noaa.gov/Datasets/cpc_us_precip/RT/precip.V1.0.2008.nc)). I have done this using resample method (i.e. `.resample(time='Y').max()`) after concatenating it along time dimension. Following along [SO](https://stackoverflow.com/questions/51709266/using-xarray-to-open-a-multi-file-dataset-when-both-the-files-and-dataset-have-a), I am wondering if I can use preprocess to find maximum (or minimum or average) for each file first and then concatenate it using time dimension. I tried the following code and was not successful. Can someone help me with this? ```import dask.array as da import numpy as np import xarray as xr from dask.distributed import Client client = Client() client def preprocess_func(ds): '''Get maximum (or minimum or average) from each file and concatenate along time''' return ds.precip.max('time') prec_ds=xr.open_mfdataset([prec_2007,prec_2008], chunks={""lat"": 25,""lon"": 25,""time"": -1,}, preprocess=preprocess_func, concat_dim='time')``` ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,344614881