diff --git a/src/glide/cli.py b/src/glide/cli.py index f05baf9..c044cce 100644 --- a/src/glide/cli.py +++ b/src/glide/cli.py @@ -266,9 +266,11 @@ def merge( dataset_dims = set(ds.dimensions) ds.close() - if dataset_dims == {"time"}: + if (dataset_dims == {"time"}) | (dataset_dims == {"time", "time_uv"}): input_file_level = 2 - elif dataset_dims == {"profile_id", "z"}: + elif (dataset_dims == {"profile_id", "z"}) | ( + dataset_dims == {"profile_id", "z", "time_uv"} + ): input_file_level = 3 else: raise ValueError( diff --git a/src/glide/process_l3.py b/src/glide/process_l3.py index b138344..699e28f 100644 --- a/src/glide/process_l3.py +++ b/src/glide/process_l3.py @@ -42,7 +42,7 @@ def bin_q( ds[v] = ( dims, np.full_like(ds.conductivity.values, np.nan), - config["variables"][v]["CF"], + config["merged_variables"][v]["CF"], ) # Dissipation rate is stored in the q file as the log10 of the value. # Convert it to the actual value. @@ -61,7 +61,10 @@ def bin_q( ds_.profile_time_end.astype("M8[s]"), ) ) - if eds_.e_1.size < 1: + # Filter to valid depths within the bin range (also drops NaN). + in_range = (eds_.depth >= depth_bins[0]) & (eds_.depth <= depth_bins[-1]) + eds_ = eds_.sel(time=in_range) + if eds_.time.size < 1: _log.debug("No epsilon data") continue binned = eds_.groupby_bins("depth", depth_bins).mean()