MCPcopy Index your code
hub / github.com/pydata/xarray / save_mfdataset

Function save_mfdataset

xarray/backends/writers.py:494–631  ·  view source on GitHub ↗

Write multiple datasets to disk as netCDF files simultaneously. This function is intended for use with datasets consisting of dask.array objects, in which case it can write the multiple datasets to disk simultaneously using a shared thread pool. When not using dask, it is no differ

(
    datasets,
    paths,
    mode="w",
    format=None,
    groups=None,
    engine=None,
    compute=True,
    **kwargs,
)

Source from the content-addressed store, hash-verified

492
493
494def save_mfdataset(
495 datasets,
496 paths,
497 mode="w",
498 format=None,
499 groups=None,
500 engine=None,
501 compute=True,
502 **kwargs,
503):
504 """Write multiple datasets to disk as netCDF files simultaneously.
505
506 This function is intended for use with datasets consisting of dask.array
507 objects, in which case it can write the multiple datasets to disk
508 simultaneously using a shared thread pool.
509
510 When not using dask, it is no different than calling ``to_netcdf``
511 repeatedly.
512
513 Parameters
514 ----------
515 datasets : list of Dataset
516 List of datasets to save.
517 paths : list of str or list of path-like objects
518 List of paths to which to save each corresponding dataset.
519 mode : {"w", "a"}, optional
520 Write ("w") or append ("a") mode. If mode="w", any existing file at
521 these locations will be overwritten.
522 format : {"NETCDF4", "NETCDF4_CLASSIC", "NETCDF3_64BIT", \
523 "NETCDF3_CLASSIC"}, optional
524 File format for the resulting netCDF file:
525
526 * NETCDF4: Data is stored in an HDF5 file, using netCDF4 API
527 features.
528 * NETCDF4_CLASSIC: Data is stored in an HDF5 file, using only
529 netCDF 3 compatible API features.
530 * NETCDF3_64BIT: 64-bit offset version of the netCDF 3 file format,
531 which fully supports 2+ GB files, but is only compatible with
532 clients linked against netCDF version 3.6.0 or later.
533 * NETCDF3_CLASSIC: The classic netCDF 3 file format. It does not
534 handle 2+ GB files very well.
535
536 All formats are supported by the netCDF4-python library.
537 scipy.io.netcdf only supports the last two formats.
538
539 The default format is NETCDF4 if you are saving a file to disk and
540 have the netCDF4-python library available. Otherwise, xarray falls
541 back to using scipy to write netCDF files and defaults to the
542 NETCDF3_64BIT format (scipy does not support netCDF4).
543 groups : list of str, optional
544 Paths to the netCDF4 group in each corresponding file to which to save
545 datasets (only works for format="NETCDF4"). The groups will be created
546 if necessary.
547 engine : {"netcdf4", "h5netcdf", "scipy"}, optional
548 Engine to use when writing netCDF files. If not provided, the
549 default engine is chosen based on available dependencies, by default
550 preferring "netcdf4" over "h5netcdf" over "scipy" (customizable via
551 ``netcdf_engine_order`` in ``xarray.set_options()``).

Calls 4

typeFunction · 0.85
to_netcdfFunction · 0.85
syncMethod · 0.45
closeMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…