Skip to content
Snippets Groups Projects
Commit 42842112 authored by Laurent Mercadier's avatar Laurent Mercadier
Browse files

Adds function to concatenate runs along trainId dimension

parent a2f524ed
No related branches found
No related tags found
No related merge requests found
......@@ -449,3 +449,20 @@ def load(fields, runNB, proposalNB, semesterNB, topic='SCS', display=False,
result.attrs['run'] = run
result.attrs['runFolder'] = runFolder
return result
def concatenateRuns(runs):
""" Concatenate two runs with identical data variables along the trainId dimension
Input:
runs: (list) the xarray Datasets to concatenate
Output:
a concatenated xarray Dataset
"""
keys = runs[0].keys()
for run in runs[1:]:
if run.keys() != keys:
print('data fields between different runs are not identical. Cannot combine runs.')
return
result = xr.concat(runs, dim='trainId')
result = result.sortby(result.trainId)
return result
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment