cdm_reader_mapper.read_mdf

Contents

cdm_reader_mapper.read_mdf#

cdm_reader_mapper.read_mdf(source, imodel=None, ext_schema_path=None, ext_schema_file=None, ext_table_path=None, year_init=None, year_end=None, encoding=None, chunksize=None, skiprows=None, convert_flag=True, converter_dict=None, converter_kwargs=None, decode_flag=True, decoder_dict=None, validate_flag=True, sections=None, excludes=None, pd_kwargs=None, xr_kwargs=None)[source]#

Read data files compliant with a user specific data model.

Reads a data file to a pandas DataFrame using a pre-defined data model. Read data is validates against its data model producing a boolean mask on output.

The data model needs to be input to the module as a named model (included in the module) or as the path to a valid data model.

Parameters:
  • source (str) – The file (including path) to be read.

  • imodel (str, optional) – Name of internally available input data model. e.g. icoads_r300_d704

  • ext_schema_path (str, optional) – The path to the external input data model schema file. The schema file must have the same name as the directory. One of imodel and ext_schema_path or ext_schema_file must be set.

  • ext_schema_file (str, optional) – The external input data model schema file. One of imodel and ext_schema_path or ext_schema_file must be set.

  • year_init (str or int, optional) – Left border of time axis.

  • year_end (str or int, optional) – Right border of time axis.

  • encoding (str, optional) – The encoding of the input file. Overrides the value in the imodel schema file.

  • chunksize (int, optional) – Number of reports per chunk.

  • skiprows (int, optional) – Number of initial rows to skip from file, default: 0

  • convert_flag (bool, default: True) – If True convert entries by using a pre-defined data model.

  • converter_dict (dict of {Hashable: func}, optional) – Functions for converting values in specific columns. If None use information from a pre-defined data model.

  • converter_kwargs (dict of {Hashable: kwargs}, optional) – Key-word arguments for converting values in specific columns. If None use information from a pre-defined data model.

  • decode_flag (bool, default: True) – If True decode entries by using a pre-defined data model.

  • decoder_dict (dict of {Hashable: func}, optional) – Functions for decoding values in specific columns. If None use information from a pre-defined data model.

  • validate_flag (bool, default: True) – Validate data entries by using a pre-defined data model.

  • sections (list, optional) – List with subset of data model sections to output, optional If None read pre-defined data model sections.

  • pd_kwargs (dict, optional) – Additional pandas arguments

  • xr_kwargs (dict, optional) – Additional xarray arguments

Return type:

DataBundle

Returns:

cdm_reader_mapper.DataBundle

See also

read

Read either original marine-meteorological or MDF data or CDM tables from disk.

read_data

Read MDF data and validation mask from disk.

read_tables

Read CDM tables from disk.

write

Write either MDF data or CDM tables to disk.

write_data

Write MDF data and validation mask to disk.

write_tables

Write CDM tables to disk.