SnBuenafe / hotrstuff

Harmonizing workflows with Dave and creating functions for soon-to-be R package
https://snbuenafe.github.io/hotrstuff/
GNU General Public License v3.0
3 stars 0 forks source link

Add options to overwrite files in functions #1

Open SnBuenafe opened 7 months ago

SnBuenafe commented 6 months ago

Not sure if the overwrite options in some of the functions (e.g., slice_period works). Have to check.

jaseeverett commented 5 months ago

Yes I flirted with this idea today. I get errors when I rerun code if the files already exist. I think the default should be to overwrite. But adding an argument to each function that creates a file seems like a good idea. Use overwrite = TRUE to be consistent with the ones that already have it. The fastest way to implement this is probably to add the -O flag to the cdo call. Not sure this works for all cdo functions though.

jaseeverett commented 5 months ago

Another thought. We need to be careful to distinguish between overwriting an exisiting output file (which should be the default IMO) and accidentally overwriting an input file (for example when you use hrt_get_Years() if the years selected match the existing file, then it will be overwritten).