A Python library for parsing BADC-CSV files from the MIDAS Open dataset
Project description
MIDAS Open Parser
midas_open_parser is a Python library specifically designed to parse BADC-CSV files from the MIDAS Open dataset. It provides a tailored and extensible framework for handling the metadata labels and structures found in the MIDAS Open dataset.
The main goal of the midas_open_parser project is to provide tools to ingest the MIDAS Open dataset into various destinations.
About MIDAS Open and BADC-CSV
MIDAS Open Dataset
The Met Office Integrated Data Archive System (MIDAS) Open dataset is a collection of surface observations from the UK land surface observing network. It includes various meteorological parameters such as temperature, wind, precipitation, and cloud cover, among others. The dataset is maintained and distributed by the Met Office, the national meteorological service for the UK.
For more information about the MIDAS Open dataset, please refer to the following resources:
BADC-CSV Format
The BADC-CSV (British Atmospheric Data Centre Comma-Separated Values) format is a text-based format used to store and distribute data from the MIDAS Open dataset. It is a structured CSV format that includes a metadata section describing the data, followed by the actual data records.
The metadata section follows various conventions, such as the Climate and Forecast (CF) conventions, to provide detailed information about the data variables, units, measurement methods, and other relevant metadata. This metadata is crucial for properly interpreting and understanding the data.
For more information about the BADC-CSV format, please refer to the following resources:
Features
- Parse BADC-CSV files and extract data records.
- Extract and process metadata from BADC-CSV files.
- Support for handling global and field-level metadata.
- Extensible architecture for adding new metadata label handlers.
- Error handling for unknown metadata labels.
- Command-line interface for running the parser.
Installation
You can install midas-open-parser using pip:
pip install midas-open-parser
Usage
Here's an example of how to use midas_open_parser:
from midas_open_parser import (
parse_badc_csv,
parse_badc_csv_metadata,
extract_midas_metadata,
UnknownMetadataLabelError,
)
# Parse the BADC-CSV file metadata
metadata = parse_badc_csv_metadata('path/to/file.csv')
# Extract MIDAS metadata
midas_metadata = extract_midas_metadata(metadata)
# Access global metadata
print("Global Metadata:")
for field, values in midas_metadata['global'].items():
print(f"{field}: {values}")
# Access field metadata
print("\nField Metadata:")
for field_name, field_data in midas_metadata.items():
if field_name != 'global':
print(f"{field_name}: {field_data}")
# Parse the BADC-CSV data records
data_rows = parse_badc_csv('path/to/file.csv')
for row in data_rows:
print(row)
Command-Line Interface
You can also use the command-line interface to parse BADC-CSV files:
python -m midas_open_parser.badc_csv_parser path/to/file.csv
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please read the CONTRIBUTING guide for details on how to get started.
Acknowledgments
- The Met Office for keeping the MIDAS Open dataset open to non-scientific community.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file midas_open_parser-0.1.27.tar.gz.
File metadata
- Download URL: midas_open_parser-0.1.27.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba15deaf018ce1f0661873682095dcad2de8aa8d4681346d40ecc3ee97e9a7b2
|
|
| MD5 |
b6f8b95d3bd8509616c60fb8991f4d37
|
|
| BLAKE2b-256 |
48fecbc875064aa44108e4bfbbe752c1ca8d08d1d18cac588c2818a23a793931
|
File details
Details for the file midas_open_parser-0.1.27-py3-none-any.whl.
File metadata
- Download URL: midas_open_parser-0.1.27-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5cff377dcd5f7eacc755a1f2e495dab4d4110e67a20e9c28b8e97be31169c75
|
|
| MD5 |
739a67ced89c7b234145ad670267a7bb
|
|
| BLAKE2b-256 |
44743eb966ed2330b2f4530db24d053106e75a803f6cbc54934b56628c3eeb2e
|