Skip to main content

A simple python library to find the CF standard name equivalent of an EPIC code.

Project description

# epic2cf

#### A simple python library to find the CF standard name equivalent of an EPIC code.

[EPIC codes](http://www.epic.noaa.gov/epic/document/epickey.htm)
[CF standard names](http://cfconventions.org/Data/cf-standard-names/28/build/cf-standard-name-table.html)


## Installation

##### Stable

pip install epic2cf

##### Development

pip install git+https://github.com/axiom-data-science/epic2cf.git


## Usage


##### Return contents

A `dict` like object is returned from a call to `get` and contains the following:
```python
{
'cell_methods': None, # If there are any cell_methods associated with this variable
'cf_units': None, # The units of the CF standard name
'convert': None, # A function to convert values from EPIC to CF
'long_name': None, # A description of the variable
'standard_name': None, # The CF standard_name
'units': None # The EPIC units
}
```

##### Get a CF mapping from an EPIC code

```python
from epic2cf import mapping

mapping.get(18)
{
'cell_methods': None,
'cf_units': 'm',
'convert': <function epic2cf.data.<lambda>>,
'long_name': 'Sea Surface Height',
'standard_name': 'sea_surface_height',
'units': 'm'
}

mapping.get(26)
{
'cell_methods': 'time: minimum',
'cf_units': 'K',
'convert': <function epic2cf.data.<lambda>>,
'long_name': 'Water Temperature',
'standard_name': 'sea_water_temperature',
'units': 'degree_Celsius'
}
```

##### Convert existing EPIC values into CF values

###### Pass in a numpy array to the convert function

```python
import numpy as np
from epic2cf import mapping

epic = mapping.get(9)
print epic
{
'cell_methods': None,
'cf_units': 'dbar',
'convert': <function epic2cf.data.<lambda>>,
'long_name': 'Sea Water Pressure',
'standard_name': 'sea_water_pressure',
'units': 'mbar'
}

values = np.random.random(6)
print values # EPIC values in 'mbar'
array([ 0.57136167, 0.98046873, 0.64963954, 0.39981203, 0.72433581, 0.16820297])

cf_values = epic.convert(values)
print cf_values # CF values in 'dbar'
array([ 0.00571362, 0.00980469, 0.0064964 , 0.00399812, 0.00724336, 0.00168203])
```

## Contributing

Not all EPIC codes have been mapped to CF standard names. If you require
a mappnig that has not been done you can do one of the following:

1. Create an issue with the EPIC code number you would like mapped and as much
information about the variable as possible (how it is used, the units, etc).
It may take some time for these to be included in `epic2cf`, especially if we
can not verify a correct mapping to CF.

2. Fork the repository and add the mapping yourself into `epic2cf/data.py`.
I will accept pull requests for updated mapping very quickly.

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

epic2cf-0.0.2.tar.gz (24.8 kB view details)

Uploaded Source

File details

Details for the file epic2cf-0.0.2.tar.gz.

File metadata

  • Download URL: epic2cf-0.0.2.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for epic2cf-0.0.2.tar.gz
Algorithm Hash digest
SHA256 01ce45577875ef09a1562edf0dcb43b36657ec211e0f7a7b4bf134624c266b1e
MD5 c486e03460f2db2ff67d79c9d0b39d95
BLAKE2b-256 4353a947b87c32951275de07f7b84733f186cdf37e10c0d48630087131abd0e6

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