Skip to content

Commit

Permalink
carry over subsetted elements in adcirc subset parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
WPringle committed Feb 27, 2024
1 parent 3c485be commit 61254d3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ensembleperturbation/parsing/adcirc.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,20 @@ def combine_outputs(
if elevation_selection is not None:
elevation_subset = subset

if 'element' in file_data:
# keep only elements where all nodes are present
elements = file_data['element'].values
element_mask = numpy.isin(elements, file_data['node'].values).all(axis=1)
elements = elements[element_mask]
# map nodes in element table to local numbering system (start at 0)
node_mapper = numpy.zeros(file_data['node'].max().values + 1, dtype=int)
node_index = numpy.arange(len(file_data['node']))
node_mapper[file_data['node'].values] = node_index
elements = node_mapper[elements]
# update element table in dataset
ele_da = DataArray(data=elements, dims=['nele', 'nvertex'])
file_data = file_data.assign_coords({'element': ele_da})

output_data[basename] = file_data

for basename, file_data in output_data.items():
Expand Down
Binary file modified tests/data/reference/test_combine_outputs/fort.63.nc
Binary file not shown.
Binary file modified tests/data/reference/test_combine_outputs/fort.64.nc
Binary file not shown.
Binary file modified tests/data/reference/test_combine_outputs/maxele.63.nc
Binary file not shown.
Binary file modified tests/data/reference/test_combine_outputs/maxvel.63.nc
Binary file not shown.
Binary file modified tests/data/reference/test_combine_outputs/perturbations.nc
Binary file not shown.

0 comments on commit 61254d3

Please sign in to comment.