| aggregate_geozarr | R Documentation |
NetCDF files have file size limitations, leading to large data sets being split up into multiple files, usually over the temporal dimension. This is very typical in climate projection data sets: a typical CMIP6 run over the period 2015-2100 at daily resolution is broken into 3 to 16 separate files for each variable, making data extractions across the temporal boundaries cumbersome. Zarr does not have that same limitation: large data sets are broken up into "chunks", each being stored as a file when the store is on a local file system, but this is transparent to the user of the data. A full CMIP6 run of any variable can be stored and manipulated in a single GeoZarr array.
aggregate_geozarr(
x,
location,
along = NULL,
var = NULL,
name = NULL,
chunking = NULL,
external_coordinates = NULL,
verbose = interactive()
)
x |
Either a character vector with fully-qualified paths to netCDF
files, or a |
location |
A |
along |
Optional. Character vector with the names of the axes to
aggregate along. If omitted or |
var |
Optional. When |
name |
Optional. The name of the array to create. If omitted or |
chunking |
Optional. Named |
external_coordinates |
Optional. Character string with the path of a
group, relative to |
verbose |
Logical. If |
This function makes a best effort. If the data variables provided are sensible, so will be the result. Otherwise, an error is thrown.
The data variables must have the same axes, by name and in the same order.
Along the axes named in along the coordinates of the data variables are
combined, in the direction of the axis; any duplicate coordinates are
included once. These axes may also be scalar axes of the data variables, such
as a height or an ensemble member, which then become new dimensions of the
array. All other axes have to be identical in all data variables, including
their boundary values. The coordinates of the data variables have to be
contiguous subsets of the aggregated axis.
The following conditions throw an error:
the data variables do not have the same axes, by name and in the same order;
an axis is not of the same type or, for time axes, does not have the same calendar, unit and origin in all data variables;
the coordinates of an axis in along are partly increasing and partly
decreasing, or have gaps or interleave;
a discrete axis is named in along;
the data variables have different data types, or not all have the same CRS;
only some data variables have an auxiliary longitude-latitude grid, the
grids differ, or, with such a grid, the X or Y axes are in along;
label sets of an axis that is not in along differ among the data
variables, or labels for the same coordinate differ;
One or more of the data variables has parametric vertical coordinates.
Attributes of the axes are set on the coordinates of the axes, leaving out
those that are structural in GeoZarr, such as axis, bounds and units.
Global attributes, those of the group of the data variables, are set on the
location group, overwriting attributes with the same name that are already
there. As no single value describes the aggregate when it differs among the
files, such as for a creation date or a tracking id, only the global
attributes that have the same value in all data variables are set. The
exception is the history attribute, which is set as an array of entries,
most recent first: an entry for the aggregation, followed by the entries of
each distinct history among the data variables.
Attributes of the data variables are set on the array. If they differ among the data variables, or are not in all of them, a warning is issued and the value from the last data variable is used. This also holds for the attributes of an axis. Missing data are translated to the GeoZarr conventions, see the "Exporting data" vignette for details.
Label sets of the axes are included. Any axis can be aggregated along,
including the X and Y axes, except when the data variables have an
auxiliary longitude-latitude grid. That grid is set as the geolocation of the
array and it is defined over the X and Y axes, so these cannot be in
along. The grid, and the axes it is defined over, must be identical in all
data variables. If the axes of the grid have no orientation, as is common for
curvilinear grids, the first is taken to be the X axis and the second the
Y axis.
Limitations: parametric vertical coordinates (CF formula terms) are not supported.
The new geozarr_array, invisibly.
## Not run:
pr <- list.files(pattern = '^pr.*\\.nc$', full.names = TRUE)
z <- zarr::create_zarr()
gza <- aggregate_geozarr(x = pr, location = z)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.