Skip to content

Commit

Permalink
fixes flake8
Browse files Browse the repository at this point in the history
Signed-off-by: nagesh bansal <nageshbansal59@gmail.com>
  • Loading branch information
Nageshbansal committed Sep 19, 2023
1 parent c26085d commit f356b58
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions neonwranglerpy/lib/extract_hsi_to_tif.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ def h5refl2array(refl_filename, remove_water_bands=True):
sns_zn = hdf5_file[sitename]['Reflectance/Metadata/to-sensor_zenith_angle'][()]
# get solar angles as array to leverage flightpaths mosaic
flightpaths = [
hdf5_file[sitename][
'Reflectance/Metadata/Ancillary_Imagery/Data_Selection_Index'][()]
hdf5_file[sitename]['Reflectance/Metadata/Ancillary_Imagery/Data_Selection_Index']
[()]
]
sol_zn = [
hdf5_file[sitename][
'Reflectance/Metadata/Ancillary_Imagery/Data_Selection_Index'][()]
hdf5_file[sitename]['Reflectance/Metadata/Ancillary_Imagery/Data_Selection_Index']
[()]
]
sol_az = [
hdf5_file[sitename][
'Reflectance/Metadata/Ancillary_Imagery/Data_Selection_Index'][()]
hdf5_file[sitename]['Reflectance/Metadata/Ancillary_Imagery/Data_Selection_Index']
[()]
]
# turn sol_az and sol_zn into arrays
sol_zn = np.array(sol_zn)
Expand All @@ -68,6 +68,7 @@ def h5refl2array(refl_filename, remove_water_bands=True):
sol_az[good_pixels] = solar_angles[pt][1]
sol_zn[good_pixels] = solar_angles[pt][2]


#
mapInfo_string = str(metadata['mapInfo'])
mapInfo_split = mapInfo_string.split(",")
Expand Down Expand Up @@ -105,9 +106,8 @@ def tile_solar_angle(full_path):
file_attrs_string = str(list(hdf5_file.items()))
file_attrs_string_split = file_attrs_string.split("'")
sitename = file_attrs_string_split[1]
flight_paths = hdf5_file[
sitename]["Reflectance/Metadata/Ancillary_Imagery/Data_Selection_Index"
].attrs["Data_Files"]
flight_paths = hdf5_file[sitename][
"Reflectance/Metadata/Ancillary_Imagery/Data_Selection_Index"].attrs["Data_Files"]
flight_paths = str(flight_paths).split(",")
which_paths = np.unique(
hdf5_file[sitename]["Reflectance/Metadata/Ancillary_Imagery/Data_Selection_Index"]
Expand Down Expand Up @@ -301,7 +301,8 @@ def generate_raster(h5_path,
sns_az_reshaped = sns_az # No need to reshape sns_az
sns_zn_reshaped = sns_zn

sol_sens_angle = np.array([sol_az_reshaped, sol_zn_reshaped, sns_az_reshaped, sns_zn_reshaped])
sol_sens_angle = np.array(
[sol_az_reshaped, sol_zn_reshaped, sns_az_reshaped, sns_zn_reshaped])
solar_tilename = os.path.splitext(
os.path.basename(rgb_filename))[0] + "_solar_sensor_angle{}.tif".format(suffix)
# Save georeference crop to file
Expand Down

0 comments on commit f356b58

Please sign in to comment.