Skip to content

Unable to open multiple .nc file using xarray.open_mfdataset() call !! because of no time dimension in individual files (only lat & lon dim in files) #5616

Answered by dcherian
HARSHBARDHANK94 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @HARSHBARDHANK94

You should try something like:

def preprocess(ds):
	# is time in ds.attrs ; if it's in the filename look at ds.encoding['source']
	ds["time"] = ...
	return ds


xr.open_mfdataset(..., concat_dim="time", preprocess=preprocess)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@HARSHBARDHANK94
Comment options

Answer selected by max-sixty
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants