EDIT: Sorry for the mess, I didn't give much thought before writing.
from template import DatasetTemplate as T
test=T({'one':10},{'ten':{'type':double'}})
test.to_netcdf()
#raises:
KeyError: 'dimensions'
There are several things here:
if we did not provide dimensions, it's safe to write the variable as dimensionless? I think so.
Despite the error, this call write a netcdf file and stop in the middle. Although this behaviour is useful for debuging, end-users will have to release the file to be able to write to it again in a new call to DatasetTemplate (say test.ncobj.close() before running again). This is clearly not optimal.
Solutions range from:
Check everything before writing (a lot of boilerplate to write and new exceptions to create)
Gracefully close the file when something is wrong (best). This still provide a good level of debug given the file can be inspected.
EDIT: Sorry for the mess, I didn't give much thought before writing.
There are several things here:
Solutions range from: