yadg package

yadg.run_with_arguments()

Main execution function.

This is the function executed when yadg is launched using the executable. The function has three subcommands:

  • process: processes a given schema into a datagram.

  • update: updates a given schema or datagram to the current version.

  • preset: creates a schema from a preset file and a target folder.

Subpackages

Submodules

yadg.main.version_check(project='yadg')
yadg.main.set_loglevel(delta)
yadg.main.run_with_arguments()

Main execution function.

This is the function executed when yadg is launched using the executable. The function has three subcommands:

  • process: processes a given schema into a datagram.

  • update: updates a given schema or datagram to the current version.

  • preset: creates a schema from a preset file and a target folder.

yadg.subcommands.process(args)

The process subcommand of yadg.

This function first checks that the supplied args.infile exists, is a valid schema, and if yes, proceeds to process the schema into a datagram. If this is successful, the datagram is checked for validity and written out into args.outfile (which is “datagram.json” by default).

Return type:

None

yadg.subcommands.update(args)

The update subcommand of yadg.

This function updates the DataSchema present in the args.infile argument to comply with the newest version of DataSchema, and saves the resulting object into args.outfile (which is the args.infile with a “.new.json” suffix by default).

Return type:

None

yadg.subcommands.preset(args)

The preset subcommand of yadg.

This function requires the args.preset and args.folder arguments. If args.folder is an existing folder and args.preset a valid schema file (with appropriately formated "import" and "calfile" entries), this function will prepend the specified args.folder to all paths in the args.preset, convert them to absolute paths, and save the resulting schema in the supplied args.outfile.

Alternatively, if args.process is specified, the created schema will be directly processed into a datagram, which is then saved in args.outfile.

Return type:

None

yadg.subcommands.extract(args)

The extract subcommand of yadg.

This function requires the args.filetype and args.infile positional arguments. If args.filetype (or it’s namespaced version, such as marda:{args.filetype}) is a known FileType, yadg will attempt to extract metadata and data from the provided args.infile.

The data is returned as a NetCDF file. The location can be configured using the args.outfile parameter, by default this is set to the stem of args.infile with a .nc suffix.

Return type:

None