create_ds

Contents

create_ds#

obsarray.templater.template_util.create_ds(template: Dict[str, Dict], size: Dict[str, int], metadata: Dict | None = None, append_ds: Dataset | None = None, propagate_ds: Dataset | None = None) Dataset[source]#

Returns template dataset

Parameters:
  • template – dictionary defining ds variable structure, as defined below.

  • size – dictionary of dataset dimensions, entry per dataset dimension with value of size as int

  • metadata – dictionary of dataset metadata

  • append_ds – base dataset to append with template variables

  • propagate_ds – template dataset is populated with data from propagate_ds for their variables with

common names and dimensions. Useful for transferring common data between datasets at different processing levels (e.g. times, etc.). :returns: template dataset

For the template dictionary each key/value pair defines one variable, where the key is the variable name and the value is a dictionary with the following entries:

  • "dtype" (np.typecodes/str) - variable data type, either a numpy data type or special value "flag" for flag variable

  • "dim" (list) - list of variable dimension names

  • "attributes" (dict) - (optional) variable attributes

  • "encoding" (dict) - (optional) variable encoding.

For more information on the required form of these entries, see the variables definition section of the user guide.