-
Notifications
You must be signed in to change notification settings - Fork 12
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
Reading string variable data #20
Comments
Var.ReadBytes doesn't work? Maybe we need to wrap nc_get_vara_string? PRs are welcome. |
How should I use Var.ReadBytes: it returns an error and takes a byte slice/array? // ReadBytes reads the entire variable v into data, which must have enough
// space for all the values (i.e. len(data) must be at least v.Len()).
func (v Var) ReadBytes(data []byte) error {
if err := okData(v, CHAR, len(data)); err != nil {
return err
}
return newError(C.nc_get_var_text(C.int(v.ds), C.int(v.id), (*C.char)(unsafe.Pointer(&data[0]))))
} |
I think you need to create a func (v Var) ReadStrings(data []string) error |
I think It would be good for Attr as well : func (a Attr) ReadStrings(data []string) error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Hw to read string variable data?
This is my cdl file:
`netcdf test {
dimensions:
station = 9 ;
...
variables:
string station_name(station) ;
...
// global attributes:
...
data:
station_name = "W1", "W2", "W3", "W4", "W5", "W6", "W7",
"W8", "W9" ;
...`
How can I read the string data?
Thanks.
The text was updated successfully, but these errors were encountered: