Oceananigans.jl
Oceananigans.jl copied to clipboard
`NetCDFOutputWriter` should have `mode = "c"` as default?
I was reading the NetCDFOutputWriter docstring and I got confused. Why mode = nothing is set as default in NetCDFOutputWriter
https://github.com/CliMA/Oceananigans.jl/blob/6ceeb012f1432bf936edd977fa1390dc694a0adc/src/OutputWriters/netcdf_output_writer.jl#L289
and then straight after is converted to mode = "c"
https://github.com/CliMA/Oceananigans.jl/blob/6ceeb012f1432bf936edd977fa1390dc694a0adc/src/OutputWriters/netcdf_output_writer.jl#L301 ?
Why not have mode = "c" the default?
The default depends on whether the file already exists or not? Just above that...
https://github.com/CliMA/Oceananigans.jl/blob/6ceeb012f1432bf936edd977fa1390dc694a0adc/src/OutputWriters/netcdf_output_writer.jl#L293-L298
It's all a little weird though I agree...
Partly I think we're in a much better position to figure out whether we want to destroy an existing file or append to a new one when we call run!. At the time the output writers are created, we don't know if someone is pickup=true or if iteration != 0, etc. I think there's an issue about this...
Something about "initializing" an output writer only after we call run!. Basically we can just move the whole constructor to some function initialize_output_writer! that only get's called when a simulation is "initialized".
Resolved, right @tomchor ?
Kinda. The current behavior is this https://github.com/CliMA/Oceananigans.jl/blob/470fd110a99b1967510979fbc313093dac060636/src/OutputWriters/netcdf_output_writer.jl#L302-L308
So the default is similar to what it was when this issue was posted, although I think it's formulated a little clearer now.
I'm okay with this and also okay with closing this issue, but I'm not sure everyone else feels this way. You mentioned at some point that we could move this part to after run!() is called and I don't think we discussed that.
Oh I see... you're right, we should leave this open.
I'm closing this issue because I'm judging that it's not of current, timely relevance to Oceananigans development. If you would like to make it a higher priority or if you think the issue was closed in error please feel free to re-open.