Skip to content

Instantly share code, notes, and snippets.

@ccarouge
Created December 7, 2020 04:43
Show Gist options
  • Save ccarouge/04dc4125ffd6699d5d6c5126668122b6 to your computer and use it in GitHub Desktop.
Save ccarouge/04dc4125ffd6699d5d6c5126668122b6 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from pyhdf.SD import SD, SDC"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"file=SD(\"/g/data/w35/ccc561/d2_3hrlymon_198307\",SDC.READ)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(9, 0)\n"
]
}
],
"source": [
"print(file.info())"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'Data-Set-6': (('fakeDim0', 'fakeDim1'), (6596, 130), 21, 0),\n",
" 'Data-Set-7': (('fakeDim2', 'fakeDim3'), (6596, 130), 21, 1),\n",
" 'Data-Set-8': (('fakeDim4', 'fakeDim5'), (6596, 130), 21, 2),\n",
" 'Data-Set-9': (('fakeDim6', 'fakeDim7'), (6596, 130), 21, 3),\n",
" 'Data-Set-10': (('fakeDim8', 'fakeDim9'), (6596, 130), 21, 4),\n",
" 'Data-Set-11': (('fakeDim10', 'fakeDim11'), (6596, 130), 21, 5),\n",
" 'Data-Set-12': (('fakeDim12', 'fakeDim13'), (6596, 130), 21, 6),\n",
" 'Data-Set-13': (('fakeDim14', 'fakeDim15'), (6596, 130), 21, 7),\n",
" 'Data-Set-14': (('fakeDim16', 'fakeDim17'), (6596, 130), 21, 8)}"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"file.datasets()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"sds_obj=file.select(\"Data-Set-13\")\n",
"data=sds_obj.get()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[ 1, 1, 1, ..., 255, 4, 151],\n",
" [ 1, 2, 49, ..., 255, 4, 151],\n",
" [ 1, 3, 97, ..., 2, 4, 151],\n",
" ...,\n",
" [ 72, 1, 1, ..., 36, 14, 174],\n",
" [ 72, 2, 49, ..., 36, 14, 175],\n",
" [ 72, 3, 97, ..., 38, 14, 174]], dtype=uint8)"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"numpy.ndarray"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:analysis3-20.07]",
"language": "python",
"name": "conda-env-analysis3-20.07-py"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment