{ "metadata": { "name": "", "signature": "sha256:77937c99b032673373c3dbeab903f927c0657a849f47876d14ccfa5ba42e8a97" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "from IPython.core.display import HTML\n", "\n", "with open('creative_commons.txt', 'r') as f:\n", " html = f.read()\n", " \n", "name = '2014-06-09-cf-compliance'\n", "\n", "html = '''\n", "\n", "

This post was written as an IPython notebook.\n", " It is available for download\n", " or as a static html.

\n", "

\n", "%s''' % (name, name, html)\n", "\n", "%matplotlib inline\n", "from matplotlib import style\n", "style.use('ggplot')" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you never heard about the Climate and Forecast\n", "([CF]([CF-rules](http://cfconventions.org/1.6.html))) Metadata Conventions you\n", "are probably living under a rock deep down the\n", "[Mariana Trench](http://en.wikipedia.org/wiki/Mariana_Trench).\n", "\n", "Now, hearing about it is one thing, claiming to fully understand it is another.\n", "First, it is under constant [change](https://cf-pcmdi.llnl.gov/trac/ticket/93),\n", "second, it seems to be more complex than the\n", "[Brazilian constitution](http://www.planalto.gov.br/ccivil_03/constituicao/constituicao.htm).\n", "\n", "Still, CF-rules are a necessary evil. It allows us to create tools that will\n", "read any dataset in a standardize way. That **is** a big deal for\n", "climate scientists.\n", "\n", "I won't get too technical here. I won't even mention the rules! To be honest,\n", "I do not know all most of them. But I do try to copy good examples from datasets\n", "similar to mine when I am saving my netcdf files.\n", "\n", "But how to determine if a particular netcdf file is a good example of\n", "CF-compliance? There is a very promising project from the\n", "[IOOS group](https://github.com/ioos/compliance-checker), but it s not ready\n", "yet. In the meanwhile we have two alternatives. The first one is to try to\n", "load the data with `iris`, the second is running cdat's `cfchecker`.\n", "\n", "Iris uses the Python Knowledge Engine [PyKE](http://pyke.sourceforge.net/) to\n", "create a set of rules that enforces CF standards. But sometimes the error\n", "messages are not that helpful at all to understand what is wrong if the\n", "metadata. On the other hand, `cfchecker` returns a report that on the\n", "compliance itself, but requires to upload the dataset to test it using the\n", "[online checker]((http://cfconventions.org/compliance-checker.html)) to install [cdat] (https://pypi.python.org/pypi/cdat-lite/6.0rc2).\n", "\n", "If you find that installing cdat is a challenge, do not fear! Appeal to conda\n", "and follow [these](https://github.com/ioos/secoora/wiki/Install-cfchecker)\n", "instructions. You will get chchecker working in no time." ] }, { "cell_type": "code", "collapsed": false, "input": [ "HTML(html)" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "\n", "\n", "

This post was written as an IPython notebook.\n", " It is available for download\n", " or as a static html.

\n", "

\n", "
python4oceanographers by Filipe Fernandes is\n", "licensed under a Creative Commons\n", "Attribution-ShareAlike 4.0 International License.
Based on a work at https://ocefpaf.github.io/.\n" ], "metadata": {}, "output_type": "pyout", "prompt_number": 2, "text": [ "" ] } ], "prompt_number": 2 } ], "metadata": {} } ] }