4
4
5
5
class FY3E (object ):
6
6
7
- def extract (fname , georange = (), band = "C_band" , test = False ):
7
+ def extract (fname , georange = (), band = "C_band" , daily = False , test = False ):
8
8
try :
9
9
init = h5py .File (fname , "r" )
10
10
except Exception :
@@ -21,12 +21,21 @@ def extract(fname, georange=(), band="C_band", test=False):
21
21
lats , lons , data_spd , data_dir , data_time , sate_name , res = [], [], [], [], "" , "" , ""
22
22
return lats , lons , data_spd , data_dir , data_time , sate_name , res
23
23
# 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' )
30
39
if band == "C_band" :
31
40
res = "20KM"
32
41
elif band == "Ku_band" :
@@ -42,4 +51,4 @@ def extract(fname, georange=(), band="C_band", test=False):
42
51
else :
43
52
print ("fy3e_hdf reader warning: content of HDF file is not FY-3E data" )
44
53
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