From 6d95311015f098ddae7d356d506713b7b5262743 Mon Sep 17 00:00:00 2001 From: BigShuiTai <79071461+BigShuiTai@users.noreply.github.com> Date: Thu, 20 Apr 2023 19:03:06 +0800 Subject: [PATCH] Update fy3e.py --- HY_Plotter/windReader/reader/fy3e.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/HY_Plotter/windReader/reader/fy3e.py b/HY_Plotter/windReader/reader/fy3e.py index eb09daf..09292de 100644 --- a/HY_Plotter/windReader/reader/fy3e.py +++ b/HY_Plotter/windReader/reader/fy3e.py @@ -4,7 +4,7 @@ class FY3E(object): - def extract(fname, georange=(), band="C_band", test=False): + def extract(fname, georange=(), band="C_band", daily=False, test=False): try: init = h5py.File(fname, "r") except Exception: @@ -21,12 +21,21 @@ def extract(fname, georange=(), band="C_band", test=False): lats, lons, data_spd, data_dir, data_time, sate_name, res = [], [], [], [], "", "", "" return lats, lons, data_spd, data_dir, data_time, sate_name, res # get values - fns = init.attrs["File Name"].decode('utf-8').split("_") - lons, lats = init[band]["wvc_lon"][:], init[band]["wvc_lat"][:] - data_spd, data_dir = init[band]["wind_speed_selected"][:], init[band]["wind_dir_selected"][:] - data_time = fns[7] + fns[8] - sate_name = init.attrs["Satellite Name"].decode('utf-8') \ - + " " + init.attrs["Sensor Name"].decode('utf-8') + if daily: + # WindRAD daily data (POAD) + fns = init.attrs["File Name"].split("_") + lons, lats = init[band]["grid_lon"][:], init[band]["grid_lat"][:] + data_spd, data_dir = init[band]["wind_speed_selected"][:], init[band]["wind_dir_selected"][:] + data_time = (fns[7] + fns[8]).replace('POAD', ' 00:00:00.0') + sate_name = init.attrs["Satellite Name"] \ + + " " + init.attrs["Sensor Name"] + else: + fns = init.attrs["File Name"].decode('utf-8').split("_") + lons, lats = init[band]["wvc_lon"][:], init[band]["wvc_lat"][:] + data_spd, data_dir = init[band]["wind_speed_selected"][:], init[band]["wind_dir_selected"][:] + data_time = fns[7] + fns[8] + sate_name = init.attrs["Satellite Name"].decode('utf-8') \ + + " " + init.attrs["Sensor Name"].decode('utf-8') if band == "C_band": res = "20KM" elif band == "Ku_band": @@ -42,4 +51,4 @@ def extract(fname, georange=(), band="C_band", test=False): else: print("fy3e_hdf reader warning: content of HDF file is not FY-3E data") lats, lons, data_spd, data_dir, data_time, sate_name, res = [], [], [], [], "", "", "" - return lats, lons, data_spd, data_dir, data_time, sate_name, res \ No newline at end of file + return lats, lons, data_spd, data_dir, data_time, sate_name, res