@@ -312,40 +312,40 @@ for FT in (Float32, Float64)
312312 end
313313 end
314314end
315- # test dataset truncation
315+ # test dataset truncation
316316@testset " test dataset truncation" begin
317- # Get the original dataset set up
317+ # Get the original dataset set up
318318 include (joinpath (pkgdir (ClimaCoupler), " artifacts" , " artifact_funcs.jl" ))
319319 sst_data_all = joinpath (sst_dataset_path (), " sst.nc" )
320320 ds = NCDatasets. NCDataset (sst_data_all, " r" )
321321 dates = ds[" time" ][:]
322322 first_date = dates[1 ]
323323 last_date = last (dates)
324324
325- # set up comms_ctx
325+ # set up comms_ctx
326326 device = ClimaComms. device ()
327327 comms_ctx = ClimaComms. context (device)
328328 ClimaComms. init (comms_ctx)
329329
330- # make path for truncated datasets
330+ # make path for truncated datasets
331331 COUPLER_OUTPUT_DIR = joinpath (" experiments" , " AMIP" , " output" , " tests" )
332332 mkpath (COUPLER_OUTPUT_DIR)
333333
334334 REGRID_DIR = joinpath (COUPLER_OUTPUT_DIR, " regrid_tmp" , " " )
335335 mkpath (REGRID_DIR)
336336
337- # values for the truncations
338- time_start = 0.0
339- time_end = 1.728e6
337+ # values for the truncations
338+ t_start = 0.0
339+ t_end = 1.728e6
340340 date0test = [" 18690101" , " 18700101" , " 19790228" , " 20220301" , " 20230101" ]
341341 for date in date0test
342342 date0 = Dates. DateTime (date, Dates. dateformat " yyyymmdd" )
343- sst_data = Regridder. truncate_dataset (sst_data_all, " test" , REGRID_DIR, date0, time_start, time_end , comms_ctx)
343+ sst_data = Regridder. truncate_dataset (sst_data_all, " test" , REGRID_DIR, date0, t_start, t_end , comms_ctx)
344344 ds_truncated = NCDatasets. NCDataset (sst_data, " r" )
345345 new_dates = ds_truncated[" time" ][:]
346346
347- date_start = date0 + Dates. Second (time_start )
348- date_end = date0 + Dates. Second (time_start + time_end )
347+ date_start = date0 + Dates. Second (t_start )
348+ date_end = date0 + Dates. Second (t_start + t_end )
349349
350350 # start date is before the first date of datafile
351351 if date_start < first_date
@@ -359,10 +359,10 @@ end
359359 @test new_dates[2 ] >= date_start
360360 end
361361
362- # end date is before the first date of datafile
362+ # end date is before the first date of datafile
363363 if date_end < first_date
364364 @test last (new_dates) == first_date
365- # end date is after the last date of datafile
365+ # end date is after the last date of datafile
366366 elseif date_end > last_date
367367 @test last (new_dates) == last_date
368368 # end date is within the bounds of datafile
371371 @test new_dates[length (new_dates) - 1 ] <= date_end
372372 end
373373
374- # check that truncation is indexing correctly
374+ # check that truncation is indexing correctly
375375 all_data = ds[" SST" ][:, :, :]
376376 new_data = ds_truncated[" SST" ][:, :, :]
377377 (start_id, end_id) = Regridder. find_idx_bounding_dates (dates, date_start, date_end)
0 commit comments