diff --git a/floodpy/Preprocessing_S1_data/Preprocessing_S1_data.py b/floodpy/Preprocessing_S1_data/Preprocessing_S1_data.py index ecfc187..e1a1ac7 100644 --- a/floodpy/Preprocessing_S1_data/Preprocessing_S1_data.py +++ b/floodpy/Preprocessing_S1_data/Preprocessing_S1_data.py @@ -54,10 +54,10 @@ def Run_Preprocessing(Floodpy_app, overwrite): if Flood_num_GRD_tiles == 1: flood_hdf5_outfile=os.path.join(Floodpy_app.Preprocessing_dir,Floodpy_app.flood_datetime_str) flood_xarray_outfile = flood_hdf5_outfile + '.nc' - + flood_img1 = os.path.join(Floodpy_app.S1_dir,S1_flood_rows.iloc[0].Name+'.zip') + if not os.path.exists(flood_xarray_outfile): - flood_img1 = os.path.join(Floodpy_app.S1_dir,S1_flood_rows.iloc[0].Name+'.zip') perform_single_1GRD_preprocessing(Floodpy_app.gpt, flood_img1, flood_hdf5_outfile, diff --git a/floodpy/Preprocessing_S1_data/xarray_funcs.py b/floodpy/Preprocessing_S1_data/xarray_funcs.py index 35a18cd..3979f51 100644 --- a/floodpy/Preprocessing_S1_data/xarray_funcs.py +++ b/floodpy/Preprocessing_S1_data/xarray_funcs.py @@ -33,7 +33,7 @@ def save_DEM_xarray(DEM, S1_lon_vector, S1_lat_vector, geojson_bbox, ref_xarray, df.y.attrs['axis'] = 'Y' df.rio.write_crs("epsg:4326", inplace=True) - + df = df.dropna("x", how="all").dropna("y", how="all") df_coreg = df.rio.clip(gpd.read_file(geojson_bbox)['geometry']) S1_coreg = df_coreg.rio.reproject_match(ref_xarray) @@ -70,6 +70,7 @@ def save_LIA_xarray(LIA, S1_lon_vector, S1_lat_vector, geojson_bbox, ref_xarray, df.y.attrs['axis'] = 'Y' df.rio.write_crs("epsg:4326", inplace=True) + df = df.dropna("x", how="all").dropna("y", how="all") df_coreg = df.rio.clip(gpd.read_file(geojson_bbox)['geometry']) @@ -119,7 +120,7 @@ def save_backscatter_xarray(VV_dB, VH_dB, VV_VH_dB, S1_lon_vector, S1_lat_vector df.y.attrs['axis'] = 'Y' df.rio.write_crs("epsg:4326", inplace=True) - + df = df.dropna("x", how="all").dropna("y", how="all") df_coreg = df.rio.clip(gpd.read_file(geojson_bbox)['geometry']) S1_coreg = df_coreg.rio.reproject_match(ref_xarray)