{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "2f5c6d52",
   "metadata": {},
   "outputs": [],
   "source": [
    "import h5py\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "f5d0ad19",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "20260210_35400.000000.h5\n",
      "20260210_35460.000000.h5\n",
      "20260210_35520.000000.h5\n",
      "20260210_35580.000000.h5\n",
      "20260210_35640.000000.h5\n",
      "20260210_35700.000000.h5\n",
      "20260210_35760.000000.h5\n",
      "20260210_35820.000000.h5\n",
      "20260210_35880.000000.h5\n",
      "20260210_35940.000000.h5\n",
      "20260210_36000.000000.h5\n",
      "20260210_36060.000000.h5\n",
      "20260210_36120.000000.h5\n",
      "20260210_36180.000000.h5\n",
      "20260210_36240.000000.h5\n",
      "20260210_36300.000000.h5\n",
      "20260210_36360.000000.h5\n",
      "20260210_36420.000000.h5\n",
      "20260210_36480.000000.h5\n",
      "20260210_36540.000000.h5\n",
      "20260210_36600.000000.h5\n",
      "20260210_36660.000000.h5\n",
      "20260210_36720.000000.h5\n",
      "20260210_36780.000000.h5\n",
      "20260210_36840.000000.h5\n",
      "20260210_36900.000000.h5\n",
      "20260210_36960.000000.h5\n",
      "20260210_37020.000000.h5\n",
      "20260210_37080.000000.h5\n",
      "20260210_37140.000000.h5\n",
      "20260210_37200.000000.h5\n",
      "20260210_37260.000000.h5\n",
      "20260210_37320.000000.h5\n",
      "20260210_37380.000000.h5\n",
      "20260210_37440.000000.h5\n",
      "20260210_37500.000000.h5\n",
      "20260210_37560.000000.h5\n",
      "20260210_37620.000000.h5\n",
      "20260210_37680.000000.h5\n",
      "20260210_37740.000000.h5\n",
      "20260210_37800.000000.h5\n"
     ]
    }
   ],
   "source": [
    "for xx in range(41):\n",
    "    filename = '20260210_' + str(35400 + 60*xx) + '.000000.h5'\n",
    "    with h5py.File(filename,'r+') as f:\n",
    "        # qp = f['Qp']\n",
    "        # qp_min = np.nanmin(qp)\n",
    "        # qp = np.nan_to_num(qp, nan=qp_min)\n",
    "        # f['Qp'][:] = qp\n",
    "\n",
    "        e0 = np.array(f['E0p'])\n",
    "        # e0_min = np.nanmin(e0)\n",
    "        # e0 = np.nan_to_num(e0, nan=e0_min)\n",
    "        # f['E0p'][:] = e0\n",
    "\n",
    "        e0_idx = np.where(e0 < 100)\n",
    "        e0[e0_idx] = 101\n",
    "        f['E0p'][:] = e0\n",
    "\n",
    "        \n",
    "    print(filename)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "596e6eb2",
   "metadata": {},
   "outputs": [],
   "source": [
    "with h5py.File('20260210_35340.000000.h5','w') as f:\n",
    "    f.create_dataset('E0p',data=e0*0)\n",
    "    f.create_dataset('Qp',data=qp*0)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2a9784a9",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
