# NCDatasets.jl: define values of dimensions

Dear all,
Using NCDatasets,

To write a data to netcdf, i can define the dimensions with this way:

``````ds = NCDataset("/tmp/test.nc","c")
defDim(ds,"lon",100)
``````

However, is there any way to define the values of my dimensions ??

Like, ` defDim(ds,"lon",collect(-179.5:179.5))`

Similar way is doing NetCDF.jl :

``````nccreate(path,"rad","lon",collect(-179.5:179.5),lonatts,"lat",collect(-89.5:89.5),latatts);
``````

A relative solution (but not that i want) i found here how to define the dimension value? · Issue #90 · Alexander-Barth/NCDatasets.jl · GitHub .

The values of the dimensions can be defined by defining a proper variable (`defVar`) which has the same name as the dimension and values the values you need.

As the issue you linked says, it is

``````ds = Dataset("./test.nc","c")
defDim(ds, "lon", length(15:55))
v = defVar(ds, "lon", Float32, ("lon",))
v[:] = 15:55
close(ds)
``````

By definition the CF standard doesn’t define dimensions with values, only with the length they have.