Skip to content

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

Description

@bminsley

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions