Skip to main content

Add meta data to netCDF files.

Project description

Build Status codecov.io

addmeta

Add meta data to netCDF files.

Metadata

The metadata is stored in attribute files in YAML format. The metadata is in key-value pairs and is a global attribute if defined in a global section, or applied to a specific named variable in the variables section.

If an attribute is listed with a missing value that attribute is deleted from the file.

For example the following is an example of an attribute file:

global:
    # Mandatory since it gives a key to all the other attributes
    Conventions: "CF-1.7, ACDD-1.3"
    # The url of the license applied to the data
    license: "http://creativecommons.org/licenses/by-nc-sa/4.0/"
variables:
    yt_ocean:
        _FillValue:
        long_name: "latitude in rotated pole grid"
        units: "degrees"
    geolat_t:
        long_name: "latitude coordinate"
        units: "degrees_north"
        standard_name: "latitude"

It will create (or replace) two global attributes: Conventions and license. It will also create (or replace) attributes for two variables, yt_ocean and geolat_t, and delete the _FillValue attribute of yt_ocean.

The information is read into a python dict. Multiple attribute files can be specified. If the same attribute is defined more than once, the last attribute file specified takes precedence. Like cascading style sheets this means default values can be given and overridden when necessary.

Invocation

addmeta is a command line program. Invoking with the -h flag prints a summay of how to invoke the program correctly.

$ addmeta -h
usage: addmeta [-h] [-m METAFILES] [-l METALIST] [-v] files [files ...]

Add meta data to one or more netCDF files

positional arguments:
files                 netCDF files

optional arguments:
-h, --help            show this help message and exit
-m METAFILES, --metafiles METAFILES
                        One or more meta-data files in YAML format
-l METALIST, --metalist METALIST
                        File containing a list of meta-data files
-v, --verbose         Verbose output

Multiple attribute files can be specified by passing more than one file with the -m option. For a large number of files this can be tedious. In that case use the -l option and pass it a text file with the names of attribute files, one per line.

Multiple meta list files and meta files can be specified on one command line.

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

addmeta-0.3.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

addmeta-0.3.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file addmeta-0.3.1.tar.gz.

File metadata

  • Download URL: addmeta-0.3.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for addmeta-0.3.1.tar.gz
Algorithm Hash digest
SHA256 2b334b8000e9207614744e6a43cd67f018c5ea0dc165afd7b6051aa525791e91
MD5 b709270cb209d82e731a173e9c1fad6f
BLAKE2b-256 facde80a8c065b9df16fcdd627ac8fe46fbf81c66482f4f076e1b3dd17433b1e

See more details on using hashes here.

File details

Details for the file addmeta-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: addmeta-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for addmeta-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68a3f172752066fb1d11b86bcce75ac11e643ecb4ac4ba7ab50a4f76e573dba4
MD5 bd1cf1522d0d6f6bdc8bfc681af2069b
BLAKE2b-256 d44092c12810610ac77bf8a450fb3b28cefbe705c7e67eed0992ae8a2a9886a5

See more details on using hashes here.

Supported by

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