Comment enregistrer un ensemble de données dans le fichier
# Reading and writing netCDF files with xarray requires scipy or the netCDF4-Python library
# to be installed (the latter is required to read/write netCDF V4 files and use the
# compression options described below).
# 1) We can load netCDF files to create a new Dataset using open_dataset():
ds_disk = xr.open_dataset("saved_on_disk.nc")
# print data information
ds_disk
# 2) We can save a Dataset to disk using the Dataset.to_netcdf() method:
ds.to_netcdf("saved_on_disk.nc")
# Datasets have a Dataset.close() method to close the associated netCDF file.
# However, it’s often cleaner to use a with statement:
# this automatically closes the dataset after use
with xr.open_dataset("saved_on_disk.nc") as ds:
print(ds.keys())
Mckynde