@@ -221,15 +221,12 @@ end
221221end
222222
223223"""
224- DatasetRestoring(variable_name::Symbol, [ arch_or_grid = CPU(), ];
225- dataset,
226- start_date = first_date(dataset, variable_name),
227- end_date = last_date(dataset, variable_name),
228- time_indices_in_memory = 2,
229- time_indexing = Cyclical(),
224+ DatasetRestoring(metadata::Metadata,
225+ arch_or_grid = CPU();
226+ rate,
230227 mask = 1,
231- rate = 1,
232- dir = default_download_directory(dataset ),
228+ time_indices_in_memory = 2, # Not more than this if we want to use GPU!
229+ time_indexing = Cyclical( ),
233230 inpainting = NearestNeighborInpainting(Inf),
234231 cache_inpainted_data = true)
235232
@@ -247,7 +244,7 @@ from the dataset of choice to the simulation grid and time.
247244Arguments
248245=========
249246
250- - `variable_name `: The name of the variable to restore. Choices include:
247+ - `metadata `: The medatada for a dataset variable to restore. Choices for variables include:
251248 * `:temperature`,
252249 * `:salinity`,
253250 * `:u_velocity`,
@@ -260,54 +257,25 @@ Arguments
260257 `arch_or_grid = CPU()` or `arch_or_grid = GPU()`, data is interpolated
261258 on-the-fly when the forcing tendency is computed. Default: CPU().
262259
263- !!! info "Providing `Metadata` instead of `variable_name`"
264- Note that `Metadata` may be provided as the first argument instead of `variable_name`.
265- In this case the `dataset`, `start_date`, and `end_date` kwargs (described below)
266- cannot be provided since they are inferred from `Metadata`.
267-
268260Keyword Arguments
269261=================
270262
271- - `dataset`: The dataset; required keyword argument if `variable_name` argument is provided.
272-
273- - `start_date`: The starting date to use for the dataset. Default: `first_date(dataset, variable_name)`.
263+ - `rate`: The restoring rate, i.e., the inverse of the restoring timescale (in s⁻¹).
274264
275- - `end_date `: The ending date to use for the dataset. Default: `end_date(dataset, variable_name)` .
265+ - `mask `: The mask value. Can be a function of `(x, y, z, time)`, an array, or a number .
276266
277267- `time_indices_in_memory`: The number of time indices to keep in memory. The number is chosen based on
278268 a trade-off between increased performance (more indices in memory) and reduced
279269 memory footprint (fewer indices in memory). Default: 2.
280270
281- - `time_indexing`: The time indexing scheme for the field time series.
282-
283- - `mask`: The mask value. Can be a function of `(x, y, z, time)`, an array, or a number.
284-
285- - `rate`: The restoring rate, i.e., the inverse of the restoring timescale (in s⁻¹).
286-
287- - `dir`: The directory where the native data is located. If the data does not exist it will
288- be automatically downloaded. Default: `default_download_directory(dataset)`.
271+ - `time_indexing`: The time indexing scheme for the field time series. Default: `Cyclical()`.
289272
290273- `inpainting`: inpainting algorithm, see [`inpaint_mask!`](@ref). Default: `NearestNeighborInpainting(Inf)`.
291274
292275- `cache_inpainted_data`: If `true`, the data is cached to disk after inpainting for later retrieving.
293276 Default: `true`.
294277"""
295- function DatasetRestoring (variable_name:: Symbol ,
296- arch_or_grid = CPU ();
297- dataset,
298- dir = default_download_directory (dataset),
299- start_date = first_date (dataset, variable_name),
300- end_date = last_date (dataset, variable_name),
301- kw... )
302-
303- native_dates = all_dates (dataset, variable_name)
304- dates = compute_native_date_range (native_dates, start_date, end_date)
305- metadata = Metadata (variable_name, dataset, dates, dir)
306-
307- return DatasetRestoring (metadata, arch_or_grid; kw... )
308- end
309-
310- function DatasetRestoring (metadata,
278+ function DatasetRestoring (metadata:: Metadata ,
311279 arch_or_grid = CPU ();
312280 rate,
313281 mask = 1 ,
@@ -316,6 +284,8 @@ function DatasetRestoring(metadata,
316284 inpainting = NearestNeighborInpainting (Inf ),
317285 cache_inpainted_data = true )
318286
287+ download_dataset (metadata)
288+
319289 fts = FieldTimeSeries (metadata, arch_or_grid;
320290 time_indices_in_memory,
321291 time_indexing,
@@ -334,13 +304,17 @@ function DatasetRestoring(metadata,
334304 return DatasetRestoring (fts, maybe_native_grid, mask, field_name, rate)
335305end
336306
337- function Base. show (io:: IO , p :: DatasetRestoring )
307+ function Base. show (io:: IO , dsr :: DatasetRestoring )
338308 print (io, " DatasetRestoring:" , ' \n ' ,
339- " ├── restored variable: " , summary (p. variable_name), ' \n ' ,
340- " ├── restoring dataset: " , summary (p. field_time_series. backend. metadata), ' \n ' ,
341- " ├── restoring rate: " , p. rate, ' \n ' ,
342- " ├── mask: " , summary (p. mask), ' \n ' ,
343- " └── grid: " , summary (p. native_grid))
309+ " ├── variable_name: " , summary (dsr. variable_name), ' \n ' ,
310+ " ├── rate: " , dsr. rate, ' \n ' ,
311+ " ├── field_time_series: " , summary (dsr. field_time_series), ' \n ' ,
312+ " │ ├── dataset: " , summary (dsr. field_time_series. backend. metadata. dataset), ' \n ' ,
313+ " │ ├── dates: " , dsr. field_time_series. backend. metadata. dates, ' \n ' ,
314+ " │ ├── time_indexing: " , summary (dsr. field_time_series. time_indexing), ' \n ' ,
315+ " │ └── dir: " , dsr. field_time_series. backend. metadata. dir, ' \n ' ,
316+ " ├── mask: " , summary (dsr. mask), ' \n ' ,
317+ " └── native_grid: " , summary (dsr. native_grid))
344318end
345319
346320regularize_forcing (forcing:: DatasetRestoring , field, field_name, model_field_names) = forcing
0 commit comments