Commit 72b00de2 authored by CEVAER's avatar CEVAER
Browse files

Added more attributes

parent f61d2fbf
......@@ -250,7 +250,10 @@ def find_center_plot_save(path, sat_file, resolution, path_fix, netcdf_path, api
eye_dict["lon_eye_fg"], eye_dict["lat_eye_fg"], eye_dict["lon_eye_hwnd"],
eye_dict["lat_eye_hwnd"], eye_dict["i_hwind"], eye_dict["j_hwind"], eye_dict["msk_lwind"],
eye_dict["msk_hwind"], api_data.iloc[0]["cyclone_name"],
api_data.iloc[0]["vmax (m/s)"], eye_dict["lon"], eye_dict["lat"], resolution)
api_data.iloc[0]["vmax (m/s)"], api_data.iloc[0]["sid"],
os.path.basename(api_data.iloc[0]["track_file"]),
eye_dict["lon"], eye_dict["lat"],
resolution)
#save_center_plot(path, sat_file, eye_dict["lon"], eye_dict["lat"], eye_dict["windspd_eye_masked"],
# eye_dict["cm_cyc"], eye_dict["lons_eye_shape"], eye_dict["lats_eye_shape"],
# eye_dict["lon_eye"], eye_dict["lat_eye"],
......
......@@ -19,7 +19,7 @@ def research_contour(mask, lon, lat):
def save_netcdf(sat_file, path, lon_center, lat_center, lons_eye_shape, lats_eye_shape,
lon_eye_lwind, lat_eye_lwind, lon_eye_fg, lat_eye_fg, lon_eye_hwind,
lat_eye_hwind, i_hwind, j_hwind, msk_lwind, msk_hwind, storm_name,
atcf_vmax, lon, lat, resolution):
atcf_vmax, sid, atcf_filename, lon, lat, resolution):
sat_file_sw = owi.L2CtoLight(sat_file, resolution=resolution, mode="sw")
ds = xr.open_dataset(sat_file_sw)
......@@ -38,7 +38,10 @@ def save_netcdf(sat_file, path, lon_center, lat_center, lons_eye_shape, lats_eye
ds_polar_north.attrs["High wind area barycenter"] = Point(lon_eye_hwind, lat_eye_hwind).wkt
ds_polar_north.attrs["Interpolated ATCF track point"] = Point(lon_eye_fg, lat_eye_fg).wkt
ds_polar_north.attrs["Storm name"] = storm_name
ds_polar_north.attrs["Track VMAX"] = float(atcf_vmax) # m/s
ds_polar_north.attrs["Track VMAX"] = f"{float(atcf_vmax)} m/s"
ds_polar_north.attrs["Storm ID"] = sid
ds_polar_north.attrs["Track source file"] = atcf_filename
ds_polar_north.attrs["Source satellite file"] = os.path.basename(sat_file_sw)
lon_lwind, lat_lwind = research_contour(msk_lwind, lon, lat)
lwind_contour_coords = []
......@@ -54,12 +57,6 @@ def save_netcdf(sat_file, path, lon_center, lat_center, lons_eye_shape, lats_eye
hwind_contour = LineString(hwind_contour_coords)
ds_polar_north.attrs["High wind research area"] = hwind_contour.wkt
# Storm id
# Source track file
# source sat file
# storm id nom du fichier
# vmax m/s
outfile = os.path.join(path, f"{os.path.basename(sat_file_sw).replace('.nc', '').replace('cm', 'ca')}.nc")
outfile = os.path.join(path, f"{os.path.basename(sat_file_sw).replace('.nc', '').replace('cm', 'ca')}_{sid}.nc")
ds_polar_north.to_netcdf(path=outfile)
logger.info(f"Wrote netCDF product to {outfile}")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment