Skip to content

Instantly share code, notes, and snippets.

@C0nsultant
Created September 6, 2017 08:25
Show Gist options
  • Save C0nsultant/43ded35c9167c09cb2f31e09e2d288c3 to your computer and use it in GitHub Desktop.
Save C0nsultant/43ded35c9167c09cb2f31e09e2d288c3 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# git clone https://github.com/openPMD/openPMD-example-datasets.git\n",
"# cd openPMD-example-datasets\n",
"# tar -xf example-2d.tar.gz\n",
"# tar -xf example-3d.tar.gz\n",
"# tar -xf example-thetaMode.tar.gz"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np\n",
"import h5py as h5"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"f = h5.File('example-3d/hdf5/data00000100.h5')\n",
"# see https://github.com/openPMD/openPMD-standard/blob/latest/STANDARD.md#required-attributes-for-the-basepath\n",
"f[\"/data/100\"].attrs[\"dt\"].dtype is np.float32"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"f = h5.File('example-2d/hdf5/data00000255.h5')\n",
"f[\"/data/255\"].attrs[\"dt\"].dtype is np.float32"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"f = h5.File('example-thetaMode/hdf5/data00000100.h5')\n",
"f[\"/data/100\"].attrs[\"dt\"].dtype is np.float32"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"f.close()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [
{
"data": {
"text/plain": [
"\"\\nNon-standard attribute datatype for 'dt' (should be float, is double)\\nNon-standard attribute datatype for 'time' (should be float, is double)\\nNon-standard attribute datatype for 'gridSpacing' (should be float, is double)\\nNon-standard attribute datatype for 'position' (should be vector of float, is vector of double)\\nNon-standard attribute datatype for 'position' (should be vector of float, is vector of double)\\nNon-standard attribute datatype for 'position' (should be vector of float, is vector of double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'gridSpacing' (should be float, is double)\\nNon-standard attribute datatype for 'position' (should be vector of float, is vector of double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'dt' (should be float, is double)\\nNon-standard attribute datatype for 'time' (should be float, is double)\\nNon-standard attribute datatype for 'gridSpacing' (should be float, is double)\\nNon-standard attribute datatype for 'position' (should be vector of float, is vector of double)\\nNon-standard attribute datatype for 'position' (should be vector of float, is vector of double)\\nNon-standard attribute datatype for 'position' (should be vector of float, is vector of double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'gridSpacing' (should be float, is double)\\nNon-standard attribute datatype for 'position' (should be vector of float, is vector of double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\nNon-standard attribute datatype for 'timeOffset' (should be float, is double)\\n\""
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'''\n",
"Non-standard attribute datatype for 'dt' (should be float, is double)\n",
"Non-standard attribute datatype for 'time' (should be float, is double)\n",
"Non-standard attribute datatype for 'gridSpacing' (should be float, is double)\n",
"Non-standard attribute datatype for 'position' (should be vector of float, is vector of double)\n",
"Non-standard attribute datatype for 'position' (should be vector of float, is vector of double)\n",
"Non-standard attribute datatype for 'position' (should be vector of float, is vector of double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'gridSpacing' (should be float, is double)\n",
"Non-standard attribute datatype for 'position' (should be vector of float, is vector of double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'dt' (should be float, is double)\n",
"Non-standard attribute datatype for 'time' (should be float, is double)\n",
"Non-standard attribute datatype for 'gridSpacing' (should be float, is double)\n",
"Non-standard attribute datatype for 'position' (should be vector of float, is vector of double)\n",
"Non-standard attribute datatype for 'position' (should be vector of float, is vector of double)\n",
"Non-standard attribute datatype for 'position' (should be vector of float, is vector of double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'gridSpacing' (should be float, is double)\n",
"Non-standard attribute datatype for 'position' (should be vector of float, is vector of double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"Non-standard attribute datatype for 'timeOffset' (should be float, is double)\n",
"'''"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
@C0nsultant
Copy link
Author

Turns out this is NOT an inconsistency.
https://github.com/openPMD/openPMD-standard/blob/latest/STANDARD.md#conventions-throughout-these-documents

The naming (float) without a closer specification is used if the implementor can choose which kind of floating point precision shall be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment