metyanc


Namemetyanc JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://github.com/metno/yanc
SummaryYet another NetCDF checker
upload_time2023-02-08 11:14:19
maintainer
docs_urlNone
authorMET Norway
requires_python
licenseGPL-3
keywords meteorology weather prediction
VCS
bugtrack_url
requirements numpy pep8 netCDF4 pyyaml
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Yet another NetCDF checker
==========================

This command-line program checks that a NetCDF file conforms to a pre-defined specification. It
checks if the file contains the specified dimensions and variables; that the dimensions are of the
correct size; that the variables have values within range; and that the variables have certain
attributes.

Example use
-----------

.. code-block:: bash

   python yanc.py\
      --ncfile http://thredds.met.no/thredds/dodsC/meps25files/meps_det_pp_2_5km_latest.nc \
      --template templates/meps_det_pp_2_5km.yml

Template
--------

Yanc checks the NetCDF file against specifications in a template file. The template understands the
following structure:

.. code-block:: bash

   dimensions:
   - name: time
       length: 15
   - name: x
       min_length: 10
       max_length: 20

   variables:
   - name: air_temperature
     min: 200
     max: 400
     units: K
     '% missing': 10
     missing_timesteps: [0,1,2]

All attributes are optional, and yanc will not check dimensions/variables/min/max/etc when not
specified. Dimensions can be checked for an exact length (by using the work 'length') or a range of
lengths (inclusively, by using 'min_length' and 'max_length').

Neither 'dimensions' nor 'variables' are required to be present in the file.

Installation
------------

The easiest way to install yanc is using pip:

.. code-block:: bash

   pip install metyanc

To install from source, install like this:

.. code-block:: bash

   pip install -r requirements.txt 
   python setup.py install

Return codes
------------
The program returns 0 if the file is valid. Otherwise a non-zero code is returned. If the template
file is missing or contains invalid YAML, or if the NetCDF file does not exist or is invalid NetCDF,
then a non-zero code is returned.

Missing values
--------------

By default, variables are not allowed to have missing values. To allow a missing values, the '%
missing' can be added, which means the test will fail if there the percentage of missing values
exceeds the allowed value. Some variables (such as precipitation_amount) will have have missing
values on the first timestep. Data in timesteps specified by missing_timesteps will not count
towards the percentage missing.

For example, the following requires the precipitation_amount variable to have no missing values
except for the first time step:

.. code-block:: bash

   variables:
   - name: precipitation_amount
     units: m
     '% missing': 0
     missing_timesteps: 0

missing_timesteps can also be an array like this:

.. code-block:: bash

   variables:
   - name: precipitation_amount
     units: m
     '% missing': 0
     missing_timesteps: [0, 1, 2]

Testing
-------

Running "make test" runs some quick unittests. Running "make testop" checks that the current
operational files conform to specifications. This can take 10-15 minutes.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/metno/yanc",
    "name": "metyanc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "meteorology weather prediction",
    "author": "MET Norway",
    "author_email": "thomas.nipen@met.no",
    "download_url": "https://files.pythonhosted.org/packages/99/6c/fc00f7027f0178bb093d18f8b8485fbca940ca16603864dd29613ffd17b8/metyanc-0.1.4.tar.gz",
    "platform": null,
    "description": "Yet another NetCDF checker\n==========================\n\nThis command-line program checks that a NetCDF file conforms to a pre-defined specification. It\nchecks if the file contains the specified dimensions and variables; that the dimensions are of the\ncorrect size; that the variables have values within range; and that the variables have certain\nattributes.\n\nExample use\n-----------\n\n.. code-block:: bash\n\n   python yanc.py\\\n      --ncfile http://thredds.met.no/thredds/dodsC/meps25files/meps_det_pp_2_5km_latest.nc \\\n      --template templates/meps_det_pp_2_5km.yml\n\nTemplate\n--------\n\nYanc checks the NetCDF file against specifications in a template file. The template understands the\nfollowing structure:\n\n.. code-block:: bash\n\n   dimensions:\n   - name: time\n       length: 15\n   - name: x\n       min_length: 10\n       max_length: 20\n\n   variables:\n   - name: air_temperature\n     min: 200\n     max: 400\n     units: K\n     '% missing': 10\n     missing_timesteps: [0,1,2]\n\nAll attributes are optional, and yanc will not check dimensions/variables/min/max/etc when not\nspecified. Dimensions can be checked for an exact length (by using the work 'length') or a range of\nlengths (inclusively, by using 'min_length' and 'max_length').\n\nNeither 'dimensions' nor 'variables' are required to be present in the file.\n\nInstallation\n------------\n\nThe easiest way to install yanc is using pip:\n\n.. code-block:: bash\n\n   pip install metyanc\n\nTo install from source, install like this:\n\n.. code-block:: bash\n\n   pip install -r requirements.txt \n   python setup.py install\n\nReturn codes\n------------\nThe program returns 0 if the file is valid. Otherwise a non-zero code is returned. If the template\nfile is missing or contains invalid YAML, or if the NetCDF file does not exist or is invalid NetCDF,\nthen a non-zero code is returned.\n\nMissing values\n--------------\n\nBy default, variables are not allowed to have missing values. To allow a missing values, the '%\nmissing' can be added, which means the test will fail if there the percentage of missing values\nexceeds the allowed value. Some variables (such as precipitation_amount) will have have missing\nvalues on the first timestep. Data in timesteps specified by missing_timesteps will not count\ntowards the percentage missing.\n\nFor example, the following requires the precipitation_amount variable to have no missing values\nexcept for the first time step:\n\n.. code-block:: bash\n\n   variables:\n   - name: precipitation_amount\n     units: m\n     '% missing': 0\n     missing_timesteps: 0\n\nmissing_timesteps can also be an array like this:\n\n.. code-block:: bash\n\n   variables:\n   - name: precipitation_amount\n     units: m\n     '% missing': 0\n     missing_timesteps: [0, 1, 2]\n\nTesting\n-------\n\nRunning \"make test\" runs some quick unittests. Running \"make testop\" checks that the current\noperational files conform to specifications. This can take 10-15 minutes.\n",
    "bugtrack_url": null,
    "license": "GPL-3",
    "summary": "Yet another NetCDF checker",
    "version": "0.1.4",
    "split_keywords": [
        "meteorology",
        "weather",
        "prediction"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "520f995e8a2ce145e489315f1c7755d26eb940e9b030b623d933b1ca9ae205e7",
                "md5": "5bdb9e4ff48366b8c558e9c7bee4e138",
                "sha256": "e4715200b074ed8a4847887b6e8586ed177b61f63a57acbd7d8d604251215660"
            },
            "downloads": -1,
            "filename": "metyanc-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5bdb9e4ff48366b8c558e9c7bee4e138",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17024,
            "upload_time": "2023-02-08T11:14:17",
            "upload_time_iso_8601": "2023-02-08T11:14:17.399872Z",
            "url": "https://files.pythonhosted.org/packages/52/0f/995e8a2ce145e489315f1c7755d26eb940e9b030b623d933b1ca9ae205e7/metyanc-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "996cfc00f7027f0178bb093d18f8b8485fbca940ca16603864dd29613ffd17b8",
                "md5": "9c0e5fe25094674ae429987b5a4bc2e0",
                "sha256": "2c2218c5d625eb9f7dcf29358f1c451bbe062972022b199f57c52288f7855842"
            },
            "downloads": -1,
            "filename": "metyanc-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "9c0e5fe25094674ae429987b5a4bc2e0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17826,
            "upload_time": "2023-02-08T11:14:19",
            "upload_time_iso_8601": "2023-02-08T11:14:19.065200Z",
            "url": "https://files.pythonhosted.org/packages/99/6c/fc00f7027f0178bb093d18f8b8485fbca940ca16603864dd29613ffd17b8/metyanc-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-08 11:14:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "metno",
    "github_project": "yanc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.7"
                ]
            ]
        },
        {
            "name": "pep8",
            "specs": []
        },
        {
            "name": "netCDF4",
            "specs": []
        },
        {
            "name": "pyyaml",
            "specs": []
        }
    ],
    "lcname": "metyanc"
}
        
Elapsed time: 0.05006s