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

add_string_variable removed #154

Open
kiranshila opened this issue Aug 10, 2024 · 3 comments
Open

add_string_variable removed #154

kiranshila opened this issue Aug 10, 2024 · 3 comments

Comments

@kiranshila
Copy link

I'm updating my project to your recent version that utilizes the fork of HDF5, but am running into an error that add_string_variable has been removed. I don't see a changelog, and a cursory look around doesn't indicate an obvious replacement.

Before I had something like:

let mut reim = file.add_string_variable("reim", &["reim"])?;
reim.put_attribute("long_name", "Complex")?;
reim.put_string("real", 0)?;
reim.put_string("imaginary", 1)?;

which now doesn't work. Any help would be appreciated.

@mulimoen
Copy link
Collaborator

add_string_variable was removed in preference to typing out the netCDF type explicitely. You can use the below as a replacement

let mut reim = file.add_variable_with_type("reim", &["reim"], &netcdf::types::NcVariableType::String)?;
reim.put_attribute("long_name", "Complex")?;
reim.put_string("real", 0)?;
reim.put_string("imaginary", 1)?;

@kiranshila
Copy link
Author

This seems regressive, what's the motivation for not having the convenience constructor?

@mulimoen
Copy link
Collaborator

This was removed at the same time as support for user-defined types were added. It felt redundant at the time to have so many constructors

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