Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output data needs to indicate whether a node is a boundary one or not #167

Open
pmav99 opened this issue Oct 16, 2023 · 6 comments
Open
Assignees

Comments

@pmav99
Copy link
Collaborator

pmav99 commented Oct 16, 2023

This is needed for GDACS

@brey
Copy link
Collaborator

brey commented Jan 22, 2024

I have second thoughts about adding it to the post-processing. The code is

import pyposeidon.mesh as pm
    #add boundary nodes
    mesh = pm.set(type='tri2d', mesh_file=os.path.join(b.rpath + 'hgrid.gr3'))
    
    out_total = xr.merge([out,mesh.Dataset[['type','node','id']]])

but it would take long for a big global mesh and the data will be in every output file. I suggest we save mesh.Dataset[['type','node','id']] to a single file once and this can be used to identify boundaries for all runs.

@pmav99
Copy link
Collaborator Author

pmav99 commented Jan 22, 2024

Sure, it can be part of the model definition.

@pmav99
Copy link
Collaborator Author

pmav99 commented Jan 22, 2024

That being said, do we need to call xr.merge()? Wouldn't that be faster?

out_total = out.assign(
    btype=mesh.Dataset.type,
    bnode=mesh.Dataset.node,
    bid=mesh.Dataset.id
)

@brey
Copy link
Collaborator

brey commented Jan 22, 2024

I agree if we needed to merge them. We will not do that. We are just going to save to a netcdf file that relates to the model and is unique.

import pyposeidon.mesh as pm
    #add boundary nodes
    mesh = pm.set(type='tri2d', mesh_file=os.path.join(b.rpath + 'hgrid.gr3'))
    
   mesh.Dataset[['type','node','id']]].to_netcdf("boundary_connectivity.nc")

This will be done once and the file can be used to identify boundary nodes for all outputs, if need be. It doesn't need to be part of pyposeidon.

@brey
Copy link
Collaborator

brey commented Jan 22, 2024

I think we can close this issue.

@pmav99
Copy link
Collaborator Author

pmav99 commented Jan 22, 2024

Should we export this file by default? Should we also be able to read it? And/or to add a reference it in the *model.json ? Or maybe just document, that extracting this information can be done with the snippet above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants