From f00ab0b480b12661cf16bc5ddbe8042b835dbed9 Mon Sep 17 00:00:00 2001 From: "Gregory L. Wagner" Date: Mon, 11 Nov 2024 22:31:57 -0500 Subject: [PATCH 1/3] Eliminate second constructor for ECCO_metadata Closes #226 --- src/DataWrangling/ECCO/ECCO_metadata.jl | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/DataWrangling/ECCO/ECCO_metadata.jl b/src/DataWrangling/ECCO/ECCO_metadata.jl index ffd2c87c..7c37bad6 100644 --- a/src/DataWrangling/ECCO/ECCO_metadata.jl +++ b/src/DataWrangling/ECCO/ECCO_metadata.jl @@ -72,9 +72,6 @@ function ECCOMetadata(name::Symbol; return ECCOMetadata(name, dates, version, dir) end -ECCOMetadata(name::Symbol, date, version=ECCO4Monthly(); dir=download_ECCO_cache) = - ECCOMetadata(name, date, version, dir) - # Treat ECCOMetadata as an array to allow iteration over the dates. Base.length(metadata::ECCOMetadata) = length(metadata.dates) Base.eltype(metadata::ECCOMetadata) = Base.eltype(metadata.dates) From 777e8e4c3e8714f31490f572dd08fb9114618d42 Mon Sep 17 00:00:00 2001 From: Simone Silvestri Date: Tue, 12 Nov 2024 09:28:02 +0100 Subject: [PATCH 2/3] fix tests --- test/test_ecco.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_ecco.jl b/test/test_ecco.jl index 061657d5..8cf73ab4 100644 --- a/test/test_ecco.jl +++ b/test/test_ecco.jl @@ -23,7 +23,7 @@ inpainting = NearestNeighborInpainting(2) A = typeof(arch) @info "Testing ECCO_field on $A..." - temperature = ECCOMetadata(:temperature, dates, ECCO4Monthly()) + temperature = ECCOMetadata(:temperature; dates, version = ECCO4Monthly()) t_restoring = ECCORestoring(temperature; rate = 1 / 1000.0, inpainting) ECCO_fts = t_restoring.field_time_series @@ -51,7 +51,7 @@ end @testset "Inpainting algorithm" begin for arch in test_architectures - temperature = ECCOMetadata(:temperature, dates[1], ECCO4Monthly()) + temperature = ECCOMetadata(:temperature; dates = dates[1], version = ECCO4Monthly()) grid = LatitudeLongitudeGrid(arch, size = (100, 100, 10), @@ -177,6 +177,6 @@ end ocean = ocean_simulation(grid) date = DateTimeProlepticGregorian(1993, 1, 1) - set!(ocean.model, T=ECCOMetadata(:temperature, date), S=ECCOMetadata(:salinity, date)) + set!(ocean.model, T=ECCOMetadata(:temperature; dates=date), S=ECCOMetadata(:salinity; dates=date)) end end From e64e074e2f7621d97e0cd458bde6fe22e8d913e1 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 12 Nov 2024 21:42:59 +1100 Subject: [PATCH 3/3] use constructor --- src/DataWrangling/ECCO/ECCO_metadata.jl | 2 +- src/DataWrangling/ECCO/ECCO_restoring.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DataWrangling/ECCO/ECCO_metadata.jl b/src/DataWrangling/ECCO/ECCO_metadata.jl index 7c37bad6..a066e411 100644 --- a/src/DataWrangling/ECCO/ECCO_metadata.jl +++ b/src/DataWrangling/ECCO/ECCO_metadata.jl @@ -42,7 +42,7 @@ Base.summary(md::ECCOMetadata{<:AbstractCFDateTime, <:ECCO2Monthly}) = "ECCO2Mon Base.summary(md::ECCOMetadata{<:AbstractCFDateTime, <:ECCO4Monthly}) = "ECCO4Monthly $(md.name) metadata at $(md.dates)" """ - ECCOMetadata(name::Symbol; + ECCOMetadata(name::Symbol; dates = DateTimeProlepticGregorian(1993, 1, 1), version = ECCO4Monthly(), dir = download_ECCO_cache) diff --git a/src/DataWrangling/ECCO/ECCO_restoring.jl b/src/DataWrangling/ECCO/ECCO_restoring.jl index 3529550b..ee7bd261 100644 --- a/src/DataWrangling/ECCO/ECCO_restoring.jl +++ b/src/DataWrangling/ECCO/ECCO_restoring.jl @@ -301,7 +301,7 @@ function ECCORestoring(arch::AbstractArchitecture, dates=all_ECCO_dates(version), kw...) - metadata = ECCOMetadata(variable_name, dates, version) + metadata = ECCOMetadata(variable_name; dates, version) return ECCORestoring(arch, metadata; kw...) end