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_d704ext_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 ofimodelandext_schema_pathorext_schema_filemust be set.ext_schema_file (
str, optional) – The external input data model schema file. One ofimodelandext_schema_pathorext_schema_filemust be set.year_init (
strorint, optional) – Left border of time axis.year_end (
strorint, 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: 0convert_flag (
bool, default:True) – If True convert entries by using a pre-defined data model.converter_dict (
dictof{Hashable: func}, optional) – Functions for converting values in specific columns. If None use information from a pre-defined data model.converter_kwargs (
dictof{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 (
dictof{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 argumentsxr_kwargs (
dict, optional) – Additional xarray arguments
- Return type:
- Returns:
See also
readRead either original marine-meteorological or MDF data or CDM tables from disk.
read_dataRead MDF data and validation mask from disk.
read_tablesRead CDM tables from disk.
writeWrite either MDF data or CDM tables to disk.
write_dataWrite MDF data and validation mask to disk.
write_tablesWrite CDM tables to disk.