From f3206d5be035117bb8356a2013509e1907e2707c Mon Sep 17 00:00:00 2001 From: Adam Theisen Date: Thu, 4 Nov 2021 11:12:42 -0500 Subject: [PATCH] ENH: There's a but in that open_mfdataset defaults to open_dataset if it's one file. Putting in a check so open_mfdataset keywords aren't passed to open_dataset --- act/io/armfiles.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/act/io/armfiles.py b/act/io/armfiles.py index 8a50f457d3..a4782e6d96 100644 --- a/act/io/armfiles.py +++ b/act/io/armfiles.py @@ -74,10 +74,11 @@ def read_netcdf(filenames, concat_dim=None, return_None=False, file_times = [] # Add funciton keywords to kwargs dictionary for passing into open_mfdataset. - kwargs['combine'] = combine - kwargs['concat_dim'] = concat_dim - kwargs['use_cftime'] = use_cftime - kwargs['combine_attrs'] = combine_attrs + if len(filenames) > 1: + kwargs['combine'] = combine + kwargs['concat_dim'] = concat_dim + kwargs['use_cftime'] = use_cftime + kwargs['combine_attrs'] = combine_attrs # Create an exception tuple to use with try statements. Doing it this way # so we can add the FileNotFoundError if requested. Can add more error