easylearning commited on
Commit
ed9348d
·
verified ·
1 Parent(s): fa26901

Upload 3 files

Browse files
Exp3_Kuroshio_forecasting/S3_results/forecast_merged.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90f67807503557deed914aa2c3d046fb12071a2a1edac5289ab564af39a96415
3
+ size 1378960303
Exp3_Kuroshio_forecasting/S3_results/merge.ipynb ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "3f7c354c-4f10-4020-a303-3b8a8e612468",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "Merging forecast_20210101.h5\n",
14
+ "Merging forecast_20210106.h5\n",
15
+ "Merging forecast_20210111.h5\n",
16
+ "Merging forecast_20210116.h5\n",
17
+ "Merging forecast_20210121.h5\n",
18
+ "Merging forecast_20210126.h5\n",
19
+ "Merging forecast_20210131.h5\n",
20
+ "Merging forecast_20210205.h5\n",
21
+ "Merging forecast_20210210.h5\n",
22
+ "Merging forecast_20210215.h5\n",
23
+ "Merging forecast_20210220.h5\n",
24
+ "Merging forecast_20210225.h5\n",
25
+ "Merging forecast_20210302.h5\n",
26
+ "Merging forecast_20210307.h5\n",
27
+ "Merging forecast_20210312.h5\n",
28
+ "Merging forecast_20210317.h5\n",
29
+ "Merging forecast_20210322.h5\n",
30
+ "Merging forecast_20210327.h5\n",
31
+ "Merging forecast_20210401.h5\n",
32
+ "Merging forecast_20210406.h5\n",
33
+ "Merging forecast_20210411.h5\n",
34
+ "Merging forecast_20210416.h5\n",
35
+ "Merging forecast_20210421.h5\n",
36
+ "Merging forecast_20210426.h5\n",
37
+ "Merging forecast_20210501.h5\n",
38
+ "Merging forecast_20210506.h5\n",
39
+ "Merging forecast_20210511.h5\n",
40
+ "Merging forecast_20210516.h5\n",
41
+ "Merging forecast_20210521.h5\n",
42
+ "Merging forecast_20210526.h5\n",
43
+ "Merging forecast_20210531.h5\n",
44
+ "Merging forecast_20210605.h5\n",
45
+ "Merging forecast_20210610.h5\n",
46
+ "Merging forecast_20210615.h5\n",
47
+ "Merging forecast_20210620.h5\n",
48
+ "Merging forecast_20210625.h5\n",
49
+ "Merging forecast_20210630.h5\n",
50
+ "Merging forecast_20210705.h5\n",
51
+ "Merging forecast_20210710.h5\n",
52
+ "Merging forecast_20210715.h5\n",
53
+ "Merging forecast_20210720.h5\n",
54
+ "Merging forecast_20210725.h5\n",
55
+ "Merging forecast_20210730.h5\n",
56
+ "Merging forecast_20210804.h5\n",
57
+ "Merging forecast_20210809.h5\n",
58
+ "Merging forecast_20210814.h5\n",
59
+ "Merging forecast_20210819.h5\n",
60
+ "Merging forecast_20210824.h5\n",
61
+ "Merging forecast_20210829.h5\n",
62
+ "Merging forecast_20210903.h5\n",
63
+ "Merging forecast_20210908.h5\n",
64
+ "Merging forecast_20210913.h5\n",
65
+ "Merging forecast_20210918.h5\n",
66
+ "Merging forecast_20210923.h5\n",
67
+ "Merging forecast_20210928.h5\n",
68
+ "Merging forecast_20211003.h5\n",
69
+ "Merging forecast_20211008.h5\n",
70
+ "Merging forecast_20211013.h5\n",
71
+ "Merging forecast_20211018.h5\n",
72
+ "Merging forecast_20211023.h5\n",
73
+ "Merging forecast_20211028.h5\n",
74
+ "Merging forecast_20211102.h5\n",
75
+ "Merging forecast_20211107.h5\n",
76
+ "Merging forecast_20211112.h5\n",
77
+ "Merging forecast_20211117.h5\n",
78
+ "Merging forecast_20211122.h5\n",
79
+ "Merging forecast_20211127.h5\n",
80
+ "Merging forecast_20211202.h5\n",
81
+ "Merging forecast_20211207.h5\n",
82
+ "Merging forecast_20211212.h5\n",
83
+ "Merging forecast_20211217.h5\n",
84
+ "Merging forecast_20211222.h5\n",
85
+ "Merging forecast_20211227.h5\n",
86
+ "合并完成!\n",
87
+ "merged_label shape: (73, 120, 2, 128, 128)\n",
88
+ "merged_prediction shape: (73, 120, 2, 128, 128)\n"
89
+ ]
90
+ }
91
+ ],
92
+ "source": [
93
+ "import os\n",
94
+ "import h5py\n",
95
+ "import numpy as np\n",
96
+ "\n",
97
+ "def merge_label_prediction(output_file='forecast_merged.h5'):\n",
98
+ " # 1) 找出当前目录下所有 forecast_*.h5 文件,并按文件名排序\n",
99
+ " file_list = sorted([\n",
100
+ " f for f in os.listdir('.')\n",
101
+ " if f.startswith('forecast_') and f.endswith('.h5')\n",
102
+ " ])\n",
103
+ "\n",
104
+ " if len(file_list) == 0:\n",
105
+ " print(\"未找到任何 forecast_*.h5 文件!\")\n",
106
+ " return\n",
107
+ "\n",
108
+ " all_label = []\n",
109
+ " all_prediction = []\n",
110
+ "\n",
111
+ " # 2) 逐个读取并收集 label、prediction\n",
112
+ " for fname in file_list:\n",
113
+ " print(f\"Merging {fname}\")\n",
114
+ " with h5py.File(fname, 'r') as f:\n",
115
+ " all_label.append(f['label'][:]) # shape 比如 (1, 120, 2, 128, 128)\n",
116
+ " all_prediction.append(f['prediction'][:])\n",
117
+ "\n",
118
+ " # 3) 沿着第0维拼接 (把原先每个文件中的前置“1”给堆叠起来)\n",
119
+ " merged_label = np.concatenate(all_label, axis=0)\n",
120
+ " merged_prediction = np.concatenate(all_prediction, axis=0)\n",
121
+ "\n",
122
+ " # 4) 写出合并结果到新文件\n",
123
+ " with h5py.File(output_file, 'w') as f_out:\n",
124
+ " f_out.create_dataset('label', data=merged_label, compression='gzip')\n",
125
+ " f_out.create_dataset('prediction', data=merged_prediction, compression='gzip')\n",
126
+ "\n",
127
+ " print(\"合并完成!\")\n",
128
+ " print(\"merged_label shape:\", merged_label.shape)\n",
129
+ " print(\"merged_prediction shape:\", merged_prediction.shape)\n",
130
+ "\n",
131
+ "if __name__ == \"__main__\":\n",
132
+ " merge_label_prediction()\n"
133
+ ]
134
+ }
135
+ ],
136
+ "metadata": {
137
+ "kernelspec": {
138
+ "display_name": "Python 3 (ipykernel)",
139
+ "language": "python",
140
+ "name": "python3"
141
+ },
142
+ "language_info": {
143
+ "codemirror_mode": {
144
+ "name": "ipython",
145
+ "version": 3
146
+ },
147
+ "file_extension": ".py",
148
+ "mimetype": "text/x-python",
149
+ "name": "python",
150
+ "nbconvert_exporter": "python",
151
+ "pygments_lexer": "ipython3",
152
+ "version": "3.10.15"
153
+ }
154
+ },
155
+ "nbformat": 4,
156
+ "nbformat_minor": 5
157
+ }
Exp3_Kuroshio_forecasting/S3_results/vis_Triton.ipynb ADDED
The diff for this file is too large to render. See raw diff