nsrdb.preprocessing.gk2a_data_model.Gk2aDataModel

class Gk2aDataModel(input_data, output_pattern)[source]

Bases: BaseUwiscDataModel

Class to handle conversion of gk2a data to standard uwisc style format for NSRDB pipeline

Methods

combine_files(files)

Combine multiple files into one dataset.

count_to_rad(ds, var, gain, offset)

Convert raw counts to radiance using gain and offset.

count_to_refl(ds, var, gain, offset, cprime)

Convert raw counts to reflectance / albedo percent.

count_to_temp(ds, var, *, center_wn, gain, ...)

Convert raw counts to brightness temperature.

derive_solar_angles(ds)

Derive solar angles if not already present in the dataset.

derive_stdevs(ds)

Derive standard deviations used as training features.

drop_vars(ds)

Drop variables that are not part of the UWISC output schema.

fill_missing_vars(ds)

Fill any missing variables with NaN arrays.

get_primary_input_file(input_files)

Get the timestamped input file used for naming outputs.

get_solar_azimuth(ds)

Derive the solar azimuth angle for the dataset.

get_solar_zenith(ds)

Derive the solar zenith angle for the dataset.

open_dataset(input_files)

Get xarray dataset for raw input file

parse_timestamp(input_file)

Parse the GK2A timestamp tuple from an input file path.

parse_timestamp_string(input_file)

Parse the output timestamp string from an input file path.

process_dataset(ds)

Run the shared UWISC preprocessing pipeline on a dataset.

rad_to_temp(rad, center_wn)

Convert radiance to brightness temperature using Planck's law.

remap_cloud_phase(ds)

Map source cloud phase flags to UWISC cloud types.

remap_dims(ds)

Rename dims and coords to standards and build 2D lat/lon grids.

rename_vars(ds)

Rename variables to uwisc conventions.

run(input_files, output_pattern)

Run conversion routine and write converted dataset.

transform_raw_data(ds)

Convert raw counts to radiance for IR and visible channels.

write_output(ds, output_file)

Write converted dataset to the final output file.

Attributes

CLOUD_TYPE_MAP

CLOUD_TYPE_SOURCE_VAR

NAME_MAP

TIMESTAMP_PATTERN

ds

Get xarray dataset for raw input data.

input_files

Get the normalized list of input files.

output_file

Get output file name for the configured output pattern.

primary_input_file

Get the primary input file used for naming outputs.

time_index

Get a single-step time index for the primary input file.

timestamp

Get the parsed timestamp tuple for the primary input file.

timestamp_string

Get the parsed output timestamp string for the primary input.

static count_to_rad(ds, var, gain, offset)[source]

Convert raw counts to radiance using gain and offset.

classmethod count_to_refl(ds, var, gain, offset, cprime)[source]

Convert raw counts to reflectance / albedo percent.

static rad_to_temp(rad, center_wn)[source]

Convert radiance to brightness temperature using Planck’s law.

classmethod count_to_temp(ds, var, *, center_wn, gain, offset, c0, c1, c2)[source]

Convert raw counts to brightness temperature.

classmethod transform_raw_data(ds)[source]

Convert raw counts to radiance for IR and visible channels.

classmethod get_primary_input_file(input_files)[source]

Get the timestamped input file used for naming outputs.

classmethod parse_timestamp(input_file)[source]

Parse the GK2A timestamp tuple from an input file path.

classmethod open_dataset(input_files)[source]

Get xarray dataset for raw input file

classmethod combine_files(files)[source]

Combine multiple files into one dataset. This is needed to combine different channels, which are stored in separate files.

classmethod run(input_files, output_pattern)[source]

Run conversion routine and write converted dataset.

derive_solar_angles(ds)

Derive solar angles if not already present in the dataset.

classmethod derive_stdevs(ds)

Derive standard deviations used as training features.

classmethod drop_vars(ds)

Drop variables that are not part of the UWISC output schema.

property ds

Get xarray dataset for raw input data.

classmethod fill_missing_vars(ds)

Fill any missing variables with NaN arrays.

get_solar_azimuth(ds)

Derive the solar azimuth angle for the dataset.

get_solar_zenith(ds)

Derive the solar zenith angle for the dataset.

property input_files

Get the normalized list of input files.

property output_file

Get output file name for the configured output pattern.

classmethod parse_timestamp_string(input_file)

Parse the output timestamp string from an input file path.

property primary_input_file

Get the primary input file used for naming outputs.

process_dataset(ds)

Run the shared UWISC preprocessing pipeline on a dataset.

classmethod remap_cloud_phase(ds)

Map source cloud phase flags to UWISC cloud types.

remap_dims(ds)

Rename dims and coords to standards and build 2D lat/lon grids.

classmethod rename_vars(ds)

Rename variables to uwisc conventions.

property time_index

Get a single-step time index for the primary input file.

property timestamp

Get the parsed timestamp tuple for the primary input file.

property timestamp_string

Get the parsed output timestamp string for the primary input.

classmethod write_output(ds, output_file)

Write converted dataset to the final output file.