Skip to content

Commit 6d95311

Browse files
authored
Update fy3e.py
1 parent 73d1641 commit 6d95311

File tree

1 file changed

+17
-8
lines changed
  • HY_Plotter/windReader/reader

1 file changed

+17
-8
lines changed

HY_Plotter/windReader/reader/fy3e.py

+17-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class FY3E(object):
66

7-
def extract(fname, georange=(), band="C_band", test=False):
7+
def extract(fname, georange=(), band="C_band", daily=False, test=False):
88
try:
99
init = h5py.File(fname, "r")
1010
except Exception:
@@ -21,12 +21,21 @@ def extract(fname, georange=(), band="C_band", test=False):
2121
lats, lons, data_spd, data_dir, data_time, sate_name, res = [], [], [], [], "", "", ""
2222
return lats, lons, data_spd, data_dir, data_time, sate_name, res
2323
# get values
24-
fns = init.attrs["File Name"].decode('utf-8').split("_")
25-
lons, lats = init[band]["wvc_lon"][:], init[band]["wvc_lat"][:]
26-
data_spd, data_dir = init[band]["wind_speed_selected"][:], init[band]["wind_dir_selected"][:]
27-
data_time = fns[7] + fns[8]
28-
sate_name = init.attrs["Satellite Name"].decode('utf-8') \
29-
+ " " + init.attrs["Sensor Name"].decode('utf-8')
24+
if daily:
25+
# WindRAD daily data (POAD)
26+
fns = init.attrs["File Name"].split("_")
27+
lons, lats = init[band]["grid_lon"][:], init[band]["grid_lat"][:]
28+
data_spd, data_dir = init[band]["wind_speed_selected"][:], init[band]["wind_dir_selected"][:]
29+
data_time = (fns[7] + fns[8]).replace('POAD', ' 00:00:00.0')
30+
sate_name = init.attrs["Satellite Name"] \
31+
+ " " + init.attrs["Sensor Name"]
32+
else:
33+
fns = init.attrs["File Name"].decode('utf-8').split("_")
34+
lons, lats = init[band]["wvc_lon"][:], init[band]["wvc_lat"][:]
35+
data_spd, data_dir = init[band]["wind_speed_selected"][:], init[band]["wind_dir_selected"][:]
36+
data_time = fns[7] + fns[8]
37+
sate_name = init.attrs["Satellite Name"].decode('utf-8') \
38+
+ " " + init.attrs["Sensor Name"].decode('utf-8')
3039
if band == "C_band":
3140
res = "20KM"
3241
elif band == "Ku_band":
@@ -42,4 +51,4 @@ def extract(fname, georange=(), band="C_band", test=False):
4251
else:
4352
print("fy3e_hdf reader warning: content of HDF file is not FY-3E data")
4453
lats, lons, data_spd, data_dir, data_time, sate_name, res = [], [], [], [], "", "", ""
45-
return lats, lons, data_spd, data_dir, data_time, sate_name, res
54+
return lats, lons, data_spd, data_dir, data_time, sate_name, res

0 commit comments

Comments
 (0)