cdm-reader-mapper

Common Data Model reader and mapper toolbox

https://github.com/glamod/cdm_reader_mapper

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.0%) to scientific vocabulary

Keywords

buoys c-raid climate-change climatology icoads observations pandas python ship xarray
Last synced: 6 months ago · JSON representation

Repository

Common Data Model reader and mapper toolbox

Basic Info
Statistics
  • Stars: 2
  • Watchers: 4
  • Forks: 6
  • Open Issues: 19
  • Releases: 12
Topics
buoys c-raid climate-change climatology icoads observations pandas python ship xarray
Created about 2 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Authors Zenodo

README.rst

==================================================================
Common Data Model reader and mapper: ``cdm_reader_mapper`` toolbox
==================================================================

+----------------------------+----------------------------------------------------------------+
| Versions                   | |pypi| |versions|                                              |
+----------------------------+----------------------------------------------------------------+
| Documentation and Support  | |docs|                                                         |
+----------------------------+----------------------------------------------------------------+
| Open Source                | |license| |zenodo|                                             |
+----------------------------+----------------------------------------------------------------+
|                            | |fair-software| |ossf|                                         |
+----------------------------+----------------------------------------------------------------+
| Coding Standards           | |black| |ruff| |pre-commit| |codefactor|                       |
+----------------------------+----------------------------------------------------------------+
|                            | |security| |fossa|                                             |
+----------------------------+----------------------------------------------------------------+
| Development Status         | |status| |build| |coveralls|                                   |
+----------------------------+----------------------------------------------------------------+
| Funding                    | |c3s|                                                          |
+----------------------------+----------------------------------------------------------------+
|                            | |noc| |ukmcas|                                                 |
+----------------------------+----------------------------------------------------------------+

The ``cdm_reader_mapper`` toolbox is a python_ tool designed for:

* to read data files compliant with a user specified `data model`_
* to map observed variables and its associated metadata from a `data model`_ or models combination to the `C3S CDS Common Data Model`_ (CDM) format
* detect and flag or remove duplicated observations

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
============

Installation using pip
----------------------

You can install the package directly from pip:

.. code-block:: console

    pip install cdm_reader_mapper

If you want to contribute, we recommend cloning the repository and installing the package in development mode, e.g.

.. code-block:: console

    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 :code:`PYTHONPATH`

Installation using uv
---------------------

You can install the package using `uv`_ package manager, this will add the library to your active environment:

.. code-block:: console

    uv add cdm_reader_mapper

To develop the package using uv, the following will create a virtual environment, uv defaults to ``.venv``:

.. code-block:: console

    git clone https://github.com/glamod/cdm_reader_mapper
    cd cdm_reader_mapper
    uv venv --python 3.12      # Create an environment with the recommended python version
    source .venv/bin/activate  # Load the virtual environment (for bash or zsh)
    uv sync

Documentation
=============

The official documentation is at https://cdm-reader-mapper.readthedocs.io/

How to make the most of cdm_reader_mapper:

* `How to read an IMMA file`_
* `How to build your own data model schema`_
* `How to map to the Common Data Model (CDM)`_

Logging
=======

By default, :code:`cdm_reader_mapper` outputs logging information to :code:`stdout`. To tell :code:`cdm_reader_mapper` to output logs to a file, set the :code:`CDM_LOG_FILE` environment variable **before** loading :code:`cdm_reader_mapper`.

.. code-block:: python

    import os

    os.environ["CDM_LOG_FILE"] = "log_file.log"

    import cdm_reader_mapper as cdm

This will set the file :code:`log_file.log` as the output for all logging information from :code:`cdm_reader_mapper`, including the initial logging on loading of the package.


Run a test
==========

Read imma data with the ``cdm_reader_mapper.read_mdf`` function:

.. code-block:: python

    from cdm_reader_mapper import read_mdf
    from cdm_reader_mapper.data import test_data

    imodel = "icoads_r300_d701"
    data = test_data.test_icoads_r300_d701.get("source")

    db_imma = read(filepath, imodel=imodel, sections=["core", "c1", "c98"])


Map this data to a CDM build for the same deck (in this case deck 704: US Marine Metereological Journal collection of data):

.. code-block:: python

    db_cdm = db_imma.map_model(
        data_raw,
        imodel=imodel,
        log_level="DEBUG",
    )

Detect and flag duplicated observations:

.. code-block:: python

    imma_bundle.duplicate_check(inplace=True)

    db_flagged = imma_bundle.flag_duplicates()

    df_flagged = db_flagged.data


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 `cdm_reader_mapper` in a research publication, we kindly ask that you refer to Zenodo: https://zenodo.org/records/15174199.

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.

.. hyperlinks

.. _Apache License 2.0: https://opensource.org/license/apache-2-0/

.. _audreyfeldroy/cookiecutter-pypackage: https://github.com/audreyfeldroy/cookiecutter-pypackage/

.. _C3S: https://climate.copernicus.eu/

.. _C3S CDS Common Data Model: https://git.noc.ac.uk/brecinosrivas/cdm-mapper/-/blob/master/docs/cdm_latest.pdf

.. _Contributing Guidelines: https://github.com/glamod/cdm_reader_mapper/blob/main/CONTRIBUTING.rst

.. _Cookiecutter: https://github.com/cookiecutter/cookiecutter/

.. _data model: https://cds.climate.copernicus.eu/toolbox/doc/how-to/15_how_to_understand_the_common_data_model/15_how_to_understand_the_common_data_model.html

.. _How to build your own data model schema: https://cdm-reader-mapper.readthedocs.io/en/latest/example_notebooks/CLIWOC_datamodel.html

.. _How to map to the Common Data Model (CDM): https://cdm-reader-mapper.readthedocs.io/en/latest/example_notebooks/CDM_mapper_example_deck704.html

.. _How to read an IMMA file: https://cdm-reader-mapper.readthedocs.io/en/latest/example_notebooks/read_overview.html

.. _IMMA: https://icoads.noaa.gov/e-doc/imma/R3.0-imma1.pdf

.. _jupyter example notebooks: https://github.com/glamod/cdm_reader_mapper/tree/main/docs/example_notebooks

.. _LICENSE: https://github.com/glamod/cdm_reader_mapper/blob/main/LICENSE

.. _NOC: https://noc.ac.uk/

.. _python: https://www.python.org

.. _Issue #11038: https://github.com/dask/dask/issues/11038

.. _issue tracker: https://github.com/glamod/cdm_reader_mapper/issues

.. _PR #11035: https://github.com/dask/dask/pull/11035

.. _UKMCAS: https://www.metoffice.gov.uk/services/data/met-office-marine-data-service

.. _uv: https://docs.astral.sh/uv/

.. |build| image:: https://github.com/glamod/cdm_reader_mapper/actions/workflows/testing-suite.yml/badge.svg
        :target: https://github.com/glamod/cdm_reader_mapper/actions/workflows/testing-suite.yml
        :alt: Build Status

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
        :target: https://github.com/psf/black
        :alt: Python Black

.. |c3s| image:: https://img.shields.io/badge/Powered%20by-Copernicus%20Climate%20Change%20Service-blue.svg
        :target: https://climate.copernicus.eu/
        :alt: Funding

.. |codefactor| image:: https://www.codefactor.io/repository/github/glamod/cdm_reader_mapper/badge
		    :target: https://www.codefactor.io/repository/github/glamod/cdm_reader_mapper
		    :alt: CodeFactor

.. |coveralls| image:: https://codecov.io/gh/glamod/cdm_reader_mapper/branch/main/graph/badge.svg
	      :target: https://codecov.io/gh/glamod/cdm_reader_mapper
	      :alt: Coveralls

.. |docs| image:: https://readthedocs.org/projects/cdm_reader_mapper/badge/?version=latest
        :target: https://cdm-reader-mapper.readthedocs.io/en/latest/?version=latest
        :alt: Documentation Status

.. |fair-software| image:: https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F-green
   	    :target: https://fair-software.eu
	      :alt: FAIR-software

.. |fossa| image:: https://app.fossa.com/api/projects/custom%2B41576%2Fgithub.com%2Fglamod%2Fcdm_reader_mapper.svg?type=shield
        :target: https://app.fossa.com/projects/custom%2B41576%2Fgithub.com%2Fglamod%2Fcdm_reader_mapper?ref=badge_shield
        :alt: FOSSA

.. |license| image:: https://img.shields.io/github/license/glamod/cdm_reader_mapper.svg
        :target: https://github.com/glamod/cdm_reader_mapper/blob/main/LICENSE
        :alt: License

.. |ossf| image:: https://api.securityscorecards.dev/projects/github.com/glamod/cdm_reader_mapper/badge
        :target: https://securityscorecards.dev/viewer/?uri=github.com/glamod/cdm_reader_mapper
        :alt: OpenSSF Scorecard

.. |pre-commit| image:: https://results.pre-commit.ci/badge/github/glamod/cdm_reader_mapper/main.svg
        :target: https://results.pre-commit.ci/latest/github/glamod/cdm_reader_mapper/main
        :alt: pre-commit.ci status

.. |pypi| image:: https://img.shields.io/pypi/v/cdm_reader_mapper.svg
        :target: https://pypi.python.org/pypi/cdm_reader_mapper
        :alt: Python Package Index Build

.. |ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
        :target: https://github.com/astral-sh/ruff
        :alt: Ruff

.. |security| image:: https://bestpractices.coreinfrastructure.org/projects/9135/badge
	      :target: https://bestpractices.coreinfrastructure.org/projects/9135
	      :alt: OpenSSf Best Practices

.. |status| image:: https://www.repostatus.org/badges/latest/active.svg
        :target: https://www.repostatus.org/#active
        :alt: Project Status: Active – The project has reached a stable, usable state and is being actively developed.

.. |ukmcas| image:: https://img.shields.io/badge/Thanks%20to-UKMCAS-blue.svg
        :target: https://www.metoffice.gov.uk/services/data/met-office-marine-data-service
        :alt: UKMCAS

.. |versions| image:: https://img.shields.io/pypi/pyversions/cdm_reader_mapper.svg
        :target: https://pypi.python.org/pypi/cdm_reader_mapper
        :alt: Supported Python Versions

.. |zenodo| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.15174199.svg
        :target: https://doi.org/10.5281/zenodo.15174199
 	:alt: DOI

.. |noc| image:: https://img.shields.io/badge/Thanks%20to-NOC-blue.svg
        :target: https://noc.ac.uk/
        :alt: NOC

Owner

  • Name: GLAMOD
  • Login: glamod
  • Kind: organization

Repositories, vocabularies and documentation for GLAMOD

GitHub Events

Total
  • Create event: 94
  • Release event: 10
  • Issues event: 21
  • Watch event: 4
  • Delete event: 50
  • Member event: 1
  • Issue comment event: 291
  • Push event: 145
  • Pull request review event: 73
  • Pull request review comment event: 73
  • Pull request event: 267
  • Fork event: 1
Last Year
  • Create event: 94
  • Release event: 10
  • Issues event: 21
  • Watch event: 4
  • Delete event: 50
  • Member event: 1
  • Issue comment event: 291
  • Push event: 145
  • Pull request review event: 73
  • Pull request review comment event: 73
  • Pull request event: 267
  • Fork event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 23
  • Total pull requests: 101
  • Average time to close issues: 10 days
  • Average time to close pull requests: 5 days
  • Total issue authors: 4
  • Total pull request authors: 4
  • Average comments per issue: 1.43
  • Average comments per pull request: 1.05
  • Merged pull requests: 64
  • Bot issues: 1
  • Bot pull requests: 42
Past Year
  • Issues: 11
  • Pull requests: 83
  • Average time to close issues: 10 days
  • Average time to close pull requests: 4 days
  • Issue authors: 4
  • Pull request authors: 4
  • Average comments per issue: 2.73
  • Average comments per pull request: 1.11
  • Merged pull requests: 52
  • Bot issues: 1
  • Bot pull requests: 42
Top Authors
Issue Authors
  • ludwiglierhammer (34)
  • dependabot[bot] (2)
  • jtsiddons (2)
  • jjk-code-otter (2)
  • JanWillruth (1)
Pull Request Authors
  • ludwiglierhammer (135)
  • dependabot[bot] (83)
  • jtsiddons (11)
  • JanWillruth (3)
  • pre-commit-ci[bot] (1)
Top Labels
Issue Labels
enhancement (15) help wanted (7) documentation (4) structure (2) invalid (2) CI (2) dependencies (2) github_actions (2) bug (2) license (1)
Pull Request Labels
CI (85) dependencies (83) github_actions (78) docs (37) cdm_mapper (30) mdf_reader (27) common (20) information (20) metmetpy (13) operations (11) release (10) enhancement (6) python (5) license (4) structure (4) bug (2) zenodo (1) documentation (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 1,219 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 1
pypi.org: cdm-reader-mapper

Common Data Model reader and mapper toolbox

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 1,219 Last month
Rankings
Dependent packages count: 10.2%
Average: 33.6%
Dependent repos count: 57.1%
Maintainers (1)
Last synced: 6 months ago

Dependencies

pyproject.toml pypi
.github/workflows/cache-cleaner.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • step-security/harden-runner c6295a65d1254861815972266d5933fd6e532bdf composite
.github/workflows/codeql.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • github/codeql-action/analyze 1245696032ecf7d39f87d54daa406e22ddf769a8 composite
  • github/codeql-action/autobuild 1245696032ecf7d39f87d54daa406e22ddf769a8 composite
  • github/codeql-action/init 1245696032ecf7d39f87d54daa406e22ddf769a8 composite
  • step-security/harden-runner c6295a65d1254861815972266d5933fd6e532bdf composite
.github/workflows/dependency-review.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • actions/dependency-review-action ce3cf9537a52e8119d91fd484ab5b8a807627bf8 composite
  • step-security/harden-runner c6295a65d1254861815972266d5933fd6e532bdf composite
.github/workflows/fair-software.yaml actions
  • fair-software/howfairis-github-action 4c11146488125aa6e1531184eed51d781bcd5871 composite
.github/workflows/first-pull-request.yml actions
  • actions/github-script 60a0d83039c74a4aee543508d2ffcb1c3799cdea composite
  • step-security/harden-runner c6295a65d1254861815972266d5933fd6e532bdf composite
.github/workflows/label-on-approval.yml actions
  • actions/github-script 60a0d83039c74a4aee543508d2ffcb1c3799cdea composite
  • peter-evans/create-or-update-comment 71345be0265236311c031f5c7866368bd1eff043 composite
  • peter-evans/find-comment 3eae4d37986fb5a8592848f6a574fdf654e61f9e composite
  • step-security/harden-runner c6295a65d1254861815972266d5933fd6e532bdf composite
.github/workflows/label.yml actions
  • actions/labeler 8558fd74291d67161a8a78ce36a881fa63b766a9 composite
  • step-security/harden-runner c6295a65d1254861815972266d5933fd6e532bdf composite
.github/workflows/license-scanning.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • fossa-contrib/fossa-action 3d2ef181b1820d6dcd1972f86a767d18167fa19b composite
.github/workflows/publish-pypi.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • actions/setup-python 8d9ed9ac5c53483de85588cdf95a591a75ab9f55 composite
  • pypa/gh-action-pypi-publish 76f52bc884231f62b9a034ebfe128415bbaabdfc composite
  • step-security/harden-runner c6295a65d1254861815972266d5933fd6e532bdf composite
.github/workflows/scorecard.yml actions
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • actions/upload-artifact ea165f8d65b6e75b540449e92b4886f43607fa02 composite
  • github/codeql-action/upload-sarif 9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 composite
  • ossf/scorecard-action f49aabe0b5af0936a0987cfb85d86b75731b0186 composite
  • step-security/harden-runner c6295a65d1254861815972266d5933fd6e532bdf composite
.github/workflows/testing-suite.yml actions
  • actions/cache v4 composite
  • actions/checkout 11bd71901bbe5b1630ceea73d27597364c9af683 composite
  • astral-sh/setup-uv 0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 composite
  • codecov/codecov-action 0565863a31f2c772f9f0395002a31e3f06189574 composite
.github/workflows/workflow-warning.yml actions
  • peter-evans/create-or-update-comment 71345be0265236311c031f5c7866368bd1eff043 composite
  • peter-evans/find-comment 3eae4d37986fb5a8592848f6a574fdf654e61f9e composite
  • step-security/harden-runner c6295a65d1254861815972266d5933fd6e532bdf composite
CI/requirements_ci.txt pypi
  • bottleneck >=1.3.1
  • dask >=2024.8.1
  • datashader >=0.15.0
  • distributed >=2.0
  • flit >=3.9
  • flit-core >=3.9
  • h5netcdf >=1.3.0
  • msgpack *
  • netcdf4 *
  • numba >=0.60.0
  • pandas >=2.2.0
  • platformdirs >4.0.0
  • pyarrow >=15.0.0
  • python-slugify *
  • recordlinkage >=0.15
  • requests *
  • swifter >=1.3.2
  • timezonefinder >6.5.0
  • xarray >=2023.11.0,
environment.yml pypi
  • msgpack *
  • platformdirs >4.0.0
  • python-slugify *
  • recordlinkage >=0.15
  • requests *