Closed twhiteaker closed 6 years ago
a .. people might want to write their time series in one step and geoms in another. Glad you are coming back to this work!!
Other libraries like pandas overwrite existing files with their .to_format functions. I suggest we follow that behavior, and add a new export method called .append_to_netcdf, which appends to an existing file. That function will also take an optional list of variable names to assign the geometry to, which just means setting their geometry attribute to be the name of the geometry container.
Makes sense to me. That or error if the file exists unless the user says overwrite or append?
After reading through every function and adding docstrings today, I was reminded of how Ben already solved this problem. Ben accommodated 'a' when he allowed the write_netcdf function to accept either a path to a netCDF file or a netCDF Dataset instance. If the former, any existing file is overwritten. If the latter, you can append.
Thus, I'm closing this issue for now. I welcome raising the issue again if this solution irks anyone.
Do we allow append (mode='a') or overwrite (mode='w')? Probably should.