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

dataset attrs are ignored upon writing #111

Closed
veenstrajelmer opened this issue Jul 5, 2023 · 1 comment
Closed

dataset attrs are ignored upon writing #111

veenstrajelmer opened this issue Jul 5, 2023 · 1 comment

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Jul 5, 2023

When writing a uds to a file, the provided attributes are overwritten by the conventions from xugrid. This might be desireable behaviour for the Conventions attribute (but I'd like to know more about this), but the other attrs should not be dropped in my view.

import xugrid as xu

uds = xu.data.adh_san_diego()
uds = uds.assign_attrs({'Conventions': 'CF-1.8 UGRID-1.0 Deltares-0.10', #TODO: add Deltares convention (was CF-1.8 UGRID-1.0)
                        'institution': 'Deltares',
                        'references': 'https://www.deltares.nl'})

file_out = 'test_conventions.nc'
uds.ugrid.to_netcdf(file_out)

uds2 = xu.open_dataset(file_out)
print(uds.attrs)
print(uds2.attrs)

Returns:

  • {'Conventions': 'CF-1.8 UGRID-1.0 Deltares-0.10', 'institution': 'Deltares', 'references': 'https://www.deltares.nl'}
  • {'Conventions': 'CF-1.8 UGRID-1.0'}

Also, should it not be CF-1.9? ocean_sigma_over_z_coordinate was only correct from then onwards

@Huite
Copy link
Collaborator

Huite commented Jul 19, 2023

@Huite Huite closed this as completed in 80e6a27 Aug 8, 2023
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