def dump_dataset_headers(self): """Print out the matching parameters for the --datasets specified on the command line. """ multi_context_headers = defaultdict(list) for context in self.contexts: if self.args.datasets: headers = api.get_dataset_headers_by_id( context, self.args.datasets) elif self.args.instrument: headers = api.get_dataset_headers_by_instrument( context, self.args.instrument) for dataset_id, header in headers.items(): multi_context_headers[dataset_id].append((context, header)) for dataset_id, context_headers in multi_context_headers.items(): for (context, header) in context_headers: if self.args.condition_values: header = utils.condition_header(header) if self.args.minimize_headers: header = crds.get_cached_mapping(context).minimize_header( header) if len(self.contexts) == 1: print(dataset_id, ":", log.format_parameter_list(header)) else: print(dataset_id, ":", context, ":", log.format_parameter_list(header))
def get_conditioned_header(filepath, needed_keys=(), original_name=None, observatory=None): """Return the complete conditioned header dictionary of a reference file, or optionally only the keys listed by `needed_keys`. DOES NOT verify checksums. `original_name`, if specified, is used to determine the type of the file and is not required to be readable, whereas `filepath` must be readable and contain the desired header. """ header = get_header(filepath, needed_keys, original_name, observatory=observatory) return utils.condition_header(header, needed_keys)
def condition_matching_header(rmapping, header): """Condition the matching header values to the normalized form of the .rmap""" return utils.condition_header(header)