rainfallqc.checks.comparison_checks¶
Quality control checks relying on comparison with a benchmark dataset.
Comparison checks are defined as QC checks that: “detect abnormalities in rainfall record based on benchmarks.”
Classes and functions ordered by appearance in IntenseQC framework.
- rainfallqc.checks.comparison_checks.add_daily_year_col(data)[source]¶
Make a year column for the data. This method will first upsample data so that it is every day.
- Parameters:
data (
DataFrame) – Rainfall data- Return type:
DataFrame- Returns:
- :
- data_w_year_col
Rainfall data with year column
- rainfallqc.checks.comparison_checks.check_annual_exceedance_etccdi_prcptot(data, target_gauge_col, gauge_lat, gauge_lon)[source]¶
Check years with exceedances of maximum PRCPTOT from ETCCDI dataset.
This is QC9 from the IntenseQC framework.
- Parameters:
data (
DataFrame) – Rainfall datatarget_gauge_col (
str) – Column with rainfall datagauge_lat (
int|float) – latitude of the rain gaugegauge_lon (
int|float) – longitude of the rain gauge
- Return type:
list- Returns:
- :
- list_of_years_where_sum_99_percentile_above_max_PRCPTOT
List of values per year where the sum of the 99th percentile is above annual max PRCPTOT
- rainfallqc.checks.comparison_checks.check_annual_exceedance_etccdi_r99p(data, target_gauge_col, gauge_lat, gauge_lon)[source]¶
Check annual exceedance of maximum R99p from ETCCDI dataset.
This is QC8 from the IntenseQC framework.
- Parameters:
data (
DataFrame) – Rainfall datatarget_gauge_col (
str) – Column with rainfall datagauge_lat (
int|float) – latitude of the rain gaugegauge_lon (
int|float) – longitude of the rain gauge
- Return type:
list- Returns:
- :
- list_of_years_where_sum_99_percentile_above_max_R99p
List of values per year where the sum of the 99th percentile is above annual max R99p
- rainfallqc.checks.comparison_checks.check_exceedance_of_rainfall_world_record(data, target_gauge_col, time_res)[source]¶
Check exceedance of rainfall world record.
See Also utils/stats.py from world record sources.
This is QC10 from the IntenseQC framework.
- Parameters:
data (
DataFrame) – Rainfall datatarget_gauge_col (
str) – Column with rainfall datatime_res (
str) – Time resolution
- Return type:
DataFrame- Returns:
- :
- data_w_flags:
Rainfall data with exceedance of World Record (see flag_exceedance_of_ref_val_as_col function)
- rainfallqc.checks.comparison_checks.check_hourly_exceedance_etccdi_rx1day(data, target_gauge_col, gauge_lat, gauge_lon)[source]¶
Check exceedance of hourly day rainfall 1-day record.
This is QC11 from the IntenseQC framework.
- Parameters:
data (
DataFrame) – Rainfall datatarget_gauge_col (
str) – Column with rainfall datagauge_lat (
int|float) – latitude of the rain gaugegauge_lon (
int|float) – longitude of the rain gauge
- Return type:
DataFrame- Returns:
- :
- data_w_flags:
Rainfall data with exceedance of Rx1day Record (see flag_exceedance_of_ref_val_as_col function)
- rainfallqc.checks.comparison_checks.flag_exceedance_of_max_etccdi_variable(annual_sum_rainfall, target_gauge_col, nearby_etccdi_data, etccdi_var)[source]¶
Flag exceedance of maximum ETCCDI variable, comparing the maximum sums of each year.
- Parameters:
annual_sum_rainfall (
DataFrame) – Rainfall data as by year sumstarget_gauge_col (
str) – Column with rainfall datanearby_etccdi_data (
Dataset) – ETCCDI data with given variable to checketccdi_var (
str) – variable to load from ETCCDI
- Return type:
list- Returns:
- :
- exceedance_flags
Flags of exceedances of max ETCCDI value
- rainfallqc.checks.comparison_checks.flag_exceedance_of_ref_val(val, ref_val)[source]¶
Exceedance flagger from intenseqc.
- Parameters:
val (
int|float) – Value to checkref_val (
int|float) – Reference value to compare against
- Return type:
int- Returns:
- :
- Flag
Exceedance flag
- rainfallqc.checks.comparison_checks.flag_exceedance_of_ref_val_as_col(data, target_gauge_col, ref_val, new_col_name)[source]¶
Flag exceedance of maximum reference value and return as column.
Used in QC11 of the IntenseQC framework. TODO: could this be used in QC8+9?
- Parameters:
data (
DataFrame) – Rainfall data.target_gauge_col (
str) – Column with rainfall dataref_val (
int|float) – Reference value.new_col_name (
str) – New column name.
- Return type:
DataFrame- Returns:
- :
- data
Data with exceedance flags between 0-4.
- rainfallqc.checks.comparison_checks.get_sum_rainfall_above_percentile_per_year(data, target_gauge_col, percentile)[source]¶
Check annual exceedance of maximum PRCPTOT from ETCCDI dataset.
- Parameters:
data (
DataFrame) – Rainfall datatarget_gauge_col (
str) – Column with rainfall datapercentile (
float) – nth percentile to check for values above (between 1-100)
- Return type:
DataFrame- Returns:
- :
- list_of_nth_percentile_exceedances_by_year
List of values per year above the nth_percentile
Functions¶
|
Make a year column for the data. |
|
Check years with exceedances of maximum PRCPTOT from ETCCDI dataset. |
|
Check annual exceedance of maximum R99p from ETCCDI dataset. |
Check exceedance of rainfall world record. |
|
|
Check exceedance of hourly day rainfall 1-day record. |
Flag exceedance of maximum ETCCDI variable, comparing the maximum sums of each year. |
|
|
Exceedance flagger from intenseqc. |
|
Flag exceedance of maximum reference value and return as column. |
Check annual exceedance of maximum PRCPTOT from ETCCDI dataset. |