diff --git a/src/Regridder.jl b/src/Regridder.jl index 53326adce..79f585331 100644 --- a/src/Regridder.jl +++ b/src/Regridder.jl @@ -647,10 +647,14 @@ function truncate_dataset( name, comms_ctx::ClimaComms.AbstractCommsContext, ) - if ClimaComms.iamroot(comms_ctx) - date_start = date0 + Dates.Second(time_start) - date_end = date0 + Dates.Second(time_start + time_end) + date_start = date0 + Dates.Second(time_start) + date_end = date0 + Dates.Second(time_start + time_end) + + file_name = string(name, "_truncated_data_", string(date_start), string(date_end), ".nc") + datafile_truncated = joinpath(datapath, file_name) + println(datafile_truncated) + if ClimaComms.iamroot(comms_ctx) ds = NCDataset(datafile, "r") dates = ds["time"][:] @@ -696,11 +700,6 @@ function truncate_dataset( println("set start and end id") println("----------------------------") - file_name = string(name, "_truncated_data_", string(date_start), string(date_end), ".nc") - datafile_truncated = joinpath(datapath, file_name) - - println(datafile_truncated) - truncated_ds = NCDataset(datafile_truncated, "c") println("file made?") c = view(ds, time = start_id:end_id)