lmstack 3 tahun lalu
induk
melakukan
955decbaa9
1 mengubah file dengan 100 tambahan dan 11 penghapusan
  1. 100 11
      LIB/OTHER/test.ipynb

+ 100 - 11
LIB/OTHER/test.ipynb

@@ -6,28 +6,117 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "import oss2"
+    "import oss2\n",
+    "from itertools import islice\n",
+    "import pandas as pd\n",
+    "columns = [\"id\",\"VIN\",\"VehModel\",\"VehState\",\"Time\",\"CellVoltage\",\"PackVoltage\",'CellMaxVolNum',\"CellMinVolNum\",'CellTemp','CellMaxTempNum','CellMinTempNum','PackCrnt','VehRmnRng','VehOdo','FltCode',\n",
+    "'FltLvl','VehSpd','PedalAngle','PackSoc','MotorPwr','EnmTemp','InsulationRss','ChrgSta','GPS_lon','GPS_lat','GPS_alt',\n",
+    "  'PowerAlreadyTime','BMSSta','ACSta','OncCmState','HVILSta','OfcAccumTime','OncAccumTime','BmsOncChgCp','BmsOfcPileOutputVol','BmsOfcPileOutputCur','BmsOfcCc','BmsOfcAllowed',\n",
+    "  'OncOutCurrent','OncOutVoltage','OfcStationMaxOutVolt','OfcStationMinOutVolt','OfcStationMaxOutCrnt','OfcStationMinOutCrnt','BmsOfcgVoltageRequest','BmsOfcType','BmsOfcCurrentRequest',\n",
+    "  'BmsOncChgRequest','BmsRequestOutputCurrent','BmsRequestOutputVoltage','BmsOncCc','BmsS2State','HvUpState','HvDownState','CellMaxVol','CellMinVol','CellMaxTemp','CellMinTemp','Tripmeter',\n",
+    "  'VehAccX','VehAccY','StringAngle','PTCSta','PTCPwr','PosRlySta','NegRlySta','OfcPreRlySta','OfcRlySta','OfcPosChrgerTemp','OfcNegChrgerTemp','OncPosChrgerTemp','OncNegChrgerTemp',\n",
+    "  'InstPwrCmsmtion','AvgPwrCmsmtion','SubPwrCmsmtion','BmsCellVoltDiff','DriveMode','BmsBatTempDiff','BmsClmThermalSts','BmsBatteryTotalCapacity','BmsBatteryAvaiCapacity',\n",
+    "  'BmsOncChgCpConn','CellVoltRecTime','CellVoltTotalCount','CellVoltFrameNo','CellVoltFrameCount','CellTempTotalCount','SN','BatteryModel']\n",
+    "auth = oss2.Auth('LTAI4FyoDnXMjqd78rdRDFHN', 'sdFl6vjM9l2rvWiUTzuFQb2xqjUoY5')\n",
+    "bucket = oss2.Bucket(auth, \"https://oss-cn-hangzhou.aliyuncs.com\", 'ff-hezhong')\n",
+    "df_data = pd.DataFrame(columns = columns)       \n",
+    "for b in islice(oss2.ObjectIterator(bucket,'alg/LUZAGAAA1MA038075/202202251410/'), 0):\n",
+    "    bucket.get_object_to_file(b.key, 'test.txt')\n",
+    "    df = pd.read_csv('test.txt', names=columns, sep=' ')\n",
+    "    df_data = pd.concat([df_data,df])"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 3,
    "metadata": {},
    "outputs": [
     {
-     "ename": "ModuleNotFoundError",
-     "evalue": "No module named 'crcmod._crcfunext'",
-     "output_type": "error",
-     "traceback": [
-      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
-      "\u001b[1;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
-      "Input \u001b[1;32mIn [5]\u001b[0m, in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mcrcmod\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_crcfunext\u001b[39;00m\n",
-      "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'crcmod._crcfunext'"
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "alg/LUZAGAAA1MA038075/202202251410/56311b72-3254-4dff-b6a8-33b2b2ab31c7.txt\n",
+      "alg/LUZAGAAA1MA038075/202202251410/d5173cf1-87e2-4117-a200-b7c8d118fa18.txt\n",
+      "alg/LUZAGAAA1MA038075/202202251410/eeb136bb-5170-4944-9008-a0dd3624ea8e.txt\n"
      ]
     }
    ],
    "source": [
-    "import crcmod._crcfunext"
+    "for b in oss2.ObjectIterator(bucket,'alg/LUZAGAAA1MA038075/202202251410/'):\n",
+    "      print(b.key)\n",
+    "\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 4,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "<div>\n",
+       "<style scoped>\n",
+       "    .dataframe tbody tr th:only-of-type {\n",
+       "        vertical-align: middle;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "</style>\n",
+       "<table border=\"1\" class=\"dataframe\">\n",
+       "  <thead>\n",
+       "    <tr style=\"text-align: right;\">\n",
+       "      <th></th>\n",
+       "      <th>id</th>\n",
+       "      <th>VIN</th>\n",
+       "      <th>VehModel</th>\n",
+       "      <th>VehState</th>\n",
+       "      <th>Time</th>\n",
+       "      <th>CellVoltage</th>\n",
+       "      <th>PackVoltage</th>\n",
+       "      <th>CellMaxVolNum</th>\n",
+       "      <th>CellMinVolNum</th>\n",
+       "      <th>CellTemp</th>\n",
+       "      <th>...</th>\n",
+       "      <th>BmsBatteryTotalCapacity</th>\n",
+       "      <th>BmsBatteryAvaiCapacity</th>\n",
+       "      <th>BmsOncChgCpConn</th>\n",
+       "      <th>CellVoltRecTime</th>\n",
+       "      <th>CellVoltTotalCount</th>\n",
+       "      <th>CellVoltFrameNo</th>\n",
+       "      <th>CellVoltFrameCount</th>\n",
+       "      <th>CellTempTotalCount</th>\n",
+       "      <th>SN</th>\n",
+       "      <th>BatteryModel</th>\n",
+       "    </tr>\n",
+       "  </thead>\n",
+       "  <tbody>\n",
+       "  </tbody>\n",
+       "</table>\n",
+       "<p>0 rows × 90 columns</p>\n",
+       "</div>"
+      ],
+      "text/plain": [
+       "Empty DataFrame\n",
+       "Columns: [id, VIN, VehModel, VehState, Time, CellVoltage, PackVoltage, CellMaxVolNum, CellMinVolNum, CellTemp, CellMaxTempNum, CellMinTempNum, PackCrnt, VehRmnRng, VehOdo, FltCode, FltLvl, VehSpd, PedalAngle, PackSoc, MotorPwr, EnmTemp, InsulationRss, ChrgSta, GPS_lon, GPS_lat, GPS_alt, PowerAlreadyTime, BMSSta, ACSta, OncCmState, HVILSta, OfcAccumTime, OncAccumTime, BmsOncChgCp, BmsOfcPileOutputVol, BmsOfcPileOutputCur, BmsOfcCc, BmsOfcAllowed, OncOutCurrent, OncOutVoltage, OfcStationMaxOutVolt, OfcStationMinOutVolt, OfcStationMaxOutCrnt, OfcStationMinOutCrnt, BmsOfcgVoltageRequest, BmsOfcType, BmsOfcCurrentRequest, BmsOncChgRequest, BmsRequestOutputCurrent, BmsRequestOutputVoltage, BmsOncCc, BmsS2State, HvUpState, HvDownState, CellMaxVol, CellMinVol, CellMaxTemp, CellMinTemp, Tripmeter, VehAccX, VehAccY, StringAngle, PTCSta, PTCPwr, PosRlySta, NegRlySta, OfcPreRlySta, OfcRlySta, OfcPosChrgerTemp, OfcNegChrgerTemp, OncPosChrgerTemp, OncNegChrgerTemp, InstPwrCmsmtion, AvgPwrCmsmtion, SubPwrCmsmtion, BmsCellVoltDiff, DriveMode, BmsBatTempDiff, BmsClmThermalSts, BmsBatteryTotalCapacity, BmsBatteryAvaiCapacity, BmsOncChgCpConn, CellVoltRecTime, CellVoltTotalCount, CellVoltFrameNo, CellVoltFrameCount, CellTempTotalCount, SN, BatteryModel]\n",
+       "Index: []\n",
+       "\n",
+       "[0 rows x 90 columns]"
+      ]
+     },
+     "execution_count": 4,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "df_data"
    ]
   },
   {