def add_easy_fcdr_variables(dataset, height, corr_dx=None, corr_dy=None, lut_size=None): dataset["u_independent"] = HIRS._create_easy_fcdr_variable(height, "uncertainty from independent errors") dataset["u_structured"] = HIRS._create_easy_fcdr_variable(height, "uncertainty from structured errors") dataset["u_common"] = HIRS._create_easy_fcdr_variable(height, "uncertainty from common errors") tu.add_correlation_matrices(dataset, NUM_CHANNELS) if lut_size is not None: tu.add_lookup_tables(dataset, NUM_CHANNELS, lut_size=lut_size) if corr_dx is not None and corr_dy is not None: tu.add_correlation_coefficients(dataset, NUM_CHANNELS, corr_dx, corr_dy)
def add_easy_fcdr_variables(dataset, height, corr_dx=None, corr_dy=None, lut_size=None): # height is ignored - supplied just for interface compatibility tb 2017-02-05 # reflectance default_array = DefaultData.create_default_array(FULL_SIZE, FULL_SIZE, np.float32, fill_value=np.NaN) variable = Variable(["y", "x"], default_array) variable.attrs["standard_name"] = "toa_bidirectional_reflectance_vis" variable.attrs["long_name"] = "top of atmosphere bidirectional reflectance factor per pixel of the visible band with central wavelength 0.7" tu.add_units(variable, "1") tu.add_encoding(variable, np.uint16, DefaultData.get_default_fill_value(np.uint16), 3.05176E-05, chunksizes=CHUNKSIZES) dataset["toa_bidirectional_reflectance_vis"] = variable # u_independent default_array = DefaultData.create_default_array(FULL_SIZE, FULL_SIZE, np.float32, fill_value=np.NaN) variable = Variable(["y", "x"], default_array) variable.attrs["long_name"] = "independent uncertainty per pixel" tu.add_units(variable, "1") tu.add_encoding(variable, np.uint16, DefaultData.get_default_fill_value(np.uint16), 3.05176E-05, chunksizes=CHUNKSIZES) dataset["u_independent_toa_bidirectional_reflectance"] = variable # u_structured default_array = DefaultData.create_default_array(FULL_SIZE, FULL_SIZE, np.float32, fill_value=np.NaN) variable = Variable(["y", "x"], default_array) variable.attrs["long_name"] = "structured uncertainty per pixel" tu.add_units(variable, "1") tu.add_encoding(variable, np.uint16, DefaultData.get_default_fill_value(np.uint16), 3.05176E-05, chunksizes=CHUNKSIZES) dataset["u_structured_toa_bidirectional_reflectance"] = variable # u_common dataset["u_common_toa_bidirectional_reflectance"] = tu.create_scalar_float_variable(long_name="common uncertainty per slot", units="1") dataset["sub_satellite_latitude_start"] = tu.create_scalar_float_variable(long_name="Latitude of the sub satellite point at image start", units="degrees_north") dataset["sub_satellite_longitude_start"] = tu.create_scalar_float_variable(long_name="Longitude of the sub satellite point at image start", units="degrees_east") dataset["sub_satellite_latitude_end"] = tu.create_scalar_float_variable(long_name="Latitude of the sub satellite point at image end", units="degrees_north") dataset["sub_satellite_longitude_end"] = tu.create_scalar_float_variable(long_name="Longitude of the sub satellite point at image end", units="degrees_east") tu.add_correlation_matrices(dataset, NUM_CHANNELS) if lut_size is not None: tu.add_lookup_tables(dataset, NUM_CHANNELS, lut_size=lut_size) if corr_dx is not None and corr_dy is not None: tu.add_correlation_coefficients(dataset, NUM_CHANNELS, corr_dx, corr_dy) tu.add_coordinates(dataset, ["vis", "wv", "ir"])
def add_easy_fcdr_variables(dataset, height, corr_dx=None, corr_dy=None, lut_size=None): # u_independent_Ch1-3a long_names = [ "independent uncertainty per pixel for channel 1", "independent uncertainty per pixel for channel 2", "independent uncertainty per pixel for channel 3a" ] names = [ "u_independent_Ch1", "u_independent_Ch2", "u_independent_Ch3a" ] AVHRR._add_refl_uncertainties_variables(dataset, height, names, long_names) # u_structured_Ch1-3a long_names = [ "structured uncertainty per pixel for channel 1", "structured uncertainty per pixel for channel 2", "structured uncertainty per pixel for channel 3a" ] names = ["u_structured_Ch1", "u_structured_Ch2", "u_structured_Ch3a"] AVHRR._add_refl_uncertainties_variables(dataset, height, names, long_names, structured=True) # u_common_Ch1-3a long_names = [ "common uncertainty per pixel for channel 1", "common uncertainty per pixel for channel 2", "common uncertainty per pixel for channel 3a" ] names = ["u_common_Ch1", "u_common_Ch2", "u_common_Ch3a"] AVHRR._add_refl_uncertainties_variables(dataset, height, names, long_names) # u_independent_Ch3b-5 long_names = [ "independent uncertainty per pixel for channel 3b", "independent uncertainty per pixel for channel 4", "independent uncertainty per pixel for channel 5" ] names = [ "u_independent_Ch3b", "u_independent_Ch4", "u_independent_Ch5" ] AVHRR._add_bt_uncertainties_variables(dataset, height, names, long_names) # u_structured_Ch3b-5 long_names = [ "structured uncertainty per pixel for channel 3b", "structured uncertainty per pixel for channel 4", "structured uncertainty per pixel for channel 5" ] names = ["u_structured_Ch3b", "u_structured_Ch4", "u_structured_Ch5"] AVHRR._add_bt_uncertainties_variables(dataset, height, names, long_names) # u_common_Ch3b-5 long_names = [ "common uncertainty per pixel for channel 3b", "common uncertainty per pixel for channel 4", "common uncertainty per pixel for channel 5" ] names = ["u_common_Ch3b", "u_common_Ch4", "u_common_Ch5"] AVHRR._add_bt_uncertainties_variables(dataset, height, names, long_names) tu.add_correlation_matrices(dataset, N_CHANS) if lut_size is not None: tu.add_lookup_tables(dataset, N_CHANS, lut_size) if corr_dx is not None and corr_dy is not None: tu.add_correlation_coefficients(dataset, N_CHANS, corr_dx, corr_dy)