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

can't save .nc with survey group only (no data groups added) #24

Open
bminsley opened this issue Jan 28, 2025 · 0 comments
Open

can't save .nc with survey group only (no data groups added) #24

bminsley opened this issue Jan 28, 2025 · 0 comments

Comments

@bminsley
Copy link
Collaborator

initialized a survey with only survey metadata, no data groups added,
survey = Survey(metadata)

error on trying to save to netcdf,
survey.write_netcdf('loupe.nc')

Traceback (most recent call last):

Cell In[71], line 1
survey.write_netcdf('loupe.nc')

File ~.conda\envs\gspy\lib\site-packages\gspy\src\classes\survey\Survey.py:332 in write_netcdf
self.xarray.to_netcdf(filename, mode='w', group='survey', format='netcdf4', engine='netcdf4')

File ~.conda\envs\gspy\lib\site-packages\xarray\core\dataset.py:1912 in to_netcdf
return to_netcdf( # type: ignore # mypy cannot resolve the overloads:(

File ~.conda\envs\gspy\lib\site-packages\xarray\backends\api.py:1232 in to_netcdf
dump_to_store(

File ~.conda\envs\gspy\lib\site-packages\xarray\backends\api.py:1279 in dump_to_store
store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)

File ~.conda\envs\gspy\lib\site-packages\xarray\backends\common.py:270 in store
self.set_variables(

File ~.conda\envs\gspy\lib\site-packages\xarray\backends\common.py:308 in set_variables
target, source = self.prepare_variable(

File ~.conda\envs\gspy\lib\site-packages\xarray\backends\netCDF4_.py:503 in prepare_variable
nc4_var.setncatts(attrs)

File src\netCDF4\_netCDF4.pyx:4632 in netCDF4._netCDF4.Variable.setncatts

File src\netCDF4\_netCDF4.pyx:1762 in netCDF4._netCDF4._set_att

TypeError: illegal data type for attribute b'data_normalized', must be one of dict_keys(['S1', 'i1', 'u1', 'i2', 'u2', 'i4', 'u4', 'i8', 'u8', 'f4', 'f8']), got b1

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

1 participant