Skip to main content

Common Data Model reader and mapper toolbox

Project description

Versions

Python Package Index Build Supported Python Versions

Tag Release

Documentation and Support

Documentation Status

Open Source

License zenodo

fair-software OpenSSF Scorecard

Coding Standards

Python Black Ruff pre-commit.ci status

OpenSSf Best Practices FOSSA CodeFactor

Development Status

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Build Status Coveralls

Funding

Funding

NOC UKMCAS

The cdm_reader_mapper toolbox is a python tool designed for both:

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

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!

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).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdm_reader_mapper-0.4.3.tar.gz (7.2 MB view details)

Uploaded Source

Built Distribution

cdm_reader_mapper-0.4.3-py3-none-any.whl (322.3 kB view details)

Uploaded Python 3

File details

Details for the file cdm_reader_mapper-0.4.3.tar.gz.

File metadata

  • Download URL: cdm_reader_mapper-0.4.3.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

Hashes for cdm_reader_mapper-0.4.3.tar.gz
Algorithm Hash digest
SHA256 6f9ecb08c14ae2b39b54c93a861383eb21b2002306bd27e81a03e63bd5a5918a
MD5 f7bc33a845b03c84f66841dad87c65f5
BLAKE2b-256 239f16e8ded93eb00845c9ca5f36905543838b4c5f16284c31ecc2276eccec1d

See more details on using hashes here.

Provenance

File details

Details for the file cdm_reader_mapper-0.4.3-py3-none-any.whl.

File metadata

File hashes

Hashes for cdm_reader_mapper-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e4f41326c103c0052fc8ad56d18f9a91e97e54e4e0fcf8797d7960d0755cf8c0
MD5 690a60252b9d83c2e6ba6754389a7a8c
BLAKE2b-256 2181aea7224ff2168eee577a0c82dcd7ffa2892d301d02d6c9687160576450d5

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page