diff --git a/hypro/AtmCorr.py b/hypro/AtmCorr.py index 69b5fa6..9e3bfa6 100644 --- a/hypro/AtmCorr.py +++ b/hypro/AtmCorr.py @@ -9,9 +9,14 @@ """ Functions to do atmospheric corrections. """ -import logging, os, numpy as np +import os +import logging + +import numpy as np + logger = logging.getLogger(__name__) + def atm_corr_band(atm_lut_WVC, atm_lut_VIS, atm_lut_VZA, atm_lut_RAA, atm_lut, wvc_image, vis_image, vza_image, raa_image, rdn_image, bg_mask): @@ -63,6 +68,7 @@ def atm_corr_band(atm_lut_WVC, atm_lut_VIS, atm_lut_VZA, atm_lut_RAA, atm_lut, return rho + def atm_corr_image(flight_dict): """ Do atmospheric corrections on the whole image. diff --git a/hypro/AtmLUT.py b/hypro/AtmLUT.py index 73f9e2d..aaac812 100644 --- a/hypro/AtmLUT.py +++ b/hypro/AtmLUT.py @@ -9,7 +9,11 @@ """ Functions to build an atmospheric lookup table (LUT). """ -import logging, os, numpy as np +import os +import logging + +import numpy as np + logger = logging.getLogger(__name__) # Define atmosphere database parameters. Do not make any change to them. @@ -23,6 +27,7 @@ atm_db_VZA = np.array([0, 5, 10, 15, 20, 25, 30, 40]) # view zenith angle, in [deg] atm_db_RAA = np.array([0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180]) # relative azimuth angle, in [deg] + def build_atm_lut(flight_dict): """ Make an atmospheric lookup table. @@ -154,6 +159,7 @@ def build_atm_lut(flight_dict): logger.info('Write the raw ALT to %s.' %flight_dict['raw_atm_lut_file']) + def resample_atm_lut(resampled_atm_lut_file, raw_atm_lut_file, rdn_header_file): """ Resample atmosphere lookup table radiance to sensor wavelengths. @@ -218,6 +224,7 @@ def resample_atm_lut(resampled_atm_lut_file, raw_atm_lut_file, rdn_header_file): logger.info('Write the resampled ALT to %s.' %resampled_atm_lut_file) + def write_binary_metadata(metadata_file, metadata): """ Write the metadata of a binary file. @@ -246,6 +253,7 @@ def write_binary_metadata(metadata_file, metadata): fid.write('%s = %s\n' %(key, value)) fid.close() + def read_binary_metadata(metadata_file): """ Read the metadata of a binary file. @@ -286,6 +294,7 @@ def read_binary_metadata(metadata_file): return metadata + def get_interp_range(xs, x): """ Get the interpolation range. """ @@ -296,6 +305,7 @@ def get_interp_range(xs, x): return {x_index0: x_delta0, x_index1: x_delta1} + def combos(indices): """ Return all combinations of indices in a list of index sublists. diff --git a/hypro/Boresight.py b/hypro/Boresight.py index 5546e2d..3d24b8a 100644 --- a/hypro/Boresight.py +++ b/hypro/Boresight.py @@ -9,9 +9,14 @@ """ Functions to do boresight calibration. """ -import logging, os, numpy as np +import os +import logging + +import numpy as np + logger = logging.getLogger(__name__) + def boresight_calibration(boresight_file, gcp_file, imugps_file, sensor_model_file, dem_image_file, boresight_options): """ Do boresight calibration. @@ -145,6 +150,7 @@ def boresight_calibration(boresight_file, gcp_file, imugps_file, sensor_model_fi logger.info('Write boresight data to %s.' %boresight_file) + def cost_fun(boresight_offsets, flight_xyz, flight_imu, flight_sensor_model, dem_image, dem_ulxy, dem_pixel_size, gcp_xyz, boresight_options): """ Cost function for boresight calibration. @@ -178,6 +184,7 @@ def cost_fun(boresight_offsets, flight_xyz, flight_imu, flight_sensor_model, dem return cost + def estimate_gcp_xyz(boresight_offsets, flight_xyz, flight_imu, flight_sensor_model, dem_image, dem_ulxy, dem_pixel_size, boresight_options): """ Cestimate GCP map coordinates. diff --git a/hypro/Classification.py b/hypro/Classification.py index 7935c80..8e5684b 100644 --- a/hypro/Classification.py +++ b/hypro/Classification.py @@ -9,11 +9,16 @@ """ Functions to do image classifications. """ -import logging, os, numpy as np +import os +import logging + +import numpy as np + logger = logging.getLogger(__name__) solar_flux_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),'data','solar_flux.dat') + def pre_classification(pre_class_image_file, rdn_image_file, sun_zenith, distance, background_mask_file=None): """ Pre-classify the image. diff --git a/hypro/CreateSCA.py b/hypro/CreateSCA.py index 5998da3..803e088 100644 --- a/hypro/CreateSCA.py +++ b/hypro/CreateSCA.py @@ -7,9 +7,10 @@ # Dept. of Forest and Wildlife Ecology # University of Wisconsin - Madison -from ENVI import read_envi_header, write_envi_header import numpy as np +from ENVI import read_envi_header, write_envi_header + if __name__ == "__main__": raw_sca_file = '/media/nanfeng/My Passport/Hyspex/Output/CEDAR-CREEK-EW_20180724_01/merge/CEDAR-CREEK-EW_20180724_01_SCA' diff --git a/hypro/DEM.py b/hypro/DEM.py index 0b658f2..f23db93 100644 --- a/hypro/DEM.py +++ b/hypro/DEM.py @@ -9,10 +9,15 @@ """ Functions to process DEM data. """ +import os +import logging + +import numpy as np from osgeo import gdal -import logging, os, numpy as np + logger = logging.getLogger(__name__) + def get_avg_elev(dem_image_file): """ Get the average elevation of a DEM image. @@ -39,6 +44,7 @@ def get_avg_elev(dem_image_file): return avg_elev + def prepare_dem(dem_image_file, dem, imugps_file, fov, map_crs, pixel_size): """ Prepare DEM data. diff --git a/hypro/ENVI.py b/hypro/ENVI.py index 05008ad..cb49737 100644 --- a/hypro/ENVI.py +++ b/hypro/ENVI.py @@ -113,6 +113,7 @@ 'z plot range', 'z plot titles'] + def read_envi_header(file): """ Read ENVI header. @@ -164,6 +165,7 @@ def read_envi_header(file): return header + def check_envi_required_fields(header): """ Check ENVI required fields. @@ -183,6 +185,7 @@ def check_envi_required_fields(header): if header[field] is None: raise ValueError('No value for %s!' %field) + def empty_envi_header(): """ Generate an empty ENVI header. @@ -198,6 +201,7 @@ def empty_envi_header(): return header + def write_envi_header(file, header): """ Write ENVI header. diff --git a/hypro/Figure.py b/hypro/Figure.py index ed5a604..e9f27c2 100644 --- a/hypro/Figure.py +++ b/hypro/Figure.py @@ -9,13 +9,18 @@ """ Functions to make figures. """ -import logging, os, matplotlib.pyplot as plt, numpy as np +import os +import logging + +import numpy as np from osgeo import gdal +import matplotlib.pyplot as plt mpl_logger = logging.getLogger('matplotlib') mpl_logger.setLevel(logging.WARNING) logger = logging.getLogger(__name__) + def plot_angle_geometry(angle_geometry_figure_file, sca_image_file): """ Plot the sun-target-view geometry in a polar coordinate system. @@ -60,6 +65,7 @@ def plot_angle_geometry(angle_geometry_figure_file, sca_image_file): logger.info('Save the angle geometry figure to %s.' %angle_geometry_figure_file) + def plot_image_area(image_area_figure_file, dem_image_file, igm_image_file, imugps_file): """ Plot image area (DEM is used as the background). @@ -124,6 +130,7 @@ def plot_image_area(image_area_figure_file, dem_image_file, igm_image_file, imug logger.info('Save the image-area figure to %s.' %image_area_figure_file) + def linear_percent_stretch(raw_image): """ Do linear percent stretch. @@ -153,6 +160,7 @@ def linear_percent_stretch(raw_image): return stretched_image + def make_quicklook(quicklook_figure_file, rdn_image_file, glt_image_file): """ Make a RGB quicklook image. @@ -235,6 +243,7 @@ def make_quicklook(quicklook_figure_file, rdn_image_file, glt_image_file): logger.info('Save the quicklook figure to %s.' %quicklook_figure_file) + def plot_avg_rdn(avg_rdn_figure_file, avg_rdn_file): """ Plot average radiance to a figure. @@ -273,6 +282,7 @@ def plot_avg_rdn(avg_rdn_figure_file, avg_rdn_file): logger.info('Save the average radiance spectra figure to %s.' %avg_rdn_figure_file) + def plot_wvc_model(wvc_model_figure_file, wvc_model_file): """ Plot the WVC model to a figure. @@ -312,6 +322,7 @@ def plot_wvc_model(wvc_model_figure_file, wvc_model_file): logger.info('Save the WVC model figure to %s.' %wvc_model_file) + def plot_smile_effect(smile_effect_at_atm_features_figure_file, smile_effect_at_atm_features_file): """ Plot smile effects at different atmosphere absorption features. @@ -412,6 +423,7 @@ def plot_smile_effect(smile_effect_at_atm_features_figure_file, smile_effect_at_ logger.info('Save smile effect at atmosphere absorption features figure to %s.' %smile_effect_at_atm_features_figure_file) + def plot_wvc_histogram(wvc_histogram_figure_file, water_vapor_column_image_file): """ Plot water vapor column histogram. diff --git a/hypro/GeoRectification.py b/hypro/GeoRectification.py index 48bdcbd..e7717a0 100644 --- a/hypro/GeoRectification.py +++ b/hypro/GeoRectification.py @@ -9,9 +9,14 @@ """ Functions to do geo-rectification. """ -import logging, os, numpy as np +import os +import logging + +import numpy as np + logger = logging.getLogger(__name__) + def orthorectify_sca(ortho_sca_image_file, sca_image_file, glt_image_file): """ Do orthorectifications on SCA. @@ -88,6 +93,7 @@ def orthorectify_sca(ortho_sca_image_file, sca_image_file, glt_image_file): logger.info('Write the geo-rectified SCA image to %s.' %ortho_sca_image_file) + def orthorectify_dem(ortho_dem_image_file, igm_image_file, glt_image_file): """ Do orthorectifications on DEM. @@ -160,6 +166,7 @@ def orthorectify_dem(ortho_dem_image_file, igm_image_file, glt_image_file): logger.info('Write the geo-rectified DEM image to %s.' %ortho_dem_image_file) + def orthorectify_rdn(ortho_rdn_image_file, rdn_image_file, glt_image_file): """ Do orthorectifications on radiance. diff --git a/hypro/GeoReferencing.py b/hypro/GeoReferencing.py index 3a3d40f..957a4dd 100644 --- a/hypro/GeoReferencing.py +++ b/hypro/GeoReferencing.py @@ -9,13 +9,20 @@ """ Functions to do geo-referencing. """ +import os +import logging +import warnings + +import numpy as np from osgeo import gdal -import logging, os, numpy as np -logger = logging.getLogger(__name__) from numba import guvectorize, jit -import warnings + + +logger = logging.getLogger(__name__) + warnings.filterwarnings("ignore") + def calculate_igm(igm_image_file, imugps_file, sensor_model_file, dem_image_file, boresight_options): """ Create an input geometry (IGM) image. @@ -137,6 +144,7 @@ def calculate_igm(igm_image_file, imugps_file, sensor_model_file, dem_image_file logger.info('Write the IGM to %s.' %igm_image_file) + def calculate_sca(sca_image_file, imugps_file, igm_image_file, sun_angles): """ Create a scan angle (SCA) image. @@ -223,6 +231,7 @@ def calculate_sca(sca_image_file, imugps_file, igm_image_file, sun_angles): logger.info('Write the SCA to %s.' %sca_image_file) + def build_glt(glt_image_file, igm_image_file, pixel_size, map_crs): """ Create a geographic lookup table (GLT) image. @@ -417,6 +426,7 @@ def build_glt(glt_image_file, igm_image_file, pixel_size, map_crs): logger.info('Write the GLT to %s.' %glt_image_file) + def get_scan_vectors(imu, sensor_model): """ Get scan vectors. @@ -507,6 +517,7 @@ def get_scan_vectors(imu, sensor_model): return L0 + def get_xyz0_xyz1(xyz, L0, h_min, h_max): """ Get the starting and ending locations of ray tracing. @@ -548,6 +559,7 @@ def get_xyz0_xyz1(xyz, L0, h_min, h_max): return xyz0, xyz1 + @guvectorize(['void(f8[:,:,:], f8[:,:,:], f8[:,:,:], f8[:,:], f8[:], f8[:,:,:])'], '(b,n,m), (b,n,m), (b,n,m), (u,v), (c) -> (b,m,n)', cache=True) def ray_tracer_ufunc(xyz0, xyz1, L0, dem, dem_gt, output): @@ -596,6 +608,7 @@ def ray_tracer_ufunc(xyz0, xyz1, L0, dem, dem_gt, output): for j in range(xyz0.shape[2]): # Iterate over scanlines output[:,j,i] = ray_tracing(xyz0[:,i,j], xyz1[:,i,j], L0[:,i,j], dem, dem_origin, resolution) + @jit def ray_tracing(XYZ0, XYZ1, V, DEM, DEM_X0Y0, DEM_Resolution): """ Implement ray-tracing to get the pixel's geo-location and elevation. diff --git a/hypro/Geography.py b/hypro/Geography.py index fe83eec..acbe89d 100644 --- a/hypro/Geography.py +++ b/hypro/Geography.py @@ -9,8 +9,11 @@ """ Functions to process map coordinate systems. """ +import os + +import numpy as np from osgeo import gdal, osr -import os, numpy as np + def get_utm_zone(lon): """ Calculate UTM zone. @@ -30,6 +33,7 @@ def get_utm_zone(lon): return zone + def is_northern(lat): """ Determine if it is northern hemisphere. @@ -49,6 +53,7 @@ def is_northern(lat): else: return 1 + def define_utm_crs(lon, lat): """ Define a UTM map coordinate system. @@ -72,6 +77,7 @@ def define_utm_crs(lon, lat): return crs + def define_wgs84_crs(): """ Define a WGS84 map coordinate system. @@ -86,6 +92,7 @@ def define_wgs84_crs(): return crs + def get_raster_crs(file): """ Get the map coordinate system of a raster image. @@ -109,6 +116,7 @@ def get_raster_crs(file): return crs + def get_grid_convergence(lon, lat, map_crs): """ Get grid convergence angles. @@ -149,6 +157,7 @@ def get_grid_convergence(lon, lat, map_crs): return grid_convergence + def get_map_crs(dem, longitude, latitude): """ Get map coordinate system. @@ -178,6 +187,7 @@ def get_map_crs(dem, longitude, latitude): return map_crs + def get_sun_angles(longitude, latitude, utc_time): """ Calculate the Sun's position. diff --git a/hypro/HyspexPro.py b/hypro/HyspexPro.py index 3c43664..552036a 100644 --- a/hypro/HyspexPro.py +++ b/hypro/HyspexPro.py @@ -151,6 +151,7 @@ from VIS import estimate_vis from AtmCorr import atm_corr_image + def get_flight_indices(config): """ Get Hyspex flight indices. @@ -177,6 +178,7 @@ def get_flight_indices(config): return flight_indices + def create_flight_log(output_dir, log_file_basename): """ Create a Hyspex flight processing log. @@ -203,6 +205,7 @@ def create_flight_log(output_dir, log_file_basename): return flight_log + def initialize_flight_dict(config, flight_index): """ Initialize a Hyspex flight dictionary. @@ -292,6 +295,7 @@ def initialize_flight_dict(config, flight_index): return flight_dict + def search_file(in_dir, keyword): """ Search a specific file with the keyword. @@ -317,6 +321,7 @@ def search_file(in_dir, keyword): else: return file[0] + def get_center_lon_lat(raw_imugps_file): """ Get Hyspex image center longitude and latitude. @@ -339,6 +344,7 @@ def get_center_lon_lat(raw_imugps_file): return [lon, lat] + def get_acquisition_time(dn_header_file, raw_imugps_file): """ Get Hyspex image acquistion time. @@ -374,6 +380,7 @@ def get_acquisition_time(dn_header_file, raw_imugps_file): return when + def get_sun_earth_distance(when): """ Get sun-earth distance of a day. @@ -396,6 +403,7 @@ def get_sun_earth_distance(when): return d + def HyspexPro(config_file): # Load configurations. config = json.load(open(config_file, 'r')) diff --git a/hypro/IMUGPS.py b/hypro/IMUGPS.py index c553fa5..4ddeca2 100644 --- a/hypro/IMUGPS.py +++ b/hypro/IMUGPS.py @@ -13,6 +13,7 @@ import logging, os, numpy as np logger = logging.getLogger(__name__) + def prepare_imugps_Hyspex(processed_imugps_file, raw_imugps_file, boresight_offsets, map_crs, boresight_options): """ Prepare Hyspex IMU and GPS data. diff --git a/hypro/ImageMerging.py b/hypro/ImageMerging.py index 4f7474e..3929421 100644 --- a/hypro/ImageMerging.py +++ b/hypro/ImageMerging.py @@ -9,8 +9,14 @@ """ Functions to merge images from different sensors. """ -import logging, os, numpy as np +import os +import logging + +import numpy as np + logger = logging.getLogger(__name__) + + def merge_dem_sca(background_mask_file, merged_dem_file, merged_sca_file, sensors): """ Merge DEM and SCA images. @@ -229,6 +235,7 @@ def merge_dem_sca(background_mask_file, merged_dem_file, merged_sca_file, sensor del raw_header, header logger.info('Write the merged SCA image to %s.' %merged_sca_file) + def merge_rdn(merged_image_file, mask_file, sensors): """ Merge radiance images. @@ -337,6 +344,7 @@ def merge_rdn(merged_image_file, mask_file, sensors): logger.info('Write the merged refletance image to %s.' %merged_image_file) + def resample_ortho_sca(raw_image, raw_ulx, raw_uly, raw_pixel_size, x, y): """ Resample geosca image to new map grids. @@ -377,6 +385,7 @@ def resample_ortho_sca(raw_image, raw_ulx, raw_uly, raw_pixel_size, x, y): return resampled_image + def resample_ortho_dem(raw_image, raw_ulx, raw_uly, raw_pixel_size, x, y): """ Resample dem image to new map grids. @@ -417,6 +426,7 @@ def resample_ortho_dem(raw_image, raw_ulx, raw_uly, raw_pixel_size, x, y): return resampled_image + def resample_ortho_rdn(raw_image, raw_ulx, raw_uly, raw_pixel_size, x, y): """ Resample radiance image to new map grids. diff --git a/hypro/Radiometry.py b/hypro/Radiometry.py index 2cd527f..bc3ff2e 100644 --- a/hypro/Radiometry.py +++ b/hypro/Radiometry.py @@ -9,9 +9,14 @@ """ Functions to do radiometric calibrations. """ -import logging, os, numpy as np +import os +import logging + +import numpy as np + logger = logging.getLogger(__name__) + def make_radio_cali_file_Hyspex(radio_cali_file, dn_image_file, setting_file): """ Make a Hyspex radiometric calibration file. @@ -222,6 +227,7 @@ def from_int8array_to_string(int8_array): logger.info('Write the radiometric calibration coefficients to %s.' %radio_cali_file) + def dn2rdn_Hyspex(rdn_image_file, dn_image_file, radio_cali_file, acquisition_time): """ Do Hyspex radiometric calibration. @@ -325,6 +331,7 @@ def dn2rdn_Hyspex(rdn_image_file, dn_image_file, radio_cali_file, acquisition_ti logger.info('Write the radiance image to %s.' %rdn_image_file) + def resample_rdn(resampled_rdn_image_file, raw_rdn_image_file, smile_effect_file): """ Resample radiance spectra. @@ -402,6 +409,7 @@ def resample_rdn(resampled_rdn_image_file, raw_rdn_image_file, smile_effect_file logger.info('Write the spectrally resampled radiance image to %s.' %resampled_rdn_image_file) + def get_hyspex_setting(setting_file): """ Read Hyspex setting data. diff --git a/hypro/SensorModel.py b/hypro/SensorModel.py index 2e7793e..eccbbcb 100644 --- a/hypro/SensorModel.py +++ b/hypro/SensorModel.py @@ -9,9 +9,14 @@ """ Functions to create a sensor model. """ -import logging, os, numpy as np +import os +import logging + +import numpy as np + logger = logging.getLogger(__name__) + def make_sensor_model(sensor_model_file, fov, ifov, samples, if_rotated): """ Generate a sensor model. @@ -52,6 +57,7 @@ def make_sensor_model(sensor_model_file, fov, ifov, samples, if_rotated): logger.info('Write the sensor model to %s.' %sensor_model_file) + def determine_if_rotated(imu_gps_file): """ Determine if the sensor is 180 degree rotated. diff --git a/hypro/SmileEffect.py b/hypro/SmileEffect.py index d90f383..57ad7b6 100644 --- a/hypro/SmileEffect.py +++ b/hypro/SmileEffect.py @@ -9,7 +9,11 @@ """ Functions to detect smile effects. """ -import logging, os, numpy as np +import os +import logging + +import numpy as np + logger = logging.getLogger(__name__) # Define atmosphere absorption features. @@ -31,6 +35,7 @@ 2420: [2400, 2435] } + def detect_smile_effect(sensor_dict, atm_lut_file): """ Detect smile effect. @@ -232,6 +237,7 @@ def detect_smile_effect(sensor_dict, atm_lut_file): logger.info('Write smile effect to %s.' %sensor_dict['smile_effect_file']) + def interp_atm_lut(atm_lut_file, WVC, VIS, VZA, RAA): """ Interpolate atmosphere look-up-table to different water vapor columns (WVC), visibilities (VIS), view zenith angles (VZA) and relative azimuth angles (RAA). @@ -296,6 +302,7 @@ def interp_atm_lut(atm_lut_file, WVC, VIS, VZA, RAA): return atm_lut_WAVE, interp_rdn + def average_rdn(avg_rdn_file, rdn_image_file, sca_image_file, pre_class_image_file): """ Average radiance along each column. @@ -407,6 +414,7 @@ def average_rdn(avg_rdn_file, rdn_image_file, sca_image_file, pre_class_image_fi logger.info('Write the averaged radiance data to %s.' %avg_rdn_file) + def interpolate_values(A, map): """ Replace array elements with interpolated values. Input array is modified in-place. @@ -421,6 +429,7 @@ def interpolate_values(A, map): def indices(x): return x.nonzero()[0] A[map] = np.interp(indices(map), indices(~map), A[~map]) + def cost_fun(shifts, sensor_wave, sensor_fwhm, sensor_rdn, lut_wave, lut_rdn): """ Cost function. diff --git a/hypro/Spectra.py b/hypro/Spectra.py index c2c1182..9ecbd3c 100644 --- a/hypro/Spectra.py +++ b/hypro/Spectra.py @@ -15,10 +15,13 @@ https://github.com/EnSpec/HyTools-sandbox/blob/master/hytools/preprocess/resampling.py """ -import numpy as np import warnings + +import numpy as np + warnings.filterwarnings("ignore", category=FutureWarning) + def estimate_fwhms_from_waves(waves): """ Estimate fwhm from wavelengths. @@ -39,6 +42,7 @@ def estimate_fwhms_from_waves(waves): return fwhms + def gaussian(x, mu, fwhm): """ Return a gaussian distribution. @@ -60,6 +64,7 @@ def gaussian(x, mu, fwhm): return np.exp(-1*((x-mu)**2/(2*sigma**2)))/(sigma*np.sqrt(2*np.pi)) + def resample_spectra(spectra, src_waves, dst_waves, dst_fwhms, src_fwhms=None): """ Return a set of coeffiencients for spectrum resampling. @@ -123,6 +128,7 @@ def resample_spectra(spectra, src_waves, dst_waves, dst_fwhms, src_fwhms=None): return resampled_spectra + def get_closest_wave(waves, center_wave): """ Get the band index whose wavelength is closest to `center_wav`. @@ -143,6 +149,7 @@ def get_closest_wave(waves, center_wave): return waves[band_index], band_index + def continuum_removal(spectra, waves): """Continuum remove spectra. @@ -165,6 +172,7 @@ def continuum_removal(spectra, waves): return cont_rmd_spectra + def resample_solar_flux(solar_flux_file, sensor_waves, sensor_fwhms): """ Resample solar flux to sensor wavelengths. diff --git a/hypro/VIS.py b/hypro/VIS.py index bad1142..5dd119a 100644 --- a/hypro/VIS.py +++ b/hypro/VIS.py @@ -9,7 +9,10 @@ """ Functions to estimate visibility. """ -import logging, os, numpy as np +import os +import logging +import numpy as np + logger = logging.getLogger(__name__) # Define typical water vapor column values of the atmosphere database. Do not make any change to them. @@ -20,6 +23,7 @@ 'midlatitude_summer': 29.2, 'tropical': 41.1} + def estimate_vis(vis_file, ddv_file, atm_lut_file, rdn_file, sca_file, background_mask_file): """ Estimate visibility. @@ -231,6 +235,7 @@ def estimate_vis(vis_file, ddv_file, atm_lut_file, rdn_file, sca_file, backgroun # Clear data del ndvi, red_refl, nir_refl, rdn_header + def interp_atm_lut(atm_lut_RHO, atm_lut_WVC, atm_lut_VZA, atm_lut_RAA, atm_lut, rho, wvc, vza, raa): """ Interpolate the atmospheric lookup table for visibility estimation. diff --git a/hypro/WVC.py b/hypro/WVC.py index cceca36..211cfb0 100644 --- a/hypro/WVC.py +++ b/hypro/WVC.py @@ -9,10 +9,15 @@ """ Functions to estimate water vapor column. """ -import logging, os, numpy as np +import os +import logging + +import numpy as np + logger = logging.getLogger(__name__) solar_flux_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),'data','solar_flux.dat') + def build_wvc_model(wvc_model_file, atm_lut_file, rdn_header_file, vis=40): """ Build water vapor models. @@ -122,6 +127,7 @@ def build_wvc_model(wvc_model_file, atm_lut_file, rdn_header_file, vis=40): json.dump(wvc_model, fid, indent=4) logger.info('Write WVC models to %s.' %wvc_model_file) + def estimate_wvc(wvc_file, rdn_file, sensors, sun_zenith, distance, background_mask_file): """ Estimate water vapor column.