yadg.extractors package

yadg.extractors.extract(filetype, path)

Worker function of the extract subcommand.

Extracts data from provided path, assuming it is the specified filetype. The data is either returned as a datatree.DataTree or a xarray.Dataset, however in either case the returned objects have a ret.to_netcdf() as well as a ret.to_dict() method, which can be used to write the file.

Warning

This feature has been introduced in yadg-5.0a2 and is unstable.

Parameters:
  • filetype (str) – Specifies the filetype. Can be both yadg-native as well as a MaRDA extractors FileType. Automatically checks for matches using the marda: prefix.

  • path (Path) – A pathlib.Path object pointing to the file to be extracted.

Returns:

The extracted data and metadata, which can be written to NetCDF format using ret.to_netcdf().

Return type:

Union[xr.Dataset, datatree.DataTree]

Subpackages