Common Data Model reader and mapper toolbox
Project description
Versions |
|
Documentation and Support |
|
Open Source |
|
Coding Standards |
|
Development Status |
|
Funding |
|
The cdm_reader_mapper toolbox is a python tool designed for both:
to read data files compliant with a user specified data model
map observed variables and its associated metadata from a data model or models combination to the C3S CDS Common Data Model (CDM) format
It was developed to read the IMMA (International Maritime Meteorological Archive) data format, but it has been enhanced to account for meteorological data formats in the case of:
Data that is stored in a human-readable manner: “ASCII” format.
Data is stored in a Network Common Data Format: “NetCDF” format.
Data that is organized in single line reports
Reports that have a coherent internal structure and can be modelised.
Reports that have a fixed width or field delimited types
Reports that can be organized in sections, in which case each section can be of different types (fixed width of delimited)
Installation
You can install the package directly from pip:
pip install cdm_reader_mapper
If you want to contribute, we recommend cloning the repository and installing the package in development mode, e.g.
git clone https://github.com/glamod/cdm_reader_mapper
cd cdm_reader_mapper
pip install -e .
This will install the package but you can still edit it and you don’t need the package in your PYTHONPATH
Documentation
The official documentation is at https://cdm-reader-mapper.readthedocs.io/
How to make the most of cdm_reader_mapper:
Logging
By default, cdm_reader_mapper
outputs logging information to stdout
. To tell cdm_reader_mapper
to output logs to a file, set the CDM_LOG_FILE
environment variable before loading cdm_reader_mapper
.
import os
os.environ["CDM_LOG_FILE"] = "log_file.log"
import cdm_reader_mapper as cdm
This will set the file log_file.log
as the output for all logging information from cdm_reader_mapper
, including the initial logging on loading of the package.
Run a test
Read imma data with the cdm_reader_mapper.mdf_reader.read() function and copy the data attributes:
from cdm_reader_mapper.mdf_reader import read
from cdm_reader_mapper.data import test_data
data = test_data.test_icoads_r300_d701.get("source")
imma_data = read(
filepath, imodel="icoads_r300_d701", sections=["core", "c1", "c98"]
)
data_raw = imma_data.data.copy()
Map this data to a CDM build for the same deck (in this case deck 704: US Marine Metereological Journal collection of data):
from cdm_reader_mapper.cdm_mapper import map_model
name_of_model = "icoads_r300_d704"
cdm_dict = map_model(
data_raw,
imodel=name_of_model,
log_level="DEBUG",
)
For more details on how to use the cdm_reader_mapper toolbox see the following jupyter example notebooks.
Contributing to cdm_reader_mapper
If you’re interested in participating in the development of cdm_reader_mapper by suggesting new features, new indices or report bugs, please leave us a message on the issue tracker.
If you would like to contribute code or documentation (which is greatly appreciated!), check out the Contributing Guidelines before you begin!
How to cite this library
If you wish to cite glamod-marine-processing in a research publication, we kindly ask that you refer to Zenodo: https://zenodo.org/records/14056188.
License
This is free software: you can redistribute it and/or modify it under the terms of the Apache License 2.0. A copy of this license is provided in the code repository (LICENSE).
Credits
cdm_reader_mapper development is funded through Copernicus Climate Change Service (C3S).
Furthermore, acknowledgments go to National Oceanography Centre (NOC) and UK Marine and Climate Advisory Service (UKMCAS).
This package was created with Cookiecutter and the audreyfeldroy/cookiecutter-pypackage project template.
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
File details
Details for the file cdm_reader_mapper-1.0.1.tar.gz
.
File metadata
- Download URL: cdm_reader_mapper-1.0.1.tar.gz
- Upload date:
- Size: 7.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f97ee15a0064ebf79a6e5f001a5e88fad75aff7027c236f79413af904af24c9a |
|
MD5 | 4acfffdd052acb7d7adc96e5453eb493 |
|
BLAKE2b-256 | 89952fed43ec01cef91984da0d468b954f865cc73f507e63a2e756839f5a9567 |
Provenance
The following attestation bundles were made for cdm_reader_mapper-1.0.1.tar.gz
:
- Repository: glamod/cdm_reader_mapper
- Workflow: publish-pypi.yml
-
Statement type: https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
cdm_reader_mapper-1.0.1.tar.gz
- Subject digest:
f97ee15a0064ebf79a6e5f001a5e88fad75aff7027c236f79413af904af24c9a
- Transparency log index: 148342854
- Transparency log integration time:
- Predicate type:
File details
Details for the file cdm_reader_mapper-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: cdm_reader_mapper-1.0.1-py3-none-any.whl
- Upload date:
- Size: 322.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 436eda787fed02b07c844e61cc1d5ff5a6c9b04719c2351b1f2014767ceb0912 |
|
MD5 | 09eda588e75f6d1aa4a4eb642f369d47 |
|
BLAKE2b-256 | 86532705207121f5de8c2f13b76b864f9c747194bda911a8ed423458038255c8 |
Provenance
The following attestation bundles were made for cdm_reader_mapper-1.0.1-py3-none-any.whl
:
- Repository: glamod/cdm_reader_mapper
- Workflow: publish-pypi.yml
-
Statement type: https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
cdm_reader_mapper-1.0.1-py3-none-any.whl
- Subject digest:
436eda787fed02b07c844e61cc1d5ff5a6c9b04719c2351b1f2014767ceb0912
- Transparency log index: 148342860
- Transparency log integration time:
- Predicate type: