Skip to main content
# 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.

Metadata

Release files for epic2cf 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for epic2cf 0.0.4
File Size Uploaded
epic2cf-0.0.4.tar.gz 24.8 kB Details

Release files / epic2cf-0.0.4.tar.gz

Download URL epic2cf-0.0.4.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8c1c023f05eb67e9fef5cb4edc1e4974ece19897aed3a58911e5c07f1db8b7b5
BLAKE2b-256 checksum
How to use checksums
d04cf2ca1eefc41ec2a24f3c9e6fa64c0ecf52cd233c630dafcb82d90c4a5b30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page