Skip to content

Commit

Permalink
Eliminate architecture kwarg
Browse files Browse the repository at this point in the history
  • Loading branch information
glwagner committed Dec 2, 2024
1 parent 632c947 commit c18ba56
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/DataWrangling/ECCO/ECCO_restoring.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,11 @@ function ECCO_times(metadata; start_time = first(metadata).dates)
end

"""
ECCOFieldTimeSeries(metadata::ECCOMetadata;
grid = nothing,
ECCOFieldTimeSeries(metadata::ECCOMetadata, grid=nothing;
architecture = isnothing(grid) ? CPU() : architecture(grid),
time_indices_in_memory = 2,
time_indexing = Cyclical(),
inpainting_iterations = prod(size(metadata)),
inpainting = nothing)
Create a field time series object for ECCO data.
Expand Down Expand Up @@ -138,28 +137,28 @@ Keyword Arguments
Default: `true`.
"""
function ECCOFieldTimeSeries(metadata::ECCOMetadata, grid=nothing;
architecture = isnothing(grid) ? CPU() : architecture(grid),
function ECCOFieldTimeSeries(metadata::ECCOMetadata, arch::AbstractArchitecture=CPU(); kw...)
download_dataset(metadata)
ftmp = empty_ECCO_field(first(metadata); architecture)
grid = ftmp.grid
return ECCOFieldTimeSeries(metadata, grid; kw...)
end

function ECCOFieldTimeSeries(metadata::ECCOMetadata, grid::AbstractGrid;
time_indices_in_memory = 2,
time_indexing = Cyclical(),
inpainting = NearestNeighborInpainting(prod(size(metadata))),
inpainting = nothing,
cache_inpainted_data = true)

# Make sure all the required individual files are downloaded
download_dataset(metadata)

inpainting isa Int && (inpainting = NearestNeighborInpainting(inpainting))

ftmp = empty_ECCO_field(first(metadata); architecture)
on_native_grid = isnothing(grid)
on_native_grid && (grid = ftmp.grid)
backend = ECCONetCDFBackend(time_indices_in_memory, metadata; on_native_grid, inpainting, cache_inpainted_data)

times = ECCO_times(metadata)
loc = LX, LY, LZ = location(metadata)
boundary_conditions = FieldBoundaryConditions(grid, loc)

backend = ECCONetCDFBackend(time_indices_in_memory, metadata; on_native_grid, inpainting, cache_inpainted_data)

fts = FieldTimeSeries{LX, LY, LZ}(grid, times; backend, time_indexing, boundary_conditions)
set!(fts)

Expand Down Expand Up @@ -248,7 +247,7 @@ end
mask = 1,
rate = 1,
grid = nothing,
inpainting = NearestNeighborInpainting(prod(size(metadata))),
inpainting = NearestNeighborInpainting(Inf),
cache_inpainted_data = true)
Create a forcing term that restores to values stored in an ECCO field time series.
Expand Down

0 comments on commit c18ba56

Please sign in to comment.