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

Unlimited dimensions not supported #14

Open
andyclegg opened this issue Jan 16, 2020 · 0 comments
Open

Unlimited dimensions not supported #14

andyclegg opened this issue Jan 16, 2020 · 0 comments

Comments

@andyclegg
Copy link

When creating a file with an unlimited dimension, data is not written properly.

package main

import "github.com/fhs/go-netcdf/netcdf"  
                  
func main() {                                                                    
    dataset, _ := netcdf.CreateFile("test.nc", netcdf.NETCDF4 | netcdf.WRITE)      
    dims := make([]netcdf.Dim, 1)                     
    dims[0], _ = dataset.AddDim("time", uint64(4))           
    ncvar, _ := dataset.AddVar("var", netcdf.FLOAT, dims)       
    dataset.EndDef()                                                
    ncvar.WriteFloat32s([]float32{0.1, 0.2, 0.3, 0.4})             
    dataset.Close()    
}        

Output of ncdump test.nc:

netcdf test {
dimensions:
	time = UNLIMITED ; // (0 currently)
variables:
	float var(time) ;
data:
}

However if the time dimension is defined as having a size of uint64(4) instead:

netcdf test {
dimensions:
	time = 4 ;
variables:
	float var(time) ;
data:

 var = 0.1, 0.2, 0.3, 0.4 ;
}

Unlimited dimensions are a very useful part of the netCDF specification and it would be great if they were supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants